diff options
Diffstat (limited to 'asdc-controller/src/test')
-rw-r--r-- | asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java | 19 | ||||
-rw-r--r-- | asdc-controller/src/test/resources/ASDC/TestBB.bpmn | 53 |
2 files changed, 15 insertions, 57 deletions
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java index 5d35ea30f1..c572097103 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -28,6 +28,9 @@ import static org.mockito.Mockito.mock; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import javax.transaction.Transactional; @@ -40,23 +43,31 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; @Transactional public class BpmnInstallerTest { private BpmnInstaller bpmnInstaller = new BpmnInstaller(); + @Rule + public TemporaryFolder folder= new TemporaryFolder(); + @Before public void init() throws Exception { - System.setProperty("mso.config.path", "src/test/resources"); + System.setProperty("mso.config.path", folder.getRoot().toString()); } @Test public void buildMimeMultiPart_Test() throws Exception { - + Path tempDirectoryPath = Paths.get(folder.getRoot().toString(), "ASDC"); + Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn"); + Files.createDirectories(tempDirectoryPath); + Files.createFile(tempFilePath); HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); - String mimeMultipartBodyFilePath = System.getProperty("mso.config.path") + "/mime-multipart-body.txt"; + String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt"; File mimeMultipartBody = new File(mimeMultipartBodyFilePath); InputStream expectedContent = new FileInputStream(mimeMultipartBody); @@ -70,7 +81,7 @@ public class BpmnInstallerTest { public void installBpmn_Test() throws Exception { HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "")); HttpClient httpClient = mock(HttpClient.class); - String csarPath = System.getProperty("mso.config.path") + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar"; + String csarPath = "src/test/resources" + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar"; doReturn(response).when(httpClient).execute(any(HttpPost.class)); bpmnInstaller.installBpmn(csarPath); } diff --git a/asdc-controller/src/test/resources/ASDC/TestBB.bpmn b/asdc-controller/src/test/resources/ASDC/TestBB.bpmn deleted file mode 100644 index 47d1f6e649..0000000000 --- a/asdc-controller/src/test/resources/ASDC/TestBB.bpmn +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> - <bpmn:process id="TestBB" name="TestBB" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1" name="Start"> - <bpmn:outgoing>SequenceFlow_1owu825</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_06wodhm" name="End"> - <bpmn:incoming>SequenceFlow_1gwcdup</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1owu825" sourceRef="StartEvent_1" targetRef="FisrtTask" /> - <bpmn:sequenceFlow id="SequenceFlow_1gwcdup" sourceRef="FisrtTask" targetRef="EndEvent_06wodhm" /> - <bpmn:scriptTask id="FisrtTask" name="FirstTask" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1owu825</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1gwcdup</bpmn:outgoing> - <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -DoCreateVnf createVnf = new DoCreateVnf() -createVnf.preProcessRequest(execution)]]></bpmn:script> - </bpmn:scriptTask> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestBB"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="217" y="171" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="223" y="207" width="23" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_06wodhm_di" bpmnElement="EndEvent_06wodhm"> - <dc:Bounds x="630" y="171" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="638" y="207" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1owu825_di" bpmnElement="SequenceFlow_1owu825"> - <di:waypoint xsi:type="dc:Point" x="253" y="189" /> - <di:waypoint xsi:type="dc:Point" x="390" y="189" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="322" y="174" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gwcdup_di" bpmnElement="SequenceFlow_1gwcdup"> - <di:waypoint xsi:type="dc:Point" x="490" y="189" /> - <di:waypoint xsi:type="dc:Point" x="630" y="189" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="174" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0u50zcm_di" bpmnElement="FisrtTask"> - <dc:Bounds x="390" y="149" width="100" height="80" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> |