|
44 | 44 | import org.neo4j.driver.v1.exceptions.ClientException;
|
45 | 45 | import org.neo4j.driver.v1.exceptions.Neo4jException;
|
46 | 46 | import org.neo4j.driver.v1.exceptions.ServiceUnavailableException;
|
| 47 | +import org.neo4j.driver.v1.util.ServerVersion; |
47 | 48 | import org.neo4j.driver.v1.util.TestNeo4j;
|
48 | 49 |
|
49 | 50 | import static org.hamcrest.CoreMatchers.containsString;
|
|
60 | 61 | import static org.junit.Assert.assertThat;
|
61 | 62 | import static org.junit.Assert.assertTrue;
|
62 | 63 | import static org.junit.Assert.fail;
|
| 64 | +import static org.junit.Assume.assumeTrue; |
63 | 65 | import static org.mockito.Matchers.any;
|
64 | 66 | import static org.mockito.Mockito.spy;
|
65 | 67 | import static org.mockito.Mockito.times;
|
66 | 68 | import static org.mockito.Mockito.verify;
|
67 | 69 | import static org.neo4j.driver.v1.Config.defaultConfig;
|
68 | 70 | import static org.neo4j.driver.v1.Values.parameters;
|
| 71 | +import static org.neo4j.driver.v1.util.ServerVersion.v3_1_0; |
69 | 72 |
|
70 | 73 | public class SessionIT
|
71 | 74 | {
|
@@ -551,6 +554,7 @@ public void readTxCommittedWithoutTxSuccess()
|
551 | 554 | try ( Driver driver = newDriverWithoutRetries();
|
552 | 555 | Session session = driver.session() )
|
553 | 556 | {
|
| 557 | + assumeBookmarkSupport( driver ); |
554 | 558 | assertNull( session.lastBookmark() );
|
555 | 559 |
|
556 | 560 | long answer = session.readTransaction( new TransactionWork<Long>()
|
@@ -600,6 +604,7 @@ public void readTxRolledBackWithTxFailure()
|
600 | 604 | try ( Driver driver = newDriverWithoutRetries();
|
601 | 605 | Session session = driver.session() )
|
602 | 606 | {
|
| 607 | + assumeBookmarkSupport( driver ); |
603 | 608 | assertNull( session.lastBookmark() );
|
604 | 609 |
|
605 | 610 | long answer = session.readTransaction( new TransactionWork<Long>()
|
@@ -654,6 +659,7 @@ public void readTxRolledBackWhenExceptionIsThrown()
|
654 | 659 | try ( Driver driver = newDriverWithoutRetries();
|
655 | 660 | Session session = driver.session() )
|
656 | 661 | {
|
| 662 | + assumeBookmarkSupport( driver ); |
657 | 663 | assertNull( session.lastBookmark() );
|
658 | 664 |
|
659 | 665 | try
|
@@ -723,6 +729,7 @@ public void readTxRolledBackWhenMarkedBothSuccessAndFailure()
|
723 | 729 | try ( Driver driver = newDriverWithoutRetries();
|
724 | 730 | Session session = driver.session() )
|
725 | 731 | {
|
| 732 | + assumeBookmarkSupport( driver ); |
726 | 733 | assertNull( session.lastBookmark() );
|
727 | 734 |
|
728 | 735 | long answer = session.readTransaction( new TransactionWork<Long>()
|
@@ -779,6 +786,7 @@ public void readTxRolledBackWhenMarkedAsSuccessAndThrowsException()
|
779 | 786 | try ( Driver driver = newDriverWithoutRetries();
|
780 | 787 | Session session = driver.session() )
|
781 | 788 | {
|
| 789 | + assumeBookmarkSupport( driver ); |
782 | 790 | assertNull( session.lastBookmark() );
|
783 | 791 |
|
784 | 792 | try
|
@@ -957,6 +965,12 @@ private static ThrowingWork newThrowingWorkSpy( String query, int failures )
|
957 | 965 | return spy( new ThrowingWork( query, failures ) );
|
958 | 966 | }
|
959 | 967 |
|
| 968 | + private static void assumeBookmarkSupport( Driver driver ) |
| 969 | + { |
| 970 | + ServerVersion serverVersion = ServerVersion.version( driver ); |
| 971 | + assumeTrue( serverVersion.greaterThanOrEqual( v3_1_0 ) ); |
| 972 | + } |
| 973 | + |
960 | 974 | private static class ThrowingWork implements TransactionWork<Record>
|
961 | 975 | {
|
962 | 976 | final String query;
|
|
0 commit comments