use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class ConceptControllerTest method whenCallingConceptEndpointAndRequestingJSON_ReturnJSON.
@Test
public void whenCallingConceptEndpointAndRequestingJSON_ReturnJSON() {
ConceptId id;
try (GraknTx tx = factory.tx(keyspace, GraknTxType.READ)) {
id = tx.admin().getMetaConcept().getId();
}
given().accept(ContentType.JSON).pathParam("keyspace", keyspace.getValue()).pathParam("id", id.getValue()).when().get("/kb/{keyspace}/concept/{id}").then().statusCode(SC_OK).contentType(ContentType.JSON);
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class ConceptControllerTest method whenCallingRelationshipsEndpoint_ReturnIdLinkToSelf.
@Test
public void whenCallingRelationshipsEndpoint_ReturnIdLinkToSelf() {
ConceptId id;
try (GraknTx tx = factory.tx(keyspace, GraknTxType.READ)) {
id = tx.admin().getMetaConcept().instances().findAny().get().getId();
}
String relationshipsLink = "/kb/" + keyspace.getValue() + "/concept/" + id + "/relationships";
RestAssured.when().get(relationshipsLink).then().statusCode(SC_OK).contentType(ContentType.JSON).body("@id", is(relationshipsLink));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class ConceptControllerTest method whenCallingKeysEndpoint_ReturnIdLinkToSelf.
@Test
public void whenCallingKeysEndpoint_ReturnIdLinkToSelf() {
ConceptId id;
try (GraknTx tx = factory.tx(keyspace, GraknTxType.READ)) {
id = tx.admin().getMetaConcept().instances().findAny().get().getId();
}
String keysLink = "/kb/" + keyspace.getValue() + "/concept/" + id + "/relationships";
RestAssured.when().get(keysLink).then().statusCode(SC_OK).contentType(ContentType.JSON).body("@id", is(keysLink));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class ConceptControllerTest method whenCallingAttributesEndpoint_ReturnIdLinkToSelf.
@Test
public void whenCallingAttributesEndpoint_ReturnIdLinkToSelf() {
ConceptId id;
try (GraknTx tx = factory.tx(keyspace, GraknTxType.READ)) {
id = tx.admin().getMetaConcept().instances().findAny().get().getId();
}
String attributesLink = "/kb/" + keyspace.getValue() + "/concept/" + id + "/relationships";
RestAssured.when().get(attributesLink).then().statusCode(SC_OK).contentType(ContentType.JSON).body("@id", is(attributesLink));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class GraqlControllerTest method testInsertQuery.
@Test
public void testInsertQuery() {
Response resp = sendQuery("insert $x isa movie;");
try {
resp.then().statusCode(200);
Assert.assertFalse(resp.jsonPath().getList(".").isEmpty());
} finally {
ConceptId id = ConceptId.of(resp.jsonPath().getList("x.id").get(0).toString());
sampleKB.rollback();
sampleKB.tx().graql().match(var("x").id(id)).delete("x").execute();
}
}
Aggregations