1717
1818#include " iceoryx_posh/internal/roudi/introspection/port_introspection.hpp"
1919#include " iceoryx_posh/mepoo/chunk_header.hpp"
20+ #include " iceoryx_posh/popo/subscriber_options.hpp"
2021#include " iceoryx_posh/testing/mocks/chunk_mock.hpp"
2122#include " iox/std_string_support.hpp"
2223#include " mocks/publisher_mock.hpp"
@@ -96,6 +97,10 @@ class PortIntrospection_test : public Test
9697 {
9798 return false ;
9899 }
100+ if (!comparePortOptions (a.m_subscriberOptions , b.m_subscriberOptions ))
101+ {
102+ return false ;
103+ }
99104
100105 return true ;
101106 }
@@ -121,10 +126,73 @@ class PortIntrospection_test : public Test
121126 {
122127 return false ;
123128 }
129+ if (!comparePortOptions (a.m_publisherOptions , b.m_publisherOptions ))
130+ {
131+ return false ;
132+ }
124133
125134 return true ;
126135 }
127136
137+ bool comparePortOptions (const iox::popo::SubscriberOptions& a, const iox::popo::SubscriberOptions& b)
138+ {
139+ auto nameA = iox::into<std::string>(a.nodeName );
140+ auto nameB = iox::into<std::string>(b.nodeName );
141+
142+ if (nameA.compare (nameB) != 0 )
143+ {
144+ return false ;
145+ }
146+ if (a.requiresPublisherHistorySupport != b.requiresPublisherHistorySupport )
147+ {
148+ return false ;
149+ }
150+ if (a.subscribeOnCreate != b.subscribeOnCreate )
151+ {
152+ return false ;
153+ }
154+ if (a.historyRequest != b.historyRequest )
155+ {
156+ return false ;
157+ }
158+ if (a.queueCapacity != b.queueCapacity )
159+ {
160+ return false ;
161+ }
162+ if (a.queueFullPolicy != b.queueFullPolicy )
163+ {
164+ return false ;
165+ }
166+
167+ return true ;
168+ }
169+
170+ bool comparePortOptions (const iox::popo::PublisherOptions& a, const iox::popo::PublisherOptions& b)
171+ {
172+ auto nameA = iox::into<std::string>(a.nodeName );
173+ auto nameB = iox::into<std::string>(b.nodeName );
174+
175+ if (nameA.compare (nameB) != 0 )
176+ {
177+ return false ;
178+ }
179+ if (a.offerOnCreate != b.offerOnCreate )
180+ {
181+ return false ;
182+ }
183+ if (a.historyCapacity != b.historyCapacity )
184+ {
185+ return false ;
186+ }
187+ if (a.subscriberTooSlowPolicy != b.subscriberTooSlowPolicy )
188+ {
189+ return false ;
190+ }
191+
192+ return true ;
193+ }
194+
195+
128196 MockPublisherPortUser m_mockPublisherPortUserIntrospection;
129197 MockPublisherPortUser m_mockPublisherPortUserIntrospection2;
130198
@@ -189,12 +257,14 @@ TEST_F(PortIntrospection_test, addAndRemovePublisher)
189257 expected1.m_caproInstanceID = " 1" ;
190258 expected1.m_caproServiceID = " 2" ;
191259 expected1.m_caproEventMethodID = " 3" ;
260+ expected1.m_publisherOptions .nodeName = " 4" ;
192261
193262 PortData expected2;
194263 expected2.m_name = runtimeName2;
195264 expected2.m_caproInstanceID = " abc" ;
196265 expected2.m_caproServiceID = " def" ;
197266 expected2.m_caproEventMethodID = " ghi" ;
267+ expected2.m_publisherOptions .nodeName = " jkl" ;
198268
199269 // prepare inputs
200270 iox::capro::ServiceDescription service1 (
@@ -203,8 +273,8 @@ TEST_F(PortIntrospection_test, addAndRemovePublisher)
203273 expected2.m_caproServiceID , expected2.m_caproInstanceID , expected2.m_caproEventMethodID );
204274
205275 iox::mepoo::MemoryManager memoryManager;
206- iox::popo::PublisherOptions publisherOptions1;
207- iox::popo::PublisherOptions publisherOptions2;
276+ iox::popo::PublisherOptions publisherOptions1 = expected1. m_publisherOptions ;
277+ iox::popo::PublisherOptions publisherOptions2 = expected2. m_publisherOptions ;
208278 iox::popo::PublisherPortData portData1 (
209279 service1, runtimeName1, iox::roudi::DEFAULT_UNIQUE_ROUDI_ID, &memoryManager, publisherOptions1);
210280 iox::popo::PublisherPortData portData2 (
@@ -318,12 +388,14 @@ TEST_F(PortIntrospection_test, addAndRemoveSubscriber)
318388 expected1.m_caproInstanceID = " 1" ;
319389 expected1.m_caproServiceID = " 2" ;
320390 expected1.m_caproEventMethodID = " 3" ;
391+ expected1.m_subscriberOptions .nodeName = nodeName1;
321392
322393 PortData expected2;
323394 expected2.m_name = runtimeName2;
324395 expected2.m_caproInstanceID = " 4" ;
325396 expected2.m_caproServiceID = " 5" ;
326397 expected2.m_caproEventMethodID = " 6" ;
398+ expected2.m_subscriberOptions .nodeName = nodeName2;
327399
328400 // prepare inputs
329401 iox::capro::ServiceDescription service1 (
@@ -332,9 +404,9 @@ TEST_F(PortIntrospection_test, addAndRemoveSubscriber)
332404 expected2.m_caproServiceID , expected2.m_caproInstanceID , expected2.m_caproEventMethodID );
333405
334406 iox::popo::SubscriberOptions subscriberOptions1;
335- subscriberOptions1. nodeName = nodeName1 ;
407+ subscriberOptions1 = expected1. m_subscriberOptions ;
336408 iox::popo::SubscriberOptions subscriberOptions2;
337- subscriberOptions2. nodeName = nodeName2 ;
409+ subscriberOptions2 = expected2. m_subscriberOptions ;
338410
339411 // test adding of ports
340412 // remark: duplicate subscriber insertions are not possible
0 commit comments