Skip to content

Commit

Permalink
Merge pull request #450 from jwillemsen/jwi-getqos
Browse files Browse the repository at this point in the history
Add test for get_qos calls
  • Loading branch information
jwillemsen authored Oct 22, 2024
2 parents 6b5b37e + a4bd918 commit 4fe64e3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ddsx11/tests/builtin/dpf_sdqwp/dpf_sdqwp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,29 @@ int main (int, char *[])
return 1;
}

DDS::DomainParticipantQos dp_qos;
retcode = domain_participant->get_qos (dp_qos);
if (retcode != DDS::RETCODE_OK)
{
DDSX11_TEST_ERROR << "dpf_sdqwp: Error retrieving dp qos: "
<< IDL::traits<::DDS::ReturnCode_t>::write<retcode_formatter> (retcode)
<< std::endl;
return 1;
}

DDS::traits<ShapeType>::topic_ref_type topic = domain_participant->create_topic (
"Square", DDS::traits<ShapeType>::get_type_name (), DDS::TOPIC_QOS_DEFAULT, nullptr, DDS::STATUS_MASK_NONE);

DDS::TopicQos topic_qos;
retcode = topic->get_qos (topic_qos);
if (retcode != DDS::RETCODE_OK)
{
DDSX11_TEST_ERROR << "dpf_sdqwp: Error retrieving topic qos: "
<< IDL::traits<::DDS::ReturnCode_t>::write<retcode_formatter> (retcode)
<< std::endl;
return 1;
}

retcode = DDS::traits<ShapeType>::register_type (domain_participant, "ShapeType");
if (retcode != DDS::RETCODE_OK)
{
Expand All @@ -74,6 +94,16 @@ int main (int, char *[])
return 1;
}

DDS::PublisherQos publisher_qos;
retcode = publisher->get_qos (publisher_qos);
if (retcode != DDS::RETCODE_OK)
{
DDSX11_TEST_ERROR << "dpf_sdqwp: Error retrieving publisher qos: "
<< IDL::traits<::DDS::ReturnCode_t>::write<retcode_formatter> (retcode)
<< std::endl;
return 1;
}

DDS::traits<ShapeType>::datawriter_ref_type dw =
publisher->create_datawriter(topic, DDS::DATAWRITER_QOS_DEFAULT, nullptr, DDS::STATUS_MASK_NONE);
if (!dw)
Expand All @@ -82,6 +112,16 @@ int main (int, char *[])
return 1;
}

DDS::DataWriterQos dw_qos;
retcode = dw->get_qos (dw_qos);
if (retcode != DDS::RETCODE_OK)
{
DDSX11_TEST_ERROR << "dpf_sdqwp: Error retrieving datawriter qos: "
<< IDL::traits<::DDS::ReturnCode_t>::write<retcode_formatter> (retcode)
<< std::endl;
return 1;
}

// Now delete the datawriter, this should work
retcode = publisher->delete_datawriter (dw);
if (retcode != DDS::RETCODE_OK)
Expand Down

0 comments on commit 4fe64e3

Please sign in to comment.