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