summaryrefslogtreecommitdiff
path: root/test/network_tests/application_tests/application_test_daemon.cpp
diff options
context:
space:
mode:
authorDiogo Pedrosa <48529452+DiogoPedrozza@users.noreply.github.com>2023-03-13 14:09:12 +0000
committerGitHub <noreply@github.com>2023-03-13 14:09:12 +0000
commit1b427801352b5dcfdc2277f6343166c01afe97d6 (patch)
treed4e984dd100f3257ce784c9e30aefb6e60a93ab5 /test/network_tests/application_tests/application_test_daemon.cpp
parentfc73f40fa1501dc53210c63cb7c0d7623d106370 (diff)
parent826ebb8d352245a36ecaec32b6af61e7abf4696e (diff)
downloadvSomeIP-1b427801352b5dcfdc2277f6343166c01afe97d6.tar.gz
Merge pull request #416 from COVESA/update_3.3.03.3.0
vsomeip 3.3.0
Diffstat (limited to 'test/network_tests/application_tests/application_test_daemon.cpp')
-rw-r--r--test/network_tests/application_tests/application_test_daemon.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/network_tests/application_tests/application_test_daemon.cpp b/test/network_tests/application_tests/application_test_daemon.cpp
new file mode 100644
index 0000000..2f0b244
--- /dev/null
+++ b/test/network_tests/application_tests/application_test_daemon.cpp
@@ -0,0 +1,42 @@
+// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <gtest/gtest.h>
+#include <future>
+
+#include <vsomeip/vsomeip.hpp>
+#include <vsomeip/internal/logger.hpp>
+
+class application_test_daemon {
+public:
+ application_test_daemon() :
+ app_(vsomeip::runtime::get()->create_application("daemon")) {
+ if (!app_->init()) {
+ ADD_FAILURE() << "Couldn't initialize application";
+ return;
+ }
+ std::promise<bool> its_promise;
+ application_thread_ = std::thread([&](){
+ its_promise.set_value(true);
+ app_->start();
+ });
+ EXPECT_TRUE(its_promise.get_future().get());
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ VSOMEIP_INFO << "Daemon starting";
+ }
+
+ ~application_test_daemon() {
+ application_thread_.join();
+ }
+
+ void stop() {
+ VSOMEIP_INFO << "Daemon stopping";
+ app_->stop();
+ }
+
+private:
+ std::shared_ptr<vsomeip::application> app_;
+ std::thread application_thread_;
+};