diff options
Diffstat (limited to 'deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity')
9 files changed, 522 insertions, 0 deletions
diff --git a/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryDataTest.java new file mode 100644 index 00000000..590432fd --- /dev/null +++ b/deprecated-workflow-designer/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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java new file mode 100644 index 00000000..8458fc5e --- /dev/null +++ b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ContentTest.java @@ -0,0 +1,73 @@ +/** + * 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; +import org.onap.sdc.workflowdesigner.utils.JsonUtils; + +/** + * + */ +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<String, InputOutput> inputs = new HashMap<String, InputOutput>(); + Map<String, InputOutput> outputs = new HashMap<String, InputOutput>(); + + 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()); + } + + @Test + public void testGson() { + String json = "{\r\n" + + " \"class\": \"aaaa\",\r\n" + + " \"inputs\": {}\r\n" + + " }"; + Content content = JsonUtils.fromJson(json, Content.class); + assertNotNull(content); + } + +} diff --git a/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfoTest.java new file mode 100644 index 00000000..6c26ec75 --- /dev/null +++ b/deprecated-workflow-designer/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<String, NodeCategory> nodes = new HashMap<>(); + Map<String, CategoryData> categoryData = new HashMap<>(); + + ExtActivityDisplayInfo ed = new ExtActivityDisplayInfo(); + ed.setCategoryData(categoryData); + ed.setNodes(nodes); + + assertEquals(categoryData, ed.getCategoryData()); + assertEquals(nodes, ed.getNodes()); + } + +} diff --git a/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/ExtendActivityTest.java new file mode 100644 index 00000000..aca66b0f --- /dev/null +++ b/deprecated-workflow-designer/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(); + + ExtActivity ea = new ExtActivity(); + 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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/I18nStringTest.java new file mode 100644 index 00000000..f72a10b3 --- /dev/null +++ b/deprecated-workflow-designer/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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/IconDataTest.java new file mode 100644 index 00000000..dae22c03 --- /dev/null +++ b/deprecated-workflow-designer/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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutputTest.java new file mode 100644 index 00000000..f453088d --- /dev/null +++ b/deprecated-workflow-designer/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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategoryTest.java new file mode 100644 index 00000000..2342d43d --- /dev/null +++ b/deprecated-workflow-designer/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/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java b/deprecated-workflow-designer/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfoTest.java new file mode 100644 index 00000000..488a744c --- /dev/null +++ b/deprecated-workflow-designer/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()); + } + +} |