From d80dca72097ee2adb414ffa2523e06a9ec893e0f Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Wed, 27 Sep 2017 14:03:35 +0800 Subject: Add unit test for bpmn workflow converter Issue-ID: SDC-404 Change-Id: Ie6f897f06b0e759992d3ba6e65c719a84a40f143 Signed-off-by: Lvbo163 --- .../convert/BPMN4Tosca2BpmnTest.java | 39 ++++++++++++++++++++++ .../src/test/resources/workflow/workflow.json | 17 ++++++++++ 2 files changed, 56 insertions(+) create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java create mode 100644 sdc-workflow-designer-server/src/test/resources/workflow/workflow.json diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java new file mode 100644 index 00000000..fc423a1a --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/convert/BPMN4Tosca2BpmnTest.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2017 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ +package org.onap.sdc.workflowdesigner.convert; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.net.URI; +import java.nio.file.Paths; + +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.junit.Test; +import org.onap.sdc.workflowdesigner.converter.Bpmn4Tosca2Bpmn; + +public class BPMN4Tosca2BpmnTest { + private static String RESOURCES_DIR = "src/test/resources/workflow"; + + @Test + public void testTransform() throws ResourceNotFoundException, ParseErrorException, Exception { + + URI srcUri = Paths.get(RESOURCES_DIR, "workflow.json").toUri(); + URI targetUri = Paths.get(RESOURCES_DIR, "bpmnworkflow.bpmn20.xml").toUri(); + BPMN4Tosca2BpmnTest.class.getResource("."); + Bpmn4Tosca2Bpmn transformer = new Bpmn4Tosca2Bpmn(); + transformer.transform("transformTest", srcUri, targetUri); + assertTrue(new File(targetUri.getPath()).exists()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json b/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json new file mode 100644 index 00000000..4799fc99 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/resources/workflow/workflow.json @@ -0,0 +1,17 @@ +{"nodes":[ + { + "sequenceFlows":[ + {"condition":"","sourceRef":"node0","targetRef":"node1"}, + {"condition":"","sourceRef":"node0","targetRef":"node3"} + ], + "parameters":[],"id":"node0","name":"startEvent","type":"startEvent","parentId":"root", + "position":{"width":30,"height":30,"left":468,"top":55} + }, + { + "sequenceFlows":[{"condition":"","sourceRef":"node1","targetRef":"node2"}], + "input":[],"output":[],"template":{},"id":"node1","name":"endEvent", + "type":"endEvent","parentId":"root", + "position":{"width":252.08334350585938,"height":46.66666793823242,"left":432,"top":167} + }], +"configs":{"restConfigs":[]} +} \ No newline at end of file -- cgit 1.2.3-korg