Skip to content
Snippets Groups Projects
Commit 778454ba authored by Geurtjens,D. (Douwe Geurtjens)'s avatar Geurtjens,D. (Douwe Geurtjens)
Browse files

Unit tests now use new new json format

parent 228b5975
No related branches found
No related tags found
1 merge request!1Big merge
...@@ -31,6 +31,8 @@ func TestEmptyQueryConversion(t *testing.T) { ...@@ -31,6 +31,8 @@ func TestEmptyQueryConversion(t *testing.T) {
}, },
"entities": [], "entities": [],
"relations": [], "relations": [],
"groupBys": [],
"filters": [],
"limit": 5000 "limit": 5000
}`) }`)
...@@ -63,55 +65,59 @@ func TestMultipleEntityTypes(t *testing.T) { ...@@ -63,55 +65,59 @@ func TestMultipleEntityTypes(t *testing.T) {
query := []byte(`{ query := []byte(`{
"databaseName": "test", "databaseName": "test",
"return": { "return": {
"entities": [ "entities": [
0, 0,
1 1
], ],
"relations": [ "relations": [
0 0
] ]
}, },
"entities": [ "entities": [
{ {
"type": "kamerleden", "type": "kamerleden",
"ID": 0 "ID": 0
] },
}, {
{ "type": "partijen",
"type": "partijen", "ID": 1
"ID": 1 }
]
}
], ],
"relations": [ "relations": [
{ {
"type": "lid_van", "ID": 0
"depth": { "type": "lid_van",
"min": 1, "depth": {
"max": 1 "min": 1,
}, "max": 1
"FromType": "entity", },
"FromID": 0, "fromType": "entity",
"ToType": "entity", "fromID": 0,
"ToID": 1 "toType": "entity",
} "toID": 1
}
], ],
"groupBys": [],
"filters": [ "filters": [
{ {
"ID": 0, "ID": 0,
"FilteredType": "entity", "fromType": "entity",
"FilteredID": 0, "fromID": 0,
"Attribute": "partij", "toType": "relation",
"Value": "GL", "toID": 0,
"DataType": "string", "attribute": "partij",
"MatchType": "exact" , "value": "GL",
"InType": "", "dataType": "string",
"InID": -1 "matchType": "exact",
"inType": "",
"inID": -1
}, },
{ {
"ID": 1, "ID": 1,
"filteredType": "entity", "fromType": "entity",
"filteredID": 1, "fromID": 1,
"toType": "relation",
"toID": 0,
"attribute": "zetels", "attribute": "zetels",
"value": "6", "value": "6",
"dataType": "int", "dataType": "int",
...@@ -119,10 +125,10 @@ func TestMultipleEntityTypes(t *testing.T) { ...@@ -119,10 +125,10 @@ func TestMultipleEntityTypes(t *testing.T) {
"inType": "", "inType": "",
"inID": -1 "inID": -1
} }
] ],
"limit": 5000, "limit": 5000,
"modifiers": [] "modifiers": []
}`) }`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -163,17 +169,26 @@ func TestEntityOneAttributeQuery(t *testing.T) { ...@@ -163,17 +169,26 @@ func TestEntityOneAttributeQuery(t *testing.T) {
"entities": [ "entities": [
{ {
"type": "airports", "type": "airports",
"constraints": [ "ID": 0
{
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
]
} }
], ],
"groupBys": [],
"relations": [], "relations": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "",
"toID": -1,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000 "limit": 5000
}`) }`)
...@@ -213,6 +228,7 @@ func TestRelationWithConstraint(t *testing.T) { ...@@ -213,6 +228,7 @@ func TestRelationWithConstraint(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"ID": 0,
"type": "airports", "type": "airports",
"constraints": [ "constraints": [
{ {
...@@ -226,23 +242,39 @@ func TestRelationWithConstraint(t *testing.T) { ...@@ -226,23 +242,39 @@ func TestRelationWithConstraint(t *testing.T) {
], ],
"relations": [ "relations": [
{ {
"ID": 0,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 1 "max": 1
}, },
"entityFrom": 0, "FromType": "entity",
"entityTo": -1, "fromID": 0,
"ToType": "",
"toID": -1,
"constraints": [ "constraints": [
{ {
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ"
} }
] ]
} }
], ],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ",
"inType": "",
"inID": -1
}
],
"limit": 5000 "limit": 5000
}`) }`)
...@@ -280,18 +312,30 @@ func TestModifierCountEntity(t *testing.T) { ...@@ -280,18 +312,30 @@ func TestModifierCountEntity(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"ID": 0,
"type": "airports", "type": "airports",
"constraints": [ "constraints": [
{ {}
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
] ]
} }
], ],
"relations": [], "relations": [],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000, "limit": 5000,
"modifiers": [ "modifiers": [
{ {
...@@ -337,18 +381,27 @@ func TestModifierCountEntityAttribute(t *testing.T) { ...@@ -337,18 +381,27 @@ func TestModifierCountEntityAttribute(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"type": "airports", "ID": 0,
"constraints": [ "type": "airports"
{
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
]
} }
], ],
"relations": [], "relations": [],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "",
"toID": -1,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000, "limit": 5000,
"modifiers": [ "modifiers": [
{ {
...@@ -396,34 +449,51 @@ func TestModifierCountRelation(t *testing.T) { ...@@ -396,34 +449,51 @@ func TestModifierCountRelation(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"type": "airports", "ID": 0,
"constraints": [ "type": "airports"
{
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
]
} }
], ],
"relations": [ "relations": [
{ {
"ID": 0,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 1 "max": 1
}, },
"entityFrom": 0, "fromType": "entity",
"entityTo": -1, "fromID": 0,
"constraints": [ "toType": "",
{ "toID": -1
"attribute": "Day", }
"value": "15", ],
"dataType": "int", "groupBys": [],
"matchType": "EQ" "filters": [
} {
] "ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 1,
"fromType": "relation",
"fromID": 0,
"toType": "entity",
"toID": 0,
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ",
"inType": "",
"inID": -1
} }
], ],
"limit": 5000, "limit": 5000,
...@@ -465,46 +535,50 @@ func TestModifierCountEntitySwap(t *testing.T) { ...@@ -465,46 +535,50 @@ func TestModifierCountEntitySwap(t *testing.T) {
query := []byte(`{ query := []byte(`{
"databaseName": "TweedeKamer", "databaseName": "TweedeKamer",
"return": { "return": {
"entities": [ "entities": [
0, 0,
1 1
], ],
"relations": [ "relations": [
0 0
] ]
}, },
"entities": [ "entities": [
{ {
"type": "partijen", "ID": 0,
"constraints": [] "type": "partijen"
}, },
{ {
"type": "kamerleden", "ID": 1,
"constraints": [] "type": "kamerleden"
} }
], ],
"relations": [ "relations": [
{ {
"type": "lid_van", "ID": 0,
"depth": { "type": "lid_van",
"min": 1, "depth": {
"max": 1 "min": 1,
}, "max": 1
"entityFrom": 1, },
"entityTo": 0, "fromType": "entity",
"constraints": [] "fromID": 1,
} "toType": "entity",
"toID": 0
}
], ],
"groupBys": [],
"filters": [],
"limit": 5000, "limit": 5000,
"modifiers": [ "modifiers": [
{ {
"type": "COUNT", "type": "COUNT",
"selectedType": "entity", "selectedType": "entity",
"selectedTypeId": 1, "selectedTypeId": 1,
"attributeIndex": -1 "attributeIndex": -1
} }
] ]
}`) }`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -541,34 +615,53 @@ func TestModifierCountRelationAttribute(t *testing.T) { ...@@ -541,34 +615,53 @@ func TestModifierCountRelationAttribute(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"type": "airports", "ID": 0,
"constraints": [ "type": "airports"
{
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
]
} }
], ],
"relations": [ "relations": [
{ {
"ID":0,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 1 "max": 1
}, },
"entityFrom": 0, "fromType": "entity",
"entityTo": -1, "fromID": 0,
"constraints": [ "toType": "",
{ "toID": -1
"attribute": "Day", }
"value": "15", ],
"dataType": "int", "groupBys": [
"matchType": "EQ"
} ],
] "filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 1,
"fromType": "relation",
"fromID": 0,
"toType": "",
"toID": -1,
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ",
"inType": "",
"inID": -1
} }
], ],
"limit": 5000, "limit": 5000,
...@@ -619,6 +712,7 @@ func TestRelationWithInOutConstraint(t *testing.T) { ...@@ -619,6 +712,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"ID": 0,
"type": "airports", "type": "airports",
"constraints": [ "constraints": [
{ {
...@@ -630,6 +724,7 @@ func TestRelationWithInOutConstraint(t *testing.T) { ...@@ -630,6 +724,7 @@ func TestRelationWithInOutConstraint(t *testing.T) {
] ]
}, },
{ {
"ID": 1,
"type": "airports", "type": "airports",
"constraints": [ "constraints": [
{ {
...@@ -643,22 +738,60 @@ func TestRelationWithInOutConstraint(t *testing.T) { ...@@ -643,22 +738,60 @@ func TestRelationWithInOutConstraint(t *testing.T) {
], ],
"relations": [ "relations": [
{ {
"ID":0,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 3 "max": 3
}, },
"entityFrom": 1, "fromType": "entity",
"entityTo": 0, "fromID": 1,
"constraints": [ "toType": "entity",
{ "toID": 0
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ"
}
]
} }
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 1,
"fromType": "entity",
"fromID": 1,
"toType": "relation",
"toID": 0,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}, {
"ID": 2,
"fromType": "relation",
"fromID": 0,
"toType": "",
"toID": -1,
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ",
"inType": "",
"inID": -1
}
], ],
"limit": 5000 "limit": 5000
}`) }`)
...@@ -702,67 +835,100 @@ func TestTwoRelations(t *testing.T) { ...@@ -702,67 +835,100 @@ func TestTwoRelations(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"type": "airports", "ID": 0,
"constraints": [ "type": "airports"
{
"attribute": "city",
"value": "New York",
"dataType": "string",
"matchType": "exact"
}
]
}, },
{ {
"type": "airports", "ID": 1,
"constraints": [ "type": "airports"
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}, },
{ {
"type": "airports", "ID": 2,
"constraints": [ "type": "airports"
{
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact"
}
]
} }
], ],
"relations": [ "relations": [
{ {
"ID": 0,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 3 "max": 3
}, },
"entityFrom": 2, "fromType": "entity",
"entityTo": 1, "fromID": 2,
"constraints": [ "toType": "entity",
{ "toID": 1
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ"
}
]
}, },
{ {
"ID":1,
"type": "flights", "type": "flights",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 1 "max": 1
}, },
"entityFrom": 0, "fromType": "entity",
"entityTo": -1, "fromID": 0,
"constraints": [] "toType": "",
"toID": -1
} }
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 1,
"attribute": "city",
"value": "New York",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 1,
"fromType": "entity",
"fromID": 1,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 2,
"fromType": "entity",
"fromID": 2,
"toType": "relation",
"toID": 0,
"attribute": "state",
"value": "HI",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
},
{
"ID": 3,
"fromType": "relation",
"fromID": 0,
"toType": "",
"toID": -1,
"attribute": "Day",
"value": "15",
"dataType": "int",
"matchType": "EQ",
"inType": "",
"inID": -1
}
], ],
"limit": 5000 "limit": 5000
}`) }`)
...@@ -793,41 +959,52 @@ func TestRelationWithOnlyToNode(t *testing.T) { ...@@ -793,41 +959,52 @@ func TestRelationWithOnlyToNode(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"return": { "return": {
"entities": [
0
],
"relations": [
0
]
},
"entities": [ "entities": [
{ 0
"type": "airports",
"constraints": [
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}
], ],
"relations": [ "relations": [
{ 0
"type": "flights", ]
"depth": { },
"min": 1, "entities": [
"max": 1 {
}, "ID": 0,
"entityFrom": -1, "type": "airports"
"entityTo": 0, }
"constraints": [] ],
} "relations": [
], {
"limit": 5000 "ID": 0,
}`) "type": "flights",
"depth": {
"min": 1,
"max": 1
},
"fromType": "",
"fromID": -1,
"toType": "entity",
"toID": 0
}
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -855,43 +1032,54 @@ func TestTooManyReturnEntities(t *testing.T) { ...@@ -855,43 +1032,54 @@ func TestTooManyReturnEntities(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"return": { "return": {
"entities": [
0,
1,
2
],
"relations": [
0
]
},
"entities": [ "entities": [
{ 0,
"type": "airports", 1,
"constraints": [ 2
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}
], ],
"relations": [ "relations": [
{ 0
"type": "flights", ]
"depth": { },
"min": 1, "entities": [
"max": 1 {
}, "ID": 0,
"entityFrom": -1, "type": "airports"
"entityTo": 0, }
"constraints": [] ],
} "relations": [
], {
"limit": 5000 "ID": 0,
}`) "type": "flights",
"depth": {
"min": 1,
"max": 1
},
"fromType": "",
"fromID": -1,
"toType": "entity",
"toID": 0
}
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -913,43 +1101,54 @@ func TestTooManyReturnRelations(t *testing.T) { ...@@ -913,43 +1101,54 @@ func TestTooManyReturnRelations(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"return": { "return": {
"entities": [
0
],
"relations": [
0,
1,
2
]
},
"entities": [ "entities": [
{ 0
"type": "airports",
"constraints": [
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}
], ],
"relations": [ "relations": [
{ 0,
"type": "flights", 1,
"depth": { 2
"min": 1, ]
"max": 1 },
}, "entities": [
"entityFrom": -1, {
"entityTo": 0, "ID": 0,
"constraints": [] "type": "airports"
} }
], ],
"limit": 5000 "relations": [
}`) {
"ID": 0,
"type": "flights",
"depth": {
"min": 1,
"max": 1
},
"fromType": "",
"fromID": -1,
"toType": "entity",
"toID": 0
}
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -971,44 +1170,55 @@ func TestNegativeReturnEntities(t *testing.T) { ...@@ -971,44 +1170,55 @@ func TestNegativeReturnEntities(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"return": { "return": {
"entities": [
0,
-1
],
"relations": [
0,
1,
2
]
},
"entities": [ "entities": [
{ 0,
"type": "airports", -1
"constraints": [
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}
], ],
"relations": [ "relations": [
{ 0,
"type": "flights", 1,
"depth": { 2
"min": 1, ]
"max": 1 },
}, "entities": [
"entityFrom": -1, {
"entityTo": 0, "ID": 0,
"constraints": [] "type": "airports"
} }
], ],
"limit": 5000 "relations": [
}`) {
"ID": 0,
"type": "flights",
"depth": {
"min": 1,
"max": 1
},
"fromType": "",
"fromID": -1,
"toType": "entity",
"toID": 0
}
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -1037,15 +1247,24 @@ func TestNoRelationsField(t *testing.T) { ...@@ -1037,15 +1247,24 @@ func TestNoRelationsField(t *testing.T) {
}, },
"entities": [ "entities": [
{ {
"type": "airports", "ID": 0,
"constraints": [ "type": "airports"
{ }
"attribute": "city", ],
"value": "San Francisco", "groupBys": [],
"dataType": "string", "filters": [
"matchType": "exact" {
} "ID": 0,
] "fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
} }
], ],
"limit": 5000 "limit": 5000
...@@ -1077,63 +1296,68 @@ func TestDoubleWITH(t *testing.T) { ...@@ -1077,63 +1296,68 @@ func TestDoubleWITH(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"databaseName": "test", "databaseName": "test",
"return": { "return": {
"entities": [ "entities": [
0, 0,
1, 1,
2, 2,
3 3
], ],
"relations": [ "relations": [
0, 0,
1 1
] ]
}, },
"entities": [ "entities": [
{ {
"type": "kamerleden", "ID": 0,
"constraints": [] "type": "kamerleden"
}, },
{ {
"type": "partijen", "ID": 1,
"constraints": [] "type": "partijen"
} },
, {
{ "ID": 2,
"type": "kamerleden", "type": "kamerleden"
"constraints": [] },
}, {
{ "ID": 3,
"type": "commissies", "type": "commissies"
"constraints": [] }
} ],
], "relations": [
"relations": [ {
{ "ID": 0,
"type": "lid_van", "type": "lid_van",
"depth": { "depth": {
"min": 1, "min": 1,
"max": 1 "max": 1
}, },
"entityFrom": 0, "fromType": "entity",
"entityTo": 1, "fromID": 0,
"constraints": [] "toType": "entity",
}, "toID": 1
{ },
"type": "onderdeel_van", {
"depth": { "ID": 1,
"min": 1, "type": "onderdeel_van",
"max": 1 "depth": {
}, "min": 1,
"entityFrom": 2, "max": 1
"entityTo": 3, },
"constraints": [] "fromType": "entity",
} "fromID": 2,
], "toType": "entity",
"limit": 5000, "toID": 3
"modifiers": [] }
}`) ],
"groupBys": [],
"filters": [],
"limit": 5000,
"modifiers": []
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
...@@ -1161,41 +1385,52 @@ func TestEntityFromLowerThanNegativeOneInRelation(t *testing.T) { ...@@ -1161,41 +1385,52 @@ func TestEntityFromLowerThanNegativeOneInRelation(t *testing.T) {
service := NewService() service := NewService()
query := []byte(`{ query := []byte(`{
"return": { "return": {
"entities": [
0
],
"relations": [
0
]
},
"entities": [ "entities": [
{ 0
"type": "airports",
"constraints": [
{
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact"
}
]
}
], ],
"relations": [ "relations": [
{ 0
"type": "flights", ]
"depth": { },
"min": 1, "entities": [
"max": 1 {
}, "ID": 0,
"entityFrom": -4, "type": "airports"
"entityTo": 0, }
"constraints": [] ],
} "relations": [
], {
"limit": 5000 "ID": 0,
}`) "type": "flights",
"depth": {
"min": 1,
"max": 1
},
"fromType": "",
"fromID": -4,
"toType": "entity",
"toID": 0
}
],
"groupBys": [],
"filters": [
{
"ID": 0,
"fromType": "entity",
"fromID": 0,
"toType": "relation",
"toID": 0,
"attribute": "city",
"value": "San Francisco",
"dataType": "string",
"matchType": "exact",
"inType": "",
"inID": -1
}
],
"limit": 5000
}`)
// Unmarshall the incoming message into an IncomingJSONQuery object // Unmarshall the incoming message into an IncomingJSONQuery object
var JSONQuery entity.IncomingQueryJSON var JSONQuery entity.IncomingQueryJSON
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment