diff --git a/janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/JanusGraphTest.java b/janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/JanusGraphTest.java index 19cd0c3e8e8..e055234a556 100644 --- a/janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/JanusGraphTest.java +++ b/janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/JanusGraphTest.java @@ -156,6 +156,7 @@ import org.janusgraph.testutil.TestGraphConfigs; import org.janusgraph.util.IDUtils; import org.janusgraph.util.stats.MetricManager; +import org.junit.Assert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -2644,7 +2645,8 @@ public void testPropertyIdAccessInDifferentTransaction() { // access property id in new transaction graph.tx().commit(); - assertEquals(expectedId, p.id()); + Exception exception = Assert.assertThrows(IllegalStateException.class, p::id); + assertEquals(exception.getMessage(), "Any lazy load operation is not supported when transaction is already closed."); } /** diff --git a/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardTransactionBuilder.java b/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardTransactionBuilder.java index 18285ee8d5a..a9e9570e6d2 100644 --- a/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardTransactionBuilder.java +++ b/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardTransactionBuilder.java @@ -88,7 +88,7 @@ public class StandardTransactionBuilder implements TransactionConfiguration, Tra private boolean skipDBCacheRead; - private boolean isLazyLoadRelations; + private boolean isLazyLoadRelations = true; private MultiQueryHasStepStrategyMode hasStepStrategyMode; diff --git a/janusgraph-inmemory/src/test/java/org/janusgraph/graphdb/inmemory/InMemoryLazyLoadGraphTest.java b/janusgraph-inmemory/src/test/java/org/janusgraph/graphdb/inmemory/InMemoryLazyLoadGraphTest.java index b91b2482baa..e31fbced57d 100644 --- a/janusgraph-inmemory/src/test/java/org/janusgraph/graphdb/inmemory/InMemoryLazyLoadGraphTest.java +++ b/janusgraph-inmemory/src/test/java/org/janusgraph/graphdb/inmemory/InMemoryLazyLoadGraphTest.java @@ -14,15 +14,9 @@ package org.janusgraph.graphdb.inmemory; -import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.janusgraph.core.JanusGraphVertex; import org.janusgraph.diskstorage.configuration.WriteConfiguration; import org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder; import org.janusgraph.graphdb.database.LazyLoadGraphTest; -import org.junit.jupiter.api.Test; - -import static org.junit.Assert.assertThrows; -import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Matthias Broecheler (me@matthiasb.com) @@ -36,18 +30,4 @@ public void open(WriteConfiguration config) { tx = graph.buildTransaction().start(); mgmt = graph.openManagement(); } - - @Override @Test - public void testPropertyIdAccessInDifferentTransaction() { - JanusGraphVertex v1 = graph.addVertex(); - Object expectedId = v1.property("name", "foo").id(); - graph.tx().commit(); - - VertexProperty p = getOnlyElement(v1.properties("name")); - - // access property id in new transaction - graph.tx().commit(); - Exception exception = assertThrows(IllegalStateException.class, p::id); - assertEquals(exception.getMessage(), "Any lazy load operation is not supported when transaction is already closed."); - } }