use of com.baidu.hugegraph.computer.core.graph.edge.DefaultEdge 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.edge.DefaultEdge 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());
}
use of com.baidu.hugegraph.computer.core.graph.edge.DefaultEdge in project hugegraph-computer by hugegraph.
the class DefaultEdgeTest method testConstructor.
@Test
public void testConstructor() {
DefaultEdge edge = new DefaultEdge(graphFactory());
Assert.assertEquals(Constants.EMPTY_STR, edge.label());
Assert.assertEquals(Constants.EMPTY_STR, edge.name());
Assert.assertNull(edge.targetId());
Assert.assertEquals(new DefaultProperties(graphFactory()), edge.properties());
edge = new DefaultEdge(graphFactory(), "knows", "2021-06-01", BytesId.of(1L));
Assert.assertEquals("knows", edge.label());
Assert.assertEquals("2021-06-01", edge.name());
Assert.assertEquals(BytesId.of(1L), edge.targetId());
Assert.assertEquals(new DefaultProperties(graphFactory()), edge.properties());
}
Aggregations