From 0e813dd358952d25d49de4833d09964dba5e42a0 Mon Sep 17 00:00:00 2001 From: YuanHu Date: Tue, 27 Mar 2018 21:18:46 +0800 Subject: Add Unit Test Add Unit Test Issue-ID: SDC-1078 Change-Id: Ie61cfdc3865420da259260c98bc02dca8263c412 Signed-off-by: YuanHu --- .../sdc/workflowdesigner/SDCServiceProxyInfo.java | 2 - .../externalservice/sdc/entity/Parameter.java | 4 +- .../resources/entity/InputOutput.java | 4 +- .../sdc/entity/ActivityContentTest.java | 56 ++++++++++++++++ .../sdc/entity/ActivitySpecTest.java | 74 ++++++++++++++++++++++ .../externalservice/sdc/entity/ParameterTest.java | 59 +++++++++++++++++ .../sdc/entity/WorkflowArtifactInfoTest.java | 57 +++++++++++++++++ .../sdc/workflowdesigner/model/DataObjectTest.java | 53 ++++++++++++++++ .../sdc/workflowdesigner/model/ElementTest.java | 30 +++++++++ .../workflowdesigner/model/ErrorEndEventTest.java | 47 ++++++++++++++ .../sdc/workflowdesigner/model/ParameterTest.java | 69 ++++++++++++++++++++ .../sdc/workflowdesigner/model/PositionTest.java | 50 +++++++++++++++ .../sdc/workflowdesigner/model/ProcessTest.java | 62 ++++++++++++++++++ .../model/RestServiceTaskTest.java | 71 +++++++++++++++++++++ .../sdc/workflowdesigner/model/ScriptTaskTest.java | 50 +++++++++++++++ .../workflowdesigner/model/SequenceFlowTest.java | 62 ++++++++++++++++++ .../workflowdesigner/model/ServiceTaskTest.java | 56 ++++++++++++++++ .../model/TimerEventDefinitionTest.java | 56 ++++++++++++++++ .../resources/entity/CategoryDataTest.java | 50 +++++++++++++++ .../resources/entity/ContentTest.java | 62 ++++++++++++++++++ .../entity/ExtActivityDisplayInfoTest.java | 53 ++++++++++++++++ .../resources/entity/ExtendActivityTest.java | 63 ++++++++++++++++++ .../resources/entity/I18nStringTest.java | 49 ++++++++++++++ .../resources/entity/IconDataTest.java | 53 ++++++++++++++++ .../resources/entity/InputOutputTest.java | 67 ++++++++++++++++++++ .../resources/entity/NodeCategoryTest.java | 47 ++++++++++++++ .../resources/entity/WorkflowInfoTest.java | 67 ++++++++++++++++++++ .../utils/entity/CommonErrorResponseTest.java | 51 +++++++++++++++ 28 files changed, 1418 insertions(+), 6 deletions(-) create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContentTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpecTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ParameterTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfoTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/DataObjectTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ErrorEndEventTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ParameterTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/PositionTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ProcessTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/RestServiceTaskTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ScriptTaskTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/SequenceFlowTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ServiceTaskTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinitionTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java create mode 100644 sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponseTest.java diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java index e8507101..caa88576 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java @@ -11,8 +11,6 @@ */ package org.onap.sdc.workflowdesigner; -import javax.validation.constraints.NotNull; - import org.hibernate.validator.constraints.NotEmpty; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java index cce803b8..8a1aaf14 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java @@ -57,14 +57,14 @@ public class Parameter { /** * @return the defaultValue */ - public String getDefaultValue() { + public String getDefault() { return defaultValue; } /** * @param defaultValue the defaultValue to set */ - public void setDefaultValue(String defaultValue) { + public void setDefault(String defaultValue) { this.defaultValue = defaultValue; } diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java index 04736225..60ab4c78 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java @@ -50,14 +50,14 @@ public class InputOutput { /** * @return the defaultValue */ - public String getDefaultValue() { + public String getDefault() { return defaultValue; } /** * @param defaultValue the defaultValue to set */ - public void setDefaultValue(String defaultValue) { + public void setDefault(String defaultValue) { this.defaultValue = defaultValue; } diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContentTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContentTest.java new file mode 100644 index 00000000..2ede2611 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContentTest.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.externalservice.sdc.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ActivityContentTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + /** + * Test method for {@link java.lang.Object#toString()}. + */ + @Test + public void testToString() { + String clazz = "clazz"; + String script = "script"; + String scriptFormat = "scriptFormat"; + + ActivityContent ac = new ActivityContent(); + ac.setClazz(clazz); + ac.setScript(script); + ac.setScriptFormat(scriptFormat ); + + assertEquals(clazz, ac.getClazz()); + assertEquals(script, ac.getScript()); + assertEquals(scriptFormat, ac.getScriptFormat()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpecTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpecTest.java new file mode 100644 index 00000000..aff131ff --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpecTest.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.externalservice.sdc.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ActivitySpecTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String id = ""; + String versionId = ""; + String name = ""; + String description = ""; + String type = ""; + ActivityContent content = new ActivityContent(); + String[] categoryList = new String[]{"aaa"}; + Parameter[] inputs = new Parameter[0]; + Parameter[] outputs = new Parameter[0]; + String status = "status"; + + ActivitySpec as = new ActivitySpec(); + as.setId(id); + as.setVersionId(versionId); + as.setName(name); + as.setDescription(description); + as.setType(type); + as.setContent(content); + as.setCategoryList(categoryList); + as.setInputs(inputs); + as.setOutputs(outputs); + as.setStatus(status); + + assertEquals(id, as.getId()); + assertEquals(versionId, as.getVersionId()); + assertEquals(name, as.getName()); + assertEquals(description, as.getDescription()); + assertEquals(type, as.getType()); + assertEquals(content, as.getContent()); + assertEquals(categoryList, as.getCategoryList()); + assertEquals(inputs, as.getInputs()); + assertEquals(outputs, as.getOutputs()); + assertEquals(status, as.getStatus()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ParameterTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ParameterTest.java new file mode 100644 index 00000000..ce034102 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ParameterTest.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.externalservice.sdc.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.google.gson.annotations.SerializedName; + +/** + * + */ +public class ParameterTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String name = "name"; + String type = "type"; + String defaultValue = "defaultValue"; + String value = "value"; + + Parameter p = new Parameter(); + p.setDefault(defaultValue); + p.setName(name); + p.setType(type); + p.setValue(value); + + assertEquals(name, p.getName()); + assertEquals(type, p.getType()); + assertEquals(defaultValue, p.getDefault()); + assertEquals(value, p.getValue()); + + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfoTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfoTest.java new file mode 100644 index 00000000..a29c55e6 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfoTest.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.externalservice.sdc.entity; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class WorkflowArtifactInfoTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String artifactName = "artifactName"; + String description = "description"; + String artifactType = "WORKFLOW"; + String payloadData = "payloadData"; + + WorkflowArtifactInfo wai = new WorkflowArtifactInfo(artifactName, description, payloadData); + wai.setArtifactName(artifactName); + wai.setArtifactType(artifactType); + wai.setDescription(description); + wai.setPayloadData(payloadData); + + assertEquals(artifactName, wai.getArtifactName()); + assertEquals(description, wai.getDescription()); + assertEquals(artifactType, wai.getArtifactType()); + assertEquals(payloadData, wai.getPayloadData()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/DataObjectTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/DataObjectTest.java new file mode 100644 index 00000000..4f3dbd1d --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/DataObjectTest.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class DataObjectTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String id = "id"; + String name = "name"; + String value = "value"; + + DataObject d = new DataObject(); + d.setId(id); + d.setName(name); + d.setValue(value); + + assertEquals(id, d.getId()); + assertEquals(name, d.getName()); + assertEquals(value, d.getValue()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ElementTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ElementTest.java index 426141d5..520061ed 100644 --- a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ElementTest.java +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ElementTest.java @@ -14,9 +14,13 @@ package org.onap.sdc.workflowdesigner.model; import static org.junit.Assert.assertEquals; +import java.util.ArrayList; +import java.util.List; + import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onap.sdc.workflowdesigner.model.Element.TYPE; /** * @@ -45,5 +49,31 @@ public class ElementTest { System.out.println(endEvent.getType()); assertEquals(endEvent.getType(), null); } + + + @Test + public void test() { + String id = "id"; + String name = "name"; + TYPE type = TYPE.endEvent; + String documentation = "documentation"; + Position position = new Position(); + List connections= new ArrayList<>(); + + Element e = new Element(); + e.setConnections(connections); + e.setDocumentation(documentation); + e.setId(id); + e.setName(name); + e.setPosition(position); + e.setType(type); + + assertEquals(connections, e.getConnections()); + assertEquals(documentation, e.getDocumentation()); + assertEquals(id, e.getId()); + assertEquals(name, e.getName()); + assertEquals(position, e.getPosition()); + assertEquals(type, e.getType()); + } } diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ErrorEndEventTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ErrorEndEventTest.java new file mode 100644 index 00000000..edd0ece6 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ErrorEndEventTest.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ErrorEndEventTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + Parameter parameter = new Parameter(); + + ErrorEndEvent eee = new ErrorEndEvent(); + eee.setParameter(parameter); + + assertEquals(parameter, eee.getParameter()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ParameterTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ParameterTest.java new file mode 100644 index 00000000..aa428bc7 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ParameterTest.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * + */ +public class ParameterTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String description = "description"; + String name = "name"; + String position = "position"; + boolean required = false; + String type = "type"; + Object value = "value"; + String valueSource = "valueSource"; + + Parameter p = new Parameter(); + p.setDescription(description); + p.setName(name); + p.setPosition(position); + p.setRequired(required); + p.setType(type); + p.setValueSource(valueSource); + p.setValue(value); + + assertEquals(description, p.getDescription()); + assertEquals(name, p.getName()); + assertEquals(position, p.getPosition()); + assertEquals(required, p.isRequired()); + assertEquals(type, p.getType()); + assertEquals(valueSource, p.getValueSource()); + assertEquals(value, p.getValue()); + + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/PositionTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/PositionTest.java new file mode 100644 index 00000000..83e826d2 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/PositionTest.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class PositionTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + int left = 100; + int top = 100; + + Position p = new Position(); + p.setLeft(left); + p.setTop(top); + + assertEquals(left, p.getLeft()); + assertEquals(top, p.getTop()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ProcessTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ProcessTest.java new file mode 100644 index 00000000..5073bbe5 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ProcessTest.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ProcessTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String id = "id"; + boolean isExecutable = false; + List elementList = new ArrayList(); + List sequenceFlowList = new ArrayList(); + List dataObjectList = new ArrayList(); + + Process p = new Process(id); + p.setDataObjectList(dataObjectList); + p.setElementList(elementList); + p.setExecutable(isExecutable); + p.setId(id); + p.setSequenceFlowList(sequenceFlowList); + + assertEquals(dataObjectList, p.getDataObjectList()); + assertEquals(elementList, p.getElementList()); + assertEquals(isExecutable, p.isExecutable()); + assertEquals(id, p.getId()); + assertEquals(sequenceFlowList, p.getSequenceFlowList()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/RestServiceTaskTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/RestServiceTaskTest.java new file mode 100644 index 00000000..2d158e9b --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/RestServiceTaskTest.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class RestServiceTaskTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + List produces = new ArrayList<>(); + List consumes = new ArrayList<>(); + List parameters = new ArrayList<>(); + String baseUrl = ""; + String serviceName = ""; + String serviceVersion = ""; + String path = ""; + String method = ""; + + RestServiceTask rst = new RestServiceTask(); + rst.setProduces(produces); + rst.setConsumes(consumes); + rst.setParameters(parameters); + rst.setBaseUrl(baseUrl); + rst.setServiceName(serviceName); + rst.setServiceVersion(serviceVersion); + rst.setPath(path); + rst.setMethod(method); + + assertEquals(produces, rst.getProduces()); + assertEquals(consumes, rst.getConsumes()); + assertEquals(parameters, rst.getParameters()); + assertEquals(baseUrl, rst.getBaseUrl()); + assertEquals(serviceName, rst.getServiceName()); + assertEquals(serviceVersion, rst.getServiceVersion()); + assertEquals(path, rst.getPath()); + assertEquals(method, rst.getMethod()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ScriptTaskTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ScriptTaskTest.java new file mode 100644 index 00000000..2323ffc2 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ScriptTaskTest.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ScriptTaskTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String scriptFormat = "scriptFormat"; + String script = "script"; + + ScriptTask st = new ScriptTask(); + st.setScript(script); + st.setScriptFormat(scriptFormat); + + assertEquals(scriptFormat, st.getScriptFormat()); + assertEquals(script, st.getScript()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/SequenceFlowTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/SequenceFlowTest.java new file mode 100644 index 00000000..7f613c1c --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/SequenceFlowTest.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class SequenceFlowTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String id = "id"; + String name = "name"; + String sourceRef = "sourceRef"; + String targetRef = "targetRef"; + String documentation = "documentation"; + String condition = "condition"; + + SequenceFlow sf = new SequenceFlow(); + sf.setCondition(condition); + sf.setDocumentation(documentation); + sf.setId(id); + sf.setName(name); + sf.setSourceRef(sourceRef); + sf.setTargetRef(targetRef); + + assertEquals(condition, sf.getCondition()); + assertEquals(documentation, sf.getDocumentation()); + assertEquals(id, sf.getId()); + assertEquals(name, sf.getName()); + assertEquals(sourceRef, sf.getSourceRef()); + assertEquals(targetRef, sf.getTargetRef()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ServiceTaskTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ServiceTaskTest.java new file mode 100644 index 00000000..a58fd586 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/ServiceTaskTest.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ServiceTaskTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String className = "className"; + List inputs = new ArrayList<>(); + List outputs = new ArrayList<>(); + + ServiceTask st = new ServiceTask(); + st.setClassName(className); + st.setInputs(inputs); + st.setOutputs(outputs); + + assertEquals(className, st.getClassName()); + assertEquals(inputs, st.getInputs()); + assertEquals(outputs, st.getOutputs()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinitionTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinitionTest.java new file mode 100644 index 00000000..b17a4820 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinitionTest.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.model; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class TimerEventDefinitionTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String type = "type"; + String timeDuration = "timeDuration"; + String timeDate = "timeDate"; + String timeCycle = "timeCycle"; + + TimerEventDefinition ted = new TimerEventDefinition(); + ted.setType(type); + ted.setTimeDate(timeDate); + ted.setTimeDuration(timeDuration); + ted.setTimeCycle(timeCycle); + + assertEquals(type, ted.getType()); + assertEquals(timeDate, ted.getTimeDate()); + assertEquals(timeDuration, ted.getTimeDuration()); + assertEquals(timeCycle, ted.getTimeCycle()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java new file mode 100644 index 00000000..c42f4d0c --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class CategoryDataTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + I18nString displayName = new I18nString(); + boolean collapse = false; + + CategoryData cd = new CategoryData(); + cd.setDisplayName(displayName); + cd.setCollapse(collapse); + + assertEquals(false, cd.isCollapse()); + assertEquals(displayName, cd.getDisplayName()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java new file mode 100644 index 00000000..58738bc0 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ContentTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String clazz = "clazz"; + String script = "script"; + String scriptFormat = "scriptFormat"; + Map inputs = new HashMap(); + Map outputs = new HashMap(); + + Content c = new Content(); + c.setClass(clazz); + c.setInputs(inputs); + c.setOutputs(outputs); + c.setScript(script); + c.setScriptFormat(scriptFormat); + + assertEquals(clazz, c.getClazz()); + assertEquals(inputs, c.getInputs()); + assertEquals(outputs, c.getOutputs()); + assertEquals(script, c.getScript()); + assertEquals(scriptFormat, c.getScriptFormat()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java new file mode 100644 index 00000000..f7112715 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ExtActivityDisplayInfoTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + Map nodes = new HashMap<>(); + Map categoryData = new HashMap<>(); + + ExtActivityDisplayInfo ed = new ExtActivityDisplayInfo(); + ed.setCategoryData(categoryData); + ed.setNodes(nodes); + + assertEquals(categoryData, ed.getCategoryData()); + assertEquals(nodes, ed.getNodes()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java new file mode 100644 index 00000000..e8fa1e75 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class ExtendActivityTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String id = ""; + I18nString displayName = new I18nString(); + I18nString description = new I18nString(); + String type = ""; + IconData icon = new IconData(); + Content content = new Content(); + + ExtendActivity ea = new ExtendActivity(); + ea.setContent(content); + ea.setDescription(description); + ea.setDisplayName(displayName); + ea.setIcon(icon); + ea.setId(id); + ea.setType(type); + + assertEquals(content, ea.getContent()); + assertEquals(description, ea.getDescription()); + assertEquals(displayName, ea.getDisplayName()); + assertEquals(icon, ea.getIcon()); + assertEquals(id, ea.getId()); + assertEquals(type, ea.getType()); + + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java new file mode 100644 index 00000000..b9ead1c3 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class I18nStringTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String en_US = "en_US"; + String zh_CN = "zh_CN"; + I18nString i18n = new I18nString(en_US, zh_CN); + i18n.setEn_US(en_US); + i18n.setZh_CN(zh_CN); + + assertEquals(en_US, i18n.getEn_US()); + assertEquals(zh_CN, i18n.getZh_CN()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java new file mode 100644 index 00000000..148d3ad0 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class IconDataTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String name = "name"; + int width = 100; + int height= 10; + + IconData id = new IconData(); + id.setHeight(height); + id.setName(name); + id.setWidth(width); + + assertEquals(height, id.getHeight()); + assertEquals(name, id.getName()); + assertEquals(width, id.getWidth()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java new file mode 100644 index 00000000..7220145d --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.google.gson.annotations.SerializedName; + +/** + * + */ +public class InputOutputTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String type = ""; + String defaultValue = ""; + boolean required = false; + I18nString displayName = new I18nString(); + boolean show = true; + boolean editable = true; + String value = ""; + + InputOutput io = new InputOutput(); + io.setDefault(defaultValue); + io.setDisplayName(displayName); + io.setEditable(editable); + io.setRequired(required); + io.setShow(show); + io.setType(type); + io.setValue(value); + + assertEquals(defaultValue, io.getDefault()); + assertEquals(displayName, io.getDisplayName()); + assertEquals(editable, io.isEditable()); + assertEquals(required, io.isRequired()); + assertEquals(show, io.isShow()); + assertEquals(type, io.getType()); + assertEquals(value, io.getValue()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java new file mode 100644 index 00000000..8bc678f6 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class NodeCategoryTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String category = "category"; + + NodeCategory nc = new NodeCategory(); + nc.setCategory(category); + + assertEquals(category, nc.getCategory()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java new file mode 100644 index 00000000..22b951e1 --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.resources.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.google.gson.JsonObject; + +/** + * + */ +public class WorkflowInfoTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @Test + public void test() { + String uuid = ""; + String operationId = ""; + String id = ""; + String name = ""; + String description = ""; + String scene = ""; + JsonObject data =new JsonObject(); + + WorkflowInfo wi = new WorkflowInfo(); + wi.setData(data); + wi.setDescription(description); + wi.setId(id); + wi.setName(name); + wi.setOperationId(operationId); + wi.setScene(scene); + wi.setUuid(uuid); + + assertEquals(data, wi.getData()); + assertEquals(description, wi.getDescription()); + assertEquals(id, wi.getId()); + assertEquals(name, wi.getName()); + assertEquals(operationId, wi.getOperationId()); + assertEquals(scene, wi.getScene()); + assertEquals(uuid, wi.getUuid()); + } + +} diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponseTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponseTest.java new file mode 100644 index 00000000..5292521b --- /dev/null +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponseTest.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the Apache License, Version 2.0 + * and the Eclipse Public License v1.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.utils.entity; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + */ +public class CommonErrorResponseTest { + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + /** + * Test method for {@link org.onap.sdc.workflowdesigner.utils.entity.CommonErrorResponse#failure(java.lang.String)}. + */ + @Test + public void testFailure() { + String code = "code"; + String message = "message"; + CommonErrorResponse errorResponse = new CommonErrorResponse(code); + errorResponse.setCode(code); + errorResponse.setMessage(message); + assertEquals(code, errorResponse.getCode()); + assertEquals(message, errorResponse.getMessage()); + } + +} -- cgit 1.2.3-korg