3838import org .neo4j .driver .v1 .AccessMode ;
3939import org .neo4j .driver .v1 .Session ;
4040import org .neo4j .driver .v1 .Transaction ;
41+ import org .neo4j .driver .v1 .TransactionWork ;
4142import org .neo4j .driver .v1 .Value ;
4243import org .neo4j .driver .v1 .exceptions .ClientException ;
4344import org .neo4j .driver .v1 .exceptions .ServiceUnavailableException ;
4445import org .neo4j .driver .v1 .exceptions .SessionExpiredException ;
45- import org .neo4j .driver .v1 .util .Function ;
4646
4747import static java .util .Collections .singletonMap ;
4848import static org .hamcrest .CoreMatchers .containsString ;
@@ -764,10 +764,10 @@ private static void testConnectionAcquisition( AccessMode sessionMode, AccessMod
764764 when ( connectionProvider .acquireConnection ( transactionMode ) ).thenReturn ( connection );
765765 NetworkSession session = newSession ( connectionProvider , sessionMode );
766766
767- Function < Transaction , Integer > work = new Function < Transaction , Integer >()
767+ TransactionWork < Integer > work = new TransactionWork < Integer >()
768768 {
769769 @ Override
770- public Integer apply ( Transaction tx )
770+ public Integer execute ( Transaction tx )
771771 {
772772 tx .success ();
773773 return 42 ;
@@ -789,10 +789,10 @@ private static void testTxCommitOrRollback( AccessMode transactionMode, final bo
789789 when ( connectionProvider .acquireConnection ( transactionMode ) ).thenReturn ( connection );
790790 NetworkSession session = newSession ( connectionProvider , WRITE );
791791
792- Function < Transaction , Integer > work = new Function < Transaction , Integer >()
792+ TransactionWork < Integer > work = new TransactionWork < Integer >()
793793 {
794794 @ Override
795- public Integer apply ( Transaction tx )
795+ public Integer execute ( Transaction tx )
796796 {
797797 if ( commit )
798798 {
@@ -831,10 +831,10 @@ private static void testTxRollbackWhenThrows( AccessMode transactionMode )
831831 NetworkSession session = newSession ( connectionProvider , WRITE );
832832
833833 final RuntimeException error = new IllegalStateException ( "Oh!" );
834- Function < Transaction , Void > work = new Function < Transaction , Void >()
834+ TransactionWork < Void > work = new TransactionWork < Void >()
835835 {
836836 @ Override
837- public Void apply ( Transaction tx )
837+ public Void execute ( Transaction tx )
838838 {
839839 throw error ;
840840 }
@@ -864,12 +864,12 @@ private static void testTxIsRetriedUntilSuccessWhenFunctionThrows( AccessMode mo
864864 when ( connectionProvider .acquireConnection ( mode ) ).thenReturn ( connection );
865865 NetworkSession session = newSession ( connectionProvider , retryLogic );
866866
867- int answer = executeTransaction ( session , mode , new Function < Transaction , Integer >()
867+ int answer = executeTransaction ( session , mode , new TransactionWork < Integer >()
868868 {
869869 int invoked ;
870870
871871 @ Override
872- public Integer apply ( Transaction tx )
872+ public Integer execute ( Transaction tx )
873873 {
874874 if ( invoked ++ < failures )
875875 {
@@ -896,10 +896,10 @@ private static void testTxIsRetriedUntilSuccessWhenTxCloseThrows( AccessMode mod
896896 when ( connectionProvider .acquireConnection ( mode ) ).thenReturn ( connection );
897897 NetworkSession session = newSession ( connectionProvider , retryLogic );
898898
899- int answer = executeTransaction ( session , mode , new Function < Transaction , Integer >()
899+ int answer = executeTransaction ( session , mode , new TransactionWork < Integer >()
900900 {
901901 @ Override
902- public Integer apply ( Transaction tx )
902+ public Integer execute ( Transaction tx )
903903 {
904904 tx .success ();
905905 return 43 ;
@@ -925,12 +925,12 @@ private static void testTxIsRetriedUntilFailureWhenFunctionThrows( AccessMode mo
925925
926926 try
927927 {
928- executeTransaction ( session , mode , new Function < Transaction , Integer >()
928+ executeTransaction ( session , mode , new TransactionWork < Integer >()
929929 {
930930 int invoked ;
931931
932932 @ Override
933- public Integer apply ( Transaction tx )
933+ public Integer execute ( Transaction tx )
934934 {
935935 if ( invoked ++ < failures )
936936 {
@@ -963,10 +963,10 @@ private static void testTxIsRetriedUntilFailureWhenTxCloseThrows( AccessMode mod
963963
964964 try
965965 {
966- executeTransaction ( session , mode , new Function < Transaction , Integer >()
966+ executeTransaction ( session , mode , new TransactionWork < Integer >()
967967 {
968968 @ Override
969- public Integer apply ( Transaction tx )
969+ public Integer execute ( Transaction tx )
970970 {
971971 tx .success ();
972972 return 42 ;
@@ -992,12 +992,12 @@ private static void testRetryErrorsAreCombined( AccessMode mode )
992992
993993 try
994994 {
995- executeTransaction ( session , mode , new Function < Transaction , Integer >()
995+ executeTransaction ( session , mode , new TransactionWork < Integer >()
996996 {
997997 int invoked ;
998998
999999 @ Override
1000- public Integer apply ( Transaction tx )
1000+ public Integer execute ( Transaction tx )
10011001 {
10021002 if ( invoked ++ < failures )
10031003 {
@@ -1035,12 +1035,12 @@ private static void testRetryErrorsAreNotCombinedWhenSameErrorIsThrown( AccessMo
10351035 final ServiceUnavailableException error = new ServiceUnavailableException ( "Oh!" );
10361036 try
10371037 {
1038- executeTransaction ( session , mode , new Function < Transaction , Integer >()
1038+ executeTransaction ( session , mode , new TransactionWork < Integer >()
10391039 {
10401040 int invoked ;
10411041
10421042 @ Override
1043- public Integer apply ( Transaction tx )
1043+ public Integer execute ( Transaction tx )
10441044 {
10451045 if ( invoked ++ < failures )
10461046 {
@@ -1060,7 +1060,7 @@ public Integer apply( Transaction tx )
10601060 }
10611061 }
10621062
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 )
10641064 {
10651065 if ( mode == READ )
10661066 {
0 commit comments