diff options
author | Elena Kuleshov <EK1439@att.com> | 2018-09-19 14:03:47 -0400 |
---|---|---|
committer | Elena Kuleshov <EK1439@att.com> | 2018-09-19 15:41:11 -0400 |
commit | 5648fffeaf625dde2b9207ceae87979082a68409 (patch) | |
tree | 7c59ec034f8c958010e2bdfda4586129154f2434 /bpmn/so-bpmn-tasks/src/test/java/org | |
parent | c18addf7b6fb56a55b0ecfd5030c43308c46186d (diff) |
Workflow Activities Execution Environment
Add a license header to ExecuteActivity.java
Fix a JUnit by modifying the values for the expected variables.
BBInput changes to support CM flows
Implement JavaDelegate for activities execution
Change-Id: I9cfc51241d414b85441d1a8443a950b97d14b65f
Issue-ID: SO-827
Signed-off-by: Elena Kuleshov <EK1439@att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java new file mode 100644 index 0000000000..d4956f9349 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.activity; + + +import static org.junit.Assert.assertEquals; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; + +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExecuteActivityTest extends BaseTaskTest { + @Autowired + protected ExecuteActivity executeActivity; + + private DelegateExecution execution; + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + execution.setVariable("vnfType", "testVnfType"); + execution.setVariable("requestAction", "testRequestAction"); + execution.setVariable("mso-request-id", "testMsoRequestId"); + execution.setVariable("vnfId", "testVnfId"); + execution.setVariable("serviceInstanceId", "testServiceInstanceId"); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + } + + @Test + public void buildBuildingBlock_Test(){ + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + assertEquals(bb.getBpmnFlowName(), "testActivityName"); + assertEquals(bb.getKey(), ""); + } + + @Test + public void executeBuildingBlock_Test() throws Exception { + BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName"); + ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb); + assertEquals(ebb.getVnfType(), "testVnfType"); + assertEquals(ebb.getRequestAction(), "testRequestAction"); + assertEquals(ebb.getRequestId(), "testMsoRequestId"); + assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId"); + assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId"); + assertEquals(ebb.getBuildingBlock(), bb); + } + +} |