+
+
+ @Test
+ public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
+ ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
+ servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ }
+
+ @Test
+ public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
+ throws ExecutionException, InterruptedException {
+ ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
+ Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
+ ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
+ servicehandlerImpl.serviceFeasibilityCheck(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ }
+
+
+