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.Ignore;
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.rev190531.RpcStatus;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInputBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInputBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureOutput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInputBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInputBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInputBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
63 import org.opendaylight.yangtools.yang.common.RpcResult;
66 public class ServicehandlerImplTest extends AbstractTest {
69 private PathComputationService pathComputationService;
72 private RendererServiceOperations rendererServiceOperations;
75 private NotificationPublishService notificationPublishService;
78 private PceListenerImpl pceListenerImpl;
81 private RendererListenerImpl rendererListenerImpl;
83 private ListeningExecutorService executorService;
84 private CountDownLatch endSignal;
85 private static final int NUM_THREADS = 5;
86 private boolean callbackRan;
90 executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
91 endSignal = new CountDownLatch(1);
93 MockitoAnnotations.initMocks(this);
97 public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
98 ServicehandlerImpl servicehandlerImpl =
99 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
100 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
101 ListenableFuture<RpcResult<ServiceCreateOutput>> result =
102 servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
103 result.addListener(new Runnable() {
107 endSignal.countDown();
113 RpcResult<ServiceCreateOutput> rpcResult = result.get();
115 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
119 public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
120 throws ExecutionException, InterruptedException {
121 ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
122 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
123 ServicehandlerImpl servicehandlerImpl =
124 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
125 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
126 ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
127 result.addListener(new Runnable() {
131 endSignal.countDown();
137 RpcResult<ServiceCreateOutput> rpcResult = result.get();
139 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
143 public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
144 ServicehandlerImpl servicehandlerImpl =
145 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
146 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
147 ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
148 servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
149 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
150 result.addListener(new Runnable() {
154 endSignal.countDown();
160 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
162 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
166 public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
167 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
168 ServicehandlerImpl servicehandlerImpl =
169 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
170 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
171 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
172 result.addListener(new Runnable() {
176 endSignal.countDown();
182 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
184 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
188 public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
189 DataBroker dataBroker = getNewDataBroker();
190 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
191 ServicehandlerImpl servicehandlerImpl =
192 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
193 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
194 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
195 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
196 serviceDataStoreOperations.createService(createInput);
197 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
198 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
199 result.addListener(new Runnable() {
203 endSignal.countDown();
209 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
211 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
216 public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
217 ServicehandlerImpl servicehandlerImpl =
218 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
219 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
220 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
221 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
222 result.addListener(new Runnable() {
226 endSignal.countDown();
232 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
234 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
238 public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
239 throws ExecutionException, InterruptedException {
240 ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
241 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
242 ServicehandlerImpl servicehandlerImpl =
243 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
244 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
245 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
246 servicehandlerImpl.serviceFeasibilityCheck(input);
247 result.addListener(new Runnable() {
251 endSignal.countDown();
257 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
259 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
263 public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
264 ServicehandlerImpl servicehandlerImpl =
265 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
266 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
267 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
268 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
269 result.addListener(new Runnable() {
273 endSignal.countDown();
279 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
281 RpcStatus.Failed, rpcResult.getResult().getStatus());
286 public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
287 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
289 //action -> service reconfigure
290 ServicehandlerImpl servicehandlerImpl =
291 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
292 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
293 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
295 result.addListener(new Runnable() {
299 endSignal.countDown();
305 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
306 //ServiceReconfigureOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
308 RpcStatus.Failed, rpcResult.getResult().getStatus());
312 public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
313 DataBroker dataBroker = getNewDataBroker();
316 // serviceReconfigure is calling service delete method in renderer
317 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
318 //create service to reconfigure
319 ServicehandlerImpl servicehandlerImpl =
320 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
321 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
322 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
323 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
324 serviceDataStoreOperations.createService(createInput);
326 //service reconfigure test action
327 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
328 //ServiceReconfigureInput is created with the same service information that is created before
329 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
330 result.addListener(new Runnable() {
334 endSignal.countDown();
340 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
342 RpcStatus.Successful, rpcResult.getResult().getStatus());
346 public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
347 ServicehandlerImpl servicehandlerImpl =
348 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
349 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
350 ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
351 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
352 result.addListener(new Runnable() {
356 endSignal.countDown();
362 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
364 RpcStatus.Failed, rpcResult.getResult().getStatus());
369 public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
370 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
372 //action -> service restore
373 ServicehandlerImpl servicehandlerImpl =
374 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
375 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
376 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
378 result.addListener(new Runnable() {
382 endSignal.countDown();
388 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
389 //ServiceRestorationOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
391 RpcStatus.Failed, rpcResult.getResult().getStatus());
395 public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
396 DataBroker dataBroker = getNewDataBroker();
399 // serviceRestoration is calling service delete method in renderer
400 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
401 //create service to restore
402 ServicehandlerImpl servicehandlerImpl =
403 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
404 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
405 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
406 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
407 serviceDataStoreOperations.createService(createInput);
409 //service Restoration test action
410 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
411 //ServiceRestorationInput is created with the same service information that is created before
412 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
413 result.addListener(new Runnable() {
417 endSignal.countDown();
423 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
425 RpcStatus.Successful, rpcResult.getResult().getStatus());
429 public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
430 ServicehandlerImpl servicehandlerImpl =
431 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
432 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
433 ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
434 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
435 result.addListener(new Runnable() {
439 endSignal.countDown();
445 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
447 RpcStatus.Failed, rpcResult.getResult().getStatus());
451 public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
452 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
454 //action -> service reconfigure
455 ServicehandlerImpl servicehandlerImpl =
456 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
457 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
458 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
460 result.addListener(new Runnable() {
464 endSignal.countDown();
470 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
471 //ServiceRerouteOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
473 RpcStatus.Failed, rpcResult.getResult().getStatus());
477 public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
478 DataBroker dataBroker = getNewDataBroker();
481 // serviceReroute is calling service delete method in renderer
482 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
483 //create service to be rerouted later
484 ServicehandlerImpl servicehandlerImpl =
485 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
486 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
487 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
488 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
489 serviceDataStoreOperations.createService(createInput);
491 //service reroute test action
492 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
493 //ServiceRerouteInput is created with the same service information that is created before
494 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
495 result.addListener(new Runnable() {
499 endSignal.countDown();
505 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
507 RpcStatus.Successful, rpcResult.getResult().getStatus());
511 public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
512 ServicehandlerImpl servicehandlerImpl =
513 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
514 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
515 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
516 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
517 .setCommonId("").build());
518 result.addListener(new Runnable() {
522 endSignal.countDown();
528 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
530 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
532 LogMessages.SERVICE_NON_COMPLIANT,
533 rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
537 public void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
538 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
539 ServicehandlerImpl servicehandlerImpl =
540 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
541 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
542 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
543 result.addListener(new Runnable() {
547 endSignal.countDown();
553 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
555 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
559 public void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
560 DataBroker dataBroker = getNewDataBroker();
561 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
563 //create temp service to delete in the temp delete action
564 ServicehandlerImpl servicehandlerImpl =
565 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
566 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
567 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
568 TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
569 serviceDataStoreOperations.createTempService(createInput);
572 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput(createInput.getCommonId());
573 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
574 result.addListener(new Runnable() {
578 endSignal.countDown();
584 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
586 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
590 public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
591 ServicehandlerImpl servicehandlerImpl =
592 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
593 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
594 ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
595 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
596 result.addListener(new Runnable() {
600 endSignal.countDown();
606 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
608 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
613 public void tempServiceCreateShouldBeSuccessfulWhenPreformPCESuccessful()
614 throws ExecutionException, InterruptedException {
615 TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
616 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
618 ServicehandlerImpl servicehandlerImpl =
619 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
620 notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
622 ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(input);
623 result.addListener(new Runnable() {
627 endSignal.countDown();
633 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
636 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());