8e3d77cd32e58c4eac794b42e94b3cd236f3b7ef
[appc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * ================================================================================
9  * Copyright (C) 2018 Ericsson. All rights reserved.
10  * ================================================================================
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  * ============LICENSE_END=========================================================
24  */
25
26 package org.onap.appc.requesthandler.impl;
27
28 import static org.junit.Assert.assertTrue;
29 import static org.mockito.Matchers.anyBoolean;
30 import static org.mockito.Matchers.anyObject;
31 import static org.mockito.Matchers.anyString;
32 import static org.mockito.Mockito.mock;
33
34 import com.att.eelf.configuration.EELFLogger;
35 import com.att.eelf.configuration.EELFLogger.Level;
36 import com.att.eelf.configuration.EELFManager;
37
38 import java.io.ByteArrayInputStream;
39 import java.io.InputStream;
40 import java.net.MalformedURLException;
41 import java.time.Instant;
42 import java.time.temporal.ChronoUnit;
43 import java.util.ArrayList;
44 import java.util.List;
45 import java.util.Properties;
46
47 import org.apache.commons.lang.StringUtils;
48 import org.apache.http.HttpResponse;
49 import org.apache.http.ProtocolVersion;
50 import org.apache.http.entity.BasicHttpEntity;
51 import org.apache.http.message.BasicHttpResponse;
52 import org.junit.Before;
53 import org.junit.Ignore;
54 import org.junit.Test;
55 import org.junit.runner.RunWith;
56 import org.mockito.Mockito;
57 import org.mockito.internal.util.reflection.Whitebox;
58 import org.mockito.invocation.InvocationOnMock;
59 import org.mockito.stubbing.Answer;
60 import org.onap.appc.configuration.Configuration;
61 import org.onap.appc.configuration.ConfigurationFactory;
62 import org.onap.appc.domainmodel.lcm.ActionIdentifiers;
63 import org.onap.appc.domainmodel.lcm.CommonHeader;
64 import org.onap.appc.domainmodel.lcm.Flags;
65 import org.onap.appc.domainmodel.lcm.Flags.Mode;
66 import org.onap.appc.domainmodel.lcm.RequestContext;
67 import org.onap.appc.domainmodel.lcm.RequestStatus;
68 import org.onap.appc.domainmodel.lcm.ResponseContext;
69 import org.onap.appc.domainmodel.lcm.RuntimeContext;
70 import org.onap.appc.domainmodel.lcm.TransactionRecord;
71 import org.onap.appc.domainmodel.lcm.VNFOperation;
72 import org.onap.appc.exceptions.APPCException;
73 import org.onap.appc.lockmanager.api.LockException;
74 import org.onap.appc.lockmanager.api.LockManager;
75 import org.onap.appc.requesthandler.LCMStateManager;
76 import org.onap.appc.requesthandler.exceptions.DGWorkflowNotFoundException;
77 import org.onap.appc.requesthandler.exceptions.LCMOperationsDisabledException;
78 import org.onap.appc.requesthandler.exceptions.RequestValidationException;
79 import org.onap.appc.requesthandler.exceptions.WorkflowNotFoundException;
80 import org.onap.appc.rest.client.RestClientInvoker;
81 import org.onap.appc.transactionrecorder.TransactionRecorder;
82 import org.onap.appc.validationpolicy.RequestValidationPolicy;
83 import org.onap.appc.validationpolicy.executors.RuleExecutor;
84 import org.onap.appc.validationpolicy.objects.RuleResult;
85 import org.onap.appc.workflow.WorkFlowManager;
86 import org.onap.appc.workflow.impl.WorkFlowManagerImpl;
87 import org.onap.appc.workflow.objects.WorkflowExistsOutput;
88 import org.onap.appc.workflow.objects.WorkflowRequest;
89 import org.onap.ccsdk.sli.adaptors.aai.AAIService;
90 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
91 import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
92 import org.osgi.framework.Bundle;
93 import org.osgi.framework.BundleContext;
94 import org.osgi.framework.FrameworkUtil;
95 import org.osgi.framework.ServiceReference;
96 import org.powermock.api.mockito.PowerMockito;
97 import org.powermock.core.classloader.annotations.PrepareForTest;
98 import org.powermock.modules.junit4.PowerMockRunner;
99
100 @RunWith(PowerMockRunner.class)
101 @PrepareForTest({FrameworkUtil.class})
102 public class RequestValidatorImplTest implements LocalRequestHanlderTestHelper {
103     private Configuration mockConfig = ConfigurationFactory.getConfiguration();
104     private RequestValidatorImpl impl;
105     private final BundleContext bundleContext = Mockito.mock(BundleContext.class);
106     private final Bundle bundleService = Mockito.mock(Bundle.class);
107     private final ServiceReference sref = Mockito.mock(ServiceReference.class);
108     private EELFLogger logger;
109     private TransactionRecorder transactionRecorder;
110     private LockManager lockManager;
111     private LCMStateManager lcmStateManager;
112
113
114     @Before
115     public void setUp() throws Exception {
116         impl = PowerMockito.spy(new RequestValidatorImpl());
117         Whitebox.setInternalState(impl, "configuration", mockConfig);
118         logger = Mockito.spy(EELFManager.getInstance().getLogger(RequestHandlerImpl.class));
119         logger.setLevel(Level.TRACE);
120         Whitebox.setInternalState(impl, "logger", logger);
121         lcmStateManager = new LCMStateManagerImpl();
122         impl.setLcmStateManager(lcmStateManager);
123         AAIService aaiService = Mockito.mock(AAIService.class);
124         PowerMockito.when(aaiService.query(
125                 anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyString(), anyObject()))
126         .thenAnswer(new Answer<SvcLogicResource.QueryStatus>() {
127             @Override
128             public SvcLogicResource.QueryStatus answer(InvocationOnMock invocation) throws Exception {
129                 Object[] args = invocation.getArguments();
130                 SvcLogicContext ctx = (SvcLogicContext) args[6];
131                 String prefix = (String) args[4];
132                 String key = (String) args[3];
133                 if (key.contains("'28'")) {
134                     return SvcLogicResource.QueryStatus.FAILURE;
135                 } else if (key.contains("'8'")) {
136                     return SvcLogicResource.QueryStatus.NOT_FOUND;
137                 } else {
138                     ctx.setAttribute(prefix + ".vnf-type", "FIREWALL");
139                     ctx.setAttribute(prefix + ".orchestration-status", "Instantiated");
140                 }
141                 return SvcLogicResource.QueryStatus.SUCCESS;
142             }
143         });
144         PowerMockito.mockStatic(FrameworkUtil.class);
145         PowerMockito.when(FrameworkUtil.getBundle(AAIService.class)).thenReturn(bundleService);
146         PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
147         PowerMockito.when(bundleContext.getServiceReference(AAIService.class.getName())).thenReturn(sref);
148         PowerMockito.when(bundleContext.getService(sref)).thenReturn(aaiService);
149         lockManager = mock(LockManager.class);
150         impl.setLockManager(lockManager);
151     }
152
153     // TODO: remove Ignore when initialize method actually throws APPCException
154     @Ignore
155     @Test(expected = APPCException.class)
156     public void testInitializeWithNullConfigProps() throws Exception {
157         Mockito.doReturn(null).when(mockConfig).getProperties();
158         impl.initialize();
159     }
160
161     // TODO: remove Ignore when initialize method actually throws APPCException
162     @Ignore
163     @Test(expected = APPCException.class)
164     public void testInitializeWithoutEndpointProp() throws Exception {
165         Properties mockProp = mock(Properties.class);
166         Mockito.doReturn(null).when(mockProp).getProperty(RequestValidatorImpl.SCOPE_OVERLAP_ENDPOINT);
167         Mockito.doReturn(mockProp).when(mockConfig).getProperties();
168         impl.initialize();
169     }
170
171     // TODO: remove Ignore when initialize method actually throws APPCException
172     @Ignore
173     @Test(expected = APPCException.class)
174     public void testInitializeWithMalFormatEndpoint() throws Exception {
175         Properties mockProp = mock(Properties.class);
176         Mockito.doReturn("a/b/c").when(mockProp).getProperty(RequestValidatorImpl.SCOPE_OVERLAP_ENDPOINT);
177         Mockito.doReturn(mockProp).when(mockConfig).getProperties();
178         impl.initialize();
179     }
180
181     @Test(expected = LCMOperationsDisabledException.class)
182     public void testValidateRequestLCMException() throws Exception {
183         RuntimeContext runtimeContext = createRequestValidatorInput();
184         logger = Mockito.spy(EELFManager.getInstance().getLogger(LCMStateManager.class));
185         logger.setLevel(Level.TRACE);
186         Whitebox.setInternalState(lcmStateManager, "logger", logger);
187         lcmStateManager.disableLCMOperations();
188         impl.validateRequest(runtimeContext);
189     }
190
191
192     @Test (expected = RequestValidationException.class)
193     public void testValidateRequest() throws Exception {
194         RuntimeContext runtimeContext = createRequestValidatorInput();
195         logger = Mockito.spy(EELFManager.getInstance().getLogger(LCMStateManager.class));
196         logger.setLevel(Level.TRACE);
197         Whitebox.setInternalState(lcmStateManager, "logger", logger);
198         lcmStateManager.enableLCMOperations();
199         transactionRecorder = Mockito.mock(TransactionRecorder.class);
200         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
201         List<TransactionRecord> transactionRecordList = new ArrayList<TransactionRecord>(1);
202         TransactionRecord transactionRecord = new TransactionRecord();
203         transactionRecord.setMode(Mode.EXCLUSIVE);
204         transactionRecord.setStartTime(Instant.now().minus(5, ChronoUnit.HOURS));
205         transactionRecord.setRequestState(RequestStatus.ACCEPTED);
206         runtimeContext.setTransactionRecord(transactionRecord);
207         transactionRecordList.add(transactionRecord);
208         Mockito.when(transactionRecorder.getInProgressRequests(Mockito.any(TransactionRecord.class),Mockito.any(int.class)))
209         .thenReturn(transactionRecordList);
210         impl.setTransactionRecorder(transactionRecorder);
211         WorkflowExistsOutput workflowExistsOutput = new WorkflowExistsOutput(true, true);
212         WorkFlowManager workflowManager = Mockito.mock(WorkFlowManagerImpl.class);
213         Mockito.when(workflowManager.workflowExists(Mockito.any(WorkflowRequest.class))).thenReturn(workflowExistsOutput);
214         impl.setWorkflowManager(workflowManager);
215         ResponseContext responseContext = runtimeContext.getResponseContext();
216         CommonHeader commonHeader = returnResponseContextCommonHeader(responseContext);
217         RestClientInvoker client = mock(RestClientInvoker.class);
218         HttpResponse httpResponse = new BasicHttpResponse(new ProtocolVersion("HTTP",1,0), 200, "ACCEPTED");
219         httpResponse.setEntity(getHttpEntity());
220         Mockito.when(client.doPost(Mockito.anyString(), Mockito.anyString())).thenReturn(httpResponse);
221         impl.setClient(client);
222         RequestValidationPolicy requestValidationPolicy = Mockito.mock(RequestValidationPolicy.class);
223         RuleExecutor ruleExecutor = Mockito.mock(RuleExecutor.class);
224         RuleResult ruleResult = RuleResult.REJECT;
225         Mockito.when(requestValidationPolicy.getInProgressRuleExecutor()).thenReturn(ruleExecutor);
226         Mockito.when(ruleExecutor.executeRule(Mockito.anyString(), Mockito.anyListOf(VNFOperation.class))).thenReturn(ruleResult);
227         impl.setRequestValidationPolicy(requestValidationPolicy);
228         impl.validateRequest(runtimeContext);
229     }
230
231     @Test
232     public void testInitializeMalformed() throws Exception {
233         Properties properties = new Properties();
234         properties.setProperty("appc.LCM.scopeOverlap.endpoint", "/not/a/URL");
235         mockConfig.setProperties(properties);
236         Whitebox.setInternalState(impl, "configuration", mockConfig);
237         impl.initialize();
238         Mockito.verify(logger).error(Mockito.anyString(), Mockito.any(MalformedURLException.class));
239     }
240
241     @Test
242     public void testInitialize() throws Exception {
243         Configuration mockConfigForInitTest = ConfigurationFactory.getConfiguration(new Properties());
244         Whitebox.setInternalState(impl, "configuration", mockConfigForInitTest);
245         impl.initialize();
246         Mockito.verify(logger).error("End point is not defined for scope over lap service in appc.properties.");
247     }
248
249     @Test(expected = RequestValidationException.class)
250     public void testValidateRequestExclusiveRequestCount() throws Exception {
251         RuntimeContext runtimeContext = createRequestValidatorInput();
252         lcmStateManager.enableLCMOperations();
253         transactionRecorder = Mockito.mock(TransactionRecorder.class);
254         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
255         List<TransactionRecord> transactionRecordList = new ArrayList<TransactionRecord>(1);
256         TransactionRecord inProgressTransaction = new TransactionRecord();
257         inProgressTransaction.setMode(Mode.EXCLUSIVE);
258         inProgressTransaction.setStartTime(Instant.now().minus(5, ChronoUnit.HOURS));
259         inProgressTransaction.setRequestState(RequestStatus.ACCEPTED);
260         transactionRecordList.add(inProgressTransaction);
261         Mockito.when(transactionRecorder.getInProgressRequests(Mockito.any(TransactionRecord.class),Mockito.any(int.class)))
262             .thenReturn(transactionRecordList);
263         runtimeContext.setTransactionRecord(inProgressTransaction);
264         impl.setTransactionRecorder(transactionRecorder);
265         WorkflowExistsOutput workflowExistsOutput = new WorkflowExistsOutput(true, true);
266         WorkFlowManager workflowManager = Mockito.mock(WorkFlowManagerImpl.class);
267         Mockito.when(workflowManager.workflowExists(Mockito.any(WorkflowRequest.class)))
268             .thenReturn(workflowExistsOutput);
269         impl.setWorkflowManager(workflowManager);
270         ResponseContext responseContext = runtimeContext.getResponseContext();
271         CommonHeader commonHeader = returnResponseContextCommonHeader(responseContext);
272         impl.validateRequest(runtimeContext);
273     }
274
275     @Test(expected = LockException.class)
276     public void testValidateLockException() throws Exception {
277         RuntimeContext runtimeContext = createRequestValidatorInput();
278         lcmStateManager.enableLCMOperations();
279         Mockito.when(lockManager.getLockOwner(Mockito.anyString())).thenReturn("TEST_LOCK_OWNER");
280         transactionRecorder = Mockito.mock(TransactionRecorder.class);
281         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
282         impl.setTransactionRecorder(transactionRecorder);
283         TransactionRecord inProgressTransaction = new TransactionRecord();
284         runtimeContext.setTransactionRecord(inProgressTransaction);
285         impl.validateRequest(runtimeContext);
286     }
287
288     @Test
289     public void testValidateRequestInProgressTransactionLoop() throws Exception {
290         RuntimeContext runtimeContext = createRequestValidatorInput();
291         lcmStateManager.enableLCMOperations();
292         transactionRecorder = Mockito.mock(TransactionRecorder.class);
293
294         List<TransactionRecord> transactionRecordList = new ArrayList<TransactionRecord>(1);
295         TransactionRecord inProgressTransaction = new TransactionRecord();
296         inProgressTransaction.setMode(Mode.NORMAL);
297         inProgressTransaction.setOperation(VNFOperation.ActionStatus);
298         inProgressTransaction.setRequestState(RequestStatus.ACCEPTED);
299         inProgressTransaction.setStartTime(Instant.now().minus(48, ChronoUnit.HOURS));
300         transactionRecordList.add(inProgressTransaction);
301         Mockito.when(transactionRecorder.getInProgressRequests(Mockito.any(TransactionRecord.class),Mockito.any(int.class)))
302         .thenReturn(transactionRecordList);
303         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
304         impl.setTransactionRecorder(transactionRecorder);
305         runtimeContext.setTransactionRecord(inProgressTransaction);
306         WorkFlowManager workflowManager = Mockito.mock(WorkFlowManagerImpl.class);
307         WorkflowExistsOutput workflowExistsOutput = Mockito.spy(new WorkflowExistsOutput(true, true));
308         Mockito.when(workflowManager.workflowExists(Mockito.any(WorkflowRequest.class)))
309             .thenReturn(workflowExistsOutput);
310         impl.setWorkflowManager(workflowManager);
311         ResponseContext responseContext = runtimeContext.getResponseContext();
312         CommonHeader commonHeader = returnResponseContextCommonHeader(responseContext);
313         RestClientInvoker client = mock(RestClientInvoker.class);
314         HttpResponse httpResponse = new BasicHttpResponse(new ProtocolVersion("HTTP",1,0), 200, "ACCEPTED");
315         httpResponse.setEntity(getHttpEntity());
316         Mockito.when(client.doPost(Mockito.anyString(), Mockito.anyString())).thenReturn(httpResponse);
317         impl.setClient(client);
318         RequestValidationPolicy requestValidationPolicy = Mockito.mock(RequestValidationPolicy.class);
319         RuleExecutor ruleExecutor = Mockito.mock(RuleExecutor.class);
320         RuleResult ruleResult = RuleResult.ACCEPT;
321         Mockito.when(requestValidationPolicy.getInProgressRuleExecutor()).thenReturn(ruleExecutor);
322         Mockito.when(ruleExecutor.executeRule(Mockito.anyString(), Mockito.anyListOf(VNFOperation.class)))
323             .thenReturn(ruleResult);
324         impl.setRequestValidationPolicy(requestValidationPolicy);
325         RequestContext requestContext = new RequestContext();
326         ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
327         actionIdentifiers.setServiceInstanceId("TEST_SERVICE_INSTANCE_ID");
328         actionIdentifiers.setVfModuleId("TEST_VNF_MODULE_ID");
329         actionIdentifiers.setVnfcName("TEST_VNFC_NAME");
330         actionIdentifiers.setVnfId("TEST_VNF_ID");
331         actionIdentifiers.setvServerId("TEST_SERVER_ID");
332         requestContext.setActionIdentifiers(actionIdentifiers);
333         impl.validateRequest(runtimeContext);
334         Mockito.verify(logger).debug("Policy validation result ACCEPT");
335     }
336
337     @Test(expected = WorkflowNotFoundException.class)
338     public void testValidateRequestWorkflowNotFoundException() throws Exception {
339         RuntimeContext runtimeContext = createRequestValidatorInput();
340         lcmStateManager.enableLCMOperations();
341         transactionRecorder = Mockito.mock(TransactionRecorder.class);
342         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
343         TransactionRecord transactionRecord = new TransactionRecord();
344         transactionRecord.setMode(Mode.EXCLUSIVE);
345         runtimeContext.setTransactionRecord(transactionRecord);
346         impl.setTransactionRecorder(transactionRecorder);
347         WorkflowExistsOutput workflowExistsOutput = Mockito.spy(new WorkflowExistsOutput(true, true));
348         WorkFlowManager workflowManager = Mockito.mock(WorkFlowManagerImpl.class);
349         Mockito.when(workflowManager.workflowExists(Mockito.any(WorkflowRequest.class)))
350             .thenReturn(workflowExistsOutput);
351         Mockito.when(workflowExistsOutput.isMappingExist()).thenReturn(false);
352         impl.setWorkflowManager(workflowManager);
353         ResponseContext responseContext = runtimeContext.getResponseContext();
354         CommonHeader commonHeader = returnResponseContextCommonHeader(responseContext);
355         RestClientInvoker client = mock(RestClientInvoker.class);
356         HttpResponse httpResponse = new BasicHttpResponse(new ProtocolVersion("HTTP",1,0), 200, "ACCEPTED");;
357         httpResponse.setEntity(getHttpEntity());
358         Mockito.when(client.doPost(Mockito.anyString(), Mockito.anyString())).thenReturn(httpResponse);
359         impl.setClient(client);
360         RequestValidationPolicy requestValidationPolicy = Mockito.mock(RequestValidationPolicy.class);
361         RuleExecutor ruleExecutor = Mockito.mock(RuleExecutor.class);
362         RuleResult ruleResult = RuleResult.REJECT;
363         Mockito.when(requestValidationPolicy.getInProgressRuleExecutor()).thenReturn(ruleExecutor);
364         Mockito.when(ruleExecutor.executeRule(Mockito.anyString(), Mockito.anyListOf(VNFOperation.class)))
365             .thenReturn(ruleResult);
366         impl.setRequestValidationPolicy(requestValidationPolicy);
367         impl.validateRequest(runtimeContext);
368     }
369
370     @Test(expected = DGWorkflowNotFoundException.class)
371     public void testValidateRequestDGWorkflowNotFoundException() throws Exception {
372         RuntimeContext runtimeContext = createRequestValidatorInput();
373         lcmStateManager.enableLCMOperations();
374         transactionRecorder = Mockito.mock(TransactionRecorder.class);
375         Mockito.when(transactionRecorder.isTransactionDuplicate(anyObject())).thenReturn(false);
376         TransactionRecord transactionRecord = new TransactionRecord();
377         transactionRecord.setMode(Mode.EXCLUSIVE);
378         runtimeContext.setTransactionRecord(transactionRecord);
379         impl.setTransactionRecorder(transactionRecorder);
380         WorkflowExistsOutput workflowExistsOutput = Mockito.spy(new WorkflowExistsOutput(true, true));
381         WorkFlowManager workflowManager = Mockito.mock(WorkFlowManagerImpl.class);
382         Mockito.when(workflowManager.workflowExists(Mockito.any(WorkflowRequest.class)))
383             .thenReturn(workflowExistsOutput);
384         Mockito.when(workflowExistsOutput.isDgExist()).thenReturn(false);
385         impl.setWorkflowManager(workflowManager);
386         ResponseContext responseContext = runtimeContext.getResponseContext();
387         CommonHeader commonHeader = returnResponseContextCommonHeader(responseContext);
388         RestClientInvoker client = mock(RestClientInvoker.class);
389         HttpResponse httpResponse = new BasicHttpResponse(new ProtocolVersion("HTTP",1,0), 200, "ACCEPTED");
390         httpResponse.setEntity(getHttpEntity());
391         Mockito.when(client.doPost(Mockito.anyString(), Mockito.anyString())).thenReturn(httpResponse);
392         impl.setClient(client);
393         RequestValidationPolicy requestValidationPolicy = Mockito.mock(RequestValidationPolicy.class);
394         RuleExecutor ruleExecutor = Mockito.mock(RuleExecutor.class);
395         RuleResult ruleResult = RuleResult.REJECT;
396         Mockito.when(requestValidationPolicy.getInProgressRuleExecutor()).thenReturn(ruleExecutor);
397         Mockito.when(ruleExecutor.executeRule(Mockito.anyString(), Mockito.anyListOf(VNFOperation.class)))
398             .thenReturn(ruleResult);
399         impl.setRequestValidationPolicy(requestValidationPolicy);
400         impl.validateRequest(runtimeContext);
401     }
402
403     @Test
404     public void testLogInProgressTransactions() {
405         ArrayList<TransactionRecord> trArray = new ArrayList();
406         TransactionRecord tr = new TransactionRecord();
407         tr.setRequestState(RequestStatus.ACCEPTED);
408         tr.setStartTime(Instant.now().minus(48, ChronoUnit.HOURS));
409         tr.setTargetId("Vnf001");
410         trArray.add(tr);
411         String loggedMessage = impl.logInProgressTransactions(trArray, 1, 1);
412         String partMessage = "In Progress transaction for Target ID - Vnf001 in state ACCEPTED";
413         assertTrue(StringUtils.contains(loggedMessage, partMessage));
414     }
415
416     private RuntimeContext createRequestValidatorInput() {
417         return createRequestHandlerRuntimeContext("VSCP", "{\"request-id\":\"request-id\"}");
418     }
419
420     private CommonHeader returnResponseContextCommonHeader(ResponseContext responseContext) {
421         CommonHeader commonHeader = responseContext.getCommonHeader();
422         Flags flags = new Flags();
423         flags.setForce(false);
424         commonHeader.setFlags(flags);
425         commonHeader.setRequestId("TEST_REQUEST_ID");
426         return commonHeader;
427     }
428
429     private BasicHttpEntity getHttpEntity() {
430         BasicHttpEntity httpEntity = new BasicHttpEntity();
431         InputStream inputStream = new ByteArrayInputStream(
432                 "{\"output\": {\"status\": {\"message\": \"test_messge\",\"code\": \"400\",\"status\":\"test_status\"},\"response-info\": { \"block\": \"true\"}}}".getBytes());
433         httpEntity.setContent(inputStream);
434         return httpEntity;
435     }
436 }