use of com.baidu.hugegraph.structure.schema.VertexLabel in project incubator-hugegraph-toolchain by apache.
the class VertexLabelApiTest method testList.
@Test
public void testList() {
VertexLabel vertexLabel1 = schema().vertexLabel("person").useAutomaticId().properties("name", "age", "city").build();
vertexLabel1 = vertexLabelAPI.create(vertexLabel1);
VertexLabel vertexLabel2 = schema().vertexLabel("software").useCustomizeStringId().properties("name", "lang", "price").build();
vertexLabel2 = vertexLabelAPI.create(vertexLabel2);
List<VertexLabel> vertexLabels = vertexLabelAPI.list();
Assert.assertEquals(2, vertexLabels.size());
assertContains(vertexLabels, vertexLabel1);
assertContains(vertexLabels, vertexLabel2);
}
use of com.baidu.hugegraph.structure.schema.VertexLabel in project incubator-hugegraph-toolchain by apache.
the class VertexLabelApiTest method testCreateWithUndefinedNullableKeys.
@Test
public void testCreateWithUndefinedNullableKeys() {
VertexLabel vertexLabel = schema().vertexLabel("person").usePrimaryKeyId().properties("name", "age", "city").primaryKeys("name").nullableKeys("undefined").build();
Utils.assertResponseError(400, () -> {
vertexLabelAPI.create(vertexLabel);
});
}
use of com.baidu.hugegraph.structure.schema.VertexLabel in project incubator-hugegraph-toolchain by apache.
the class VertexLabelApiTest method testDelete.
@Test
public void testDelete() {
VertexLabel vertexLabel = schema().vertexLabel("person").useAutomaticId().properties("name", "age", "city").build();
vertexLabelAPI.create(vertexLabel);
long taskId = vertexLabelAPI.delete("person");
waitUntilTaskCompleted(taskId);
Utils.assertResponseError(404, () -> {
vertexLabelAPI.get("person");
});
}
use of com.baidu.hugegraph.structure.schema.VertexLabel in project incubator-hugegraph-toolchain by apache.
the class VertexLabelApiTest method testCreateWithUuidIdStrategy.
@Test
public void testCreateWithUuidIdStrategy() {
VertexLabel vertexLabel = schema().vertexLabel("person").useCustomizeUuidId().properties("name", "age", "city").build();
vertexLabel = vertexLabelAPI.create(vertexLabel);
Assert.assertEquals("person", vertexLabel.name());
Assert.assertEquals(IdStrategy.CUSTOMIZE_UUID, vertexLabel.idStrategy());
Assert.assertEquals(true, vertexLabel.enableLabelIndex());
Set<String> props = ImmutableSet.of("name", "age", "city");
Assert.assertEquals(props, vertexLabel.properties());
vertexLabel = schema().vertexLabel("person1").idStrategy(IdStrategy.CUSTOMIZE_UUID).properties("name", "age", "city").build();
vertexLabel = vertexLabelAPI.create(vertexLabel);
Assert.assertEquals("person1", vertexLabel.name());
Assert.assertEquals(IdStrategy.CUSTOMIZE_UUID, vertexLabel.idStrategy());
Assert.assertEquals(true, vertexLabel.enableLabelIndex());
props = ImmutableSet.of("name", "age", "city");
Assert.assertEquals(props, vertexLabel.properties());
}
use of com.baidu.hugegraph.structure.schema.VertexLabel in project incubator-hugegraph-toolchain by apache.
the class VertexLabelApiTest method testGet.
@Test
public void testGet() {
VertexLabel vertexLabel1 = schema().vertexLabel("person").useAutomaticId().properties("name", "age", "city").build();
vertexLabel1 = vertexLabelAPI.create(vertexLabel1);
VertexLabel vertexLabel2 = vertexLabelAPI.get("person");
Assert.assertEquals(vertexLabel1.name(), vertexLabel2.name());
Assert.assertEquals(vertexLabel1.idStrategy(), vertexLabel2.idStrategy());
Assert.assertEquals(vertexLabel1.properties(), vertexLabel2.properties());
}
Aggregations