mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-08-30 12:15:12 +00:00
connection between 2 systems and bug fixes (#14)
This commit is contained in:
@@ -57,7 +57,7 @@ set_target_properties(ComponentTest_Repository_test_module PROPERTIES SUFFIX ".s
|
||||
|
||||
# Execute the installation helper utility to create an installation manifest for the core files.
|
||||
add_custom_target(ComponentTest_Repository_install_manifest
|
||||
COMMAND "$<TARGET_FILE:sdv_packager>" DIRECT_INSTALL ComponentTest_Repository -T. --instance2005 "$<TARGET_FILE:ComponentTest_Repository_test_module>" "$<TARGET_FILE:ComponentTest_Repository_ps>" "-I$<TARGET_FILE_DIR:ComponentTest_Repository_test_module>" --overwrite --user_config+TestObject_ComplexHelloService+TestObject_HelloUtility --interface_config+Example_Object+Example_Object_2+TestObject_HelloDevice+TestObject_BasicHelloService+TestObject_SystemHelloService
|
||||
COMMAND "$<TARGET_FILE:sdv_packager>" DIRECT_INSTALL ComponentTest_Repository --instance2005 "$<TARGET_FILE:ComponentTest_Repository_test_module>" "$<TARGET_FILE:ComponentTest_Repository_ps>" "-I$<TARGET_FILE_DIR:ComponentTest_Repository_test_module>" --overwrite --user_config+TestObject_ComplexHelloService+TestObject_HelloUtility --interface_config+Example_Object+Example_Object_2+TestObject_HelloDevice+TestObject_BasicHelloService+TestObject_SystemHelloService
|
||||
DEPENDS ComponentTest_Repository_test_module ComponentTest_Repository_ps
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
|
||||
@@ -44,14 +44,18 @@ public:
|
||||
*/
|
||||
virtual void SetUp()
|
||||
{
|
||||
bool bRet = Startup(R"code(
|
||||
bool bRet = Startup(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Main"
|
||||
Instance = 2005
|
||||
)code");
|
||||
|
||||
[Console]
|
||||
Report = "Silent"
|
||||
RedirectMon = true
|
||||
)toml");
|
||||
if (!bRet)
|
||||
std::cout << "Failed to start the application for instance 2005." << std::endl;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
|
||||
END_SDV_INTERFACE_MAP()
|
||||
|
||||
virtual void Initialize([[maybe_unused]] const sdv::u8string& ssObjectConfig) override
|
||||
virtual void Initialize([[maybe_unused]] const sdv::SObjectInfo& sObjectInfo) override
|
||||
{
|
||||
FAIL() << "Error: Initialize should not be called by Repo Service!";
|
||||
// m_eObjectState = sdv::EObjectState::initialization_failure;
|
||||
@@ -83,13 +83,13 @@ public:
|
||||
|
||||
TEST(RepositoryTest, LoadNonexistentModule)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -105,13 +105,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, CreateNonexistantClass)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -129,13 +129,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, GetNonexistantObject)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -158,13 +158,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateAndGet)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -189,13 +189,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateInitFail)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -218,13 +218,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateDuplicateCreateObjectName)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -255,13 +255,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateDuplicateExternalObjectName)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -290,13 +290,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateDuplicateObjectNameMixed)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -327,13 +327,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateTwoNamedInstances)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -365,13 +365,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, ChainCreateSimple)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -398,13 +398,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, ChainCreateParallel)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -417,43 +417,47 @@ Mode = "Essential"
|
||||
|
||||
ASSERT_TRUE(pModuleControl->Load((GetExecDirectory() / "ComponentTest_Repository_test_module.sdv").generic_u8string()));
|
||||
|
||||
std::thread testThread([pRepositoryControl, pObjectAccess]()
|
||||
sdv::core::secure_thread testThread(
|
||||
[pRepositoryControl, pObjectAccess]()
|
||||
{
|
||||
for (uint32_t i = 0; i < LoopCount; ++i)
|
||||
{
|
||||
std::string count = std::to_string(i);
|
||||
bool bRes = pRepositoryControl->CreateObject("TestObject_CreateChain", "Bar_" + count,
|
||||
"chained_object = \"BarFoo_" + count + "\"");
|
||||
bool bRes = pRepositoryControl->CreateObject(
|
||||
"TestObject_CreateChain", "Bar_" + count, "chained_object = \"BarFoo_" + count + "\"");
|
||||
EXPECT_TRUE(bRes);
|
||||
EXPECT_NE(nullptr, pObjectAccess->GetObject("BarFoo_" + count));
|
||||
}
|
||||
});
|
||||
|
||||
// TEMP EVE 05.05.2026: The parallel execution of the creation threads causes a sporadic crash.
|
||||
// See: https://dev.azure.com/SW4ZF/AZP-431_DivDI_Vehicle_API/_workitems/edit/799698
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
|
||||
for (uint32_t i = 0; i < LoopCount; ++i)
|
||||
{
|
||||
std::string count = std::to_string(i);
|
||||
bool bRes =
|
||||
pRepositoryControl->CreateObject("TestObject_CreateChain", "Foo_" + count, "chained_object =\"FooBar_" + count + "\"");
|
||||
bool bRes = pRepositoryControl->CreateObject(
|
||||
"TestObject_CreateChain", "Foo_" + count, "chained_object =\"FooBar_" + count + "\"");
|
||||
EXPECT_TRUE(bRes);
|
||||
EXPECT_NE(nullptr, pObjectAccess->GetObject("FooBar_" + count));
|
||||
}
|
||||
|
||||
testThread.join();
|
||||
|
||||
|
||||
control.SetRunningMode();
|
||||
control.Shutdown();
|
||||
}
|
||||
|
||||
TEST(RepositoryTest, ChainCreateParallelLock)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -474,7 +478,7 @@ Mode = "Essential"
|
||||
|
||||
//attempt to create deadlock by taking lock during initialize and by taking lock before call to create object
|
||||
|
||||
std::thread testThread([&]()
|
||||
sdv::core::secure_thread testThread([&]()
|
||||
{
|
||||
for (uint32_t i = 0; i < LoopCount; ++i)
|
||||
{
|
||||
@@ -507,13 +511,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, ChainCreateParallelThreadLock)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -534,7 +538,7 @@ Mode = "Essential"
|
||||
|
||||
//attempt to create deadlock by taking lock during initialize and by taking lock before call to create object
|
||||
|
||||
std::thread testThread([&]()
|
||||
sdv::core::secure_thread testThread([&]()
|
||||
{
|
||||
for (uint32_t i = 0; i < LoopCount; ++i)
|
||||
{
|
||||
@@ -567,13 +571,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, InstantiateDuringShutdown)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -598,13 +602,13 @@ Mode = "Essential"
|
||||
|
||||
TEST(RepositoryTest, CreateUtility)
|
||||
{
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Essential"
|
||||
)code");
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -621,14 +625,18 @@ TEST(RepositoryTest, MainApplication_GetInstalledAndLoadedComponent)
|
||||
{
|
||||
// Start the app control. The application automatically loads the installation manifests and the application configuration,
|
||||
// starting automatically the objects.
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
[Application]
|
||||
Mode = "Main"
|
||||
Instance = 2005
|
||||
)code");
|
||||
|
||||
[Console]
|
||||
Report = "Silent"
|
||||
RedirectMon = true
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
@@ -644,7 +652,7 @@ TEST(RepositoryTest, MainApplication_GetInstalledComponent)
|
||||
{
|
||||
// Start the app control. The application automatically loads the installation manifests, but since there is no application
|
||||
// configuration, it doesn't load the objects.
|
||||
sdv::app::CAppControl control(R"code(
|
||||
sdv::app::CAppControl control(R"toml(
|
||||
[LogHandler]
|
||||
ViewFilter = "Fatal"
|
||||
|
||||
@@ -652,7 +660,11 @@ ViewFilter = "Fatal"
|
||||
Mode = "Main"
|
||||
Instance = 2005
|
||||
AppConfig = "" # override application config
|
||||
)code");
|
||||
|
||||
[Console]
|
||||
Report = "Silent"
|
||||
RedirectMon = true
|
||||
)toml");
|
||||
ASSERT_TRUE(control.IsRunning());
|
||||
control.SetConfigMode();
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::thread testThread(fun);
|
||||
sdv::core::secure_thread testThread(fun);
|
||||
|
||||
testThread.join();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user