Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions fastdds_python/test/api/test_datareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,25 +773,35 @@ def test_get_liveliness_changed_status(datareader):
assert(fastdds.c_InstanceHandle_Unknown == status.last_publication_handle)


def test_get_matched_publication_data(datareader):
def test_get_matched_publication_data(datareader, datawriter):
"""
This test checks:
- DataReader::get_matched_publication_data
"""
# Check with an invalid instance handle
pub_data = fastdds.PublicationBuiltinTopicData()
ih = fastdds.InstanceHandle_t()
assert(fastdds.RETCODE_UNSUPPORTED ==
assert(fastdds.RETCODE_BAD_PARAMETER ==
datareader.get_matched_publication_data(pub_data, ih))

time.sleep(1)
# Check with the writer's instance handle
assert(fastdds.RETCODE_OK ==
datareader.get_matched_publication_data(pub_data, datawriter.get_instance_handle()))
assert(pub_data.guid == datawriter.guid())

def test_get_matched_publications(datareader):
def test_get_matched_publications(datareader, datawriter):
"""
This test checks:
- DataReader::get_matched_publications
"""
ihs = fastdds.InstanceHandleVector()
assert(fastdds.RETCODE_UNSUPPORTED ==
time.sleep(1)
assert(fastdds.RETCODE_OK ==
datareader.get_matched_publications(ihs))
# The datawriter (added in the fixture) is the only
# one that should be matched
assert(1 == ihs.size())
Comment thread
richiware marked this conversation as resolved.


def test_get_requested_deadline_missed_status(datareader):
Expand Down
26 changes: 20 additions & 6 deletions fastdds_python/test/api/test_datawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,26 +308,40 @@ def test_get_liveliness_lost_status(datawriter):
assert(0 == status.total_count_change)


def test_get_matched_subscription_data(datawriter):
def test_get_matched_subscription_data(datawriter, reader_topic, subscriber):
Comment thread
richiware marked this conversation as resolved.
Outdated
"""
This test checks:
- DataWriter::get_matched_subscription_data
"""
# Check with an invalid instance handle
sub_data = fastdds.SubscriptionBuiltinTopicData()
ih = fastdds.InstanceHandle_t()
assert(fastdds.RETCODE_UNSUPPORTED ==
assert(fastdds.RETCODE_BAD_PARAMETER ==
datawriter.get_matched_subscription_data(sub_data, ih))

# Add a reader and check that the datawriter has matched subscriptions
datareader = subscriber.create_datareader(reader_topic, fastdds.DATAREADER_QOS_DEFAULT)
time.sleep(1)
assert(fastdds.RETCODE_OK ==
datawriter.get_matched_subscription_data(sub_data, datareader.get_instance_handle()))
assert(sub_data.guid == datareader.guid())
assert(fastdds.RETCODE_OK ==
subscriber.delete_datareader(datareader))

def test_get_matched_subscriptions(datawriter):
def test_get_matched_subscriptions(datawriter, reader_topic, subscriber):
"""
This test checks:
- DataWriter::get_matched_subscriptions
"""
ihs = fastdds.InstanceHandleVector()
assert(fastdds.RETCODE_UNSUPPORTED ==
datawriter.get_matched_subscriptions(ihs))

# Add a reader and check that the datawriter has matched subscriptions
datareader = subscriber.create_datareader(reader_topic, fastdds.DATAREADER_QOS_DEFAULT)
time.sleep(1)
assert(fastdds.RETCODE_OK == datawriter.get_matched_subscriptions(ihs))
assert(1 == ihs.size())
assert(ihs[0] == datareader.get_instance_handle())
assert(fastdds.RETCODE_OK ==
subscriber.delete_datareader(datareader))

def test_get_offered_deadline_missed_status(datawriter):
"""
Expand Down