Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20165] Add tests for TypeLookup service #4339

Merged
merged 45 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
170bfc6
Refs #20165: Created basic communication
adriancampo Dec 20, 2023
a395be7
Refs #20165: Changes to work with multiple types
adriancampo Jan 11, 2024
053d80f
Refs #20165: Renamed discovery methods. Improved typelookup tests.
adriancampo Jan 14, 2024
730a90d
Refs #20165: Added check_registered_type. Created idl file for each t…
adriancampo Jan 16, 2024
aafbb83
Refs #20165: Changed type creation.
adriancampo Jan 21, 2024
13e6804
Refs #20165: Added all types.
adriancampo Jan 21, 2024
9fd7b1f
Refs #20165: Fixes for TypeBig.
adriancampo Jan 22, 2024
75d9611
Refs #20165: Fixes for json files.
adriancampo Jan 23, 2024
b7afbf7
Refs #20165: Removed code for debug.
adriancampo Jan 23, 2024
283ad16
Refs #20165: Created unittest
adriancampo Jan 28, 2024
8e3c121
Refs #20165: Implemented unittests. Added Case0 for no TypeObject
adriancampo Jan 30, 2024
46b467a
Refs #20165: Removed sending and receiving samples
adriancampo Jan 31, 2024
03994eb
Refs #20165: Removed descriptions from json tests case files
adriancampo Feb 1, 2024
f435495
Refs #20165: Added communication with dynamic types.
adriancampo Feb 8, 2024
359837d
Refs #20165: Fixed Log macro namespace. And TypeObjectRegistry::regis…
adriancampo Feb 12, 2024
2b99f80
Refs #20165: Fix for type with no TypeObject.
adriancampo Feb 12, 2024
5a72018
Refs #20165: Update TypeLookupManager mock.
adriancampo Feb 13, 2024
6e2d5f8
Refs #20165: Added testing for dds-types-tests.
adriancampo Feb 18, 2024
5319f75
Refs #20165: Changed TypeObject consistency checks when typelookup se…
adriancampo Feb 18, 2024
ed818b5
Refs #20165: Fix for modules in update_header_and_create_cases.py. Ig…
adriancampo Feb 19, 2024
5a93b52
Refs #20165: Reduced number of Cases.json files.
adriancampo Feb 20, 2024
c95ce07
Refs #20165: Fix for modules.
adriancampo Feb 20, 2024
b82bb45
Refs #20165: Changes to use take method. Fixed bug with get_map_depen…
adriancampo Feb 22, 2024
6c6bddd
Refs #20165: Removed willdcards from cmake.
adriancampo Feb 22, 2024
8834124
Refs #20165: Updated types.
adriancampo Feb 28, 2024
dec5d7e
Refs #20165: Fix for custom annotations name hash.
adriancampo Mar 4, 2024
b28b9fb
Refs #20165. Return typelookupservice unit tests
richiware May 30, 2024
46c747e
Refs #20165. Fix for future rebase
richiware Jun 12, 2024
3825749
Refs #20165. Improve tests
richiware Sep 6, 2024
0ee77c7
Refs #20165. Fix typelookupservice builin endpoing discovery
richiware Sep 9, 2024
1b861d0
Refs #20165. Removed member_id testing
richiware Sep 9, 2024
0cf0837
Refs #20165. Fix and improve tests
richiware Sep 10, 2024
2313a11
Apply suggestions from code review
richiware Sep 10, 2024
f8ccba6
Refs #20165. Fix identation
richiware Sep 10, 2024
5c9c223
Refs #20165. Fix compilation error in mac
richiware Sep 10, 2024
8bb5fe6
Refs #20165. Fix compilation errors
richiware Sep 10, 2024
80a2c1f
Refs #20165. Remove trace
richiware Sep 11, 2024
0a2b7c4
Refs #20165. Fixes on windows
richiware Sep 11, 2024
5f46f42
Refs #20165. Fixes after rebase
richiware Sep 11, 2024
9b85819
Refs #20165. Fixes on mac
richiware Sep 12, 2024
e73a278
Refs #20165. Fixes asan
richiware Sep 17, 2024
e7c0a00
Refs #20165. Apply suggestions
richiware Sep 24, 2024
5b5eaeb
Refs #20165. Fix minimal type_id built
richiware Sep 24, 2024
b548118
Refs #20165. Apply suggestions
richiware Sep 24, 2024
29daa05
Refs #20165. Apply suggestions
richiware Sep 24, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ void TypeLookupReplyListener::check_get_types_reply(
}
else
{
typelookup_manager_->notify_callbacks(RETCODE_NO_DATA, type_id);
EPROSIMA_LOG_WARNING(TYPELOOKUP_SERVICE_REPLY_LISTENER,
"Received reply with no types.");
register_result = RETCODE_ERROR;
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
47 changes: 39 additions & 8 deletions src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,47 @@ const TypeIdentifier TypeObjectRegistry::get_complementary_type_identifier(
{
if (TypeObjectUtils::is_direct_hash_type_identifier(type_id))
{
std::lock_guard<std::mutex> data_guard(type_object_registry_mutex_);
std::unique_lock<std::mutex> lock(type_object_registry_mutex_);
auto it = type_registry_entries_.find(type_id);
if (type_registry_entries_.end() != it)
{
return it->second.complementary_type_id;
if (TK_NONE != it->second.complementary_type_id._d())
{
return it->second.complementary_type_id;
}
else
{
TypeRegistryEntry minimal_entry;
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
CompleteTypeObject complete_type_object = it->second.type_object.complete();
lock.unlock();
minimal_entry.type_object = build_minimal_from_complete_type_object(complete_type_object);
minimal_entry.complementary_type_id = type_id;
TypeIdentifier minimal_type_id = calculate_type_identifier(
minimal_entry.type_object,
minimal_entry.type_object_serialized_size);

lock.lock();
auto min_entry_result {type_registry_entries_.insert(
{minimal_type_id, minimal_entry})};
if (!min_entry_result.second)
{
EPROSIMA_LOG_INFO(
XTYPES_TYPE_REPRESENTATION,
"Minimal type identifier already registered his EK_MINIMAL remotely.");
}
it = type_registry_entries_.find(type_id);
assert(type_registry_entries_.end() != it);
it->second.complementary_type_id = minimal_type_id;

return minimal_type_id;
}
}
else
{
EPROSIMA_LOG_WARNING(
XTYPES_TYPE_REPRESENTATION,
"Complete type identifier was not registered previously.");

}
}
return type_id;
Expand Down Expand Up @@ -1375,12 +1411,7 @@ const TypeIdentifier TypeObjectRegistry::minimal_from_complete_type_identifier(
switch (type_id._d()){
case EK_COMPLETE:
{
std::lock_guard<std::mutex> data_guard(type_object_registry_mutex_);
auto it = type_registry_entries_.find(type_id);
if (type_registry_entries_.end() != it)
{
return it->second.complementary_type_id;
}
return get_complementary_type_identifier(type_id);
}
break;
case TI_PLAIN_SEQUENCE_SMALL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ TEST_F(TypeLookupServiceTests, TypeLookupReplyListener_wrong_replyid)
tlm_->async_get_type_requests_.emplace(valid_sampleidentity(), tidws);

TypeLookup_Reply reply;
reply.header().relatedRequestId(valid_sampleidentity());
reply.return_value()._default();
ReplyWithServerGUID reply_with_guid;
reply_with_guid.reply = reply;
Expand All @@ -632,7 +633,7 @@ TEST_F(TypeLookupServiceTests, TypeLookupReplyListener_wrong_replyid)
TEST_F(TypeLookupServiceTests, TypeLookupReplyListener_getTypes_empty)
{
MockLogConsumer* log_consumer =
setup_expect_log_msg("TYPELOOKUP_SERVICE_REPLY_LISTENER", "Reply no contains any type.");
setup_expect_log_msg("TYPELOOKUP_SERVICE_REPLY_LISTENER", "Received reply with no types.");

TypeIdentfierWithSize tidws;
tlm_->async_get_type_requests_.emplace(valid_sampleidentity(), tidws);
Expand Down Expand Up @@ -852,7 +853,7 @@ TEST_F(TypeLookupServiceTests, TypeLookupRequestListener_getTypes_empty)
{
MockLogConsumer* log_consumer =
setup_expect_log_msg("TYPELOOKUP_SERVICE_REQUEST_LISTENER",
"Request no contains any type identifier.");
"Received request with no type identifiers.");

TypeIdentfierWithSize tidws;
tlm_->async_get_type_requests_.emplace(valid_sampleidentity(), tidws);
Expand Down
Loading