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

type support for properties #470

Merged
merged 74 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c28810e
Rename current properties imp to properties_v1.c
pnoltes Dec 31, 2022
1ff603b
Refactor celix properties to be based on celix_string_hash_map.
pnoltes Jan 1, 2023
6156c70
Add initial primitive type support for celix properties entries
pnoltes Jan 2, 2023
02b08a1
Improve celix properties iterator
pnoltes Jan 3, 2023
2c5194f
Add unit test for celix types properties and fix some mem issues
pnoltes Jan 4, 2023
740bbbf
Add properties type support to C++ properties
pnoltes Jan 5, 2023
efa1017
Improve test coverage and fix issues in properties and string/long ha…
pnoltes Jan 7, 2023
ced3279
Refactor and improve properties and string hash map test suite and impl
pnoltes Jan 8, 2023
71daacf
Remove old properties.c file
pnoltes Jan 8, 2023
efb74c1
Fix Properties implementation for C++11 and C++14.
pnoltes Jan 8, 2023
4f86a3d
Improve codecov and replace usage of CELIX_PROPERTIES_FOR_EACH with _…
pnoltes Jan 8, 2023
c15bf71
Adjust short properties optimization values based on some basic testing
pnoltes Jan 8, 2023
1ce505d
Merge remote-tracking branch 'origin/master' into feature/type_suppor…
pnoltes Jan 8, 2023
fe434a0
Fix issue with setting properties with NULL values
pnoltes Jan 8, 2023
17441f7
Merge remote-tracking branch 'origin/master' into feature/type_suppor…
pnoltes May 7, 2023
0c0bf14
Refactor properties and version after merge with master
pnoltes May 7, 2023
78b94d5
Refactor cpputest version ei test to gtest
pnoltes May 7, 2023
717869d
Add missing output param in serviceReference_getPropertyKeys
pnoltes May 7, 2023
ce71cf0
Merge remote-tracking branch 'origin/master' into feature/type_suppor…
pnoltes Aug 23, 2023
e032679
Refactor and correction after merge with master
pnoltes Aug 23, 2023
226a546
Remove cpputest include from gtest
pnoltes Aug 23, 2023
0988291
Fix properties iterator usage in disc zeroconf
pnoltes Aug 24, 2023
74c6b58
Merge remote-tracking branch 'origin/master' into feature/type_suppor…
pnoltes Aug 24, 2023
c0218db
Merge branch 'master' into feature/type_support_for_properties
pnoltes Oct 1, 2023
1f5bf79
#509: Update changes for celix properties with type support
pnoltes Oct 1, 2023
77f212a
#509: Remove deprecated macro (incl usage) CELIX_PROPERTIES_FOR_EACH
pnoltes Oct 7, 2023
1856ced
Merge remote-tracking branch 'origin/feature/type_support_for_propert…
pnoltes Oct 8, 2023
2765f6a
#509: Add CMakeUserPresets.json to gitignore
pnoltes Oct 15, 2023
88e513d
#509: Replace props FOR_EACH to ITERATE macro in rsa shm & zeroconf disc
pnoltes Oct 15, 2023
a652e9b
Merge branch 'master' into feature/type_support_for_properties
pnoltes Oct 15, 2023
bd7aa8b
Remove C++17 constructions from updated Properties.h
pnoltes Oct 15, 2023
6d25c2b
Remove use realloc or calloc define in celix_hash_map.c
pnoltes Oct 15, 2023
747cd8a
Add celix_status_t return to celix properties set functions
pnoltes Oct 15, 2023
3541c67
Refactor celix hash map for alloc failure handling
pnoltes Oct 17, 2023
94e6a3b
Fix some memleaks in properties.c
pnoltes Oct 17, 2023
287d6f0
Extend error injection test for celix properties
pnoltes Oct 22, 2023
770818d
Add error injection for celix_properties_loadFromString
pnoltes Oct 23, 2023
9979697
Add equals for celix string/long hashmap en celix properties
pnoltes Oct 23, 2023
27e9e78
Link test_utils_cxx17tests into test_utils.
PengZheng Nov 1, 2023
bf880fc
Merge branch 'master' into feature/type_support_for_properties
PengZheng Nov 1, 2023
aa51299
Merge branch 'master' into feature/type_support_for_properties
PengZheng Nov 3, 2023
833a5c8
Remove unused functions and fix typo.
PengZheng Nov 5, 2023
b5f25b5
#509: Fix celix string/long hashmap equals functions
pnoltes Nov 6, 2023
97aa3cc
Merge branch 'master' into feature/type_support_for_properties
pnoltes Nov 6, 2023
737773b
Minor typo fix and return value improvement.
PengZheng Nov 7, 2023
71742e8
#509: Remove string_view usage from Version.h and remove deprecated P…
pnoltes Nov 9, 2023
701b5c9
#509: Add the celix properties optimization cache sizes as configurab…
pnoltes Nov 9, 2023
e8c4072
#509: Update properties handling in remote service zeroconf discovery
pnoltes Nov 9, 2023
24eab9c
Update discovery_zeroconf_announcer.c
xuzhenbao Nov 10, 2023
ef6f343
#509: Improve hashmap/properties equals and apply properties equals i…
pnoltes Nov 10, 2023
9930ecb
#509: Add Properties equal operator
pnoltes Nov 10, 2023
f1beb5f
#509: Fix memleak in celix_properties_setWithoutCopy
pnoltes Nov 10, 2023
cb0a8ba
#509: Improve some error handling in celix properties.
pnoltes Nov 10, 2023
be9f0a9
Improve some header doc for string hash map / properties
pnoltes Nov 10, 2023
9d0ad57
Add some error handling for version
pnoltes Nov 10, 2023
4bb275c
Refactor celix_properties_constants.h to celix_utils_private_constants.h
pnoltes Nov 10, 2023
229a90b
Remove incorrect celix_steal_ptr usage.
PengZheng Nov 11, 2023
e981ee4
Minor documentation improvement.
PengZheng Nov 11, 2023
3964e0b
Refactor hash map long hash, load factor and hash function usage base…
pnoltes Nov 12, 2023
468a161
Merge branch 'feature/type_support_for_properties' of github.com:apac…
pnoltes Nov 12, 2023
10e16f6
Fix memleak in hash map by first resizing and then adding entry
pnoltes Nov 12, 2023
8248da5
Update hash map maxLoadFactor documentation.
PengZheng Nov 13, 2023
d1206d9
Refactor celix_properties fill/create entry
pnoltes Nov 17, 2023
038808e
Add an extra byte for the terminating null byte to the value buffer.
PengZheng Nov 18, 2023
804d633
Detect error condition in string formatting.
PengZheng Nov 18, 2023
74f9550
Detect error condition in string formatting and make celix_properties…
PengZheng Nov 18, 2023
3ff7046
Fix initial hash table capacity in celix_properties.
PengZheng Nov 18, 2023
1706890
Fix misplaced documentation and update it.
PengZheng Nov 18, 2023
4d4e9f7
Refactor celix_properties_size return type to size_t
pnoltes Nov 18, 2023
492c457
Fix hash map iterator index tests and behaviour
pnoltes Nov 18, 2023
03731d6
Refactor properties createEntry to use destroyEntry
pnoltes Nov 18, 2023
caedd79
Avoid unnecessary strlen call and check error condition in celix_prop…
PengZheng Nov 19, 2023
78d7879
Remove index field from hashmap and properties iterator
pnoltes Nov 20, 2023
95460e9
Add ftell check and error injection test for properties
pnoltes Nov 20, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ cmake-build*
nbproject
target
html
CMakeUserPresets.json

9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ limitations under the License.
- The `OSGI_FRAMEWORK_UUID` ("org.osgi.framework.uuid") config property, replacement is `CELIX_FRAMEWORK_UUID`.
- Removed support for bundle activator symbols without a `celix_` prefix.
- Removed service property constant `CELIX_FRAMEWORK_SERVICE_PID`.
- Support and usage of "service.lang" service property is removed.
- pubsub_serializer.h is removed and no longer supported. Use pubsub_message_serialization_service.h instead.
- C Properties are no longer a direct typedef of `hashmap`.
- celix_string/long_hashmap put functions now return a celix_status_t instead of bool (value replaced).
THe celix_status_t is used to indicate an ENOMEM error.

## New Features

- Basic type support for value in celix Properties.

# Noteworthy Changes for 2.4.0 (2023-09-27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ int pubsub_subscriber_recv(void* handle, const char* msgType, unsigned int msgTy
if (metadata == NULL || celix_properties_size(metadata) == 0) {
printf("No metadata\n");
} else {
const char *key;
CELIX_PROPERTIES_FOR_EACH(metadata, key) {
const char *val = celix_properties_get(metadata, key, "!Error!");
printf("%s=%s\n", key, val);
CELIX_PROPERTIES_ITERATE(metadata, iter) {
printf("%s=%s\n", iter.key, iter.entry.value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ class PubSubInterceptorTestSuite : public ::testing::Test {
const auto *msg = static_cast<const msg_t*>(rawMsg);
EXPECT_GE(msg->seqNr, 0);
EXPECT_STREQ(celix_properties_get(metadata, "test", nullptr), "preSend");
const char *key;
CELIX_PROPERTIES_FOR_EACH(metadata, key) {
printf("got property %s=%s\n", key, celix_properties_get(metadata, key, nullptr));
CELIX_PROPERTIES_ITERATE(metadata, iter) {
printf("got property %s=%s\n", iter.key, iter.entry.value);
}
fprintf(stdout, "Got message in postSend interceptor %s/%s for type %s and ser %s with seq nr %i\n", intProps->scope, intProps->topic, intProps->psaType, intProps->serializationType, msg->seqNr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,8 @@ static celix_status_t pubsub_websocketAdmin_connectEndpointToReceiver(pubsub_web

if (publisher && (sockAddress == NULL || sockPort < 0)) {
L_WARN("[PSA WEBSOCKET] Error got endpoint without websocket address/port or endpoint type. Properties:");
const char *key = NULL;
CELIX_PROPERTIES_FOR_EACH(endpoint, key) {
L_WARN("[PSA WEBSOCKET] |- %s=%s\n", key, celix_properties_get(endpoint, key, NULL));
CELIX_PROPERTIES_ITERATE(endpoint, iter) {
L_WARN("[PSA WEBSOCKET] |- %s=%s\n", iter.key, iter.entry.value);
}
status = CELIX_BUNDLE_EXCEPTION;
} else {
Expand Down Expand Up @@ -436,9 +435,8 @@ static celix_status_t pubsub_websocketAdmin_disconnectEndpointFromReceiver(pubsu

if (publisher && (sockAddress == NULL || sockPort < 0)) {
L_WARN("[PSA WEBSOCKET] Error got endpoint without websocket address/port or endpoint type. Properties:");
const char *key = NULL;
CELIX_PROPERTIES_FOR_EACH(endpoint, key) {
L_WARN("[PSA WEBSOCKET] |- %s=%s\n", key, celix_properties_get(endpoint, key, NULL));
CELIX_PROPERTIES_ITERATE(endpoint, iter) {
L_WARN("[PSA WEBSOCKET] |- %s=%s\n", iter.key, iter.entry.value);
}
status = CELIX_BUNDLE_EXCEPTION;
} else if (eTopic != NULL && strncmp(eTopic, topic, 1024 * 1024) == 0) {
Expand Down
6 changes: 2 additions & 4 deletions bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,8 @@ static char* pubsub_discovery_createJsonEndpoint(const celix_properties_t *props
//note props is already check for validity (pubsubEndpoint_isValid)

json_t *jsEndpoint = json_object();
const char* propKey = NULL;
PROPERTIES_FOR_EACH((celix_properties_t*)props, propKey) {
const char* val = celix_properties_get(props, propKey, NULL);
json_object_set_new(jsEndpoint, propKey, json_string(val));
CELIX_PROPERTIES_ITERATE(props, iter) {
json_object_set_new(jsEndpoint, iter.key, json_string(iter.entry.value));
}
char* str = json_dumps(jsEndpoint, JSON_COMPACT);
json_decref(jsEndpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
static celix_status_t pubsubProtocol_addNetstringEntryToBuffer(char* buffer, size_t bufferSize, size_t* offsetInOut, const char* str) {
size_t offset = *offsetInOut;

size_t strLen = strnlen(str, CELIX_UTILS_MAX_STRLEN);
if (strLen == CELIX_UTILS_MAX_STRLEN) {
return CELIX_ILLEGAL_ARGUMENT;
}
size_t strLen = celix_utils_strlen(str);

char strLenString[32]; //note the str needed to print the strLen of str.
int written = snprintf(strLenString, sizeof(strLenString), "%zu", strLen);
Expand Down Expand Up @@ -76,7 +73,7 @@ static celix_status_t pubsubProtocol_addNetstringEntryToBuffer(char* buffer, siz
}

celix_status_t pubsubProtocol_encodeMetadata(pubsub_protocol_message_t* message, char** bufferInOut, size_t* bufferLengthInOut, size_t* bufferContentLengthOut) {
int metadataSize = message->metadata.metadata == NULL ? 0 : celix_properties_size(message->metadata.metadata);
size_t metadataSize = message->metadata.metadata == NULL ? 0 : celix_properties_size(message->metadata.metadata);
bool reallocBuffer = false;
bool encoded = false;

Expand All @@ -101,19 +98,17 @@ celix_status_t pubsubProtocol_encodeMetadata(pubsub_protocol_message_t* message,
*bufferInOut = newBuffer;
*bufferLengthInOut = newLength;
}
const char* key;
if (metadataSize == 0) {
encoded = true;
continue;
}
celix_status_t status = CELIX_SUCCESS;
CELIX_PROPERTIES_FOR_EACH(message->metadata.metadata, key) {
const char *val = celix_properties_get(message->metadata.metadata, key, "");
CELIX_PROPERTIES_ITERATE(message->metadata.metadata, iter) {
if (status == CELIX_SUCCESS) {
status = pubsubProtocol_addNetstringEntryToBuffer(*bufferInOut, *bufferLengthInOut, &offset, key);
status = pubsubProtocol_addNetstringEntryToBuffer(*bufferInOut, *bufferLengthInOut, &offset, iter.key);
PengZheng marked this conversation as resolved.
Show resolved Hide resolved
}
if (status == CELIX_SUCCESS) {
status = pubsubProtocol_addNetstringEntryToBuffer(*bufferInOut, *bufferLengthInOut, &offset, val);
status = pubsubProtocol_addNetstringEntryToBuffer(*bufferInOut, *bufferLengthInOut, &offset, iter.entry.value);
}
}
if (status == CELIX_FILE_IO_EXCEPTION) {
Expand Down
5 changes: 2 additions & 3 deletions bundles/pubsub/pubsub_spi/src/pubsub_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ static void pubsubEndpoint_setFields(celix_properties_t *ep, const char* fwUUID,

//copy topic properties
if (topic_props != NULL) {
const char *key = NULL;
CELIX_PROPERTIES_FOR_EACH((celix_properties_t *) topic_props, key) {
celix_properties_set(ep, key, celix_properties_get(topic_props, key, NULL));
CELIX_PROPERTIES_ITERATE((celix_properties_t *) topic_props, iter) {
celix_properties_set(ep, iter.key, iter.entry.value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,15 @@ static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor
} else {
xmlTextWriterStartElement(writer->writer, ENDPOINT_DESCRIPTION);

hash_map_iterator_pt iter = hashMapIterator_create(endpoint->properties);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);

void* propertyName = hashMapEntry_getKey(entry);
const xmlChar* propertyValue = (const xmlChar*) hashMapEntry_getValue(entry);

CELIX_PROPERTIES_ITERATE(endpoint->properties, iter) {
const xmlChar* propertyValue = (const xmlChar*) celix_properties_get(endpoint->properties, iter.key, "");
PengZheng marked this conversation as resolved.
Show resolved Hide resolved
xmlTextWriterStartElement(writer->writer, PROPERTY);
xmlTextWriterWriteAttribute(writer->writer, NAME, propertyName);
xmlTextWriterWriteAttribute(writer->writer, NAME, (const xmlChar*)iter.key);

if (strcmp(CELIX_FRAMEWORK_SERVICE_NAME, (char*) propertyName) == 0) {
if (strcmp(CELIX_FRAMEWORK_SERVICE_NAME, (char*) iter.key) == 0) {
// objectClass *must* be represented as array of string values...
endpointDescriptorWriter_writeArrayValue(writer->writer, propertyValue);
} else if (strcmp(OSGI_RSA_ENDPOINT_SERVICE_ID, (char*) propertyName) == 0) {
} else if (strcmp(OSGI_RSA_ENDPOINT_SERVICE_ID, (char*) iter.key) == 0) {
// endpoint.service.id *must* be represented as long value...
endpointDescriptorWriter_writeTypedValue(writer->writer, VALUE_TYPE_LONG, propertyValue);
} else {
Expand All @@ -162,7 +157,6 @@ static celix_status_t endpointDescriptorWriter_writeEndpoint(endpoint_descriptor

xmlTextWriterEndElement(writer->writer);
}
hashMapIterator_destroy(iter);

xmlTextWriterEndElement(writer->writer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,21 +342,21 @@ static void discoveryZeroconfAnnouncer_revokeEndpoints(discovery_zeroconf_announ
static bool discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord(discovery_zeroconf_announcer_t *announcer, celix_properties_iterator_t *propIter, TXTRecordRef *txtRecord, uint16_t maxTxtLen, bool splitTxtRecord) {
const char *key;
const char *val;
celix_properties_t *props;
while (celix_propertiesIterator_hasNext(propIter)) {
key = celix_propertiesIterator_nextKey(propIter);
props = celix_propertiesIterator_properties(propIter);
val = celix_properties_get(props, key, "");
while (!celix_propertiesIterator_isEnd(propIter)) {
key = propIter->key;
val = propIter->entry.value;
PengZheng marked this conversation as resolved.
Show resolved Hide resolved
if (key) {
DNSServiceErrorType err = TXTRecordSetValue(txtRecord, key, strlen(val), val);
if (err != kDNSServiceErr_NoError) {
celix_logHelper_error(announcer->logHelper, "Announcer: Failed to set txt value, %d.", err);
return false;
}
if (splitTxtRecord && TXTRecordGetLength(txtRecord) >= maxTxtLen - UINT8_MAX) {
celix_propertiesIterator_next(propIter);
break;
}
}
celix_propertiesIterator_next(propIter);
}
return true;
}
Expand All @@ -374,11 +374,11 @@ static void discoveryZeroconfAnnouncer_announceEndpoints(discovery_zeroconf_anno
}
char txtBuf[DZC_MAX_TXT_RECORD_SIZE] = {0};
TXTRecordRef txtRecord;
celix_properties_iterator_t propIter = celix_propertiesIterator_construct(entry->properties);
celix_properties_iterator_t propIter = celix_properties_begin(entry->properties);

TXTRecordCreate(&txtRecord, sizeof(txtBuf), txtBuf);
char propSizeStr[16]= {0};
sprintf(propSizeStr, "%d", celix_properties_size(entry->properties) + 1);
sprintf(propSizeStr, "%zu", celix_properties_size(entry->properties) + 1);
(void)TXTRecordSetValue(&txtRecord, DZC_SERVICE_PROPERTIES_SIZE_KEY, strlen(propSizeStr), propSizeStr);
if (!discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord(announcer, &propIter, &txtRecord, sizeof(txtBuf), splitTxtRecord)) {
TXTRecordDeallocate(&txtRecord);
Expand Down Expand Up @@ -411,7 +411,7 @@ static void discoveryZeroconfAnnouncer_announceEndpoints(discovery_zeroconf_anno

if (registered) {
entry->registerRef = dsRef;
while (celix_propertiesIterator_hasNext(&propIter)) {
while (!celix_propertiesIterator_isEnd(&propIter)) {
TXTRecordCreate(&txtRecord, sizeof(txtBuf), txtBuf);
if (!discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord(announcer, &propIter, &txtRecord, sizeof(txtBuf), true)) {
TXTRecordDeallocate(&txtRecord);
Expand Down Expand Up @@ -541,4 +541,4 @@ static void *discoveryZeroconfAnnouncer_refreshEndpointThread(void *data) {
celix_arrayList_destroy(revokedEndpoints);
celix_arrayList_destroy(announcedEndpoints);
return NULL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,7 @@ static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_servic
}
}

hash_map_entry_pt entry = hashMap_getEntry(endpointProperties, (void *) CELIX_FRAMEWORK_SERVICE_ID);

char* key = hashMapEntry_getKey(entry);
char *serviceId = (char *) hashMap_remove(endpointProperties, (void *) CELIX_FRAMEWORK_SERVICE_ID);
const char* serviceId = celix_properties_get(endpointProperties, CELIX_FRAMEWORK_SERVICE_ID, "-1");
const char *uuid = NULL;

char buf[512];
Expand All @@ -775,12 +772,9 @@ static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_servic
}

if (props != NULL) {
hash_map_iterator_pt propIter = hashMapIterator_create(props);
while (hashMapIterator_hasNext(propIter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(propIter);
celix_properties_set(endpointProperties, (char*)hashMapEntry_getKey(entry), (char*)hashMapEntry_getValue(entry));
CELIX_PROPERTIES_ITERATE(props, iter) {
celix_properties_set(endpointProperties, iter.key, iter.entry.value);
}
hashMapIterator_destroy(propIter);
}

*endpoint = calloc(1, sizeof(**endpoint));
Expand All @@ -794,8 +788,6 @@ static celix_status_t remoteServiceAdmin_createEndpointDescription(remote_servic
(*endpoint)->properties = endpointProperties;
}

free(key);
free(serviceId);
free(keys);

return status;
Expand Down Expand Up @@ -1002,14 +994,10 @@ static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description
} else {
struct curl_slist *metadataHeader = NULL;
if (metadata != NULL && celix_properties_size(metadata) > 0) {
const char *key = NULL;
CELIX_PROPERTIES_FOR_EACH(metadata, key) {
const char *val = celix_properties_get(metadata, key, "");
size_t length = strlen(key) + strlen(val) + 18; // "X-RSA-Metadata-key: val\0"

CELIX_PROPERTIES_ITERATE(metadata, iter) {
size_t length = strlen(iter.key) + strlen(iter.entry.value) + 18; // "X-RSA-Metadata-key: val\0"
char header[length];

snprintf(header, length, "X-RSA-Metadata-%s: %s", key, val);
snprintf(header, length, "X-RSA-Metadata-%s: %s", iter.key, iter.entry.value);
metadataHeader = curl_slist_append(metadataHeader, header);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ celix_status_t rsaShmClientManager_sendMsgTo(rsa_shm_client_manager_t *clientMan
|| response == NULL) {
return CELIX_ILLEGAL_ARGUMENT;
}
const char *key = NULL;
size_t metadataStringSize = 0;
FILE *fp = NULL;
rsa_shm_msg_control_t *msgCtrl = NULL;
Expand All @@ -279,9 +278,8 @@ celix_status_t rsaShmClientManager_sendMsgTo(rsa_shm_client_manager_t *clientMan
return CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO, errno);
}
if (metadata != NULL) {
CELIX_PROPERTIES_FOR_EACH(metadata, key) {
const char * value = celix_properties_get(metadata, key,"");
fprintf(fp,"%s=%s\n", key, value);
CELIX_PROPERTIES_ITERATE(metadata, iter) {
fprintf(fp,"%s=%s\n", iter.key, iter.entry.value);
}
}
fclose(fp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,26 @@ static void rsaShm_overlayProperties(celix_properties_t *additionalProperties, c

/*The property keys of a service are case-insensitive,while the property keys of the specified additional properties map are case sensitive.
* A property key in the additional properties map must therefore override any case variant property key in the properties of the specified Service Reference.*/
const char *additionalPropKey = NULL;
const char *servicePropKey = NULL;
CELIX_PROPERTIES_FOR_EACH(additionalProperties, additionalPropKey) {
if (strcmp(additionalPropKey,(char*) CELIX_FRAMEWORK_SERVICE_NAME) != 0
&& strcmp(additionalPropKey,(char*) CELIX_FRAMEWORK_SERVICE_ID) != 0) {
CELIX_PROPERTIES_ITERATE(additionalProperties, additionalPropIter) {
if (strcmp(additionalPropIter.key,(char*) CELIX_FRAMEWORK_SERVICE_NAME) != 0
&& strcmp(additionalPropIter.key,(char*) CELIX_FRAMEWORK_SERVICE_ID) != 0) {
bool propKeyCaseEqual = false;

CELIX_PROPERTIES_FOR_EACH(serviceProperties, servicePropKey) {
if (strcasecmp(additionalPropKey,servicePropKey) == 0) {
const char* val = celix_properties_get(additionalProperties,additionalPropKey,NULL);
celix_properties_set(serviceProperties,servicePropKey,val);
CELIX_PROPERTIES_ITERATE(serviceProperties, servicePropIter) {
if (strcasecmp(additionalPropIter.key,servicePropIter.key) == 0) {
const char* val = additionalPropIter.entry.value;
celix_properties_set(serviceProperties,servicePropIter.key,val);
propKeyCaseEqual = true;
break;
}
}

if (!propKeyCaseEqual) {
const char* val = celix_properties_get(additionalProperties,additionalPropKey,NULL);
celix_properties_set(serviceProperties,additionalPropKey,val);
const char* val = additionalPropIter.entry.value;
celix_properties_set(serviceProperties,additionalPropIter.key,val);
}
}
}
return;
}

static bool rsaShm_isConfigTypeMatched(celix_properties_t *properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ celix_status_t topologyManager_importScopeChanged(void *handle, char *service_na
hash_map_entry_pt entry = hashMapIterator_nextEntry(importedServicesIterator);
endpoint = hashMapEntry_getKey(entry);

entry = hashMap_getEntry(endpoint->properties, (void *) CELIX_FRAMEWORK_SERVICE_NAME);
char* name = (char *) hashMapEntry_getValue(entry);
const char* name = celix_properties_get(endpoint->properties, CELIX_FRAMEWORK_SERVICE_NAME, "");
// Test if a service with the same name is imported
if (strcmp(name, service_name) == 0) {
found = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ extern "C" {
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *) arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
const char* value = celix_properties_get(props, "key2", "");
EXPECT_STREQ("inaetics", value);
/*
printf("Service: %s ", ep->service);
Expand Down Expand Up @@ -433,8 +432,7 @@ extern "C" {
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *) arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
const char* value = celix_properties_get(props, "key2", "");
EXPECT_STREQ("inaetics", value);
}
printf("End: %s\n", __func__);
Expand All @@ -458,8 +456,7 @@ extern "C" {
for (unsigned int i = 0; i < arrayList_size(epList); i++) {
endpoint_description_t *ep = (endpoint_description_t *) arrayList_get(epList, i);
celix_properties_t *props = ep->properties;
hash_map_entry_pt entry = hashMap_getEntry(props, (void *)"key2");
char* value = (char*) hashMapEntry_getValue(entry);
const char* value = celix_properties_get(props, "key2", "");
EXPECT_STREQ("inaetics", value);
}
printf("End: %s\n", __func__);
Expand Down
Loading
Loading