- private void whenCreateVhostUserIfThenSuccess()
- throws ExecutionException, InterruptedException, VppInvocationException, TimeoutException {
- final CompletionStage<CreateVhostUserIfReply> replyCS = mock(CompletionStage.class);
- final CompletableFuture<CreateVhostUserIfReply> replyFuture = mock(CompletableFuture.class);
- when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
- final CreateVhostUserIfReply reply = new CreateVhostUserIfReply();
- when(replyFuture.get(anyLong(), eq(TimeUnit.SECONDS))).thenReturn(reply);
- when(api.createVhostUserIf(any(CreateVhostUserIf.class))).thenReturn(replyCS);
- }
-
- /**
- * Failure response send
- */
- private void whenCreateVhostUserIfThenFailure()
- throws ExecutionException, InterruptedException, VppInvocationException {
- doReturn(TestHelperUtils.<CreateVhostUserIfReply>createFutureException()).when(api)
- .createVhostUserIf(any(CreateVhostUserIf.class));
- }
-
- private void whenModifyVhostUserIfThenSuccess()
- throws ExecutionException, InterruptedException, VppInvocationException, TimeoutException {
- final CompletionStage<ModifyVhostUserIfReply> replyCS = mock(CompletionStage.class);
- final CompletableFuture<ModifyVhostUserIfReply> replyFuture = mock(CompletableFuture.class);
- when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
- final ModifyVhostUserIfReply reply = new ModifyVhostUserIfReply();
- when(replyFuture.get(anyLong(), eq(TimeUnit.SECONDS))).thenReturn(reply);
- when(api.modifyVhostUserIf(any(ModifyVhostUserIf.class))).thenReturn(replyCS);
- }
-
- /**
- * Failure response send
- */
- private void whenModifyVhostUserIfThenFailure()
- throws ExecutionException, InterruptedException, VppInvocationException {
- doReturn(TestHelperUtils.<ModifyVhostUserIfReply>createFutureException()).when(api)
- .modifyVhostUserIf(any(ModifyVhostUserIf.class));
- }
-
- private void whenDeleteVhostUserIfThenSuccess()
- throws ExecutionException, InterruptedException, VppInvocationException, TimeoutException {
- final CompletionStage<DeleteVhostUserIfReply> replyCS = mock(CompletionStage.class);
- final CompletableFuture<DeleteVhostUserIfReply> replyFuture = mock(CompletableFuture.class);
- when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
- final DeleteVhostUserIfReply reply = new DeleteVhostUserIfReply();
- when(replyFuture.get(anyLong(), eq(TimeUnit.SECONDS))).thenReturn(reply);
- when(api.deleteVhostUserIf(any(DeleteVhostUserIf.class))).thenReturn(replyCS);
- }
-
- /**
- * Failure response send
- */
- private void whenDeleteVhostUserIfThenFailure()
- throws ExecutionException, InterruptedException, VppInvocationException {
- doReturn(TestHelperUtils.<DeleteVhostUserIfReply>createFutureException()).when(api)
- .deleteVhostUserIf(any(DeleteVhostUserIf.class));
- }
-