Coverage Summary for Class: TestBatchModeMultipleGraphs (org.umlg.sqlg.test.batch)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
TestBatchModeMultipleGraphs |
100%
(1/1)
|
100%
(5/5)
|
87.5%
(7/8)
|
100%
(24/24)
|
| package org.umlg.sqlg.test.batch; |
| |
| import org.apache.tinkerpop.gremlin.structure.T; |
| import org.apache.tinkerpop.gremlin.structure.Vertex; |
| import org.junit.Assume; |
| import org.junit.Before; |
| import org.junit.BeforeClass; |
| import org.junit.Test; |
| import org.umlg.sqlg.test.BaseTest; |
| |
| import static org.junit.Assert.assertEquals; |
| |
| |
| |
| |
| |
| public class TestBatchModeMultipleGraphs extends BaseTest { |
| |
| @BeforeClass |
| public static void beforeClass() { |
| BaseTest.beforeClass(); |
| if (isPostgres()) { |
| configuration.addProperty("distributed", true); |
| } |
| } |
| |
| @Before |
| public void beforeTest() { |
| Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsBatchMode()); |
| Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsDistribution()); |
| } |
| |
| @Test |
| public void testStreamingBatchModeOnMultipleGraphs() throws Exception { |
| Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsStreamingBatchMode()); |
| this.sqlgGraph.tx().streamingBatchModeOn(); |
| for (int i = 0; i < 10; i++) { |
| this.sqlgGraph.streamVertex(T.label, "Person", "name", "asdasd"); |
| } |
| this.sqlgGraph.tx().flush(); |
| for (int i = 0; i < 10; i++) { |
| this.sqlgGraph.streamVertex(T.label, "Address", "name", "asdasd"); |
| } |
| this.sqlgGraph.tx().commit(); |
| Thread.sleep(1000); |
| assertEquals(this.sqlgGraph.traversal().V().toList(), this.sqlgGraph1.traversal().V().toList()); |
| } |
| |
| @Test |
| public void testNormalBatchModeOnMultipleGraphs() throws Exception { |
| this.sqlgGraph.tx().normalBatchModeOn(); |
| for (int i = 0; i < 10; i++) { |
| Vertex person = this.sqlgGraph.addVertex(T.label, "Person", "name", "asdasd"); |
| Vertex address = this.sqlgGraph.addVertex(T.label, "Address", "name", "asdasd"); |
| person.addEdge("address", address, "name", "asdasd"); |
| } |
| this.sqlgGraph.tx().commit(); |
| Thread.sleep(1000); |
| assertEquals(this.sqlgGraph.traversal().V().toList(), this.sqlgGraph1.traversal().V().toList()); |
| } |
| } |