Release version 2.1.1 and roll versions
[sdnc/northbound.git] / vnfapi / provider / src / test / java / org / onap / sdnc / vnfapi / VNFSDNSvcLogicServiceClientTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.sdnc.vnfapi;
23
24 import org.junit.Assert;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.mockito.Mockito;
28 import org.mockito.internal.util.reflection.Whitebox;
29 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
30 import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
31 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
32 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
33 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
34 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
35 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
36 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
37 import org.slf4j.Logger;
38
39 import java.util.Properties;
40
41 import static org.mockito.Matchers.any;
42 import static org.mockito.Mockito.*;
43
44 public class VNFSDNSvcLogicServiceClientTest {
45     private static final String MODE = "mode";
46     private static final String MODULE = "module";
47     private static final String RPC = "rpc";
48     private static final String VERSION = "version";
49
50     private Logger mockLog = mock(Logger.class);
51     private SvcLogicService mockSvcLogic = mock(SvcLogicService.class);
52
53     private VNFSDNSvcLogicServiceClient svcClient;
54
55     @Before
56     public void setUp() throws Exception {
57         svcClient = spy(new VNFSDNSvcLogicServiceClient(mockSvcLogic));
58
59         Whitebox.setInternalState(svcClient, "logger", mockLog);
60         Whitebox.setInternalState(svcClient, "svcLogic", mockSvcLogic);
61     }
62
63     @Test
64     public void testConstructorWithoutSvcLogicBundle() throws Exception {
65         VNFSDNSvcLogicServiceClient client = new VNFSDNSvcLogicServiceClient(mockSvcLogic);
66         Assert.assertEquals("Should have set mockSvcLogic",
67                 mockSvcLogic, Whitebox.getInternalState(client, "svcLogic"));
68     }
69
70     @Test (expected = SvcLogicException.class)
71     public void testHasGraphWithException() throws Exception {
72         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).hasGraph(MODULE, RPC, VERSION, MODE);
73         svcClient.hasGraph(MODULE, RPC, VERSION, MODE);
74     }
75
76     @Test
77     public void testHasGraph() throws Exception {
78         Mockito.doReturn(true).when(mockSvcLogic).hasGraph(MODULE, RPC, VERSION, MODE);
79         Assert.assertTrue("Should return true", svcClient.hasGraph(MODULE, RPC, VERSION, MODE));
80     }
81
82     // --------- Test cases for ServiceDataBuilder serviceData-----------------
83     @Test (expected = SvcLogicException.class)
84     public void testExecuteWithServiceDataBuilderWithException() throws Exception {
85         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
86         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
87                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
88
89         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
90     }
91
92     @Test
93     public void testExecuteWithServiceDataBuilder() throws Exception {
94         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
95         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
96         Mockito.verify(svcClient, times(1)).execute(
97                 any(String.class), any(String.class), any(String.class), any(String.class),
98                 any(ServiceDataBuilder.class), any(Properties.class));
99     }
100
101     @Test (expected = SvcLogicException.class)
102     public void testParamExecuteWithServiceDataBuilderWithException() throws Exception {
103         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
104         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
105                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
106
107         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
108     }
109
110     @Test
111     public void testParamExecuteWithServiceDataBuilderWithExecutorReturnNull() throws Exception {
112         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
113         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
114         Assert.assertTrue("Should return null", properties == null);
115         Mockito.verify(mockSvcLogic, times(1)).execute(
116                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
117     }
118
119     @Test
120     public void testParamExecuteWithServiceDataBuilderWithExecutorReturnFailure() throws Exception {
121         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
122         Properties resultProps = new Properties();
123         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
124                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
125         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
126                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
127         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
128         Assert.assertEquals("Should return resultProps", resultProps, properties);
129     }
130
131     @Test
132     public void testParamExecuteWithServiceDataBuilder() throws Exception {
133         Mockito.doReturn(true).when(mockLog).isDebugEnabled();
134         ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
135         Properties resultProps = new Properties();
136         resultProps.setProperty("my", "testing");
137         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
138                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
139         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
140         Assert.assertEquals("Should still return resultProps", resultProps, properties);
141     }
142
143     // --------- Test cases for PreloadDataBuilder serviceData-----------------
144     @Test (expected = SvcLogicException.class)
145     public void testExecuteWithPreloadDataBuilderWithException() throws Exception {
146         PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
147         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
148                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
149
150         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
151     }
152
153     @Test
154     public void testExecuteWithPreloadDataBuilder() throws Exception {
155         PreloadDataBuilder  mockBuilder = mock(PreloadDataBuilder.class);
156         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
157         Mockito.verify(svcClient, times(1)).execute(
158                 any(String.class), any(String.class), any(String.class), any(String.class),
159                 any(PreloadDataBuilder .class), any(Properties.class));
160     }
161
162     @Test (expected = SvcLogicException.class)
163     public void testParamExecuteWithPreloadDataBuilderWithException() throws Exception {
164         PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
165         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
166                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
167
168         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
169     }
170
171     @Test
172     public void testParamExecuteWithPreloadDataBuilderWithExecutorReturnNull() throws Exception {
173         PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
174         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
175         Assert.assertTrue("Should return null", properties == null);
176         Mockito.verify(mockSvcLogic, times(1)).execute(
177                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
178     }
179
180     @Test
181     public void testParamExecuteWithPreloadDataBuilderWithExecutorReturnFailure() throws Exception {
182         PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
183         Properties resultProps = new Properties();
184         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
185                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
186         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
187                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
188         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
189         Assert.assertEquals("Should return resultProps", resultProps, properties);
190     }
191
192     @Test
193     public void testParamExecuteWithPreloadDataBuilder() throws Exception {
194         Mockito.doReturn(true).when(mockLog).isDebugEnabled();
195         PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
196         Properties resultProps = new Properties();
197         resultProps.setProperty("my", "testing");
198         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
199                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
200         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
201         Assert.assertEquals("Should still return resultProps", resultProps, properties);
202     }
203
204
205     // --------- Test cases for VfModulePreloadDataBuilder serviceData-----------------
206     @Test (expected = SvcLogicException.class)
207     public void testExecuteWithVfModulePreloadDataBuilderWithException() throws Exception {
208         VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
209         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
210                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
211
212         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
213     }
214
215     @Test
216     public void testExecuteWithVfModulePreloadDataBuilder() throws Exception {
217         VfModulePreloadDataBuilder  mockBuilder = mock(VfModulePreloadDataBuilder.class);
218         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
219         Mockito.verify(svcClient, times(1)).execute(
220                 any(String.class), any(String.class), any(String.class), any(String.class),
221                 any(VfModulePreloadDataBuilder .class), any(Properties.class));
222     }
223
224     @Test (expected = SvcLogicException.class)
225     public void testParamExecuteWithVfModulePreloadDataBuilderWithException() throws Exception {
226         VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
227         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
228                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
229
230         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
231     }
232
233     @Test
234     public void testParamExecuteWithVfModulePreloadDataBuilderWithExecutorReturnNull() throws Exception {
235         VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
236         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
237         Assert.assertTrue("Should return null", properties == null);
238         Mockito.verify(mockSvcLogic, times(1)).execute(
239                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
240     }
241
242     @Test
243     public void testParamExecuteWithVfModulePreloadDataBuilderWithExecutorReturnFailure() throws Exception {
244         VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
245         Properties resultProps = new Properties();
246         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
247                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
248         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
249                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
250         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
251         Assert.assertEquals("Should return resultProps", resultProps, properties);
252     }
253
254     @Test
255     public void testParamExecuteWithVfModulePreloadDataBuilder() throws Exception {
256         Mockito.doReturn(true).when(mockLog).isDebugEnabled();
257         VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
258         Properties resultProps = new Properties();
259         resultProps.setProperty("my", "testing");
260         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
261                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
262         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
263         Assert.assertEquals("Should still return resultProps", resultProps, properties);
264     }
265
266     // --------- Test cases for VfModuleServiceDataBuilder serviceData-----------------
267     @Test (expected = SvcLogicException.class)
268     public void testExecuteWithVfModuleServiceDataBuilderWithException() throws Exception {
269         VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
270         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
271                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
272
273         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
274     }
275
276     @Test
277     public void testExecuteWithVfModuleServiceDataBuilder() throws Exception {
278         VfModuleServiceDataBuilder  mockBuilder = mock(VfModuleServiceDataBuilder.class);
279         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
280         Mockito.verify(svcClient, times(1)).execute(
281                 any(String.class), any(String.class), any(String.class), any(String.class),
282                 any(VfModuleServiceDataBuilder .class), any(Properties.class));
283     }
284
285     @Test (expected = SvcLogicException.class)
286     public void testParamExecuteWithVfModuleServiceDataBuilderWithException() throws Exception {
287         VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
288         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
289                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
290
291         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
292     }
293
294     @Test
295     public void testParamExecuteWithVfModuleServiceDataBuilderWithExecutorReturnNull() throws Exception {
296         VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
297         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
298         Assert.assertTrue("Should return null", properties == null);
299         Mockito.verify(mockSvcLogic, times(1)).execute(
300                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
301     }
302
303     @Test
304     public void testParamExecuteWithVfModuleServiceDataBuilderWithExecutorReturnFailure() throws Exception {
305         VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
306         Properties resultProps = new Properties();
307         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
308                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
309         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
310                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
311         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
312         Assert.assertEquals("Should return resultProps", resultProps, properties);
313     }
314
315     @Test
316     public void testParamExecuteWithVfModuleServiceDataBuilder() throws Exception {
317         Mockito.doReturn(true).when(mockLog).isDebugEnabled();
318         VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
319         Properties resultProps = new Properties();
320         resultProps.setProperty("my", "testing");
321         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
322                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
323         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
324         Assert.assertEquals("Should still return resultProps", resultProps, properties);
325     }
326
327     // --------- Test cases for VnfInstancePreloadDataBuilder serviceData-----------------
328     @Test (expected = SvcLogicException.class)
329     public void testExecuteWithVnfInstancePreloadDataBuilderWithException() throws Exception {
330         VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
331         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
332                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
333
334         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
335     }
336
337     @Test
338     public void testExecuteWithVnfInstancePreloadDataBuilder() throws Exception {
339         VnfInstancePreloadDataBuilder  mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
340         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
341         Mockito.verify(svcClient, times(1)).execute(
342                 any(String.class), any(String.class), any(String.class), any(String.class),
343                 any(VnfInstancePreloadDataBuilder .class), any(Properties.class));
344     }
345
346     @Test (expected = SvcLogicException.class)
347     public void testParamExecuteWithVnfInstancePreloadDataBuilderWithException() throws Exception {
348         VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
349         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
350                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
351
352         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
353     }
354
355     @Test
356     public void testParamExecuteWithVnfInstancePreloadDataBuilderWithExecutorReturnNull() throws Exception {
357         VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
358         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
359         Assert.assertTrue("Should return null", properties == null);
360         Mockito.verify(mockSvcLogic, times(1)).execute(
361                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
362     }
363
364     @Test
365     public void testParamExecuteWithVnfInstancePreloadDataBuilderWithExecutorReturnFailure() throws Exception {
366         VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
367         Properties resultProps = new Properties();
368         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
369                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
370         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
371                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
372         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
373         Assert.assertEquals("Should return resultProps", resultProps, properties);
374     }
375
376     @Test
377     public void testParamExecuteWithVnfInstancePreloadDataBuilder() throws Exception {
378         Mockito.doReturn(true).when(mockLog).isDebugEnabled();
379         VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
380         Properties resultProps = new Properties();
381         resultProps.setProperty("my", "testing");
382         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
383                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
384         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
385         Assert.assertEquals("Should still return resultProps", resultProps, properties);
386     }
387
388     // --------- Test cases for VnfInstanceServiceDataBuilder serviceData-----------------
389     @Test (expected = SvcLogicException.class)
390     public void testExecuteWithVnfInstanceServiceDataBuilderWithException() throws Exception {
391         VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
392         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
393                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
394
395         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
396     }
397
398     @Test
399     public void testExecuteWithVnfInstanceServiceDataBuilder() throws Exception {
400         VnfInstanceServiceDataBuilder  mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
401         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
402         Mockito.verify(svcClient, times(1)).execute(
403                 any(String.class), any(String.class), any(String.class), any(String.class),
404                 any(VnfInstanceServiceDataBuilder .class), any(Properties.class));
405     }
406
407     @Test (expected = SvcLogicException.class)
408     public void testParamExecuteWithVnfInstanceServiceDataBuilderWithException() throws Exception {
409         VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
410         Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
411                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
412
413         svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
414     }
415
416     @Test
417     public void testParamExecuteWithVnfInstanceServiceDataBuilderWithExecutorReturnNull() throws Exception {
418         VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
419         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
420         Assert.assertTrue("Should return null", properties == null);
421         Mockito.verify(mockSvcLogic, times(1)).execute(
422                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
423     }
424
425     @Test
426     public void testParamExecuteWithVnfInstanceServiceDataBuilderWithExecutorReturnFailure() throws Exception {
427         VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
428         Properties resultProps = new Properties();
429         resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
430                 VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
431         Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
432                 any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
433         Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
434         Assert.assertEquals("Should return resultProps", resultProps, properties);
435     }
436
437 }