-
Notifications
You must be signed in to change notification settings - Fork 104
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
Fix/attribute metadata #1923
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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); |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment legacy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 611a63c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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"}]})