Search in sources :

Example 6 with TableBackendEntry

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();
    });
}
Also used : BackendColumn(com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn) TableBackendEntry(com.baidu.hugegraph.backend.serializer.TableBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 7 with TableBackendEntry

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());
}
Also used : TableBackendEntry(com.baidu.hugegraph.backend.serializer.TableBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 8 with TableBackendEntry

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));
}
Also used : TableBackendEntry(com.baidu.hugegraph.backend.serializer.TableBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 9 with TableBackendEntry

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());
}
Also used : Id(com.baidu.hugegraph.backend.id.Id) TableBackendEntry(com.baidu.hugegraph.backend.serializer.TableBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 10 with TableBackendEntry

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));
}
Also used : TableBackendEntry(com.baidu.hugegraph.backend.serializer.TableBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Aggregations

TableBackendEntry (com.baidu.hugegraph.backend.serializer.TableBackendEntry)10 BaseUnitTest (com.baidu.hugegraph.unit.BaseUnitTest)9 Test (org.junit.Test)9 Id (com.baidu.hugegraph.backend.id.Id)2 BackendColumn (com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn)1