use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class PropertyKeyCoreTest method testCreateTime.
@Test
public void testCreateTime() {
SchemaManager schema = graph().schema();
PropertyKey id = schema.propertyKey("id").asText().valueSingle().create();
Date createTime = (Date) id.userdata().get(Userdata.CREATE_TIME);
Date now = DateUtil.now();
Assert.assertFalse(createTime.after(now));
id = schema.getPropertyKey("id");
createTime = (Date) id.userdata().get(Userdata.CREATE_TIME);
Assert.assertFalse(createTime.after(now));
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class PropertyKeyCoreTest method testAddPropertyKeyWithoutDataType.
@Test
public void testAddPropertyKeyWithoutDataType() {
SchemaManager schema = graph().schema();
PropertyKey id = schema.propertyKey("id").valueSingle().create();
Assert.assertEquals(DataType.TEXT, id.dataType());
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class PropertyKeyCoreTest method testAppendPropertyKeyWithUserdata.
@Test
public void testAppendPropertyKeyWithUserdata() {
SchemaManager schema = graph().schema();
PropertyKey age = schema.propertyKey("age").userdata("min", 0).create();
Assert.assertEquals(2, age.userdata().size());
Assert.assertEquals(0, age.userdata().get("min"));
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"));
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class PropertyKeyCoreTest method testAddPropertyKeyWithoutCardinality.
@Test
public void testAddPropertyKeyWithoutCardinality() {
SchemaManager schema = graph().schema();
PropertyKey id = schema.propertyKey("id").asText().create();
Assert.assertEquals(Cardinality.SINGLE, id.cardinality());
}
use of com.baidu.hugegraph.schema.PropertyKey in project incubator-hugegraph by apache.
the class PropertyKeyCoreTest method testAddPropertyKeyWithoutDataTypeAndCardinality.
@Test
public void testAddPropertyKeyWithoutDataTypeAndCardinality() {
SchemaManager schema = graph().schema();
PropertyKey id = schema.propertyKey("id").create();
Assert.assertEquals(DataType.TEXT, id.dataType());
Assert.assertEquals(Cardinality.SINGLE, id.cardinality());
}
Aggregations