+++ /dev/null
-/**\r
- * Copyright (c) 2017 ZTE Corporation.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the Apache License, Version 2.0\r
- * and the Eclipse Public License v1.0 which both accompany this distribution,\r
- * and are available at http://www.eclipse.org/legal/epl-v10.html\r
- * and http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Contributors:\r
- * ZTE - initial API and implementation and/or initial documentation\r
- */\r
-package org.onap.sdc.workflowdesigner.converter;\r
-\r
-import java.net.URI;\r
-import java.nio.file.Files;\r
-import java.nio.file.Path;\r
-import java.nio.file.Paths;\r
-import java.nio.file.StandardOpenOption;\r
-\r
-import org.onap.sdc.workflowdesigner.model.Process;\r
-import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser;\r
-import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class Bpmn4Tosca2Bpmn {\r
-\r
- private static Logger log = LoggerFactory.getLogger(Bpmn4Tosca2Bpmn.class);\r
-\r
- /**\r
- * Transforms the given BPMN4Tosca Json management into a bpmn plan that can\r
- * be excuted by activiti.\r
- * <p>\r
- *\r
- * @param srcBpmn4ToscaJsonFile\r
- * @param targetBpmnArchive\r
- * @throws Exception \r
- */\r
- public void transform(String processId, URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) throws Exception {\r
- log.info("transform start");\r
-\r
- // parse json object\r
- Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser();\r
- Process process = parser.parse(processId, srcBpmn4ToscaJsonFile);\r
-\r
- // transform bpmn template\r
- BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process);\r
- String workflowString = writer.completePlanTemplate();\r
-\r
- // write bpmn to file\r
- Path targetPath = Paths.get(targetBpmnArchive);\r
- Files.write(targetPath, workflowString.getBytes(), StandardOpenOption.CREATE);\r
- log.info("transform end");\r
- }\r
-\r
-}\r
import java.io.IOException;
import java.net.URI;
-import java.nio.file.Paths;
+//import java.nio.file.Paths;
import java.util.List;
-import java.util.UUID;
+//import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.eclipse.jetty.http.HttpStatus;
-import org.onap.sdc.workflowdesigner.common.WorkflowDesignerException;
-import org.onap.sdc.workflowdesigner.externalservice.sdc.SDCServiceProxy;
-import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo;
+//import org.onap.sdc.workflowdesigner.common.WorkflowDesignerException;
+//import org.onap.sdc.workflowdesigner.externalservice.sdc.SDCServiceProxy;
+//import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo;
import org.onap.sdc.workflowdesigner.model.Process;
import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser;
-import org.onap.sdc.workflowdesigner.resources.entity.WorkflowInfo;
+//import org.onap.sdc.workflowdesigner.resources.entity.WorkflowInfo;
import org.onap.sdc.workflowdesigner.utils.FileCommonUtils;
-import org.onap.sdc.workflowdesigner.utils.JsonUtils;
+//import org.onap.sdc.workflowdesigner.utils.JsonUtils;
import org.onap.sdc.workflowdesigner.utils.RestUtils;
import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
import org.slf4j.Logger;
private static final Logger logger = LoggerFactory.getLogger(WorkflowModelerResource.class);
private static final String WORKFLOW_JSON_TEMP_FILE_NAME = "temp_workflow.json";
- private static final String WORKFLOW_XML_TEMP_FILE_NAME = "temp_workflow.xml";
+// private static final String WORKFLOW_XML_TEMP_FILE_NAME = "temp_workflow.xml";
/**
@ApiParam(value = "Model Content", required = true) String json) {
try {
FileCommonUtils.write(WORKFLOW_JSON_TEMP_FILE_NAME, json);
-
- URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri();
- String processName = "plan_" + UUID.randomUUID().toString();
- // TODO for Nexus-IQ
+
+ // TODO for Nexus-IQ
+// URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri();
+// String processName = "plan_" + UUID.randomUUID().toString();
// String bpmn = buildBPMN(srcUri, processName);
// String jsonBpmn = insertJson2Bpmn(json, bpmn);
}
- /**
- * @param json
- * @param bpmn
- * @throws WorkflowDesignerException
- */
- private void save2SDC(String json, String bpmn) throws WorkflowDesignerException {
- WorkflowInfo workflowInfo = JsonUtils.fromJson(json, WorkflowInfo.class);
- WorkflowArtifactInfo workflowArtifactInfo =
- new WorkflowArtifactInfo(workflowInfo.getName(), workflowInfo.getDescription(), bpmn);
-
- SDCServiceProxy sdcProxy = new SDCServiceProxy();
- sdcProxy.saveWorkflowArtifact(workflowInfo.getUuid(), workflowInfo.getOperationId(),
- workflowInfo.getId(), workflowArtifactInfo);
- }
+// /**
+// * @param json
+// * @param bpmn
+// * @throws WorkflowDesignerException
+// */
+// private void save2SDC(String json, String bpmn) throws WorkflowDesignerException {
+// WorkflowInfo workflowInfo = JsonUtils.fromJson(json, WorkflowInfo.class);
+// WorkflowArtifactInfo workflowArtifactInfo =
+// new WorkflowArtifactInfo(workflowInfo.getName(), workflowInfo.getDescription(), bpmn);
+//
+// SDCServiceProxy sdcProxy = new SDCServiceProxy();
+// sdcProxy.saveWorkflowArtifact(workflowInfo.getUuid(), workflowInfo.getOperationId(),
+// workflowInfo.getId(), workflowArtifactInfo);
+// }
/**
*
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.hibernate.validator.constraints.NotEmpty;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+/**\r
+ *\r
+ */\r
+public class SDCServiceProxyInfoTest {\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @Before\r
+ public void setUp() throws Exception {}\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @After\r
+ public void tearDown() throws Exception {}\r
+\r
+ @Test\r
+ public void test() {\r
+ String serviceAddr = "serviceAddr";\r
+ String xEcompInstanceId = "xEcompInstanceId";\r
+ String authorization = "authorization";\r
+ \r
+ SDCServiceProxyInfo spi = new SDCServiceProxyInfo();\r
+ spi.setAuthorization(authorization);\r
+ spi.setServiceAddr(serviceAddr);\r
+ spi.setxEcompInstanceId(xEcompInstanceId);\r
+ \r
+ assertEquals(authorization, spi.getAuthorization());\r
+ assertEquals(serviceAddr, spi.getServiceAddr());\r
+ assertEquals(xEcompInstanceId, spi.getxEcompInstanceId());\r
+ }\r
+\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2018 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import javax.validation.constraints.NotNull;\r
+\r
+import org.hibernate.validator.constraints.NotEmpty;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+/**\r
+ *\r
+ */\r
+public class WorkflowDesignerConfigurationTest {\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @Before\r
+ public void setUp() throws Exception {}\r
+\r
+ /**\r
+ * @throws java.lang.Exception\r
+ */\r
+ @After\r
+ public void tearDown() throws Exception {}\r
+\r
+ @Test\r
+ public void test() {\r
+ String template = "template";\r
+ String defaultName = "Workflow Designer";\r
+ SDCServiceProxyInfo sdcServiceProxy = new SDCServiceProxyInfo();\r
+ \r
+ \r
+ WorkflowDesignerConfiguration wdc = new WorkflowDesignerConfiguration();\r
+ wdc.setDefaultName(defaultName);\r
+ wdc.setSdcServiceProxy(sdcServiceProxy);\r
+ wdc.setTemplate(template);\r
+ \r
+ assertEquals(defaultName, wdc.getDefaultName());\r
+ assertEquals(sdcServiceProxy, wdc.getSdcServiceProxy());\r
+ assertEquals(template, wdc.getTemplate());\r
+ }\r
+\r
+}\r
+++ /dev/null
-/**\r
- * Copyright (c) 2017-2018 ZTE Corporation.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the Apache License, Version 2.0\r
- * and the Eclipse Public License v1.0 which both accompany this distribution,\r
- * and are available at http://www.eclipse.org/legal/epl-v10.html\r
- * and http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Contributors:\r
- * ZTE - initial API and implementation and/or initial documentation\r
- */\r
-package org.onap.sdc.workflowdesigner.convert;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.File;\r
-import java.net.URI;\r
-import java.nio.file.Paths;\r
-\r
-import org.apache.velocity.exception.ParseErrorException;\r
-import org.apache.velocity.exception.ResourceNotFoundException;\r
-import org.junit.Test;\r
-import org.onap.sdc.workflowdesigner.converter.Bpmn4Tosca2Bpmn;\r
-\r
-public class BPMN4Tosca2BpmnTest {\r
- private static String RESOURCES_DIR = "src/test/resources/workflow";\r
-\r
- @Test\r
- public void testTransform() throws ResourceNotFoundException, ParseErrorException, Exception {\r
-\r
- URI srcUri = Paths.get(RESOURCES_DIR, "workflow.json").toUri();\r
- URI targetUri = Paths.get(RESOURCES_DIR, "bpmnworkflow.bpmn20.xml").toUri();\r
- BPMN4Tosca2BpmnTest.class.getResource(".");\r
- Bpmn4Tosca2Bpmn transformer = new Bpmn4Tosca2Bpmn();\r
-// transformer.transform("transformTest", srcUri, targetUri);\r
-// assertTrue(new File(targetUri.getPath()).exists());\r
- // TODO for Nexus-IQ\r
- }\r
-\r
-}\r