3030import java .util .Properties ;
3131import java .util .concurrent .CompletableFuture ;
3232
33- import com .google .common .util .concurrent .ListenableFuture ;
34- import com .google .common .util .concurrent .SettableFuture ;
3533import com .google .protobuf .ByteString ;
3634import io .grpc .Status ;
3735import io .grpc .StatusRuntimeException ;
@@ -791,8 +789,9 @@ public void testQueryInstalledChaincodesERROR() throws Exception {
791789 final Channel channel = createRunningChannel (null );
792790 Peer peer = channel .getPeers ().iterator ().next ();
793791
794- final SettableFuture <FabricProposalResponse .ProposalResponse > settableFuture = SettableFuture .create ();
795- settableFuture .setException (new Error ("Error bad bad bad" ));
792+ final CompletableFuture <FabricProposalResponse .ProposalResponse > settableFuture = new CompletableFuture <>();
793+ // settableFuture.setException(new Error("Error bad bad bad"));
794+ settableFuture .completeExceptionally (new Error ("Error bad bad bad" ));
796795 setField (peer , "endorserClent" , new MockEndorserClient (settableFuture ));
797796
798797 hfclient .queryChannels (peer );
@@ -808,8 +807,9 @@ public void testQueryInstalledChaincodesStatusRuntimeException() throws Exceptio
808807 final Channel channel = createRunningChannel (null );
809808 Peer peer = channel .getPeers ().iterator ().next ();
810809
811- final SettableFuture <FabricProposalResponse .ProposalResponse > settableFuture = SettableFuture .create ();
812- settableFuture .setException (new StatusRuntimeException (Status .ABORTED ));
810+ final CompletableFuture <FabricProposalResponse .ProposalResponse > settableFuture = new CompletableFuture <>();
811+ settableFuture .completeExceptionally (new StatusRuntimeException (Status .ABORTED ));
812+
813813 setField (peer , "endorserClent" , new MockEndorserClient (settableFuture ));
814814
815815 hfclient .queryChannels (peer );
@@ -1016,7 +1016,7 @@ public void testProposalBuilderWithMetaInfEmpty() throws Exception {
10161016
10171017 class MockEndorserClient extends EndorserClient {
10181018 final Throwable throwThis ;
1019- private final ListenableFuture <FabricProposalResponse .ProposalResponse > returnedFuture ;
1019+ private final CompletableFuture <FabricProposalResponse .ProposalResponse > returnedFuture ;
10201020
10211021 MockEndorserClient (Throwable throwThis ) {
10221022 super ("blahchannlname" , "blahpeerName" , "blahURL" , new Endpoint ("grpc://loclhost:99" , null ).getChannelBuilder ());
@@ -1027,14 +1027,14 @@ class MockEndorserClient extends EndorserClient {
10271027 this .returnedFuture = null ;
10281028 }
10291029
1030- MockEndorserClient (ListenableFuture <FabricProposalResponse .ProposalResponse > returnedFuture ) {
1030+ MockEndorserClient (CompletableFuture <FabricProposalResponse .ProposalResponse > returnedFuture ) {
10311031 super ("blahchannlname" , "blahpeerName" , "blahURL" , new Endpoint ("grpc://loclhost:99" , null ).getChannelBuilder ());
10321032 this .throwThis = null ;
10331033 this .returnedFuture = returnedFuture ;
10341034 }
10351035
10361036 @ Override
1037- public ListenableFuture <FabricProposalResponse .ProposalResponse > sendProposalAsync (FabricProposal .SignedProposal proposal ) throws PeerException {
1037+ public CompletableFuture <FabricProposalResponse .ProposalResponse > sendProposalAsync (FabricProposal .SignedProposal proposal ) {
10381038 if (throwThis != null ) {
10391039 getUnsafe ().throwException (throwThis );
10401040 }
0 commit comments