Exemple #1
0
void TestAll(std::vector<Tk>& keyVector)
{
	std::set<Tk> stdSet;
	Poco::HashSet<Tk> pocoHashSet;

	TestMethod(stdSet,		eInsert,	"std::set insert ",	keyVector);
	TestMethod(pocoHashSet,	eInsert,	"HashSet  insert ",	keyVector, true);

	TestMethod(stdSet,		eFind,		"std::set find ",	keyVector);
	TestMethod(pocoHashSet,	eFind,		"HashSet  find ",	keyVector, true);

	TestMethod(stdSet,		eErase,		"std::set erase ",	keyVector);
	TestMethod(pocoHashSet,	eErase,		"HashSet  erase ",	keyVector, true);
}
TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressedNoObjectManager) {
    std::thread fakeServiceThreadNoObjectManager = std::thread(fakeLegacyServiceThreadNoObjectMananger);
    usleep(500000);

    std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
    ASSERT_TRUE((bool)runtime);

    auto proxyForFakeLegacyServiceNoObjectManager = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceNoObjectManagerProxy>(domainOfFakeLegacyServiceNoObjectManager, instanceOfFakeLegacyServiceNoObjectManager);
    ASSERT_TRUE((bool)proxyForFakeLegacyServiceNoObjectManager);

    const CommonAPI::Address & address = proxyForFakeLegacyServiceNoObjectManager->getAddress();
    ASSERT_EQ(domainOfFakeLegacyServiceNoObjectManager, address.getDomain());
    ASSERT_EQ(interfaceOfFakeLegacyServiceNoObjectManager, address.getInterface());
    ASSERT_EQ(instanceOfFakeLegacyServiceNoObjectManager, address.getInstance());

    proxyForFakeLegacyServiceNoObjectManager->isAvailableBlocking();

    CommonAPI::CallStatus status;

    const int32_t input = 42;
    int32_t output1, output2;
    proxyForFakeLegacyServiceNoObjectManager->TestMethod(input, status, output1, output2);
    EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
    if(CommonAPI::CallStatus::SUCCESS == status) {
        EXPECT_EQ(input -5, output1);
        EXPECT_EQ(input +5, output2);
    }

    std::string greeting;
    int32_t identifier;
    proxyForFakeLegacyServiceNoObjectManager->OtherTestMethod(status, greeting, identifier);
    EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
    if(CommonAPI::CallStatus::SUCCESS == status) {
        EXPECT_EQ(std::string("Hello"), greeting);
        EXPECT_EQ(42, identifier);
    }

    //end the fake legacy service via dbus
    callPythonService("sendToFakeLegacyService.py finish " + interfaceOfFakeLegacyServiceNoObjectManager);

    fakeServiceThreadNoObjectManager.join();
}