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

Fix/attribute metadata #1923

Merged
merged 7 commits into from
Sep 4, 2020
Merged

Fix/attribute metadata #1923

merged 7 commits into from
Sep 4, 2020

Conversation

IvanHdzC
Copy link
Contributor

@IvanHdzC IvanHdzC commented Sep 4, 2020

This PR fixes the mentioned exception on. #1902.

On the entity that failed when persisting on the comment, this would be the persistance json.

Persisting data at NGSICKANSink (orgName=dipbad, pkgName=dipbad_envairqualityrespira, resName=bada1_respira, data={"recvTime":"2020-09-04T07:05:54.756Z","fiwareServicePath":"/envAirQualityRESPIRA","entityId":"bada1","entityType":"RESPIRA","TimeInstant":"2020-07-01T20:32:06.000Z","TimeInstant_md":[{"name":"dateCreated","type":"DateTime","value":"2020-01-10T10:08:33.000Z"},{"name":"dateModified","type":"DateTime","value":"2020-07-08T10:55:38.000Z"}],"airQualityIndex":31,"airQualityIndex_md":[{"name":"dateCreated","type":"DateTime","value":"2020-01-10T10:08:33.000Z"},{"name":"dateModified","type":"DateTime","value":"2020-07-08T10:55:38.000Z"}]})

Copy link
Member

@AlvaroVega AlvaroVega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlvaroVega
Copy link
Member

This PR reopens #1919 so no CNR update is needed

@@ -108,7 +108,8 @@ public void aggregate(NGSIEvent event) {
String attrType = contextAttribute.getType();
JsonElement attrValue = contextAttribute.getValue();
String attrMetadata = contextAttribute.getContextMetadata();
JsonArray jsonAttrMetadata = new Gson().fromJson(attrMetadata, JsonArray.class);
JsonParser jsonParser = new JsonParser();
JsonArray jsonAttrMetadata = (JsonArray) jsonParser.parse(attrMetadata);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some test should be added covering the failing case (now solved by the PR)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous PR #1919 were modifying existing tests about this feature

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I understand new tests are not needed.

In that case, NTC.

Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IvanHdzC IvanHdzC changed the title Fix/attribute metadata [WIP]Fix/attribute metadata Sep 4, 2020
@IvanHdzC IvanHdzC changed the title [WIP]Fix/attribute metadata Fix/attribute metadata Sep 4, 2020
@@ -92,7 +96,8 @@ public void aggregate(NGSIEvent event) {
aggregation.get(NGSIConstants.ATTR_NAME).add(new JsonPrimitive(attrName));
aggregation.get(NGSIConstants.ATTR_TYPE).add(new JsonPrimitive(attrType));
aggregation.get(NGSIConstants.ATTR_VALUE).add(attrValue);
aggregation.get(NGSIConstants.ATTR_MD).add(new JsonPrimitive(attrMetadata));
aggregation.get(NGSIConstants.ATTR_MD).add(jsonAttrMetadata);
//aggregation.get(NGSIConstants.ATTR_MD).add(new JsonPrimitive(attrMetadata));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment legacy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 611a63c

Copy link
Member

@AlvaroVega AlvaroVega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlvaroVega AlvaroVega merged commit 0a49c7c into master Sep 4, 2020
@fgalan fgalan deleted the fix/attribute_type_key branch September 4, 2020 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants