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