use of com.baidu.hugegraph.task.TaskScheduler in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testRemoveVertexLabelUsedByEdgeLabel.
@Test
public void testRemoveVertexLabelUsedByEdgeLabel() {
super.initPropertyKeys();
SchemaManager schema = graph().schema();
schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").nullableKeys("city").create();
schema.vertexLabel("book").properties("name").primaryKeys("name").create();
schema.edgeLabel("write").link("person", "book").properties("time", "weight").create();
Vertex marko = graph().addVertex(T.label, "person", "name", "marko", "age", 22);
Vertex java = graph().addVertex(T.label, "book", "name", "java in action");
marko.addEdge("write", java, "time", "2016-12-12", "weight", 0.3);
TaskScheduler scheduler = graph().taskScheduler();
Id id = schema.vertexLabel("person").remove();
sleepAWhile(100L);
HugeTask<?> task = scheduler.task(id);
Assert.assertEquals(TaskStatus.FAILED, task.status());
Assert.assertContains("Not allowed to remove vertex label " + "'person' because the edge label 'write' " + "still link with it", task.result());
id = schema.vertexLabel("book").remove();
sleepAWhile(100L);
task = scheduler.task(id);
Assert.assertEquals(TaskStatus.FAILED, task.status());
Assert.assertContains("Not allowed to remove vertex label 'book' " + "because the edge label 'write' still link " + "with it", task.result());
}
Aggregations