38
38
import org .neo4j .driver .v1 .AccessMode ;
39
39
import org .neo4j .driver .v1 .Session ;
40
40
import org .neo4j .driver .v1 .Transaction ;
41
+ import org .neo4j .driver .v1 .TransactionWork ;
41
42
import org .neo4j .driver .v1 .Value ;
42
43
import org .neo4j .driver .v1 .exceptions .ClientException ;
43
44
import org .neo4j .driver .v1 .exceptions .ServiceUnavailableException ;
44
45
import org .neo4j .driver .v1 .exceptions .SessionExpiredException ;
45
- import org .neo4j .driver .v1 .util .Function ;
46
46
47
47
import static java .util .Collections .singletonMap ;
48
48
import static org .hamcrest .CoreMatchers .containsString ;
@@ -764,10 +764,10 @@ private static void testConnectionAcquisition( AccessMode sessionMode, AccessMod
764
764
when ( connectionProvider .acquireConnection ( transactionMode ) ).thenReturn ( connection );
765
765
NetworkSession session = newSession ( connectionProvider , sessionMode );
766
766
767
- Function < Transaction , Integer > work = new Function < Transaction , Integer >()
767
+ TransactionWork < Integer > work = new TransactionWork < Integer >()
768
768
{
769
769
@ Override
770
- public Integer apply ( Transaction tx )
770
+ public Integer execute ( Transaction tx )
771
771
{
772
772
tx .success ();
773
773
return 42 ;
@@ -789,10 +789,10 @@ private static void testTxCommitOrRollback( AccessMode transactionMode, final bo
789
789
when ( connectionProvider .acquireConnection ( transactionMode ) ).thenReturn ( connection );
790
790
NetworkSession session = newSession ( connectionProvider , WRITE );
791
791
792
- Function < Transaction , Integer > work = new Function < Transaction , Integer >()
792
+ TransactionWork < Integer > work = new TransactionWork < Integer >()
793
793
{
794
794
@ Override
795
- public Integer apply ( Transaction tx )
795
+ public Integer execute ( Transaction tx )
796
796
{
797
797
if ( commit )
798
798
{
@@ -831,10 +831,10 @@ private static void testTxRollbackWhenThrows( AccessMode transactionMode )
831
831
NetworkSession session = newSession ( connectionProvider , WRITE );
832
832
833
833
final RuntimeException error = new IllegalStateException ( "Oh!" );
834
- Function < Transaction , Void > work = new Function < Transaction , Void >()
834
+ TransactionWork < Void > work = new TransactionWork < Void >()
835
835
{
836
836
@ Override
837
- public Void apply ( Transaction tx )
837
+ public Void execute ( Transaction tx )
838
838
{
839
839
throw error ;
840
840
}
@@ -864,12 +864,12 @@ private static void testTxIsRetriedUntilSuccessWhenFunctionThrows( AccessMode mo
864
864
when ( connectionProvider .acquireConnection ( mode ) ).thenReturn ( connection );
865
865
NetworkSession session = newSession ( connectionProvider , retryLogic );
866
866
867
- int answer = executeTransaction ( session , mode , new Function < Transaction , Integer >()
867
+ int answer = executeTransaction ( session , mode , new TransactionWork < Integer >()
868
868
{
869
869
int invoked ;
870
870
871
871
@ Override
872
- public Integer apply ( Transaction tx )
872
+ public Integer execute ( Transaction tx )
873
873
{
874
874
if ( invoked ++ < failures )
875
875
{
@@ -896,10 +896,10 @@ private static void testTxIsRetriedUntilSuccessWhenTxCloseThrows( AccessMode mod
896
896
when ( connectionProvider .acquireConnection ( mode ) ).thenReturn ( connection );
897
897
NetworkSession session = newSession ( connectionProvider , retryLogic );
898
898
899
- int answer = executeTransaction ( session , mode , new Function < Transaction , Integer >()
899
+ int answer = executeTransaction ( session , mode , new TransactionWork < Integer >()
900
900
{
901
901
@ Override
902
- public Integer apply ( Transaction tx )
902
+ public Integer execute ( Transaction tx )
903
903
{
904
904
tx .success ();
905
905
return 43 ;
@@ -925,12 +925,12 @@ private static void testTxIsRetriedUntilFailureWhenFunctionThrows( AccessMode mo
925
925
926
926
try
927
927
{
928
- executeTransaction ( session , mode , new Function < Transaction , Integer >()
928
+ executeTransaction ( session , mode , new TransactionWork < Integer >()
929
929
{
930
930
int invoked ;
931
931
932
932
@ Override
933
- public Integer apply ( Transaction tx )
933
+ public Integer execute ( Transaction tx )
934
934
{
935
935
if ( invoked ++ < failures )
936
936
{
@@ -963,10 +963,10 @@ private static void testTxIsRetriedUntilFailureWhenTxCloseThrows( AccessMode mod
963
963
964
964
try
965
965
{
966
- executeTransaction ( session , mode , new Function < Transaction , Integer >()
966
+ executeTransaction ( session , mode , new TransactionWork < Integer >()
967
967
{
968
968
@ Override
969
- public Integer apply ( Transaction tx )
969
+ public Integer execute ( Transaction tx )
970
970
{
971
971
tx .success ();
972
972
return 42 ;
@@ -992,12 +992,12 @@ private static void testRetryErrorsAreCombined( AccessMode mode )
992
992
993
993
try
994
994
{
995
- executeTransaction ( session , mode , new Function < Transaction , Integer >()
995
+ executeTransaction ( session , mode , new TransactionWork < Integer >()
996
996
{
997
997
int invoked ;
998
998
999
999
@ Override
1000
- public Integer apply ( Transaction tx )
1000
+ public Integer execute ( Transaction tx )
1001
1001
{
1002
1002
if ( invoked ++ < failures )
1003
1003
{
@@ -1035,12 +1035,12 @@ private static void testRetryErrorsAreNotCombinedWhenSameErrorIsThrown( AccessMo
1035
1035
final ServiceUnavailableException error = new ServiceUnavailableException ( "Oh!" );
1036
1036
try
1037
1037
{
1038
- executeTransaction ( session , mode , new Function < Transaction , Integer >()
1038
+ executeTransaction ( session , mode , new TransactionWork < Integer >()
1039
1039
{
1040
1040
int invoked ;
1041
1041
1042
1042
@ Override
1043
- public Integer apply ( Transaction tx )
1043
+ public Integer execute ( Transaction tx )
1044
1044
{
1045
1045
if ( invoked ++ < failures )
1046
1046
{
@@ -1060,7 +1060,7 @@ public Integer apply( Transaction tx )
1060
1060
}
1061
1061
}
1062
1062
1063
- private static <T > T executeTransaction ( Session session , AccessMode mode , Function < Transaction , T > work )
1063
+ private static <T > T executeTransaction ( Session session , AccessMode mode , TransactionWork < T > work )
1064
1064
{
1065
1065
if ( mode == READ )
1066
1066
{
0 commit comments