use of com.baidu.hugegraph.backend.serializer.TableBackendEntry in project incubator-hugegraph by apache.
the class TableBackendEntryTest method testNotImplemented.
@Test
public void testNotImplemented() {
TableBackendEntry entry = new TableBackendEntry(HugeType.VERTEX);
BackendColumn col = BackendColumn.of(new byte[] { 1 }, new byte[] { 12 });
Assert.assertThrows(NotImplementedException.class, () -> {
entry.columnsSize();
});
Assert.assertThrows(NotImplementedException.class, () -> {
entry.columns();
});
Assert.assertThrows(NotImplementedException.class, () -> {
entry.columns(ImmutableList.of(col));
});
Assert.assertThrows(NotImplementedException.class, () -> {
entry.columns(col);
});
Assert.assertThrows(NotImplementedException.class, () -> {
entry.merge(entry);
});
Assert.assertThrows(NotImplementedException.class, () -> {
entry.clear();
});
}
use of com.baidu.hugegraph.backend.serializer.TableBackendEntry in project incubator-hugegraph by apache.
the class TableBackendEntryTest method testSelfChanged.
@Test
public void testSelfChanged() {
TableBackendEntry entry = new TableBackendEntry(HugeType.VERTEX);
Assert.assertTrue(entry.selfChanged());
entry.selfChanged(false);
Assert.assertFalse(entry.selfChanged());
}
use of com.baidu.hugegraph.backend.serializer.TableBackendEntry in project incubator-hugegraph by apache.
the class TableBackendEntryTest method testColumnOfMap.
@Test
public void testColumnOfMap() {
TableBackendEntry entry = new TableBackendEntry(HugeType.VERTEX);
entry.column(HugeKeys.PROPERTIES, "k1", "v1");
Assert.assertEquals(ImmutableMap.of("k1", "v1"), entry.column(HugeKeys.PROPERTIES));
entry.column(HugeKeys.PROPERTIES, "k2", "v2");
Assert.assertEquals(ImmutableMap.of("k1", "v1", "k2", "v2"), entry.column(HugeKeys.PROPERTIES));
entry.column(HugeKeys.PROPERTIES, "k3", "v3");
Assert.assertEquals(ImmutableMap.of("k1", "v1", "k2", "v2", "k3", "v3"), entry.column(HugeKeys.PROPERTIES));
entry.column(HugeKeys.PROPERTIES, "k1", "v0");
Assert.assertEquals(ImmutableMap.of("k1", "v0", "k2", "v2", "k3", "v3"), entry.column(HugeKeys.PROPERTIES));
}
use of com.baidu.hugegraph.backend.serializer.TableBackendEntry in project incubator-hugegraph by apache.
the class TableBackendEntryTest method testType.
@Test
public void testType() {
Id id = IdGenerator.of(1L);
TableBackendEntry entry = new TableBackendEntry(id);
Assert.assertNull(entry.type());
Assert.assertEquals(id, entry.id());
entry.type(HugeType.VERTEX);
Assert.assertEquals(HugeType.VERTEX, entry.type());
}
use of com.baidu.hugegraph.backend.serializer.TableBackendEntry in project incubator-hugegraph by apache.
the class TableBackendEntryTest method testColumn.
@Test
public void testColumn() {
TableBackendEntry entry = new TableBackendEntry(HugeType.VERTEX, IdGenerator.of(1L));
entry.column(HugeKeys.ID, "v1");
Assert.assertEquals("v1", entry.column(HugeKeys.ID));
Assert.assertEquals("TableBackendEntry{Row{type=VERTEX, id=1, " + "columns={ID=v1}}, sub-rows: []}", entry.toString());
entry.column(HugeKeys.ID, "v2");
Assert.assertEquals("v2", entry.column(HugeKeys.ID));
Assert.assertEquals("TableBackendEntry{Row{type=VERTEX, id=1, " + "columns={ID=v2}}, sub-rows: []}", entry.toString());
entry.column(HugeKeys.NAME, "tom");
Assert.assertEquals("tom", entry.column(HugeKeys.NAME));
Assert.assertEquals("v2", entry.column(HugeKeys.ID));
}
Aggregations