Adapt TransportPCE code to Sulfur
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / ModelMappingUtilsTest.java
1 /*
2  * Copyright © 2018 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.servicehandler;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import com.google.common.util.concurrent.ListeningExecutorService;
12 import com.google.common.util.concurrent.MoreExecutors;
13 import java.time.OffsetDateTime;
14 import java.time.ZoneOffset;
15 import java.time.format.DateTimeFormatter;
16 import java.util.Map;
17 import java.util.Set;
18 import java.util.concurrent.CountDownLatch;
19 import java.util.concurrent.ExecutionException;
20 import java.util.concurrent.Executors;
21 import org.junit.After;
22 import org.junit.Assert;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.opendaylight.transportpce.common.ResponseCodes;
26 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
27 import org.opendaylight.transportpce.test.AbstractTest;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestOutput;
29 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestOutputBuilder;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.CoRoutingBuilder;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co.routing.ServiceIdentifierListBuilder;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraintsBuilder;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraintsBuilder;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInputBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInputBuilder;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckInput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckInputBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckOutput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureInput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureInputBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInputBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationInput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationInputBuilder;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationOutput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInputBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesBuilder;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesKey;
60 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder;
62 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
63 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
64 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.response.parameters.PathDescriptionBuilder;
65 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
66 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsBuilder;
67 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
68 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
69 import org.opendaylight.yangtools.yang.common.RpcResult;
70 import org.opendaylight.yangtools.yang.common.Uint32;
71
72 public class ModelMappingUtilsTest extends AbstractTest {
73
74     private ListeningExecutorService executorService;
75     private CountDownLatch endSignal;
76     private static final int NUM_THREADS = 5;
77
78     @Before
79     public void setUp() {
80         executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
81         endSignal = new CountDownLatch(1);
82     }
83
84     @After
85     public void tearDown() {
86         executorService.shutdownNow();
87     }
88
89     private ServiceReconfigureInput buildServiceConfigurationInput() {
90         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
91         OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
92         OffsetDateTime offsetDateTime2 = offsetDateTime.plusDays(10);
93         return new ServiceReconfigureInputBuilder().setNewServiceName("service 1")
94             .setServiceName("service 1").setCommonId("common id").setConnectionType(ConnectionType.Service)
95             .setCustomer("customer").setCustomerContact("customer contact").setDueDate(new DateAndTime(
96                     dtf.format(offsetDateTime)))
97             .setEndDate(new DateAndTime(dtf.format(offsetDateTime2)))
98             .setNcCode("nc node").setNciCode("nci node").setSecondaryNciCode("secondry").setOperatorContact("operator")
99             .setServiceAEnd(ServiceDataUtils.getServiceAEndBuildReconfigure().build())
100             .setServiceZEnd(ServiceDataUtils.getServiceZEndBuildReconfigure().build())
101             .setHardConstraints(new HardConstraintsBuilder()
102                 .setCustomerCode(Set.of("Some customer-code"))
103                 .setCoRouting(new CoRoutingBuilder()
104                     .setServiceIdentifierList(Map.of(
105                         new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210
106                             .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
107                         new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
108                             .build()))
109                     .build())
110                 .build())
111             .setSoftConstraints(new SoftConstraintsBuilder()
112                 .setCustomerCode(Set.of("Some customer-code"))
113                 .setCoRouting(new CoRoutingBuilder()
114                     .setServiceIdentifierList(Map.of(
115                         new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210
116                             .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
117                         new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
118                             .build()))
119                     .build())
120                 .build())
121             .build();
122     }
123
124     private PathComputationRequestOutput buildPathComputationOutput() {
125         ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
126                 .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
127                 .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
128         ResponseParameters responseParameters = new ResponseParametersBuilder()
129             .setPathDescription(new PathDescriptionBuilder()
130                 .setAToZDirection(new AToZDirectionBuilder().setAToZWavelengthNumber(Uint32.valueOf(1))
131                     .setRate(Uint32.valueOf(1)).build())
132                 .setZToADirection(new ZToADirectionBuilder().setZToAWavelengthNumber(Uint32.valueOf(1))
133                     .setRate(Uint32.valueOf(1)).build()).build())
134             .build();
135         return new PathComputationRequestOutputBuilder().setConfigurationResponseCommon(configurationResponseCommon)
136             .setResponseParameters(responseParameters).build();
137     }
138
139     @Test
140     //TODO : is this unit test relevant ?
141     public void mappingServicesNullServiceCreateInput() {
142         Services services = ModelMappingUtils.mappingServices(null, null);
143         Assert.assertEquals(new ServicesBuilder().withKey(new ServicesKey("unknown")).build(), services);
144     }
145
146     @Test
147     public void mappingServiceNotNullServiceReconfigureInput() {
148         Services services = ModelMappingUtils.mappingServices(null, buildServiceConfigurationInput());
149         Assert.assertEquals("service 1", services.getServiceName());
150     }
151
152     @Test
153     public void mappingServiceValid() {
154         Services services = ModelMappingUtils.mappingServices(ServiceDataUtils.buildServiceCreateInput(),
155                 null);
156         Assert.assertEquals("service 1", services.getServiceName());
157     }
158
159     @Test
160     //TODO : is this unit test relevant ?
161     public void mappingServicesPathNullServiceCreateInput() {
162         ServicePaths services = ModelMappingUtils.mappingServicePaths(null, buildPathComputationOutput());
163         Assert.assertEquals(new ServicePathsBuilder().withKey(new ServicePathsKey("unknown")).build(), services);
164     }
165
166     @Test
167     public void mappingServicePathWithServiceInputWithHardConstraints() {
168         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithHardConstraints();
169         ServiceInput serviceInput = new ServiceInput(createInput);
170         ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
171         Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
172         Assert.assertNotNull(services.getHardConstraints());
173     }
174
175     @Test
176     public void mappingServicePathWithServiceInputWithSoftConstraints() {
177         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithSoftConstraints();
178         ServiceInput serviceInput = new ServiceInput(createInput);
179         ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
180         Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
181         Assert.assertNotNull(services.getSoftConstraints());
182     }
183
184     @Test
185     public void createServiceDeleteInputWithServiceRerouteInput() {
186         ServiceRerouteInput serviceRerouteinput = new ServiceRerouteInputBuilder().setServiceName("reroute").build();
187         Services services = new ServicesBuilder()
188                 .withKey(new ServicesKey("reroute"))
189                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
190         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
191             serviceDeleteInput =
192                     ModelMappingUtils.createServiceDeleteInput(serviceRerouteinput, services);
193         Assert.assertEquals("reroute", serviceDeleteInput.getServiceName());
194         Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
195     }
196
197     @Test
198     public void  createServiceDeleteInputWithServiceReconfigureInput() {
199         ServiceReconfigureInput serviceReconfigureInput = new  ServiceReconfigureInputBuilder()
200                 .setServiceName("reconf").build();
201         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
202             serviceDeleteInput =
203                     ModelMappingUtils.createServiceDeleteInput(serviceReconfigureInput);
204         Assert.assertEquals("reconf", serviceDeleteInput.getServiceName());
205         Assert.assertEquals("reconf-reconfigure", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
206     }
207
208     @Test
209     public void createServiceDeleteInputWithServiceRestorationInput() {
210         Services services = new ServicesBuilder()
211                 .withKey(new ServicesKey("rest"))
212                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
213         ServiceRestorationInput serviceRestorationInput =
214             new ServiceRestorationInputBuilder().setServiceName("rest").build();
215         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
216             serviceDeleteInput =
217                     ModelMappingUtils.createServiceDeleteInput(serviceRestorationInput, services);
218         Assert.assertEquals("rest", serviceDeleteInput.getServiceName());
219         Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
220     }
221
222     @Test
223     public void createDeleteServiceReplyWithServiceDeleteInputWithSdncHeader()
224         throws ExecutionException, InterruptedException  {
225         ServiceDeleteInput input = new ServiceDeleteInputBuilder()
226                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
227         ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
228             ModelMappingUtils.createDeleteServiceReply(input, "ack", "message", "200");
229         serviceDeleteOutputF.addListener(new Runnable() {
230             @Override
231             public void run() {
232                 endSignal.countDown();
233             }
234         }, executorService);
235
236         endSignal.await();
237         RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
238         Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
239         Assert.assertEquals(
240             "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
241         Assert.assertEquals(
242             "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
243         Assert.assertEquals("12", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
244     }
245
246     @Test
247     public void createDeleteServiceReplyWithServiceDeleteInputWithoutSdncHeader()
248             throws ExecutionException, InterruptedException  {
249         ServiceDeleteInput input = new ServiceDeleteInputBuilder().build();
250         ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
251             ModelMappingUtils.createDeleteServiceReply(input, "ack", "message", "200");
252         serviceDeleteOutputF.addListener(new Runnable() {
253             @Override
254             public void run() {
255                 endSignal.countDown();
256             }
257         }, executorService);
258
259         endSignal.await();
260         RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
261         Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
262         Assert.assertEquals(
263             "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
264         Assert.assertEquals(
265             "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
266         Assert.assertNull(serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
267     }
268
269     @Test
270     public void createCreateServiceReplyWithServiceCreatInputWithSdncRequestHeader()
271             throws ExecutionException, InterruptedException {
272         ServiceCreateInput input =
273             new ServiceCreateInputBuilder()
274                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
275         ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
276             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
277         serviceCreatOutputF.addListener(new Runnable() {
278             @Override
279             public void run() {
280                 endSignal.countDown();
281             }
282         }, executorService);
283
284         endSignal.await();
285         RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
286         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
287         Assert.assertEquals(
288             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
289         Assert.assertEquals(
290             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
291         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
292     }
293
294     @Test
295     public void createCreateServiceReplyWithServiceCreatInputWithoutSdncRequestHeader()
296         throws ExecutionException, InterruptedException {
297         ServiceCreateInput input = new ServiceCreateInputBuilder().build();
298         ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
299             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
300         serviceCreatOutputF.addListener(new Runnable() {
301             @Override
302             public void run() {
303                 endSignal.countDown();
304             }
305         }, executorService);
306
307         endSignal.await();
308         RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
309         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
310         Assert.assertEquals(
311             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
312         Assert.assertEquals(
313             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
314         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
315     }
316
317     @Test
318     public void createCreateServiceReplyWithTempServiceCreatInputWithSdncRequestHeader()
319         throws ExecutionException, InterruptedException {
320         TempServiceCreateInput input =
321             new TempServiceCreateInputBuilder()
322                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
323         ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
324             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
325         serviceCreatOutputF.addListener(new Runnable() {
326             @Override
327             public void run() {
328                 endSignal.countDown();
329             }
330         }, executorService);
331
332         endSignal.await();
333         RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
334         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
335         Assert.assertEquals(
336             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
337         Assert.assertEquals(
338             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
339         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
340     }
341
342     @Test
343     public void createCreateServiceReplyWithTempServiceCreatInputWithoutSdncRequestHeader()
344         throws ExecutionException, InterruptedException {
345         TempServiceCreateInput input = new TempServiceCreateInputBuilder().build();
346         ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
347             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
348         serviceCreatOutputF.addListener(new Runnable() {
349             @Override
350             public void run() {
351                 endSignal.countDown();
352             }
353         }, executorService);
354
355         endSignal.await();
356         RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
357         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
358         Assert.assertEquals(
359             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
360         Assert.assertEquals(
361             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
362         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
363     }
364
365     @Test
366     public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithSdncRequestHeader()
367         throws ExecutionException, InterruptedException {
368         ServiceFeasibilityCheckInput input =
369             new ServiceFeasibilityCheckInputBuilder()
370                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
371         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
372             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
373         serviceCreatOutputF.addListener(new Runnable() {
374             @Override
375             public void run() {
376                 endSignal.countDown();
377             }
378         }, executorService);
379
380         endSignal.await();
381         RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
382         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
383         Assert.assertEquals(
384             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
385         Assert.assertEquals(
386             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
387         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
388     }
389
390     @Test
391     public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithoutSdncRequestHeader()
392         throws ExecutionException, InterruptedException {
393         ServiceFeasibilityCheckInput input = new ServiceFeasibilityCheckInputBuilder().build();
394         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
395             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
396         serviceCreatOutputF.addListener(new Runnable() {
397             @Override
398             public void run() {
399                 endSignal.countDown();
400             }
401         }, executorService);
402
403         endSignal.await();
404         RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
405         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
406         Assert.assertEquals(
407             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
408         Assert.assertEquals(
409             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
410         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
411     }
412
413     @Test
414     public void testCreateRestoreServiceReply() throws ExecutionException, InterruptedException {
415         ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestorationOutputF =
416             ModelMappingUtils.createRestoreServiceReply("message");
417         serviceRestorationOutputF.addListener(new Runnable() {
418             @Override
419             public void run() {
420                 endSignal.countDown();
421             }
422         }, executorService);
423
424         endSignal.await();
425     }
426 }