diff options
Diffstat (limited to 'asdc-controller/src/test')
3 files changed, 40 insertions, 95 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> diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index a84b02db63..b17fb5d47c 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -517,36 +517,29 @@ default character set = latin1; engine = innodb auto_increment = 20654 default character set = latin1; - create table if not exists `service_proxy` ( - `model_uuid` varchar(200) not null, - `model_invariant_uuid` varchar(200) not null, - `model_version` varchar(20) not null, - `model_name` varchar(200) not null, - `description` varchar(1200) null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_uuid`)) - engine = innodb auto_increment = 20654 - default character set = latin1; - -create table if not exists `service_proxy_customization` ( -`model_customization_uuid` varchar(200) not null, -`model_instance_name` varchar(200) not null, -`tosca_node_type` varchar(200) not null, -`source_service_model_uuid` varchar(200) not null, -`creation_timestamp` datetime not null default current_timestamp, -`service_proxy_model_uuid` varchar(200) not null, -primary key (`model_customization_uuid`), -index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc), -index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc), -constraint`fk_spr_customization__service_proxy_resource1` -foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`) -on delete cascade on update cascade, -constraint `fk_service_proxy_resource_customization__service1` -foreign key (`source_service_model_uuid`) references `service` -(`model_uuid`) on delete cascade on update cascade) -engine = innodb -auto_increment = 20654 -default character set = latin1; +CREATE TABLE IF NOT EXISTS `service_proxy_customization` ( + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC), + UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_service_proxy_resource_customization__service1` + FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; create table if not exists `configuration_customization` ( `model_customization_uuid` varchar(200) not null, @@ -560,19 +553,13 @@ create table if not exists `configuration_customization` ( `configuration_customization_model_customization_uuid` varchar(200) null, primary key (`model_customization_uuid`), index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc), -index `fk_configuration_customization__service_proxy_customization_idx` -(`service_proxy_customization_model_customization_uuid` asc), index `fk_configuration_customization__configuration_customization_idx` (`configuration_customization_model_customization_uuid` asc), constraint `fk_configuration_resource_customization__configuration_resour1` foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`) on delete cascade on update cascade, -constraint `fk_configuration_customization__service_proxy_customization1` foreign -key (`service_proxy_customization_model_customization_uuid`) references -`service_proxy_customization` (`model_customization_uuid`) -on delete cascade on update cascade, constraint -`fk_configuration_customization__configuration_customization1` foreign -key (`configuration_customization_model_customization_uuid`) references +constraint `fk_configuration_customization__configuration_customization1` +foreign key (`configuration_customization_model_customization_uuid`) references `configuration_customization` (`model_customization_uuid`) on delete cascade on update cascade) engine = innodb |