Search in sources :

Example 6 with DefaultProperties

use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties 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());
}
Also used : DefaultProperties(com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties) DefaultEdge(com.baidu.hugegraph.computer.core.graph.edge.DefaultEdge) Test(org.junit.Test)

Example 7 with DefaultProperties

use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.

the class DefaultPropertiesTest method testReadWrite.

@Test
public void testReadWrite() throws IOException {
    DefaultProperties properties = new DefaultProperties(graphFactory());
    Assert.assertEquals(0, properties.get().size());
    properties.put("p1", new LongValue(1L));
    properties.put("p2", new DoubleValue(2.0D));
    DefaultProperties props2 = new DefaultProperties(graphFactory());
    UnitTestBase.assertEqualAfterWriteAndRead(properties, props2);
}
Also used : DefaultProperties(com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties) DoubleValue(com.baidu.hugegraph.computer.core.graph.value.DoubleValue) LongValue(com.baidu.hugegraph.computer.core.graph.value.LongValue) Test(org.junit.Test)

Example 8 with DefaultProperties

use of com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties in project hugegraph-computer by hugegraph.

the class DefaultPropertiesTest method testEquals.

@Test
public void testEquals() {
    DefaultProperties props1 = new DefaultProperties(graphFactory());
    props1.put("p1", new LongValue(1L));
    props1.put("p2", new DoubleValue(2.0D));
    DefaultProperties props2 = new DefaultProperties(props1.get(), UnitTestBase.graphFactory());
    Assert.assertEquals(props1, props2);
}
Also used : DefaultProperties(com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties) DoubleValue(com.baidu.hugegraph.computer.core.graph.value.DoubleValue) LongValue(com.baidu.hugegraph.computer.core.graph.value.LongValue) Test(org.junit.Test)

Aggregations

DefaultProperties (com.baidu.hugegraph.computer.core.graph.properties.DefaultProperties)8 Test (org.junit.Test)8 DoubleValue (com.baidu.hugegraph.computer.core.graph.value.DoubleValue)7 LongValue (com.baidu.hugegraph.computer.core.graph.value.LongValue)7 DefaultEdge (com.baidu.hugegraph.computer.core.graph.edge.DefaultEdge)3 Properties (com.baidu.hugegraph.computer.core.graph.properties.Properties)2 Value (com.baidu.hugegraph.computer.core.graph.value.Value)2