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;
16 import java.util.concurrent.CountDownLatch;
17 import java.util.concurrent.ExecutionException;
18 import java.util.concurrent.Executors;
19 import org.junit.Assert;
20 import org.junit.Before;
21 import org.junit.Test;
22 import org.mockito.Mock;
23 import org.mockito.Mockito;
24 import org.mockito.MockitoAnnotations;
25 import org.opendaylight.mdsal.binding.api.DataBroker;
26 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
27 import org.opendaylight.transportpce.common.ResponseCodes;
28 import org.opendaylight.transportpce.pce.service.PathComputationService;
29 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
30 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
31 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
32 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
33 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
34 import org.opendaylight.transportpce.test.AbstractTest;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev190531.RpcStatus;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInputBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInputBuilder;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureOutput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInputBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteOutput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInputBuilder;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInputBuilder;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
61 import org.opendaylight.yangtools.yang.common.RpcResult;
63 public class ServicehandlerImplTest extends AbstractTest {
66 private PathComputationService pathComputationService;
69 private RendererServiceOperations rendererServiceOperations;
72 private NotificationPublishService notificationPublishService;
75 private PceListenerImpl pceListenerImpl;
78 private RendererListenerImpl rendererListenerImpl;
80 private ListeningExecutorService executorService;
81 private CountDownLatch endSignal;
82 private static final int NUM_THREADS = 5;
83 private boolean callbackRan;
87 executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
88 endSignal = new CountDownLatch(1);
90 MockitoAnnotations.initMocks(this);
94 public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
95 ServicehandlerImpl servicehandlerImpl =
96 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
97 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
98 ListenableFuture<RpcResult<ServiceCreateOutput>> result =
99 servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
100 result.addListener(new Runnable() {
104 endSignal.countDown();
110 RpcResult<ServiceCreateOutput> rpcResult = result.get();
112 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
116 public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
117 throws ExecutionException, InterruptedException {
118 ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
119 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
120 ServicehandlerImpl servicehandlerImpl =
121 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
122 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
123 ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
124 result.addListener(new Runnable() {
128 endSignal.countDown();
134 RpcResult<ServiceCreateOutput> rpcResult = result.get();
136 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
140 public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
141 ServicehandlerImpl servicehandlerImpl =
142 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
143 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
144 ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
145 servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
146 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
147 result.addListener(new Runnable() {
151 endSignal.countDown();
157 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
159 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
163 public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
164 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
165 ServicehandlerImpl servicehandlerImpl =
166 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
167 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
168 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
169 result.addListener(new Runnable() {
173 endSignal.countDown();
179 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
181 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
185 public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
186 DataBroker dataBroker = getNewDataBroker();
187 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
188 ServicehandlerImpl servicehandlerImpl =
189 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
190 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
191 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
192 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
193 serviceDataStoreOperations.createService(createInput);
194 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
195 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
196 result.addListener(new Runnable() {
200 endSignal.countDown();
206 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
208 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
213 public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
214 ServicehandlerImpl servicehandlerImpl =
215 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
216 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
217 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
218 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
219 result.addListener(new Runnable() {
223 endSignal.countDown();
229 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
231 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
235 public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
236 throws ExecutionException, InterruptedException {
237 ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
238 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
239 ServicehandlerImpl servicehandlerImpl =
240 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
241 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
242 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
243 servicehandlerImpl.serviceFeasibilityCheck(input);
244 result.addListener(new Runnable() {
248 endSignal.countDown();
254 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
256 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
260 public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
261 ServicehandlerImpl servicehandlerImpl =
262 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
263 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
264 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
265 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
266 result.addListener(new Runnable() {
270 endSignal.countDown();
276 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
278 RpcStatus.Failed, rpcResult.getResult().getStatus());
283 public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
284 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
286 //action -> service reconfigure
287 ServicehandlerImpl servicehandlerImpl =
288 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
289 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
290 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
292 result.addListener(new Runnable() {
296 endSignal.countDown();
302 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
303 //ServiceReconfigureOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
305 RpcStatus.Failed, rpcResult.getResult().getStatus());
309 public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
310 DataBroker dataBroker = getNewDataBroker();
313 // serviceReconfigure is calling service delete method in renderer
314 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
315 //create service to reconfigure
316 ServicehandlerImpl servicehandlerImpl =
317 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
318 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
319 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
320 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
321 serviceDataStoreOperations.createService(createInput);
323 //service reconfigure test action
324 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
325 //ServiceReconfigureInput is created with the same service information that is created before
326 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
327 result.addListener(new Runnable() {
331 endSignal.countDown();
337 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
339 RpcStatus.Successful, rpcResult.getResult().getStatus());
343 public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
344 ServicehandlerImpl servicehandlerImpl =
345 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
346 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
347 ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
348 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
349 result.addListener(new Runnable() {
353 endSignal.countDown();
359 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
361 RpcStatus.Failed, rpcResult.getResult().getStatus());
366 public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
367 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
369 //action -> service restore
370 ServicehandlerImpl servicehandlerImpl =
371 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
372 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
373 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
375 result.addListener(new Runnable() {
379 endSignal.countDown();
385 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
386 //ServiceRestorationOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
388 RpcStatus.Failed, rpcResult.getResult().getStatus());
392 public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
393 DataBroker dataBroker = getNewDataBroker();
396 // serviceRestoration is calling service delete method in renderer
397 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
398 //create service to restore
399 ServicehandlerImpl servicehandlerImpl =
400 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
401 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
402 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
403 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
404 serviceDataStoreOperations.createService(createInput);
406 //service Restoration test action
407 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
408 //ServiceRestorationInput is created with the same service information that is created before
409 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
410 result.addListener(new Runnable() {
414 endSignal.countDown();
420 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
422 RpcStatus.Successful, rpcResult.getResult().getStatus());
426 public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
427 ServicehandlerImpl servicehandlerImpl =
428 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
429 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
430 ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
431 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
432 result.addListener(new Runnable() {
436 endSignal.countDown();
442 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
444 RpcStatus.Failed, rpcResult.getResult().getStatus());
448 public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
449 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
451 //action -> service reconfigure
452 ServicehandlerImpl servicehandlerImpl =
453 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
454 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
455 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
457 result.addListener(new Runnable() {
461 endSignal.countDown();
467 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
468 //ServiceRerouteOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
470 RpcStatus.Failed, rpcResult.getResult().getStatus());
474 public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
475 DataBroker dataBroker = getNewDataBroker();
478 // serviceReroute is calling service delete method in renderer
479 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
480 //create service to be rerouted later
481 ServicehandlerImpl servicehandlerImpl =
482 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
483 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
484 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
485 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
486 serviceDataStoreOperations.createService(createInput);
488 //service reroute test action
489 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
490 //ServiceRerouteInput is created with the same service information that is created before
491 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
492 result.addListener(new Runnable() {
496 endSignal.countDown();
502 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
504 RpcStatus.Successful, rpcResult.getResult().getStatus());
508 public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
509 ServicehandlerImpl servicehandlerImpl =
510 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
511 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
512 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
513 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
514 .setCommonId("").build());
515 result.addListener(new Runnable() {
519 endSignal.countDown();
525 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
527 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
529 "Service not compliant !", rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
533 public void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
534 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
535 ServicehandlerImpl servicehandlerImpl =
536 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
537 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
538 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
539 result.addListener(new Runnable() {
543 endSignal.countDown();
549 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
551 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
555 public void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
556 DataBroker dataBroker = getNewDataBroker();
557 Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
559 //create temp service to delete in the temp delete action
560 ServicehandlerImpl servicehandlerImpl =
561 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
562 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
563 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
564 TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
565 serviceDataStoreOperations.createTempService(createInput);
568 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput(createInput.getCommonId());
569 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
570 result.addListener(new Runnable() {
574 endSignal.countDown();
580 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
582 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
586 public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
587 ServicehandlerImpl servicehandlerImpl =
588 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
589 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
590 ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
591 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
592 result.addListener(new Runnable() {
596 endSignal.countDown();
602 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
604 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
609 public void tempServiceCreateShouldBeSuccessfulWhenPreformPCESuccessful()
610 throws ExecutionException, InterruptedException {
611 TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
612 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
614 ServicehandlerImpl servicehandlerImpl =
615 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
616 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
618 ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(input);
619 result.addListener(new Runnable() {
623 endSignal.countDown();
629 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
632 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());