use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testResetPropertyKeyId.
@Test
public void testResetPropertyKeyId() {
SchemaManager schema = schema();
PropertyKey age = schema.propertyKey("age").userdata("min", 0).userdata("max", 100).create();
Assert.assertTrue(age.id() > 0);
age.resetId();
Assert.assertEquals(0L, age.id());
}
use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testAppendPropertyKeyWithUserData.
@Test
public void testAppendPropertyKeyWithUserData() {
SchemaManager schema = schema();
PropertyKey age = schema.propertyKey("age").userdata("min", 0).create();
Assert.assertEquals(2, age.userdata().size());
Assert.assertEquals(0, age.userdata().get("min"));
String time = (String) age.userdata().get("~create_time");
Date createTime = DateUtil.parse(time);
Assert.assertTrue(createTime.before(DateUtil.now()));
age = schema.propertyKey("age").userdata("min", 1).userdata("max", 100).append();
Assert.assertEquals(3, age.userdata().size());
Assert.assertEquals(1, age.userdata().get("min"));
Assert.assertEquals(100, age.userdata().get("max"));
time = (String) age.userdata().get("~create_time");
Assert.assertEquals(createTime, DateUtil.parse(time));
}
use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testSetCheckExist.
@Test
public void testSetCheckExist() {
SchemaManager schema = schema();
PropertyKey age = schema.propertyKey("age").userdata("min", 0).userdata("max", 100).create();
Assert.assertTrue(age.checkExist());
age.checkExist(false);
Assert.assertFalse(age.checkExist());
}
use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.
the class HugeClientHttpsTest method addVertexAndCheckPropertyValue.
private void addVertexAndCheckPropertyValue() {
SchemaManager schema = client.schema();
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("age").asInt().ifNotExist().create();
schema.propertyKey("city").asText().ifNotExist().create();
schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create();
GraphManager graph = client.graph();
Vertex marko = graph.addVertex(T.label, "person", "name", "marko", "age", 29, "city", "Beijing");
Map<String, Object> props = ImmutableMap.of("name", "marko", "age", 29, "city", "Beijing");
Assert.assertEquals(props, marko.properties());
}
use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.
the class VertexLabelTest method testResetVertexLabelId.
@Test
public void testResetVertexLabelId() {
SchemaManager schema = schema();
VertexLabel player = schema.vertexLabel("player").properties("name").create();
Assert.assertTrue(player.id() > 0);
player.resetId();
Assert.assertEquals(0L, player.id());
}
Aggregations