2 * Copyright © 2019 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl.LogMessages;
13 import com.google.common.util.concurrent.Futures;
14 import com.google.common.util.concurrent.ListenableFuture;
15 import com.google.common.util.concurrent.ListeningExecutorService;
16 import com.google.common.util.concurrent.MoreExecutors;
17 import java.util.concurrent.CountDownLatch;
18 import java.util.concurrent.ExecutionException;
19 import java.util.concurrent.Executors;
20 import org.junit.Assert;
21 import org.junit.Before;
22 import org.junit.Test;
23 import org.mockito.Mock;
24 import org.mockito.Mockito;
25 import org.mockito.MockitoAnnotations;
26 import org.opendaylight.mdsal.binding.api.DataBroker;
27 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
28 import org.opendaylight.transportpce.common.ResponseCodes;
29 import org.opendaylight.transportpce.pce.service.PathComputationService;
30 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
31 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
32 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
33 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
34 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
35 import org.opendaylight.transportpce.test.AbstractTest;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev190531.RpcStatus;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInputBuilder;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInputBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureOutput;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInputBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteOutput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInputBuilder;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInputBuilder;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutput;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
62 import org.opendaylight.yangtools.yang.common.RpcResult;
64 public class ServicehandlerImplTest extends AbstractTest {
67 private PathComputationService pathComputationService;
70 private RendererServiceOperations rendererServiceOperations;
73 private NotificationPublishService notificationPublishService;
76 private PceListenerImpl pceListenerImpl;
79 private RendererListenerImpl rendererListenerImpl;
81 private ListeningExecutorService executorService;
82 private CountDownLatch endSignal;
83 private static final int NUM_THREADS = 5;
84 private boolean callbackRan;
88 executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
89 endSignal = new CountDownLatch(1);
91 MockitoAnnotations.initMocks(this);
95 public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
96 ServicehandlerImpl servicehandlerImpl =
97 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
98 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
99 ListenableFuture<RpcResult<ServiceCreateOutput>> result =
100 servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
101 result.addListener(new Runnable() {
105 endSignal.countDown();
111 RpcResult<ServiceCreateOutput> rpcResult = result.get();
113 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
117 public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
118 throws ExecutionException, InterruptedException {
119 ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
120 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
121 ServicehandlerImpl servicehandlerImpl =
122 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
123 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
124 ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
125 result.addListener(new Runnable() {
129 endSignal.countDown();
135 RpcResult<ServiceCreateOutput> rpcResult = result.get();
137 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
141 public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
142 ServicehandlerImpl servicehandlerImpl =
143 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
144 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
145 ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
146 servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
147 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
148 result.addListener(new Runnable() {
152 endSignal.countDown();
158 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
160 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
164 public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
165 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
166 ServicehandlerImpl servicehandlerImpl =
167 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
168 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
169 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
170 result.addListener(new Runnable() {
174 endSignal.countDown();
180 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
182 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
186 public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
187 DataBroker dataBroker = getNewDataBroker();
188 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
189 ServicehandlerImpl servicehandlerImpl =
190 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
191 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
192 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
193 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
194 serviceDataStoreOperations.createService(createInput);
195 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
196 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
197 result.addListener(new Runnable() {
201 endSignal.countDown();
207 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
209 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
214 public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
215 ServicehandlerImpl servicehandlerImpl =
216 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
217 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
218 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
219 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
220 result.addListener(new Runnable() {
224 endSignal.countDown();
230 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
232 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
236 public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
237 throws ExecutionException, InterruptedException {
238 ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
239 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
240 ServicehandlerImpl servicehandlerImpl =
241 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
242 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
243 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
244 servicehandlerImpl.serviceFeasibilityCheck(input);
245 result.addListener(new Runnable() {
249 endSignal.countDown();
255 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
257 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
261 public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
262 ServicehandlerImpl servicehandlerImpl =
263 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
264 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
265 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
266 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
267 result.addListener(new Runnable() {
271 endSignal.countDown();
277 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
279 RpcStatus.Failed, rpcResult.getResult().getStatus());
284 public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
285 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
287 //action -> service reconfigure
288 ServicehandlerImpl servicehandlerImpl =
289 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
290 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
291 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
293 result.addListener(new Runnable() {
297 endSignal.countDown();
303 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
304 //ServiceReconfigureOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
306 RpcStatus.Failed, rpcResult.getResult().getStatus());
310 public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
311 DataBroker dataBroker = getNewDataBroker();
314 // serviceReconfigure is calling service delete method in renderer
315 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
316 //create service to reconfigure
317 ServicehandlerImpl servicehandlerImpl =
318 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
319 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
320 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
321 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
322 serviceDataStoreOperations.createService(createInput);
324 //service reconfigure test action
325 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
326 //ServiceReconfigureInput is created with the same service information that is created before
327 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
328 result.addListener(new Runnable() {
332 endSignal.countDown();
338 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
340 RpcStatus.Successful, rpcResult.getResult().getStatus());
344 public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
345 ServicehandlerImpl servicehandlerImpl =
346 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
347 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
348 ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
349 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
350 result.addListener(new Runnable() {
354 endSignal.countDown();
360 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
362 RpcStatus.Failed, rpcResult.getResult().getStatus());
367 public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
368 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
370 //action -> service restore
371 ServicehandlerImpl servicehandlerImpl =
372 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
373 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
374 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
376 result.addListener(new Runnable() {
380 endSignal.countDown();
386 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
387 //ServiceRestorationOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
389 RpcStatus.Failed, rpcResult.getResult().getStatus());
393 public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
394 DataBroker dataBroker = getNewDataBroker();
397 // serviceRestoration is calling service delete method in renderer
398 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
399 //create service to restore
400 ServicehandlerImpl servicehandlerImpl =
401 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
402 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
403 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
404 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
405 serviceDataStoreOperations.createService(createInput);
407 //service Restoration test action
408 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
409 //ServiceRestorationInput is created with the same service information that is created before
410 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
411 result.addListener(new Runnable() {
415 endSignal.countDown();
421 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
423 RpcStatus.Successful, rpcResult.getResult().getStatus());
427 public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
428 ServicehandlerImpl servicehandlerImpl =
429 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
430 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
431 ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
432 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
433 result.addListener(new Runnable() {
437 endSignal.countDown();
443 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
445 RpcStatus.Failed, rpcResult.getResult().getStatus());
449 public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
450 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
452 //action -> service reconfigure
453 ServicehandlerImpl servicehandlerImpl =
454 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
455 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
456 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
458 result.addListener(new Runnable() {
462 endSignal.countDown();
468 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
469 //ServiceRerouteOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
471 RpcStatus.Failed, rpcResult.getResult().getStatus());
475 public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
476 DataBroker dataBroker = getNewDataBroker();
479 // serviceReroute is calling service delete method in renderer
480 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
481 //create service to be rerouted later
482 ServicehandlerImpl servicehandlerImpl =
483 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
484 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
485 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
486 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
487 serviceDataStoreOperations.createService(createInput);
489 //service reroute test action
490 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
491 //ServiceRerouteInput is created with the same service information that is created before
492 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
493 result.addListener(new Runnable() {
497 endSignal.countDown();
503 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
505 RpcStatus.Successful, rpcResult.getResult().getStatus());
509 public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
510 ServicehandlerImpl servicehandlerImpl =
511 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
512 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
513 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
514 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
515 .setCommonId("").build());
516 result.addListener(new Runnable() {
520 endSignal.countDown();
526 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
528 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
530 LogMessages.SERVICE_NON_COMPLIANT,
531 rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
535 public void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
536 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
537 ServicehandlerImpl servicehandlerImpl =
538 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
539 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
540 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
541 result.addListener(new Runnable() {
545 endSignal.countDown();
551 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
553 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
557 public void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
558 DataBroker dataBroker = getNewDataBroker();
559 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
561 //create temp service to delete in the temp delete action
562 ServicehandlerImpl servicehandlerImpl =
563 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
564 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
565 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
566 TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
567 serviceDataStoreOperations.createTempService(createInput);
570 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput(createInput.getCommonId());
571 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
572 result.addListener(new Runnable() {
576 endSignal.countDown();
582 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
584 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
588 public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
589 ServicehandlerImpl servicehandlerImpl =
590 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
591 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
592 ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
593 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
594 result.addListener(new Runnable() {
598 endSignal.countDown();
604 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
606 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
611 public void tempServiceCreateShouldBeSuccessfulWhenPreformPCESuccessful()
612 throws ExecutionException, InterruptedException {
613 TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
614 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
616 ServicehandlerImpl servicehandlerImpl =
617 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
618 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
620 ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(input);
621 result.addListener(new Runnable() {
625 endSignal.countDown();
631 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
634 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());