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

dateModified/dateCreated not included in initial notifications #3182

Closed
fgalan opened this issue May 25, 2018 · 1 comment
Closed

dateModified/dateCreated not included in initial notifications #3182

fgalan opened this issue May 25, 2018 · 1 comment
Labels
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented May 25, 2018

Not a very important bug (as initial notifications are not very important)... but a bug after all :)

This is the .test script that raises the problem:

--NAME--
BUG REPORT: dateModified and dateCreated are not included in inital notification

--SHELL-INIT--
dbInit CB
brokerStart CB
accumulatorStart --pretty-print

--SHELL--

echo "01.Create entity E1/T"
echo "======================================================================================================"
payload='{
  "id": "E1",
  "type": "T",
  "A": {
    "value": "foo",
    "type": "Text"
  }
}'
orionCurl --url '/v2/entities' --payload "$payload"
echo
echo


echo "02. Create sub E.*/T with with dateModified and dateCreated in notification.attrs"
echo "================================================================================="
payload='{
    "subject": {
        "entities": [
            {
                "idPattern": ".*",
                "type": "T"
            }
        ]
    },
    "notification": {
        "http": {"url": "http://localhost:'$LISTENER_PORT'/notify"},
        "attrs": [ "dateModified", "dateCreated", "*" ]
    }
}'
orionCurl --url /v2/subscriptions --payload "$payload"
echo
echo


echo "03. Dump & reset accumulator shows the bug: dateModified and dateCreated are not included"
echo "========================================================================================="
accumulatorDump
accumulatorReset
echo
echo


echo "04. But we can check that they are there, with a GET /v2/entities/E1/attrs?attrs=dateCreated,dateModified,* request"
echo "==================================================================================================================="
orionCurl --url '/v2/entities/E1/attrs?attrs=dateCreated,dateModified,*'
echo
echo

echo "04. ... and also in regular notifications (update entity and dump accumulator)"
echo "=============================================================================="
payload='{
  "A": {
    "value": "bar",
    "type": "Text"
  }
}'
orionCurl --url '/v2/entities/E1/attrs' --payload "$payload"
echo
echo
accumulatorDump
accumulatorReset
echo
echo


--REGEXPECT--
TBD

--TEARDOWN--
brokerStop CB
dbDrop CB

The output of the .test in something like this:

01.Create entity E1/T
======================================================================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/entities/E1?type=T
Fiware-Correlator: 07a03566-6027-11e8-83de-000c29173617
Date: Fri, 25 May 2018 14:22:18 GMT



02. Create sub E.*/T with with dateModified and dateCreated in notification.attrs
=================================================================================
HTTP/1.1 201 Created
Content-Length: 0
Location: /v2/subscriptions/5b081c1ae99354cf0d001abe
Fiware-Correlator: 07a3c7f8-6027-11e8-b10f-000c29173617
Date: Fri, 25 May 2018 14:22:18 GMT



03. Dump & reset accumulator shows the bug: dateModified and dateCreated are not included
=========================================================================================
POST http://localhost:9997/notify
Fiware-Servicepath: /
Content-Length: 125
User-Agent: orion/1.13.0-next libcurl/7.38.0
Ngsiv2-Attrsformat: normalized
Host: localhost:9997
Accept: application/json
Content-Type: application/json; charset=utf-8
Fiware-Correlator: 07a3c7f8-6027-11e8-b10f-000c29173617

{
    "data": [
        {
            "A": {
                "metadata": {}, 
                "type": "Text", 
                "value": "foo"
            }, 
            "id": "E1", 
            "type": "T"
        }
    ], 
    "subscriptionId": "5b081c1ae99354cf0d001abe"
}
=======================================


04. But we can check that they are there, with a GET /v2/entities/E1/attrs?attrs=dateCreated,dateModified,* request
===================================================================================================================
HTTP/1.1 200 OK
Content-Length: 214
Content-Type: application/json
Fiware-Correlator: 07adaf66-6027-11e8-b897-000c29173617
Date: Fri, 25 May 2018 14:22:18 GMT

{
    "A": {
        "metadata": {},
        "type": "Text",
        "value": "foo"
    },
    "dateCreated": {
        "metadata": {},
        "type": "DateTime",
        "value": "2018-05-25T14:22:18.00Z"
    },
    "dateModified": {
        "metadata": {},
        "type": "DateTime",
        "value": "2018-05-25T14:22:18.00Z"
    }
}


04. ... and also in regular notifications (update entity and dump accumulator)
==============================================================================
HTTP/1.1 204 No Content
Content-Length: 0
Fiware-Correlator: 07b3a52e-6027-11e8-8ae2-000c29173617
Date: Fri, 25 May 2018 14:22:18 GMT



POST http://localhost:9997/notify
Fiware-Servicepath: /
Content-Length: 290
User-Agent: orion/1.13.0-next libcurl/7.38.0
Ngsiv2-Attrsformat: normalized
Host: localhost:9997
Accept: application/json
Content-Type: application/json; charset=utf-8
Fiware-Correlator: 07b3a52e-6027-11e8-8ae2-000c29173617

{
    "data": [
        {
            "A": {
                "metadata": {}, 
                "type": "Text", 
                "value": "bar"
            }, 
            "dateCreated": {
                "metadata": {}, 
                "type": "DateTime", 
                "value": "2018-05-25T14:22:18.00Z"
            }, 
            "dateModified": {
                "metadata": {}, 
                "type": "DateTime", 
                "value": "2018-05-25T14:22:18.00Z"
            }, 
            "id": "E1", 
            "type": "T"
        }
    ], 
    "subscriptionId": "5b081c1ae99354cf0d001abe"
}
=======================================
@fgalan
Copy link
Member Author

fgalan commented Sep 27, 2018

Fixed in PR #3301, .test and CNR added in PR #3315

@fgalan fgalan closed this as completed Sep 27, 2018
@fgalan fgalan added this to the 1.16.0 milestone Sep 27, 2018
AlvaroVega added a commit that referenced this issue Sep 27, 2018
…es_in_initial_notif

Functional test for #3182 issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant