diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-30 15:56:09 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-31 11:09:25 -0400 |
commit | 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch) | |
tree | 59a968f27b4b603aacc9d5e7b51fb598aeec5321 /bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso | |
parent | b6dc38501f3b746426b42d9de4cc883d894149e8 (diff) |
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18
Issue-ID: SO-670
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso')
28 files changed, 0 insertions, 2190 deletions
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java deleted file mode 100644 index 1086cc75ef..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/HealthCheckHandlerTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; - -public class HealthCheckHandlerTest { - - HealthCheckHandler healthCheckHandler = new HealthCheckHandler(); - - @Test - public void nodeHealthcheck() throws Exception { - healthCheckHandler.nodeHealthcheck(); - } - - @Test - public void healthcheck() throws Exception { - healthCheckHandler.healthcheck("test-123"); - } - -}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java deleted file mode 100644 index 9643db7834..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java +++ /dev/null @@ -1,356 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core; - - - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; - -import org.json.JSONObject; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.bpmn.core.xml.XmlTool; -import org.xmlunit.builder.DiffBuilder; -import org.xmlunit.diff.DefaultNodeMatcher; -import org.xmlunit.diff.Diff; -import org.xmlunit.diff.ElementSelectors; - -/** - * @version 1.0 - */ -public class JsonUtilsTest { - - private static final String EOL = "\n"; - private static final String XML_REQ = - "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + - " <request-info>" + EOL + - " <request-id>DEV-VF-0021</request-id>" + EOL + - " <action>CREATE_VF_MODULE</action>" + EOL + - " <source>PORTAL</source>" + EOL + - " </request-info>" + EOL + - " <vnf-inputs>" + EOL + - " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL + - " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + - " <vnf-type>asc_heat-int</vnf-type>" + EOL + - " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL + - " <vf-module-model-name>STMTN5MMSC21-MMSC::model-1-0</vf-module-model-name>" + EOL + - " <is-base-module>true</is-base-module>" + EOL + - " <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id>" + EOL + - " <persona-model-version>1.0</persona-model-version>" + EOL + - " <vnf-persona-model-id>999999999-0000-0000-0000-000000000000</vnf-persona-model-id>" + EOL + - " <vnf-persona-model-version>1.5</vnf-persona-model-version>" + EOL + - " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL + - " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL + - " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL + - " <orchestration-status>pending-delete</orchestration-status>" + EOL + - " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL + - " <asdc-service-model-version>1</asdc-service-model-version>" + EOL + - " </vnf-inputs>" + EOL + - " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + - " <param name=\"network\">network1111</param>" + EOL + - " <param name=\"server\">server1111</param>" + EOL + - " </vnf-params> " + EOL + - "</vnf-request>" + EOL; - - private static final String XML_REQ_NO_ATTRS = - "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + - " <request-info>" + EOL + - " <action>DELETE_VF_MODULE</action>" + EOL + - " <source>PORTAL</source>" + EOL + - " </request-info>" + EOL + - " <vnf-inputs>" + EOL + - " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL + - " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + - " <vnf-type>asc_heat-int</vnf-type>" + EOL + - " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL + - " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL + - " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL + - " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL + - " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL + - " <orchestration-status>pending-delete</orchestration-status>" + EOL + - " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL + - " </vnf-inputs>" + EOL + - " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL + - "</vnf-request>" + EOL; - - private static final String XML_ARRAY_REQ = - "<ucpeInfo>" + EOL + - " <outOfBandManagementModem>BROADBAND</outOfBandManagementModem>" + EOL + - " <internetTopology>IVLAN</internetTopology>" + EOL + - " <ucpeAliasHostName>SHELLUCPE31</ucpeAliasHostName>" + EOL + - " <wanList>" + EOL + - " <wanInfo>" + EOL + - " <wanType>AVPN</wanType>" + EOL + - " <interfaceType>1000BASE-T</interfaceType>" + EOL + - " <transportProviderName>ATT</transportProviderName>" + EOL + - " <circuitId>BT/SLIR/70911</circuitId>" + EOL + - " <dualMode>Active</dualMode>" + EOL + - " <wanPortNumber>WAN1</wanPortNumber>" + EOL + - " <transportManagementOption>ATT</transportManagementOption>" + EOL + - " <transportVendorTotalBandwidth>100</transportVendorTotalBandwidth>" + EOL + - " <mediaType>ELECTRICAL</mediaType>" + EOL + - " </wanInfo>" + EOL + - " <wanInfo>" + EOL + - " <wanType>AVPN</wanType>" + EOL + - " <interfaceType>10/100/1000BASE-T</interfaceType>" + EOL + - " <transportProviderName>ATT</transportProviderName>" + EOL + - " <circuitId>AS/KRFN/34611</circuitId>" + EOL + - " <dualMode>Active</dualMode>" + EOL + - " <wanPortNumber>WAN2</wanPortNumber>" + EOL + - " <transportManagementOption>ATT</transportManagementOption>" + EOL + - " <transportVendorTotalBandwidth>10000</transportVendorTotalBandwidth>" + EOL + - " <mediaType>MMF</mediaType>" + EOL + - " </wanInfo>" + EOL + - " </wanList>" + EOL + - " <ucpeActivationCode>ASD-987-M31</ucpeActivationCode>" + EOL + - " <ucpeHostName>USOSTCDALTX0101UJZZ31</ucpeHostName>" + EOL + - " <ucpePartNumber>FG-VM00*</ucpePartNumber>" + EOL + - "</ucpeInfo>"; - - // JSON request w/ embedded XML will be read from a file - private static String jsonReq; - private static String jsonReqArray; - - @BeforeClass - public static void initialize() throws Exception { - jsonReq = readFileToString("src/test/resources/request.json"); - jsonReqArray = readFileToString("src/test/resources/requestArray.json"); - } - - private static String readFileToString(String path) throws IOException { - File file = new File(path); - return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); - } - - @Test - public void shouldConvertXmlToJsonAndBackToSameXml() throws Exception { - // Note: the current version of the JsonUtils.json2xml() method - // does not support converting the JSONObject representation - // of XML attributes (JSONArray) back to XML. So this test will - // only succeed if the original XML does not contain attributes - - // given - String xmlIn = XmlTool.removeNamespaces(XML_REQ_NO_ATTRS); - // when - String json = JsonUtils.xml2json(XML_REQ_NO_ATTRS); - String xmlOut = JsonUtils.json2xml(json); - // then - Diff diffXml = DiffBuilder.compare(xmlIn).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - public void shouldReadValuesForAbsoluteJsonPaths() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name")).isEqualTo("STMTN5MMSC21"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.request-info.action")).isEqualTo("CREATE_VF_MODULE"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version")).isEqualTo("1"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version")).isEqualTo("1.5"); - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module")).isEqualTo("true"); - } - - @Test - public void shouldReturnValueForJsonKey() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValueForKey(json, "source")).isEqualTo("PORTAL"); - } - - @Test - public void shouldReturnNullForNonexistentJsonNode() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValueForKey(json, "nonexistent-node")).isNull(); - } - - @Test - public void shouldReturnNullForNonExistentParameter() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad")).isNull(); - } - - @Test - public void shouldGetJasonParametersFromArray() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - // when, then - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name")).isEqualTo("network"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content")) - .isEqualTo("network1111"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 1)).isEqualTo("server"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content", 1)) - .isEqualTo("server1111"); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam")) - .withFailMessage("Expected null for nonexistent param").isNull(); - assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2)) - .withFailMessage("Expected null for index out of bound").isNull(); - } - - @Test - public void shouldAddJsonValue() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.request-info.comment"; - String value = "Some comment"; - // when - String jsonUpd = JsonUtils.addJsonValue(json, key, value); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isEqualTo(value); - } - - @Test - public void shouldIgnoreAddIfFieldAlreadyExists() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String newValue = "STMTN5MMSC22"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.addJsonValue(json, key, newValue); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isEqualTo(oldValue).isNotEqualTo(newValue); - } - - @Test - public void shouldUpdateValueInJson() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String newValue = "STMTN5MMSC22"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.updJsonValue(json, key, newValue); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isNotEqualTo(oldValue).isEqualTo(newValue); - } - - @Test - public void shouldDeleteValue() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.vnf-name"; - String oldValue = JsonUtils.getJsonValue(json, key); - // when - String jsonUpd = JsonUtils.delJsonValue(json, key); - // then - String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); - assertThat(extractedValue).isNotEqualTo(oldValue).isNull(); - JSONObject jsonObj = new JSONObject(json); - Integer intValue = JsonUtils.getJsonIntValueForKey(jsonObj, "persona-model-version"); - Assert.assertTrue(intValue == 1); - Boolean boolValue = JsonUtils.getJsonBooleanValueForKey(jsonObj, "is-base-module"); - Assert.assertTrue(boolValue); - } - - @Test - public void shouldReturnOriginalJsonWhenTryingToRemoveNonexistentField() throws Exception { - // given - String json = JsonUtils.xml2json(XML_REQ); - String key = "vnf-request.vnf-inputs.does-not-exist"; - // when - String jsonUpd = JsonUtils.delJsonValue(json, key); - // then - assertThat(jsonUpd).isEqualTo(json); - } - - @Test - public void shouldConvertXmlToJsonAndBackToSameXmlExtractedFromTheRequest() throws Exception { - // given - String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); - String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); - // when - String json = JsonUtils.xml2json(xmlReq); - String xmlOut = JsonUtils.json2xml(json); - // then - Diff diffXml = DiffBuilder.compare(xmlReq).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - public void shouldConvertJsonContainingArrayToXml() throws Exception { - // when - String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); - String xmlOut = JsonUtils.json2xml(jsonParm); - // then - Diff diffXml = DiffBuilder.compare(XML_ARRAY_REQ).withTest(xmlOut).ignoreWhitespace() - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); - assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - - @Test - // Tests the jsonSchemaValidation() method - public void testJsonSchemaValidation() { - try { - String myReqArray = jsonReqArray; - String result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); - System.out.println("Schema Validation Result: " + result); - Assert.assertTrue(result.contains("success")); - // remove a required parameter from the JSON doc so that validation fails - myReqArray = JsonUtils.delJsonValue(myReqArray, "requestDetails.requestParameters.ucpeInfo.ucpeHostName"); - result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); - System.out.println("Schema Validation Result: " + result); - Assert.assertTrue(result.contains("failure")); - Assert.assertTrue(result.contains("error: object has missing required properties ([\"ucpeHostName\"])")); - } catch (ValidationException e) { - e.printStackTrace(); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java deleted file mode 100644 index 57a512891f..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core; - -import java.io.IOException; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - - -public class PropertyConfigurationTest { - @Before - public void beforeTest() throws IOException { - PropertyConfiguration.resetPropertyConfigurationSingletonInstance(); - - Map<String, String> defaultProperties = PropertyConfigurationSetup.createBpmnProperties(); - defaultProperties.put("testValue", "testKey"); - PropertyConfigurationSetup.init(defaultProperties); - } - - @Test - public void testPropertyFileWatcher() throws InterruptedException, IOException { - Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning()); - } - - @Test - public void testPropertyLoading() throws IOException, InterruptedException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(props); - Assert.assertEquals("testValue", props.get("testKey")); - } - - @Test - public void testPropertyReload() throws IOException, InterruptedException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map<String,String> properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(properties); - Assert.assertEquals("testValue", properties.get("testKey")); - - Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties(); - newProperties.put("newKey", "newValue"); - PropertyConfigurationSetup.addProperties(newProperties, 10000); - - // Reload and check for the new value - properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(properties); - Assert.assertEquals("newValue", properties.get("newKey")); - } - - @Test(expected=IllegalArgumentException.class) - public void testPropertyFileDoesNotExists_NotIntheList() throws IOException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - propertyConfiguration.getProperties("badfile.properties"); - Assert.fail("Expected IllegalArgumentException"); - } - - @Test(expected=java.lang.UnsupportedOperationException.class) - public void testPropertyModificationException() throws IOException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); - Assert.assertNotNull(props); - Assert.assertEquals("testValue", props.get("testKey")); - props.put("newKey", "newvalue"); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java deleted file mode 100644 index c51af23e30..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - -import org.junit.Test; - -public class RollbackDataTest { - - private final static String TYPE_A = "typeA"; - private final static String TYPE_B = "typeB"; - private static final String KEY_1 = "key1"; - private static final String VALUE_1 = "value1"; - private static final String VALUE_2 = "value2"; - - @Test - public void shouldReturnStringRepresentationOfDataInAnyPermutation() throws Exception { - // given - RollbackData data = new RollbackData(); - data.put(TYPE_A, KEY_1, VALUE_1); - data.put(TYPE_A, "key2", "value2"); - data.put(TYPE_B, "key3", "value3"); - // when, then - assertThat(data.toString()).isIn( - "[typeB{key3=value3},typeA{key1=value1, key2=value2}]", - "[typeB{key3=value3},typeA{key2=value2, key1=value1}]", - "[typeA{key1=value1, key2=value2},typeB{key3=value3}]", - "[typeA{key2=value2, key1=value1},typeB{key3=value3}]"); - } - - @Test - public void shouldBeEmptyOnCreation() throws Exception { - // given - RollbackData data = new RollbackData(); - // then - assertThat(data.hasType(TYPE_A)).isFalse(); - assertThat(data.get(TYPE_A, KEY_1)).isNull(); - } - - @Test - public void shouldHaveTypeAfterPuttingDataOfThatType() throws Exception { - // given - RollbackData data = new RollbackData(); - // when - data.put(TYPE_A, KEY_1, VALUE_1); - // then - assertThat(data.hasType(TYPE_A)).isTrue(); - assertThat(data.hasType(TYPE_B)).isFalse(); - assertThat(data.get(TYPE_A, KEY_1)).isEqualTo(VALUE_1); - } - - @Test - public void shouldKeepTwoValuesWithSameKeysButDifferentTypes() throws Exception { - // given - RollbackData data = new RollbackData(); - // when - data.put(TYPE_A, KEY_1, VALUE_1); - data.put(TYPE_B, KEY_1, VALUE_2); - // then - assertThat(data.get(TYPE_A, KEY_1)).isEqualTo(VALUE_1); - assertThat(data.get(TYPE_A)).containsExactly(entry(KEY_1, VALUE_1)); - assertThat(data.get(TYPE_B, KEY_1)).isEqualTo(VALUE_2); - assertThat(data.get(TYPE_B)).containsExactly(entry(KEY_1, VALUE_2)); - } -}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java deleted file mode 100644 index 1346fde674..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java +++ /dev/null @@ -1,271 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core; - -import static org.junit.Assert.assertNotNull; - -import java.util.HashMap; -import java.util.Map; - -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.Expression; -import org.camunda.bpm.engine.test.Deployment; -import org.camunda.bpm.engine.test.ProcessEngineRule; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; - -import org.openecomp.mso.bpmn.core.utils.CamundaDBSetup; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Unit test for BaseTask class. - */ -public class TestBaseTask { - - @Rule - public ProcessEngineRule processEngineRule = new ProcessEngineRule(); - - @BeforeClass - public static void setUpClass() { - System.setProperty("mso.config.path", "src/test/resources"); - PropertyConfiguration.resetPropertyConfigurationSingletonInstance(); - } - - @Before - public void beforeTest() throws Exception { - CamundaDBSetup.configure(); - PropertyConfigurationSetup.init(); - } - - @Test - @Deployment(resources={"BaseTaskTest.bpmn"}) - public void shouldInvokeService() { - Map<String, Object> variables = new HashMap<>(); - variables.put("firstName", "Jane"); - variables.put("lastName", "Doe"); - variables.put("age", 25); - variables.put("lastVisit", 1438270117000L); - - RuntimeService runtimeService = processEngineRule.getRuntimeService(); - assertNotNull(runtimeService); - processEngineRule.getTaskService(); - runtimeService.startProcessInstanceByKey("BaseTaskTest", variables); - } - - /** - * Unit test code for BaseTask. - */ - public static class TestTask extends BaseTask { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private Expression existingString; - private Expression nonExistingString; - private Expression existingStringFromVar; - private Expression nonExistingStringFromVar; - - private Expression existingInteger; - private Expression nonExistingInteger; - private Expression existingIntegerFromVar; - private Expression nonExistingIntegerFromVar; - - private Expression existingLong; - private Expression nonExistingLong; - private Expression existingLongFromVar; - private Expression nonExistingLongFromVar; - - private Expression existingOutputVar; - private Expression nonExistingOutputVar; - private Expression existingBadOutputVar; - - public void execute(DelegateExecution execution) throws Exception { - msoLogger.debug("Started executing " + getClass().getSimpleName()); - - /*********************************************************************/ - msoLogger.debug("Running String Field Tests"); - /*********************************************************************/ - - String s = getStringField(existingString, execution, "existingString"); - Assert.assertEquals("Hello World", s); - - try { - s = getStringField(nonExistingString, execution, "nonExistingString"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - s = getOptionalStringField(existingString, execution, "existingString"); - Assert.assertEquals("Hello World", s); - - s = getOptionalStringField(nonExistingString, execution, "nonExistingString"); - Assert.assertEquals(null, s); - - /*********************************************************************/ - msoLogger.debug("Running String Expression Tests"); - /*********************************************************************/ - - s = getStringField(existingStringFromVar, execution, "existingStringFromVar"); - Assert.assertEquals("Jane", s); - - try { - s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar"); - } - } - - s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar"); - Assert.assertEquals("Jane", s); - - s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); - Assert.assertEquals(null, s); - - /*********************************************************************/ - msoLogger.debug("Running Integer Field Tests"); - /*********************************************************************/ - - Integer i = getIntegerField(existingInteger, execution, "existingInteger"); - Assert.assertEquals((Integer)42, i); - - try { - i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger"); - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } - } - - i = getOptionalIntegerField(existingInteger, execution, "existingInteger"); - Assert.assertEquals((Integer)42, i); - - i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Integer Expression Tests"); - /*********************************************************************/ - - i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); - Assert.assertEquals((Integer)25, i); - - try { - i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar"); - } - } - - i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); - Assert.assertEquals((Integer)25, i); - - i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Long Field Tests"); - /*********************************************************************/ - - Long l = getLongField(existingLong, execution, "existingLong"); - Assert.assertEquals((Long)123456789L, l); - - try { - l = getLongField(nonExistingLong, execution, "nonExistingLong"); - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } - } - - l = getOptionalLongField(existingLong, execution, "existingLong"); - Assert.assertEquals((Long)123456789L, l); - - l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong"); - Assert.assertEquals(null, l); - - /*********************************************************************/ - msoLogger.debug("Running Long Expression Tests"); - /*********************************************************************/ - - l = getLongField(existingLongFromVar, execution, "existingLongFromVar"); - Assert.assertEquals((Long)1438270117000L, l); - - try { - l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar"); - } - } - - l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar"); - Assert.assertEquals((Long)1438270117000L, l); - - l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); - Assert.assertEquals(null, i); - - /*********************************************************************/ - msoLogger.debug("Running Output Variable Field Tests"); - /*********************************************************************/ - - String var = getOutputField(existingOutputVar, execution, "existingOutputVar"); - Assert.assertEquals("goodVariable", var); - - try { - var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar"); - Assert.assertEquals("goodVariable", var); - - var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); - Assert.assertEquals(null, var); - - try { - var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar"); - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } catch (Exception e) { - if (!(e instanceof BadInjectedFieldException)) { - Assert.fail("Expected BadInjectedFieldException for nonExistingString"); - } - } - - msoLogger.debug("Finished executing " + getClass().getSimpleName()); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java deleted file mode 100644 index 09720be9b9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class AllottedResourceTest {
- private AllottedResource ar = new AllottedResource();
- TunnelConnect tc = new TunnelConnect();
-
- @Test
- public void testAllottedResource() {
- ar.setAllottedResourceType("allottedResourceType");
- ar.setAllottedResourceRole("allottedResourceRole");
- ar.setProvidingServiceModelName("providingServiceModelName");
- ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid");
- ar.setProvidingServiceModelUuid("providingServiceModelUuid");
- ar.setNfFunction("nfFunction");
- ar.setNfType("nfType");
- ar.setNfRole("nfRole");
- ar.setNfNamingCode("nfNamingCode");
- ar.setOrchestrationStatus("orchestrationStatus");
- ar.setTunnelConnect(tc);
- assertEquals(ar.getAllottedResourceType(), "allottedResourceType");
- assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole");
- assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName");
- assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid");
- assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid");
- assertEquals(ar.getNfFunction(), "nfFunction");
- assertEquals(ar.getNfType(), "nfType");
- assertEquals(ar.getNfRole(), "nfRole");
- assertEquals(ar.getNfNamingCode(), "nfNamingCode");
- assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus");
- assertEquals(ar.getTunnelConnect(), tc);
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java deleted file mode 100644 index 90cb7362cf..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class CompareModelsResultTest {
-
- private CompareModelsResult modelsResult;
- private List<ResourceModelInfo> addedResourceList;
- private List<ResourceModelInfo> deletedResourceList;
- private ResourceModelInfo resourceModelInfo1;
- private ResourceModelInfo resourceModelInfo2;
- private List<String> requestInputs;
-
- @Before
- public void before() {
- resourceModelInfo1 = new ResourceModelInfo();
- resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e");
- resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f");
- resourceModelInfo1.setResourceName("resourceName1");
- resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g");
- resourceModelInfo2 = new ResourceModelInfo();
- resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d");
- resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e");
- resourceModelInfo2.setResourceName("resourceName2");
- resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f");
- }
-
- @Test
- public void testSetAddedResourceList() {
- addedResourceList = new ArrayList<ResourceModelInfo>();
- addedResourceList.add(resourceModelInfo1);
- addedResourceList.add(resourceModelInfo2);
- modelsResult = new CompareModelsResult();
- modelsResult.setAddedResourceList(addedResourceList);
- assertEquals(addedResourceList, modelsResult.getAddedResourceList());
- }
-
- @Test
- public void testSetDeletedResourceList() {
- deletedResourceList = new ArrayList<ResourceModelInfo>();
- deletedResourceList.add(resourceModelInfo1);
- deletedResourceList.add(resourceModelInfo2);
- modelsResult = new CompareModelsResult();
- modelsResult.setDeletedResourceList(deletedResourceList);
- assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());
- }
-
- @Test
- public void testSetRequestInputs() {
- requestInputs = new ArrayList<String>();
- requestInputs.add("requestInput1");
- requestInputs.add("requestInput2");
- modelsResult = new CompareModelsResult();
- modelsResult.setRequestInputs(requestInputs);
- assertEquals(requestInputs, modelsResult.getRequestInputs());
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java deleted file mode 100644 index ecaf601c90..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ConfigResourceTest {
- private ConfigResource configresource = new ConfigResource();{
- configresource.resourceType = ResourceType.CONFIGURATION;
- }
-
- @Test
- public void testConfigResource() {
- configresource.setToscaNodeType("toscaNodeType");
- assertEquals(configresource.getToscaNodeType(), "toscaNodeType");
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java deleted file mode 100644 index df8440addf..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ConfigurationTest {
- private Configuration configuration = new Configuration();
-
- @Test
- public void testConfigurationTest() {
- configuration.setId("id");
- configuration.setName("name");
- configuration.setType("type");
- configuration.setOrchestrationStatus("orchestrationStatus");
- configuration.setTunnelBandwidth("tunnelBandwidth");
- configuration.setVendorAllowedMaxBandwidth("vendorAllowedMaxBandwidth");
- configuration.setResourceVersion("resourceVersion");
- assertEquals(configuration.getId(), "id");
- assertEquals(configuration.getName(), "name");
- assertEquals(configuration.getType(), "type");
- assertEquals(configuration.getOrchestrationStatus(), "orchestrationStatus");
- assertEquals(configuration.getTunnelBandwidth(), "tunnelBandwidth");
- assertEquals(configuration.getVendorAllowedMaxBandwidth(), "vendorAllowedMaxBandwidth");
- assertEquals(configuration.getResourceVersion(), "resourceVersion");
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java deleted file mode 100644 index 1a4e0898ee..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class CustomerTest {
- private Customer customer = new Customer();
-
- @Test
- public void testCustomer() {
- customer.setSubscriptionServiceType("subscriptionServiceType");
- customer.setGlobalSubscriberId("globalSubscriberId");
- assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType");
- assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId");
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java deleted file mode 100644 index e334348b5d..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class HomingSolutionTest {
-
- private HomingSolution homingsolution = new HomingSolution();
- InventoryType inventory = InventoryType.cloud;
- VnfResource vnfresource = new VnfResource();
- License license = new License();
-
- @Test
- public void testHomingSolution() {
- homingsolution.setInventoryType(inventory);
- homingsolution.setRehome(true);
- homingsolution.setServiceInstanceId("serviceInstanceId");
- homingsolution.setCloudOwner("cloudOwner");
- homingsolution.setCloudRegionId("cloudRegionId");
- homingsolution.setAicClli("aicClli");
- homingsolution.setAicVersion("aicVersion");
- homingsolution.setTenant("tenant");
- homingsolution.setVnf(vnfresource);
- homingsolution.setLicense(license);
- assertEquals(homingsolution.getInventoryType(), inventory);
- assertEquals(homingsolution.isRehome(), true);
- assertEquals(homingsolution.getServiceInstanceId(), "serviceInstanceId");
- assertEquals(homingsolution.getCloudOwner(), "cloudOwner");
- assertEquals(homingsolution.getCloudRegionId(), "cloudRegionId");
- assertEquals(homingsolution.getAicClli(), "aicClli");
- assertEquals(homingsolution.getAicVersion(), "aicVersion");
- assertEquals(homingsolution.getTenant(), "tenant");
- assertEquals(homingsolution.getVnf(), vnfresource);
- assertEquals(homingsolution.getLicense(), license);
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java deleted file mode 100644 index 9ed194c455..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.BDDMockito.Then;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-
-//@RunWith(PowerMockRunner.class)
-//@PrepareForTest({License.class})
-public class LicenseTest {
-
- //@Mock
- private License license= new License();
- //@InjectMocks
- //private LicenseTest licenceTest;
- List<String> entitlementPoolList = new ArrayList<String>();
- private List<String> licenseKeyGroupList = new ArrayList<String>();
- //JSONArray array = new JSONArray(entitlementPoolList);
- //JSONArray array1 = new JSONArray(licenseKeyGroupList);
- //@PrepareForTest({License.class})
- Long serialVersionUID = 333L;
-
- @Test
- public void testLicense() {
- license.setEntitlementPoolList(entitlementPoolList);
- license.setLicenseKeyGroupList(licenseKeyGroupList);
- //license.addEntitlementPool("entitlementPoolUuid");
- license.addLicenseKeyGroup("licenseKeyGroupUuid");
- assertEquals(license.getEntitlementPoolList(), entitlementPoolList);
- assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList);
- assert(license.getEntitlementPoolListAsString()!= null);
- assert(license.getLicenseKeyGroupListAsString()!=null);
- license.addEntitlementPool("entitlementPoolUuid");
- //assertEquals(license.getSerialversionuid(), serialVersionUID);
- //assertArrayEquals(license.getSerialversionuid(), serialVersionUID);
- //assert
-
- /*PowerMockito.mockStatic(License.class);
- Mockito.when(License.getSerialversionuid()).thenReturn(getserial());
- assertEquals(License.getSerialversionuid(),"abc");*/
-
- }
- // @Before
- // public void mocksetUp() {
-// Long serialVersionUID = 333L;
-// PowerMockito.mockStatic(License.class);
-// expect (license.getSerialversionuid()).andReturn(serialVersionUID);
-// //PowerMockito.when(license.getSerialversionuid().
-// //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1);
-// }
-
- /*private Long getserial() {
-
- return abc;
- }*/
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java deleted file mode 100644 index 90eb230a4c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ModelInfoTest {
- private ModelInfo modelinfo = new ModelInfo();
-
- @Test
- public void testModelInfo() {
- modelinfo.setModelName("modelName");
- modelinfo.setModelUuid("modelUuid");
- modelinfo.setModelInvariantUuid("modelInvariantUuid");
- modelinfo.setModelVersion("modelVersion");
- modelinfo.setModelCustomizationUuid("modelCustomizationUuid");
- modelinfo.setModelInstanceName("modelInstanceName");
- modelinfo.setModelType("modelType");
- assertEquals(modelinfo.getModelName(), "modelName");
- assertEquals(modelinfo.getModelUuid(), "modelUuid");
- assertEquals(modelinfo.getModelInvariantUuid(), "modelInvariantUuid");
- assertEquals(modelinfo.getModelVersion(), "modelVersion");
- assertEquals(modelinfo.getModelCustomizationUuid(), "modelCustomizationUuid");
- assertEquals(modelinfo.getModelInstanceName(), "modelInstanceName");
- assertEquals(modelinfo.getModelType(), "modelType");
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java deleted file mode 100644 index 58cd45c3f1..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ModuleResourceTest {
- private ModuleResource moduleresource = new ModuleResource();
-
- @Test
- public void testModuleResource() {
-
- moduleresource.setVfModuleName("vfModuleName");
- moduleresource.setHeatStackId("heatStackId");
- moduleresource.setIsBase(true);
- moduleresource.setVfModuleLabel("vfModuleLabel");
- moduleresource.setInitialCount(0);
- moduleresource.setVfModuleType("vfModuleType");
- moduleresource.setHasVolumeGroup(true);
- assertEquals(moduleresource.getVfModuleName(), "vfModuleName");
- assertEquals(moduleresource.getHeatStackId(), "heatStackId");
- assertEquals(moduleresource.getIsBase(), true);
- assertEquals(moduleresource.getVfModuleLabel(), "vfModuleLabel");
- assertEquals(moduleresource.getInitialCount(), 0);
- assertEquals(moduleresource.getVfModuleType(), "vfModuleType");
- assertEquals(moduleresource.isHasVolumeGroup(), true);
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java deleted file mode 100644 index 22e62663c9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class NetworkResourceTest {
- private NetworkResource nr = new NetworkResource();
-
- @Test
- public void testNetworkResource() {
- nr.setNetworkType("networkType");
- nr.setNetworkRole("networkRole");
- nr.setNetworkTechnology("networkTechnology");
- nr.setNetworkScope("networkScope");
- assertEquals(nr.getNetworkType(), "networkType");
- assertEquals(nr.getNetworkRole(), "networkRole");
- assertEquals(nr.getNetworkTechnology(), "networkTechnology");
- assertEquals(nr.getNetworkScope(), "networkScope");
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java deleted file mode 100644 index 215fa3cff9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class OwningEntityTest {
- private OwningEntity oe = new OwningEntity();
-
- @Test
- public void testOwingEntity() {
- oe.setOwningEntityId("owningEntityId");
- oe.setOwningEntityName("owningEntityName");
- assertEquals(oe.getOwningEntityId(), "owningEntityId");
- assertEquals(oe.getOwningEntityName(), "owningEntityName");
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java deleted file mode 100644 index 3a9a53f743..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ProjectTest {
-
- private Project project = new Project();
-
- @Test
- public void testProject() {
- project.setProjectName("projectName");
- assertEquals(project.getProjectName(), "projectName");
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java deleted file mode 100644 index 9a9d41567a..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class RequestTest {
-
- private Request request = new Request();
- ModelInfo model = new ModelInfo();
-
- @Test
- public void testRequest() {
- request.setSdncRequestId("sdncRequestId");
- request.setRequestId("requestId");
- request.setModelInfo(model);
- request.setProductFamilyId("productFamilyId");
- assertEquals(request.getSdncRequestId(), "sdncRequestId");
- assertEquals(request.getRequestId(), "requestId");
- assertEquals(request.getModelInfo(), model);
- assertEquals(request.getProductFamilyId(), "productFamilyId");
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java deleted file mode 100644 index 5eaa60260b..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ResourceDecompositionTest {
-
- private ResourceDecomposition rd = new ResourceDecomposition() {
- private static final long serialVersionUID = 1L;
- };
- ModelInfo model = new ModelInfo();
- ResourceInstance ri = new ResourceInstance();
-
-
-
- @Test
- public void testResourceDecomposition() {
- rd.setModelInfo(model);
- rd.setInstanceData(ri);
- rd.setResourceType("resourceType");
- rd.setResourceInstanceId("newInstanceId");
- rd.setResourceInstanceName("newInstanceName");
- assertEquals(rd.getResourceModel(), model);
- assertEquals(rd.getModelInfo(), model);
- assertEquals(rd.getInstanceData(), ri);
- assertEquals(rd.getResourceInstanceId(), "newInstanceId");
- assertEquals(rd.getResourceInstanceName(), "newInstanceName");
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java deleted file mode 100644 index 8d6b61f4aa..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class ResourceTest {
- private Resource resource = new Resource() {
- private static final long serialVersionUID = 1L;
-
-
- };
- ModelInfo model = new ModelInfo();
- ResourceInstance ri = new ResourceInstance();
- HomingSolution hs = new HomingSolution();
- ResourceType rt = ResourceType.VNF;
- public long concurrencyCounter = 1L;
- long initval = resource.getConcurrencyCounter();
-
- @Test
- public void testResource() {
- resource.setResourceId("resourceId");
- resource.setModelInfo(model);
- resource.setResourceInstance(ri);
- resource.setHomingSolution(hs);
- resource.setCurrentHomingSolution(hs);
- resource.setResourceType(rt);
- resource.setToscaNodeType("toscaNodeType");
- resource.setResourceInstanceId("newInstanceId");
- resource.setResourceInstanceName("newInstanceName");
- resource.incrementConcurrencyCounter();
- assertEquals(resource.getResourceId(), "resourceId");
- assertEquals(resource.getModelInfo(), model);
- assertEquals(resource.getResourceInstance(), ri);
- assertEquals(resource.getHomingSolution(), hs);
- assertEquals(resource.getCurrentHomingSolution(), hs);
- assertEquals(resource.getResourceType(), rt);
- assertEquals(resource.getToscaNodeType(), "toscaNodeType");
- assertEquals(resource.getResourceInstanceId(), "newInstanceId");
- assertEquals(resource.getResourceInstanceName(), "newInstanceName");
- assertEquals(resource.getConcurrencyCounter(), initval+1);
-
-
-
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java deleted file mode 100644 index 58548db23b..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-
-import org.junit.Test;
-
-public class ServiceDecompositionTest {
- private ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo model= new ModelInfo();
- ServiceInstance si= new ServiceInstance();
- Project project= new Project();
- OwningEntity oe= new OwningEntity();
- //VnfResource vnf = new VnfResource();
- List<VnfResource> vnfResources;
- List<NetworkResource> networkResources;
- List<ConfigResource> configResources;
- List<AllottedResource> allottedResources;
- Request request= new Request();
- Customer customer= new Customer();
-
-
- @Test
- public void testServiceDecomposition() {
- sd.setModelInfo(model);
- sd.setServiceInstance(si);
- sd.setProject(project);
- sd.setOwningEntity(oe);
- sd.setServiceVnfs(vnfResources);
- sd.setServiceConfigs(configResources);
- sd.setServiceNetworks(networkResources);
- sd.setServiceAllottedResources(allottedResources);
- sd.setServiceConfigResources(configResources);
- sd.setServiceType("serviceType");
- sd.setServiceRole("serviceRole");
- sd.setRequest(request);
- sd.setCustomer(customer);
- sd.setCallbackURN("callbackURN");
- sd.setSdncVersion("sdncVersion");
- assertEquals(sd.getModelInfo(), model);
- assertEquals(sd.getServiceInstance(), si);
- assertEquals(sd.getProject(), project);
- assertEquals(sd.getOwningEntity(), oe);
- assertEquals(sd.getServiceVnfs(), vnfResources);
- assertEquals(sd.getServiceConfigs(), configResources);
- assertEquals(sd.getServiceNetworks(), networkResources);
- assertEquals(sd.getServiceAllottedResources(), allottedResources);
- assertEquals(sd.getServiceConfigResources(), configResources);
- assertEquals(sd.getRequest(), request);
- assertEquals(sd.getCustomer(), customer);
- assertEquals(sd.getCallbackURN(), "callbackURN");
- assertEquals(sd.getSdncVersion(), "sdncVersion");
-
-
-
-
-
-
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java deleted file mode 100644 index b600fef3fd..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.Map;
-
-import org.junit.Test;
-
-public class ServiceInstanceTest {
-
- private ServiceInstance si= new ServiceInstance();
- Map serviceParams;
- Configuration config= new Configuration();
- ModelInfo model= new ModelInfo();
-
- @Test
- public void testServiceInstance() {
- si.setServiceType("serviceType");
- si.setServiceId("serviceId");
- si.setServiceParams(serviceParams);
- si.setInstanceId("instanceId");
- si.setInstanceName("instanceName");
- si.setOrchestrationStatus("orchestrationStatus");
- si.setConfiguration(config);
- si.setModelInfo(model);
- si.setEnvironmentContext("environmentContext");
- si.setWorkloadContext("workloadContext");
- assertEquals(si.getServiceType(), "serviceType");
- assertEquals(si.getServiceId(), "serviceId");
- assertEquals(si.getServiceParams(), serviceParams);
- assertEquals(si.getInstanceId(), "instanceId");
- assertEquals(si.getInstanceName(), "instanceName");
- assertEquals(si.getOrchestrationStatus(), "orchestrationStatus");
- assertEquals(si.getConfiguration(), config);
- assertEquals(si.getModelInfo(), model);
- assertEquals(si.getEnvironmentContext(), "environmentContext");
- assertEquals(si.getWorkloadContext(), "workloadContext");
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java deleted file mode 100644 index 7e9aef29a6..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class SubscriberTest {
- Subscriber subscriber= new Subscriber("globalId", "name", "commonSiteId");
-
- @Test
- public void testSubscriber() {
- subscriber.setGlobalId("globalId");
- subscriber.setName("name");
- subscriber.setCommonSiteId("commonSiteId");
- assertEquals(subscriber.getGlobalId(), "globalId");
- assertEquals(subscriber.getName(), "name");
- assertEquals(subscriber.getCommonSiteId(), "commonSiteId");
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java deleted file mode 100644 index 2a5639f0ff..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class TunnelConnectTest {
- private TunnelConnect tc= new TunnelConnect();
-
- @Test
- public void testTunnelConnect() {
- tc.setId("id");
- tc.setUpBandwidth("upBandwidth");
- tc.setDownBandwidth("downBandwidth");
- tc.setUpBandwidth2("upBandwidth2");
- tc.setDownBandwidth2("downBandwidth2");
- assertEquals(tc.getId(), "id");
- assertEquals(tc.getUpBandwidth(), "upBandwidth");
- assertEquals(tc.getDownBandwidth(), "downBandwidth");
- assertEquals(tc.getUpBandwidth2(), "upBandwidth2");
- assertEquals(tc.getDownBandwidth2(), "downBandwidth2");
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java deleted file mode 100644 index e476ef9fd5..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.bpmn.core.domain;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-
-import org.junit.Test;
-
-public class VnfResourceTest {
-
- private VnfResource vnf= new VnfResource();
- List<ModuleResource> moduleResources;
-
- @Test
- public void testVnfResource() {
- vnf.setModules(moduleResources);
- vnf.setVnfHostname("vnfHostname");
- vnf.setVnfType("vnfType");
- vnf.setNfFunction("nfFunction");
- vnf.setNfType("nfType");
- vnf.setNfRole("nfRole");
- vnf.setNfNamingCode("nfNamingCode");
- vnf.setMultiStageDesign("multiStageDesign");
- assertEquals(vnf.getVfModules(), moduleResources);
- assertEquals(vnf.getVnfHostname(), "vnfHostname");
- assertEquals(vnf.getVnfType(), "vnfType");
- assertEquals(vnf.getNfFunction(), "nfFunction");
- assertEquals(vnf.getNfType(), "nfType");
- assertEquals(vnf.getNfRole(), "nfRole");
- assertEquals(vnf.getNfNamingCode(), "nfNamingCode");
- assertEquals(vnf.getMultiStageDesign(), "multiStageDesign");
-
-
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java deleted file mode 100644 index 57f479f7cb..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Optional; -import org.junit.Test; - -public class VariableNameExtractorTest { - - @Test - public void shouldExtractVariableName() throws Exception { - // given - String name = "A_different_NAME123"; - String variable = "${A_different_NAME123}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional<String> extracted = extractor.extract(); - // then - assertThat(extracted).isPresent().contains(name); - } - - @Test - public void shouldExtractVariableNameFromWhitespaces() throws Exception { - // given - String name = "name"; - String variable = " \n\t$ \n\t{ \n\tname \n\t} \n\t"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional<String> extracted = extractor.extract(); - // then - assertThat(extracted).isPresent().contains(name); - } - - @Test - public void shouldReturnEmptyIfThereIsMoreThanVariable() throws Exception { - // given - String variable = "a ${test}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional<String> extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } - - @Test - public void shouldReturnEmptyIfVariableNameIsIncorrect() throws Exception { - // given - String variable = "${name with space}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional<String> extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } - - @Test - public void shouldReturnEmptyIfTwoVariablesPresent() throws Exception { - // given - String variable = "${var1} ${var2}"; - VariableNameExtractor extractor = new VariableNameExtractor(variable); - // when - Optional<String> extracted = extractor.extract(); - // then - assertThat(extracted).isNotPresent(); - } -}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java deleted file mode 100644 index 644f98349c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core.json; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.Mock; - -public class JsonUtilsTest { - - @Mock public DelegateExecution execution; - private final String fileLocation = "src/test/resources/json-examples/"; - - @Test - public void jsonStringToMapTest() throws IOException { - - JsonUtils utils = new JsonUtils(); - String response = this.getJson("SDNCServiceResponseExample.json"); - String entry = utils.getJsonValue(response, "SDNCServiceResponse.params"); - Map<String, String> map = utils.jsonStringToMap(execution, entry); - assertEquals(map.get("e2e-vpn-key"), "my-key"); - } - - @Test - public void entryArrayToMapTest() throws IOException { - JsonUtils utils = new JsonUtils(); - String response = this.getJson("SNIROExample.json"); - String entry = utils.getJsonValue(response, "solutionInfo.placement"); - JSONArray arr = new JSONArray(entry); - JSONObject homingDataJson = arr.getJSONObject(0); - JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); - Map<String, String> map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue"); - assertEquals(map.get("cloudOwner"), "att-aic"); - } - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(fileLocation + filename))); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java deleted file mode 100644 index f29ccc75e0..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.core.utils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import org.openecomp.mso.logger.MsoLogger; - -/** - * Sets up the unit test (H2) database for Camunda. - */ -public class CamundaDBSetup { - private static boolean isDBConfigured = false; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private CamundaDBSetup() { - } - - public static synchronized void configure() throws SQLException { - if (isDBConfigured) { - return; - } - - LOGGER.debug ("Configuring the Camunda H2 database for MSO"); - - Connection connection = null; - PreparedStatement stmt = null; - - try { - connection = DriverManager.getConnection( - "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", ""); - - stmt = connection.prepareStatement("delete from ACT_HI_VARINST"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - -// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); -// stmt.executeUpdate(); -// stmt.close(); -// stmt = null; - - stmt = connection.prepareStatement("delete from ACT_HI_DETAIL"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - -// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); -// stmt.executeUpdate(); -// stmt.close(); -// stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - connection.close(); - connection = null; - - isDBConfigured = true; - } catch (SQLException e) { - LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName()); - LOGGER.debug("SQLException :",e); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - - if (connection != null) { - try { - connection.close(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - } - } -}
\ No newline at end of file |