use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelTest method testListByNames.
@Test
public void testListByNames() {
SchemaManager schema = schema();
EdgeLabel father = schema.edgeLabel("father").link("person", "person").create();
EdgeLabel write = schema.edgeLabel("write").link("person", "book").create();
List<EdgeLabel> edgeLabels;
edgeLabels = schema.getEdgeLabels(ImmutableList.of("father"));
Assert.assertEquals(1, edgeLabels.size());
assertContains(edgeLabels, father);
edgeLabels = schema.getEdgeLabels(ImmutableList.of("write"));
Assert.assertEquals(1, edgeLabels.size());
assertContains(edgeLabels, write);
edgeLabels = schema.getEdgeLabels(ImmutableList.of("father", "write"));
Assert.assertEquals(2, edgeLabels.size());
assertContains(edgeLabels, father);
assertContains(edgeLabels, write);
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelTest method testResetEdgeLabelId.
@Test
public void testResetEdgeLabelId() {
SchemaManager schema = schema();
EdgeLabel write = schema.edgeLabel("write").link("person", "book").properties("date", "weight").userdata("multiplicity", "one-to-many").userdata("icon", "picture2").create();
Assert.assertTrue(write.id() > 0);
write.resetId();
Assert.assertEquals(0L, write.id());
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelApiTest method testCreateWithUndefinedPropertyKey.
@Test
public void testCreateWithUndefinedPropertyKey() {
EdgeLabel edgeLabel = schema().edgeLabel("created").sourceLabel("person").targetLabel("software").singleTime().properties("undefined", "city").build();
Utils.assertResponseError(400, () -> {
edgeLabelAPI.create(edgeLabel);
});
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelApiTest method testCreateWithNonNullKeysIntersectSortKeys.
@Test
public void testCreateWithNonNullKeysIntersectSortKeys() {
EdgeLabel edgeLabel = schema().edgeLabel("created").sourceLabel("person").targetLabel("software").multiTimes().properties("date", "city").sortKeys("date").nullableKeys("date").build();
Utils.assertResponseError(400, () -> {
edgeLabelAPI.create(edgeLabel);
});
Utils.assertResponseError(400, () -> {
edgeLabelAPI.create(edgeLabel);
});
}
use of com.baidu.hugegraph.structure.schema.EdgeLabel in project incubator-hugegraph-toolchain by apache.
the class EdgeLabelApiTest method testCreateWithUndefinedNullableKeys.
@Test
public void testCreateWithUndefinedNullableKeys() {
EdgeLabel edgeLabel = schema().edgeLabel("created").sourceLabel("person").targetLabel("software").singleTime().properties("date", "city").nullableKeys("undefined").build();
Utils.assertResponseError(400, () -> {
edgeLabelAPI.create(edgeLabel);
});
}
Aggregations