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;
12 import com.google.common.util.concurrent.Futures;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import com.google.common.util.concurrent.ListeningExecutorService;
15 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;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.mockito.Mock;
25 import org.mockito.Mockito;
26 import org.mockito.MockitoAnnotations;
27 import org.opendaylight.mdsal.binding.api.DataBroker;
28 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
29 import org.opendaylight.transportpce.common.ResponseCodes;
30 import org.opendaylight.transportpce.pce.service.PathComputationService;
31 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
32 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
33 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
34 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
35 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
36 import org.opendaylight.transportpce.test.AbstractTest;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInputBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInputBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInputBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInputBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationOutput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInputBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInputBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteOutput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfoBuilder;
63 import org.opendaylight.yangtools.yang.common.RpcResult;
65 public class ServicehandlerImplTest extends AbstractTest {
68 private PathComputationService pathComputationService;
71 private RendererServiceOperations rendererServiceOperations;
74 private NotificationPublishService notificationPublishService;
77 private PceListenerImpl pceListenerImpl;
80 private RendererListenerImpl rendererListenerImpl;
82 private ListeningExecutorService executorService;
83 private CountDownLatch endSignal;
84 private static final int NUM_THREADS = 5;
85 private boolean callbackRan;
89 executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
90 endSignal = new CountDownLatch(1);
92 MockitoAnnotations.initMocks(this);
96 public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
97 ServicehandlerImpl servicehandlerImpl =
98 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
99 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
100 ListenableFuture<RpcResult<ServiceCreateOutput>> result =
101 servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
102 result.addListener(new Runnable() {
106 endSignal.countDown();
112 RpcResult<ServiceCreateOutput> rpcResult = result.get();
114 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
118 public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
119 throws ExecutionException, InterruptedException {
120 ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
121 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
122 ServicehandlerImpl servicehandlerImpl =
123 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
124 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
125 ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
126 result.addListener(new Runnable() {
130 endSignal.countDown();
136 RpcResult<ServiceCreateOutput> rpcResult = result.get();
138 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
142 public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
143 ServicehandlerImpl servicehandlerImpl =
144 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
145 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
146 ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
147 servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
148 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
149 result.addListener(new Runnable() {
153 endSignal.countDown();
159 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
161 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
165 public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
166 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
167 ServicehandlerImpl servicehandlerImpl =
168 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
169 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
170 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
171 result.addListener(new Runnable() {
175 endSignal.countDown();
181 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
183 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
187 public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
188 DataBroker dataBroker = getNewDataBroker();
189 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
190 ServicehandlerImpl servicehandlerImpl =
191 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
192 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
193 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
194 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
195 serviceDataStoreOperations.createService(createInput);
196 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
197 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
198 result.addListener(new Runnable() {
202 endSignal.countDown();
208 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
210 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
215 public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
216 ServicehandlerImpl servicehandlerImpl =
217 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
218 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
219 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
220 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
221 result.addListener(new Runnable() {
225 endSignal.countDown();
231 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
233 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
237 public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
238 throws ExecutionException, InterruptedException {
239 ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
240 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
241 ServicehandlerImpl servicehandlerImpl =
242 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
243 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
244 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
245 servicehandlerImpl.serviceFeasibilityCheck(input);
246 result.addListener(new Runnable() {
250 endSignal.countDown();
256 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
258 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
262 public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
263 ServicehandlerImpl servicehandlerImpl =
264 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
265 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
266 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
267 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
268 result.addListener(new Runnable() {
272 endSignal.countDown();
278 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
280 RpcStatus.Failed, rpcResult.getResult().getStatus());
285 public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
286 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
288 //action -> service reconfigure
289 ServicehandlerImpl servicehandlerImpl =
290 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
291 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
292 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
294 result.addListener(new Runnable() {
298 endSignal.countDown();
304 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
305 //ServiceReconfigureOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
307 RpcStatus.Failed, rpcResult.getResult().getStatus());
311 public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
312 DataBroker dataBroker = getNewDataBroker();
315 // serviceReconfigure is calling service delete method in renderer
316 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
317 //create service to reconfigure
318 ServicehandlerImpl servicehandlerImpl =
319 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
320 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
321 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
322 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
323 serviceDataStoreOperations.createService(createInput);
325 //service reconfigure test action
326 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
327 //ServiceReconfigureInput is created with the same service information that is created before
328 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
329 result.addListener(new Runnable() {
333 endSignal.countDown();
339 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
341 RpcStatus.Successful, rpcResult.getResult().getStatus());
345 public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
346 ServicehandlerImpl servicehandlerImpl =
347 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
348 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
349 ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
350 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
351 result.addListener(new Runnable() {
355 endSignal.countDown();
361 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
363 RpcStatus.Failed, rpcResult.getResult().getStatus());
368 public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
369 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
371 //action -> service restore
372 ServicehandlerImpl servicehandlerImpl =
373 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
374 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
375 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
377 result.addListener(new Runnable() {
381 endSignal.countDown();
387 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
388 //ServiceRestorationOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
390 RpcStatus.Failed, rpcResult.getResult().getStatus());
394 public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
395 DataBroker dataBroker = getNewDataBroker();
398 // serviceRestoration is calling service delete method in renderer
399 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
400 //create service to restore
401 ServicehandlerImpl servicehandlerImpl =
402 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
403 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
404 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
405 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
406 serviceDataStoreOperations.createService(createInput);
408 //service Restoration test action
409 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
410 //ServiceRestorationInput is created with the same service information that is created before
411 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
412 result.addListener(new Runnable() {
416 endSignal.countDown();
422 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
424 RpcStatus.Successful, rpcResult.getResult().getStatus());
428 public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
429 ServicehandlerImpl servicehandlerImpl =
430 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
431 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
432 ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
433 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
434 result.addListener(new Runnable() {
438 endSignal.countDown();
444 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
446 RpcStatus.Failed, rpcResult.getResult().getStatus());
450 public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
451 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
453 //action -> service reconfigure
454 ServicehandlerImpl servicehandlerImpl =
455 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
456 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
457 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
459 result.addListener(new Runnable() {
463 endSignal.countDown();
469 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
470 //ServiceRerouteOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
472 RpcStatus.Failed, rpcResult.getResult().getStatus());
476 public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
477 DataBroker dataBroker = getNewDataBroker();
480 // serviceReroute is calling service delete method in renderer
481 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
482 //create service to be rerouted later
483 ServicehandlerImpl servicehandlerImpl =
484 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
485 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
486 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
487 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
488 serviceDataStoreOperations.createService(createInput);
490 //service reroute test action
491 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
492 //ServiceRerouteInput is created with the same service information that is created before
493 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
494 result.addListener(new Runnable() {
498 endSignal.countDown();
504 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
506 RpcStatus.Successful, rpcResult.getResult().getStatus());
510 public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
511 ServicehandlerImpl servicehandlerImpl =
512 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
513 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
514 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
515 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
516 .setCommonId("").build());
517 result.addListener(new Runnable() {
521 endSignal.countDown();
527 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
529 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
531 "Service not compliant !", 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())).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());