Search in sources :

Example 6 with TextBackendEntry

use of com.baidu.hugegraph.backend.serializer.TextBackendEntry in project incubator-hugegraph by apache.

the class TextBackendEntryTest method testColumns.

@Test
public void testColumns() {
    TextBackendEntry entry = new TextBackendEntry(HugeType.VERTEX, IdGenerator.of(1));
    entry.column(HugeKeys.ID, "1");
    entry.column(HugeKeys.NAME, "tom");
    BackendColumn col1 = BackendColumn.of(new byte[] { 'i', 'd' }, new byte[] { '1' });
    BackendColumn col2 = BackendColumn.of(new byte[] { 'n', 'a', 'm', 'e' }, new byte[] { 't', 'o', 'm' });
    Assert.assertEquals(2, entry.columnsSize());
    Assert.assertEquals(ImmutableList.of(col1, col2), entry.columns());
}
Also used : BackendColumn(com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 7 with TextBackendEntry

use of com.baidu.hugegraph.backend.serializer.TextBackendEntry in project incubator-hugegraph by apache.

the class TextBackendEntryTest method testCopy.

@Test
public void testCopy() {
    TextBackendEntry entry = new TextBackendEntry(HugeType.VERTEX, IdGenerator.of(1));
    entry.column(HugeKeys.ID, "1");
    entry.column(HugeKeys.NAME, "tom");
    Assert.assertEquals(2, entry.columnsSize());
    TextBackendEntry entry2 = entry.copy();
    Assert.assertEquals(2, entry2.columnsSize());
    Assert.assertEquals("1", entry2.column(HugeKeys.ID));
    Assert.assertEquals("tom", entry2.column(HugeKeys.NAME));
    entry2.clear();
    Assert.assertEquals(0, entry2.columnsSize());
    Assert.assertEquals(2, entry.columnsSize());
}
Also used : TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Aggregations

TextBackendEntry (com.baidu.hugegraph.backend.serializer.TextBackendEntry)7 BaseUnitTest (com.baidu.hugegraph.unit.BaseUnitTest)3 Test (org.junit.Test)3 BackendException (com.baidu.hugegraph.backend.BackendException)2 BackendEntry (com.baidu.hugegraph.backend.store.BackendEntry)2 Condition (com.baidu.hugegraph.backend.query.Condition)1 BackendColumn (com.baidu.hugegraph.backend.store.BackendEntry.BackendColumn)1