エンティティがタイプで作成され、次に同じ ID で空のタイプのエンティティが作成されると、contextbroker は正常に応答しますが、エンティティは作成されません。
ただし、作成が逆の順序で行われた場合、最初に空の ID を持つエンティティが作成され、次に aa タイプのエンティティが作成された場合、Context Broker は ok として応答し、エンティティが一覧表示されます。
ケース1を実行するスクリプト
#/bin/bash
HOST=localhost
SERVICE=Service123
SUBSERVICE=/Subservice123
#Create an entity with id and type
CREATE=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
-d '
{
"id": "firstID",
"type": "firstType",
"attributes": []
}')
#List the entities
LIST=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
)
echo $CREATE
echo "**********************"
echo $LIST
#Create an entity with the same ID but different type
CREATE=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
-d '
{
"id": "firstID",
"type": "",
"attributes": []
}')
#List the entityies
LIST=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
)
echo
echo "Second Iteration"
echo
echo $CREATE
echo "**********************"
echo $LIST
ケース2を実行するスクリプト
#/bin/bash
HOST=localhost
SERVICE=Service1234
SUBSERVICE=/Subservice1234
#Create an entity with id and type
CREATE=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
-d '
{
"id": "firstID",
"type": "",
"attributes": []
}')
#List the entities
LIST=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
)
echo $CREATE
echo "**********************"
echo $LIST
#Create an entity with the same ID but different type
CREATE=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
-d '
{
"id": "firstID",
"type": "fistType",
"attributes": []
}')
#List the entityies
LIST=$(\
curl http://$HOST:1026/v1/contextEntities \
-s \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: $SERVICE" \
-H "Fiware-ServicePath: $SUBSERVICE" \
)
echo
echo "Second Iteration"
echo
echo $CREATE
echo "**********************"
echo $LIST