Skip to content

Commit

Permalink
iox-#1533 Port to non-deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Sep 6, 2023
1 parent 36b2635 commit 658e657
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 42 deletions.
1 change: 1 addition & 0 deletions iceoryx_binding_c/test/moduletests/test_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern "C" {

namespace
{
using namespace ::testing;
using namespace iox;
using namespace iox::mepoo;
using namespace iox::roudi_env;
Expand Down
1 change: 1 addition & 0 deletions iceoryx_binding_c/test/moduletests/test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {

namespace
{
using namespace ::testing;
using namespace iox;
using namespace iox::runtime;
using namespace iox::roudi_env;
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_binding_c/test/moduletests/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "iceoryx_posh/internal/popo/ports/publisher_port_user.hpp"
#include "iceoryx_posh/mepoo/mepoo_config.hpp"
#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"

using namespace iox;
using namespace iox::popo;
Expand Down Expand Up @@ -144,7 +144,7 @@ TEST(iox_pub_test_DeathTest, initPublisherWithNotInitializedPublisherOptionsTerm
TEST_F(iox_pub_test, initPublisherWithDefaultOptionsWorks)
{
::testing::Test::RecordProperty("TEST_ID", "d2e677cd-2fcc-47a2-80e6-2d08245b7c1a");
iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()};
iox::roudi_env::RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()};

iox_runtime_init("hypnotoad");

Expand Down
1 change: 1 addition & 0 deletions iceoryx_binding_c/test/moduletests/test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C" {

namespace
{
using namespace ::testing;
using namespace iox;
using namespace iox::runtime;
using namespace iox::roudi_env;
Expand Down
14 changes: 7 additions & 7 deletions iceoryx_binding_c/test/moduletests/test_service_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TEST_F(iox_service_discovery_test,
::testing::Test::RecordProperty("TEST_ID", "09a2cd6c-fba9-4b9d-af96-c5a6cc168d98");

// let the roudi discovery loop run at least once
InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

iox_service_discovery_find_service_apply_callable_with_context_data(
sut, nullptr, nullptr, nullptr, findHandler, &searchResult, MessagingPattern_PUB_SUB);
Expand All @@ -104,7 +104,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableAndContextDataReturnsO
ASSERT_NE(publisher, nullptr);
const iox_service_description_t SERVICE_DESCRIPTION = iox_pub_get_service_description(publisher);

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

iox_service_discovery_find_service_apply_callable_with_context_data(sut,
SERVICE_DESCRIPTION.serviceString,
Expand All @@ -125,7 +125,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableWithNullptrsForService
{
::testing::Test::RecordProperty("TEST_ID", "ec565ca3-7494-42d7-9440-2000f1513759");

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

auto findHandler = [](const iox_service_description_t s) { EXPECT_THAT(s.instanceString, StrEq("RouDi_ID")); };
iox_service_discovery_find_service_apply_callable(
Expand All @@ -141,7 +141,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableReturnsFindsCorrectSer
auto* publisher = iox_pub_init(&storage, "service", "instance", "event", &options);
ASSERT_NE(publisher, nullptr);

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

auto findHandler = [](const iox_service_description_t s) {
EXPECT_THAT(s.serviceString, StrEq("service"));
Expand All @@ -158,7 +158,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithNullptrsForServiceInstanceEven
{
::testing::Test::RecordProperty("TEST_ID", "75b411d7-b8c7-42d5-8acd-3916fd172081");

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

const uint64_t SERVICE_CONTAINER_CAPACITY = 10U;
iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY];
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST_F(iox_service_discovery_test, FindServiceReturnsOfferedService)
ASSERT_NE(publisher, nullptr);
const iox_service_description_t SERVICE_DESCRIPTION = iox_pub_get_service_description(publisher);

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

const uint64_t SERVICE_CONTAINER_CAPACITY = 10U;
iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY];
Expand All @@ -217,7 +217,7 @@ TEST_F(iox_service_discovery_test, FindServiceReturnsCorrectNumberOfServicesWhen
{
::testing::Test::RecordProperty("TEST_ID", "01047b88-f257-447c-8c5e-9bef7c358433");

InterOpWait();
triggerDiscoveryLoopAndWaitToFinish();

const uint64_t SERVICE_CONTAINER_CAPACITY = 3U;
iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY];
Expand Down
6 changes: 3 additions & 3 deletions iceoryx_binding_c/test/moduletests/test_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp"
#include "iceoryx_posh/mepoo/mepoo_config.hpp"
#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"
#include "mocks/wait_set_mock.hpp"

using namespace iox;
Expand Down Expand Up @@ -149,7 +149,7 @@ TEST_F(iox_sub_test, initSubscriberWithNotInitializedSubscriberOptionsTerminates
TEST_F(iox_sub_test, initSubscriberWithDefaultOptionsWorks)
{
::testing::Test::RecordProperty("TEST_ID", "40eaa006-4781-46cd-bde3-40fa7d572f29");
iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()};
RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()};

iox_runtime_init("hypnotoad");

Expand Down Expand Up @@ -406,7 +406,7 @@ TEST_F(iox_sub_test, hasDataTriggersWaitSetWithCorrectCallback)
TEST_F(iox_sub_test, deinitSubscriberDetachesTriggerFromWaitSet)
{
::testing::Test::RecordProperty("TEST_ID", "93e350fb-5430-43ff-982b-b43c6ae9b890");
iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()};
RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()};
iox_runtime_init("hypnotoad");

iox_sub_storage_t storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ using namespace ::testing;

using namespace iox::gw;
using namespace iox::roudi_env;
using namespace iox::testing;

class InterfacePortRequestStackBlowup_test : public RouDi_GTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ using namespace iox::popo;
using namespace iox::capro;
using namespace iox::runtime;
using namespace iox::roudi_env;
using namespace iox::testing;

void onSampleReceivedCallback(Subscriber<int>* subscriber IOX_MAYBE_UNUSED)
{
Expand Down
10 changes: 5 additions & 5 deletions iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "iceoryx_posh/popo/wait_set.hpp"
#include "iceoryx_posh/roudi/introspection_types.hpp"
#include "iceoryx_posh/roudi/roudi_app.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"
#include "iceoryx_posh/runtime/posh_runtime.hpp"
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"
#include "iox/duration.hpp"
#include "iox/optional.hpp"

Expand All @@ -38,8 +38,8 @@ namespace
{
using namespace ::testing;
using namespace iox::units::duration_literals;
using namespace iox::roudi_env;
using iox::mepoo::MePooConfig;
using iox::roudi::RouDiEnvironment;

class Mepoo_IntegrationTest : public Test
{
Expand Down Expand Up @@ -115,7 +115,7 @@ class Mepoo_IntegrationTest : public Test
const configType defaultconf = configType::DEFAULT)
{
auto config = createRouDiConfig(memPoolTestContainer, testMempoolConfig, defaultconf);
m_roudiEnv = iox::optional<RouDiEnvironment>(config);
m_roudiEnv.emplace(config);

ASSERT_THAT(m_roudiEnv.has_value(), Eq(true));

Expand All @@ -133,7 +133,7 @@ class Mepoo_IntegrationTest : public Test
const configType defaultconf = configType::DEFAULT)
{
auto config = createRouDiConfig(memPoolTestContainer, testMempoolConfig, defaultconf);
m_roudiEnv = iox::optional<RouDiEnvironment>(config);
m_roudiEnv.emplace(config);

ASSERT_THAT(m_roudiEnv.has_value(), Eq(true));
}
Expand Down Expand Up @@ -347,7 +347,7 @@ class Mepoo_IntegrationTest : public Test
iox::optional<iox::popo::PublisherPortUser> publisherPort;
iox::optional<iox::popo::SubscriberPortUser> subscriberPort;

iox::optional<RouDiEnvironment> m_roudiEnv;
iox::optional<RouDiEnv> m_roudiEnv;
};

constexpr uint32_t Mepoo_IntegrationTest::DEFAULT_NUMBER_OF_CHUNKS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ using namespace iox;
using namespace iox::popo;
using namespace iox::cxx;
using namespace iox::roudi_env;
using namespace iox::testing;

template <typename T>
struct ComplexDataType
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/integrationtests/test_roudi_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"

#include "test.hpp"

Expand Down
34 changes: 17 additions & 17 deletions iceoryx_posh/test/integrationtests/test_service_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ TYPED_TEST(ServiceDiscovery_test, ReofferedServiceCanBeFound)
const iox::capro::ServiceDescription SERVICE_DESCRIPTION("service", "instance", "event");
typename TestFixture::CommunicationKind::Producer producer(SERVICE_DESCRIPTION);

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->findService(SERVICE_DESCRIPTION);

Expand All @@ -205,15 +205,15 @@ TYPED_TEST(ServiceDiscovery_test, ReofferedServiceCanBeFound)

producer.stopOffer();

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->findService(SERVICE_DESCRIPTION);

EXPECT_TRUE(serviceContainer.empty());

producer.offer();

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->findService(SERVICE_DESCRIPTION);

Expand All @@ -228,7 +228,7 @@ TYPED_TEST(ServiceDiscovery_test, ServiceOfferedMultipleTimesCanBeFound)
const iox::capro::ServiceDescription SERVICE_DESCRIPTION("service", "instance", "event");
typename TestFixture::CommunicationKind::Producer producer(SERVICE_DESCRIPTION);

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->findService(SERVICE_DESCRIPTION);

Expand All @@ -237,7 +237,7 @@ TYPED_TEST(ServiceDiscovery_test, ServiceOfferedMultipleTimesCanBeFound)

producer.offer();

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->findService(SERVICE_DESCRIPTION);

Expand Down Expand Up @@ -805,7 +805,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenNothingOffered)
::testing::Test::RecordProperty("TEST_ID", "7f0bf2c0-5e96-4da6-b282-f84917bb5243");

// ensure the discovery loop ran at least once
this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

// Checks whether the reference implementation result matches the sut result if we call
// findService({"a"}, {"b"}, {"c"}).
Expand All @@ -819,7 +819,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenSingleServiceOffered)
::testing::Test::RecordProperty("TEST_ID", "aab09c10-8b1e-4f25-8f72-bd762b69f2cb");
this->add({"a", "b", "c"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"a"}, {"b"}, {"c"});
}
Expand All @@ -830,7 +830,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenSingleServiceIsOfferedMulti
this->add({"a", "b", "c"});
this->add({"a", "b", "c"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"a"}, {"b"}, {"c"});
}
Expand All @@ -843,7 +843,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenMultipleServicesAreOffered)
this->add({"aa", "a", "c"});
this->add({"a", "ab", "a"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"aa"}, {"a"}, {"c"});
}
Expand All @@ -854,7 +854,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenMultipleInstancesOfTheSameS
this->add({"a", "b", "c"});
this->add({"a", "d", "c"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"a"}, {"d"}, {"c"});
}
Expand All @@ -867,7 +867,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, RepeatedSearchYieldsSameResult)
this->add({"aa", "a", "c"});
this->add({"a", "ab", "a"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"a"}, {"b"}, {"aa"});
auto previousResult = serviceContainer;
Expand All @@ -881,7 +881,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindNonExistingService)
::testing::Test::RecordProperty("TEST_ID", "6f953d0d-bae3-45a1-82e7-c78a32b6d365");
this->add({"a", "b", "c"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

// those are all representatives of equivalence classes of mismatches
// that hould not be found
Expand All @@ -906,7 +906,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindNonExistingServiceAmongMultiple
this->add({"x", "b", "x"});
this->add({"x", "x", "x"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"a"}, {"b"}, {"c"});
}
Expand Down Expand Up @@ -956,7 +956,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindInMaximumServices)

EXPECT_EQ(created, MAX);

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

// search for specific services we inserted at various times (includes wildcard searches etc.):
// find first offered service, last offered service and some service offered inbetween
Expand All @@ -975,7 +975,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, SameServerAndPublisherCanBeFound)
this->add({"Ferdinand", "Schnüffel", "Spitz"});
this->addOther({"Ferdinand", "Schnüffel", "Spitz"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"Ferdinand"}, {"Schnüffel"}, {"Spitz"});
}
Expand All @@ -986,7 +986,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, OtherServiceKindWithMatchingNameIsN
this->add({"Schnüffel", "Ferdinand", "Spitz"});
this->addOther({"Ferdinand", "Schnüffel", "Spitz"});

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

this->testFindService({"Ferdinand"}, {"Schnüffel"}, {"Spitz"});
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindInMaximumMixedServices)

EXPECT_EQ(created, OTHER_MAX);

this->InterOpWait();
this->triggerDiscoveryLoopAndWaitToFinish();

// now we have the maximum of services of both kinds with semi-random services

Expand Down
5 changes: 2 additions & 3 deletions iceoryx_posh/test/moduletests/test_posh_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "iceoryx_posh/popo/untyped_client.hpp"
#include "iceoryx_posh/popo/untyped_server.hpp"
#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"
#include "iceoryx_posh/runtime/posh_runtime.hpp"
#include "iceoryx_posh/testing/mocks/posh_runtime_mock.hpp"
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"
#include "test.hpp"

#include <type_traits>
Expand All @@ -42,7 +42,6 @@ using namespace iox::cxx;
using namespace iox;
using namespace iox::popo;
using namespace iox::roudi_env;
using iox::roudi::RouDiEnvironment;

class PoshRuntime_test : public Test
{
Expand Down Expand Up @@ -106,7 +105,7 @@ class PoshRuntime_test : public Test
}

const iox::RuntimeName_t m_runtimeName{"publisher"};
RouDiEnvironment m_roudiEnv{MinimalRouDiConfigBuilder().create()};
RouDiEnv m_roudiEnv{MinimalRouDiConfigBuilder().create()};
PoshRuntime* m_runtime{&iox::runtime::PoshRuntime::initRuntime(m_runtimeName)};
IpcMessage m_sendBuffer;
IpcMessage m_receiveBuffer;
Expand Down
Loading

0 comments on commit 658e657

Please sign in to comment.