Search in sources :

Example 26 with BackendMutation

use of com.baidu.hugegraph.backend.store.BackendMutation in project incubator-hugegraph by apache.

the class BackendMutationTest method testInsertAndAppendEntry.

@Test
public void testInsertAndAppendEntry() {
    BackendMutation mutation = new BackendMutation();
    BackendEntry entry1 = constructBackendEntry("1");
    BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
    mutation.add(entry1, Action.INSERT);
    Assert.assertThrows(HugeException.class, () -> {
        mutation.add(entry2, Action.APPEND);
    });
}
Also used : BackendMutation(com.baidu.hugegraph.backend.store.BackendMutation) BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 27 with BackendMutation

use of com.baidu.hugegraph.backend.store.BackendMutation in project incubator-hugegraph by apache.

the class BackendMutationTest method testDeleteAndDeleteEntry.

@Test
public void testDeleteAndDeleteEntry() {
    BackendMutation mutation = new BackendMutation();
    BackendEntry entry1 = constructBackendEntry("1");
    BackendEntry entry2 = constructBackendEntry("1");
    mutation.add(entry1, Action.DELETE);
    mutation.add(entry2, Action.DELETE);
    Assert.assertEquals(1, get(mutation, "1").size());
    Assert.assertEquals(Action.DELETE, get(mutation, "1").get(0).action());
}
Also used : BackendMutation(com.baidu.hugegraph.backend.store.BackendMutation) BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 28 with BackendMutation

use of com.baidu.hugegraph.backend.store.BackendMutation in project incubator-hugegraph by apache.

the class BackendMutationTest method testAppendAndEliminateEntryWithSameEntry.

@Test
public void testAppendAndEliminateEntryWithSameEntry() {
    BackendMutation mutation = new BackendMutation();
    BackendEntry entry1 = constructBackendEntry("1", "name", "marko");
    BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
    mutation.add(entry1, Action.APPEND);
    mutation.add(entry2, Action.ELIMINATE);
    Assert.assertEquals(1, get(mutation, "1").size());
    Assert.assertEquals(Action.ELIMINATE, get(mutation, "1").get(0).action());
}
Also used : BackendMutation(com.baidu.hugegraph.backend.store.BackendMutation) BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 29 with BackendMutation

use of com.baidu.hugegraph.backend.store.BackendMutation in project incubator-hugegraph by apache.

the class BackendMutationTest method testAppendAndInsertEntry.

@Test
public void testAppendAndInsertEntry() {
    BackendMutation mutation = new BackendMutation();
    BackendEntry entry1 = constructBackendEntry("1");
    BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
    mutation.add(entry1, Action.APPEND);
    mutation.add(entry2, Action.INSERT);
    Assert.assertEquals(1, get(mutation, "1").size());
    Assert.assertEquals(Action.INSERT, get(mutation, "1").get(0).action());
}
Also used : BackendMutation(com.baidu.hugegraph.backend.store.BackendMutation) BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Example 30 with BackendMutation

use of com.baidu.hugegraph.backend.store.BackendMutation in project incubator-hugegraph by apache.

the class BackendMutationTest method testAppendAndAppendEntryWithSameEntry.

@Test
public void testAppendAndAppendEntryWithSameEntry() {
    BackendMutation mutation = new BackendMutation();
    BackendEntry entry1 = constructBackendEntry("1", "name", "marko");
    BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
    mutation.add(entry1, Action.APPEND);
    mutation.add(entry2, Action.APPEND);
    Assert.assertEquals(1, get(mutation, "1").size());
    Assert.assertEquals(Action.APPEND, get(mutation, "1").get(0).action());
}
Also used : BackendMutation(com.baidu.hugegraph.backend.store.BackendMutation) BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) BaseUnitTest(com.baidu.hugegraph.unit.BaseUnitTest) Test(org.junit.Test)

Aggregations

BackendMutation (com.baidu.hugegraph.backend.store.BackendMutation)31 Test (org.junit.Test)22 BackendEntry (com.baidu.hugegraph.backend.store.BackendEntry)21 TextBackendEntry (com.baidu.hugegraph.backend.serializer.TextBackendEntry)20 BaseUnitTest (com.baidu.hugegraph.unit.BaseUnitTest)20 BinaryBackendEntry (com.baidu.hugegraph.backend.serializer.BinaryBackendEntry)3 BytesBuffer (com.baidu.hugegraph.backend.serializer.BytesBuffer)3 BackendAction (com.baidu.hugegraph.backend.store.BackendAction)2 BackendException (com.baidu.hugegraph.backend.BackendException)1 Id (com.baidu.hugegraph.backend.id.Id)1 BackendStore (com.baidu.hugegraph.backend.store.BackendStore)1 IncrCounter (com.baidu.hugegraph.backend.store.raft.RaftBackendStore.IncrCounter)1 StoreCommand (com.baidu.hugegraph.backend.store.raft.StoreCommand)1 Watched (com.baidu.hugegraph.perf.PerfUtil.Watched)1 HugeType (com.baidu.hugegraph.type.HugeType)1 Action (com.baidu.hugegraph.type.define.Action)1 ArrayList (java.util.ArrayList)1