@@ -111,7 +111,11 @@ DdsRouterConfiguration dds_test_simple_configuration(
111111 * The transient_local option changes the test behavior to verify that the communication is transient_local and all old data is sent
112112 * to Late Joiners.
113113 */
114+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
115+ template <class MsgStruct >
116+ #else
114117template <class MsgStruct , class MsgStructType >
118+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
115119void test_local_communication (
116120 DdsRouterConfiguration ddsrouter_configuration,
117121 uint32_t samples_to_receive = DEFAULT_SAMPLES_TO_RECEIVE ,
@@ -130,7 +134,10 @@ void test_local_communication(
130134
131135 // Create a message with size specified by repeating the same string
132136 MsgStruct msg;
137+
138+ #if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13
133139 MsgStructType type;
140+ #endif // if FASTRTPS_VERSION_MAJOR >= 2 && FASTRTPS_VERSION_MINOR >= 13
134141
135142 std::string msg_str;
136143
@@ -142,11 +149,21 @@ void test_local_communication(
142149 msg.message (msg_str);
143150
144151 // Create DDS Publisher in domain 0
152+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
153+ TestPublisher<MsgStruct> publisher (msg.isKeyDefined ());
154+ #else
145155 TestPublisher<MsgStruct> publisher (type.m_isGetKeyDefined );
156+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
157+
146158 ASSERT_TRUE (publisher.init (0 ));
147159
148160 // Create DDS Subscriber in domain 1
161+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
162+ TestSubscriber<MsgStruct> subscriber (msg.isKeyDefined (), transient_local);
163+ #else
149164 TestSubscriber<MsgStruct> subscriber (type.m_isGetKeyDefined , transient_local);
165+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
166+
150167 ASSERT_TRUE (subscriber.init (1 , &msg, &samples_received));
151168
152169 // Create DdsRouter entity
@@ -209,8 +226,14 @@ void test_local_communication(
209226 */
210227TEST (DDSTestLocal, end_to_end_local_communication)
211228{
229+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
230+ test::test_local_communication<HelloWorld>(
231+ test::dds_test_simple_configuration ());
232+ #else
212233 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
213234 test::dds_test_simple_configuration ());
235+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
236+
214237}
215238
216239/* *
@@ -219,8 +242,13 @@ TEST(DDSTestLocal, end_to_end_local_communication)
219242 */
220243TEST (DDSTestLocal, end_to_end_local_communication_keyed)
221244{
245+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
246+ test::test_local_communication<HelloWorldKeyed>(
247+ test::dds_test_simple_configuration ());
248+ #else
222249 test::test_local_communication<HelloWorldKeyed, HelloWorldKeyedPubSubType>(
223250 test::dds_test_simple_configuration ());
251+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
224252}
225253
226254/* *
@@ -230,14 +258,24 @@ TEST(DDSTestLocal, end_to_end_local_communication_keyed)
230258 */
231259TEST (DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery)
232260{
261+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
262+ test::test_local_communication<HelloWorld>(
263+ test::dds_test_simple_configuration (true ));
264+ #else
233265 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
234266 test::dds_test_simple_configuration (true ));
267+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
235268}
236269
237270TEST (DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery_keyed)
238271{
272+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
273+ test::test_local_communication<HelloWorldKeyed>(
274+ test::dds_test_simple_configuration (true ));
275+ #else
239276 test::test_local_communication<HelloWorldKeyed, HelloWorldKeyedPubSubType>(
240277 test::dds_test_simple_configuration (true ));
278+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
241279}
242280
243281/* *
@@ -249,10 +287,17 @@ TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery_keye
249287 */
250288TEST (DDSTestLocal, end_to_end_local_communication_high_frequency)
251289{
290+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
291+ test::test_local_communication<HelloWorld>(
292+ test::dds_test_simple_configuration (),
293+ 1000 , // wait for 1000 samples received
294+ 0 ); // send it without waiting from one sample to the other
295+ #else
252296 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
253297 test::dds_test_simple_configuration (),
254- 1000 , // wait for 1000 samples received
255- 0 ); // send it without waiting from one sample to the other
298+ 1000 , // wait for 1000 samples received
299+ 0 ); // send it without waiting from one sample to the other
300+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
256301}
257302
258303/* *
@@ -264,11 +309,19 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_frequency)
264309 */
265310TEST (DDSTestLocal, end_to_end_local_communication_high_size)
266311{
312+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
313+ test::test_local_communication<HelloWorld>(
314+ test::dds_test_simple_configuration (),
315+ test::DEFAULT_SAMPLES_TO_RECEIVE ,
316+ test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
317+ 10000 ); // 500K message size
318+ #else
267319 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
268320 test::dds_test_simple_configuration (),
269321 test::DEFAULT_SAMPLES_TO_RECEIVE ,
270322 test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
271- 10000 ); // 500K message size
323+ 10000 ); // 500K message size
324+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
272325}
273326
274327/* *
@@ -282,11 +335,19 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_size)
282335 */
283336TEST (DDSTestLocal, end_to_end_local_communication_high_throughput)
284337{
338+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
339+ test::test_local_communication<HelloWorld>(
340+ test::dds_test_simple_configuration (),
341+ 500 ,
342+ 1 ,
343+ 1000 ); // 50K message size
344+ #else
285345 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
286346 test::dds_test_simple_configuration (),
287347 500 ,
288348 1 ,
289- 1000 ); // 50K message size
349+ 1000 ); // 50K message size
350+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
290351}
291352
292353/* *
@@ -295,12 +356,21 @@ TEST(DDSTestLocal, end_to_end_local_communication_high_throughput)
295356 */
296357TEST (DDSTestLocal, end_to_end_local_communication_transient_local)
297358{
359+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
360+ test::test_local_communication<HelloWorld>(
361+ test::dds_test_simple_configuration (),
362+ test::DEFAULT_SAMPLES_TO_RECEIVE ,
363+ test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
364+ test::DEFAULT_MESSAGE_SIZE ,
365+ true );
366+ #else
298367 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
299368 test::dds_test_simple_configuration (),
300369 test::DEFAULT_SAMPLES_TO_RECEIVE ,
301370 test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
302371 test::DEFAULT_MESSAGE_SIZE ,
303372 true );
373+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
304374}
305375
306376/* *
@@ -309,12 +379,21 @@ TEST(DDSTestLocal, end_to_end_local_communication_transient_local)
309379 */
310380TEST (DDSTestLocal, end_to_end_local_communication_transient_local_disable_dynamic_discovery)
311381{
382+ #if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
383+ test::test_local_communication<HelloWorld>(
384+ test::dds_test_simple_configuration (true , true ),
385+ test::DEFAULT_SAMPLES_TO_RECEIVE ,
386+ test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
387+ test::DEFAULT_MESSAGE_SIZE ,
388+ true );
389+ #else
312390 test::test_local_communication<HelloWorld, HelloWorldPubSubType>(
313391 test::dds_test_simple_configuration (true , true ),
314392 test::DEFAULT_SAMPLES_TO_RECEIVE ,
315393 test::DEFAULT_MILLISECONDS_PUBLISH_LOOP ,
316394 test::DEFAULT_MESSAGE_SIZE ,
317395 true );
396+ #endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
318397}
319398
320399int main (
0 commit comments