use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.
the class DefaultPropertiesTest method testConstructor.
@Test
public void testConstructor() {
DefaultProperties properties = new DefaultProperties(graphFactory());
Assert.assertEquals(0, properties.get().size());
properties.put("p1", new LongValue(1L));
properties.put("p2", new DoubleValue(2.0D));
Map<String, Value> props = properties.get();
Assert.assertEquals(2, props.size());
Assert.assertEquals(new LongValue(1L), props.get("p1"));
Assert.assertEquals(new DoubleValue(2.0D), props.get("p2"));
}
use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.
the class DefaultPropertiesTest method testHashCode.
@Test
public void testHashCode() {
DefaultProperties props = new DefaultProperties(graphFactory());
props.put("p1", new LongValue(1L));
props.put("p2", new DoubleValue(2.0D));
Assert.assertEquals(1073748897, props.hashCode());
}
use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.
the class DefaultPropertiesTest method testOverwrite.
@Test
public void testOverwrite() {
DefaultProperties properties = new DefaultProperties(graphFactory());
Assert.assertEquals(0, properties.get().size());
properties.put("p1", new LongValue(1L));
properties.put("p2", new DoubleValue(2.0D));
Assert.assertEquals(new LongValue(1L), properties.get("p1"));
properties.put("p1", new LongValue(2L));
Assert.assertEquals(new LongValue(2L), properties.get("p1"));
Map<String, Value> props = properties.get();
Assert.assertEquals(2, props.size());
Assert.assertEquals(new LongValue(2L), props.get("p1"));
Assert.assertEquals(new DoubleValue(2.0D), props.get("p2"));
}
use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.
the class DefaultEdgeTest method testEquals.
@Test
public void testEquals() {
DefaultEdge edge1 = new DefaultEdge(graphFactory());
edge1.label("knows");
edge1.name("2021-06-01");
edge1.targetId(BytesId.of(1L));
Properties properties = new DefaultProperties(graphFactory());
properties.put("p1", new LongValue(1L));
properties.put("p2", new DoubleValue(2.0D));
edge1.properties(properties);
DefaultEdge edge2 = new DefaultEdge(graphFactory(), "knows", "2021-06-01", BytesId.of(1L));
edge2.properties().put("p1", new LongValue(1L));
edge2.properties().put("p2", new DoubleValue(2.0D));
Assert.assertEquals(edge1, edge2);
Assert.assertNotEquals(edge1, properties);
}
use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.
the class DefaultEdgeTest method testOverwrite.
@Test
public void testOverwrite() {
DefaultEdge edge = new DefaultEdge(graphFactory());
edge.label("knows");
edge.name("2021-06-01");
edge.targetId(BytesId.of(1L));
Properties properties = new DefaultProperties(graphFactory());
properties.put("p1", new LongValue(1L));
properties.put("p2", new DoubleValue(2.0D));
edge.properties(properties);
Assert.assertEquals("knows", edge.label());
Assert.assertEquals("2021-06-01", edge.name());
Assert.assertEquals(BytesId.of(1L), edge.targetId());
Assert.assertEquals(properties, edge.properties());
}
Aggregations