diff options
Diffstat (limited to 'src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype')
21 files changed, 1728 insertions, 0 deletions
diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java new file mode 100644 index 0000000..9e274b2 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/AppTest.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest extends TestCase { + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() { + assertTrue( true ); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java new file mode 100644 index 0000000..d64b2e8 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/GenericResponseTest.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.model.GenericResponse; + +public class GenericResponseTest { + + @Test + public void testGenericResponse() { + GenericResponse response = new GenericResponse(); + + response.setFailureReason("failureReason"); + response.setResponseObj(new Object()); + response.setStatus("status"); + + assertEquals("failureReason", response.getFailureReason()); + assertEquals("status", response.getStatus()); + assertTrue(response.getResponseObj() != null); + + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java new file mode 100644 index 0000000..dde6f8d --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JerseyConfigurationTest.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; + +import javax.ws.rs.client.Client; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.JerseyConfiguration; + +public class JerseyConfigurationTest { + @Test + public void testJerseyConfiguration() { + JerseyConfiguration jerseyConfiguration = new JerseyConfiguration(); + Client client = jerseyConfiguration.jerseyClient(); + String protocol = client.getSslContext().getProtocol(); + assertEquals("TLS", protocol); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java new file mode 100644 index 0000000..f4e26ac --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/JsonReaderTest.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.fail; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.exception.AuditException; +import org.onap.pomba.contextbuilder.aai.reader.JsonReader; + +public class JsonReaderTest { + + @Test + public void testJsonReader() { + JsonReader reader = new JsonReader(); + try { + reader.parse("{test:test}"); + } catch (AuditException e) { + fail("This should not throw an exception."); + } + } + + @Test + public void testJsonReaderWithException() { + JsonReader reader = new JsonReader(); + try { + reader.parse("{test}"); + fail("This should throw an exception."); + } catch (AuditException e) { + //Just a test, no need to log the exception here. + } + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java new file mode 100644 index 0000000..8432f87 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/L3networkInstanceTest.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance; + +public class L3networkInstanceTest { + @Test + public void testL3networkInstanceEquals() { + L3networkInstance l3networkInstance1 = new L3networkInstance("networkId1", "networkName1", "networkType1", + "networkRole1", "networkTechnology1", "resourceVersion1", "modelInvariantId1", "modelVersionId1", + "physicalNetworkName1", "true", null); + + L3networkInstance l3networkInstance2 = new L3networkInstance(); + l3networkInstance2.setNetworkId("networkId1"); + l3networkInstance2.setNetworkName("networkName1"); + l3networkInstance2.setNetworkType("networkType1"); + l3networkInstance2.setNetworkRole("networkRole1"); + l3networkInstance2.setNetworkTechnology("networkTechnology1"); + l3networkInstance2.setResourceVersion("resourceVersion1"); + l3networkInstance2.setModelInvariantId("modelInvariantId1"); + l3networkInstance2.setModelVersionId("modelVersionId1"); + l3networkInstance2.setPhysicalNetworkName("physicalNetworkName1"); + l3networkInstance2.setSharedNetworkBoolean("true"); + l3networkInstance2.setRelationshipList(null); + + l3networkInstance1.toJson(); + l3networkInstance1.toString(); + assertEquals("physicalNetworkName1", l3networkInstance2.getPhysicalNetworkName()); + assertTrue(l3networkInstance1.equals(l3networkInstance1)); + assertTrue(l3networkInstance1.equals(l3networkInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java new file mode 100644 index 0000000..5ec2420 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LInterfaceInstanceTest.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstance; + +public class LInterfaceInstanceTest { + @Test + public void testLInterfaceInstanceEquals() { + LInterfaceInstance lInterfaceInstance1 = new LInterfaceInstance("interfaceId1", "interfaceName1", + "interfaceRole1", "isPortMirrored1", "adminStatus1", "networkName1", "macAddr1", "inMaint1", null); + + LInterfaceInstance lInterfaceInstance2 = new LInterfaceInstance(); + lInterfaceInstance2.setInterfaceId("interfaceId1"); + lInterfaceInstance2.setInterfaceName("interfaceName1"); + lInterfaceInstance2.setInterfaceRole("interfaceRole1"); + lInterfaceInstance2.setIsPortMirrored("isPortMirrored1"); + lInterfaceInstance2.setAdminStatus("adminStatus1"); + lInterfaceInstance2.setNetworkName("networkName1"); + lInterfaceInstance2.setMacAddr("macAddr1"); + lInterfaceInstance2.setInMaint("inMaint1"); + + lInterfaceInstance1.toJson(); + lInterfaceInstance1.toString(); + assertEquals("interfaceName1", lInterfaceInstance2.getInterfaceName()); + assertTrue(lInterfaceInstance1.equals(lInterfaceInstance1)); + assertTrue(lInterfaceInstance1.equals(lInterfaceInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java new file mode 100644 index 0000000..9ee3c3e --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/LogicalLinkInstanceTest.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LogicalLinkInstance; + +public class LogicalLinkInstanceTest { + @Test + public void testLogicalLinkInstanceEquals() { + LogicalLinkInstance logicalLinkInstance1 = new LogicalLinkInstance("linkName1", "linkId1", + "modelVersionId1", "modelInvariantId1", "linkType1", "routingProtocol1", "speedValue1", "speedUnits1", + "provStatus1", "inMaint1", "linkRole1", "ipVersion1", "linkName21","circuitId1","purpose1"); + + LogicalLinkInstance logicalLinkInstance2 = new LogicalLinkInstance(); + logicalLinkInstance2.setLinkName("linkName1"); + logicalLinkInstance2.setLinkId("linkId1"); + logicalLinkInstance2.setModelVersionId("modelVersionId1"); + logicalLinkInstance2.setModelInvariantId("modelInvariantId1"); + logicalLinkInstance2.setLinkType("linkType1"); + logicalLinkInstance2.setRoutingProtocol("routingProtocol1"); + logicalLinkInstance2.setSpeedValue("speedValue1"); + logicalLinkInstance2.setSpeedUnits("speedUnits1"); + logicalLinkInstance2.setProvStatus("provStatus1"); + logicalLinkInstance2.setInMaint("inMaint1"); + logicalLinkInstance2.setLinkRole("linkRole1"); + logicalLinkInstance2.setIpVersion("ipVersion1"); + logicalLinkInstance2.setLinkName2("linkName21"); + logicalLinkInstance2.setCircuitId("circuitId1"); + logicalLinkInstance2.setPurpose("purpose1"); + + logicalLinkInstance1.toJson(); + logicalLinkInstance1.toString(); + assertEquals("linkName1", logicalLinkInstance2.getLinkName()); + assertTrue(logicalLinkInstance1.equals(logicalLinkInstance1)); + assertTrue(logicalLinkInstance1.equals(logicalLinkInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java new file mode 100644 index 0000000..60c0e92 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PInterfaceInstanceTest.java @@ -0,0 +1,55 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; +import org.onap.pomba.contextbuilder.aai.datatype.PInterfaceInstance; + +public class PInterfaceInstanceTest { + + @Test + public void testPInterfaceInstanceEquals() { + PInterfaceInstance pInterfaceInstance1 = new PInterfaceInstance("interfaceName1", "speedValue1", + "speedUnits1", "portDescription1", "equipmentIdentifier1", "interfaceRole1", "interfaceType1", + "provStatus1", "resourceVersion1", "inMaint1", "invStatus1" , new LInterfaceInstanceList(), null); + + PInterfaceInstance pInterfaceInstance2 = new PInterfaceInstance(); + pInterfaceInstance2.setInterfaceName("interfaceName1"); + pInterfaceInstance2.setSpeedValue("speedValue1"); + pInterfaceInstance2.setSpeedUnits("speedUnits1"); + pInterfaceInstance2.setPortDescription("portDescription1"); + pInterfaceInstance2.setEquipmentIdentifier("equipmentIdentifier1"); + pInterfaceInstance2.setInterfaceRole("interfaceRole1"); + pInterfaceInstance2.setInterfaceType("interfaceType1"); + pInterfaceInstance2.setProvStatus("provStatus1"); + pInterfaceInstance2.setResourceVersion("resourceVersion1"); + pInterfaceInstance2.setInMaint("inMaint1"); + pInterfaceInstance2.setInvStatus("invStatus1"); + + pInterfaceInstance1.toJson(); + pInterfaceInstance1.toString(); + assertEquals("interfaceName1", pInterfaceInstance2.getInterfaceName()); + assertTrue(pInterfaceInstance1.equals(pInterfaceInstance1)); + assertTrue(pInterfaceInstance1.equals(pInterfaceInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java new file mode 100644 index 0000000..a623912 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PnfInstanceTest.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.PnfInstance; + +public class PnfInstanceTest { + + @Test + public void testPnfInstanceEquals() { + PnfInstance pnfInstance1 = new PnfInstance("uuid1", "name1", "networkRole1", "name21", "name2Source1", + "equipmentType1", "equipmentVendor1", "equipmentModel1", "managementOptions1", "swVersion1", + "frameId1", "serialNumber1", "modelInvariantId1", "modelVersionId1", null); + + PnfInstance pnfInstance2 = new PnfInstance(); + pnfInstance2.setPnfId("uuid1"); + pnfInstance2.setPnfName("name1"); + pnfInstance2.setNfRole("networkRole1"); + pnfInstance2.setPnfName2("name21"); + pnfInstance2.setPnfName2Source("name2Source1"); + pnfInstance2.setEquipmentType("equipmentType1"); + pnfInstance2.setEquipmentVendor("equipmentVendor1"); + pnfInstance2.setEquipmentModel("equipmentModel1"); + pnfInstance2.setManagementOptions("managementOptions1"); + pnfInstance2.setSwVersion("swVersion1"); + pnfInstance2.setFrameId("frameId1"); + pnfInstance2.setSerialNumber("serialNumber1"); + pnfInstance2.setModelInvariantId("modelInvariantId1"); + pnfInstance2.setModelVersionId("modelVersionId1"); + pnfInstance2.setPInterfaceInstanceList(null); + + pnfInstance1.toJson(); + pnfInstance1.toString(); + assertEquals("name1", pnfInstance2.getPnfName()); + assertTrue(pnfInstance1.equals(pnfInstance1)); + assertTrue(pnfInstance1.equals(pnfInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java new file mode 100644 index 0000000..b20cfc2 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/PserverInstanceTest.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.PserverInstance; + +public class PserverInstanceTest { + + @Test + public void testPserverInstanceEquals() { + PserverInstance pserverInstance1 = new PserverInstance("pserverId1", "hostname1", "pserverName2a", + "ptniiEquipName1", "equipType1", "equipVendor1", "equipModel1", "fqdn1", "internetTopology1", + "inMaint1", "resourceVersion1", "serialNumber1", + "purpose1",null); + + PserverInstance pserverInstance2 = new PserverInstance(); + pserverInstance2.setPserverId("pserverId1"); + pserverInstance2.setHostname("hostname1"); + pserverInstance2.setPserverName2("pserverName2a"); + pserverInstance2.setPtniiEquipName("ptniiEquipName1"); + pserverInstance2.setEquipType("equipType1"); + pserverInstance2.setEquipVendor("equipVendor1"); + pserverInstance2.setEquipModel("equipModel1"); + pserverInstance2.setFqdn("fqdn1"); + pserverInstance2.setInternetTopology("internetTopology1"); + pserverInstance2.setInMaint("inMaint1"); + pserverInstance2.setResourceVersion("resourceVersion1"); + pserverInstance2.setSerialNumber("serialNumber1"); + pserverInstance2.setPurpose("purpose1"); + pserverInstance2.setPInterfaceInstanceList(null); + + pserverInstance1.toJson(); + pserverInstance1.toString(); + assertEquals("hostname1", pserverInstance2.getHostname()); + assertTrue(pserverInstance1.equals(pserverInstance1)); + assertTrue(pserverInstance1.equals(pserverInstance2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java new file mode 100644 index 0000000..e64a63a --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelatedToPropertyTest.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty; + +public class RelatedToPropertyTest { + + @Test + public void testRelatedToPropertyWithParameters() { + RelatedToProperty relatedToProperty = new RelatedToProperty("propertyKey", "propertyValue"); + assertEquals("propertyKey", relatedToProperty.getPropertyKey()); + assertEquals("propertyValue", relatedToProperty.getPropertyValue()); + } + + @Test + public void testRelatedToProperty() { + RelatedToProperty relatedToProperty = new RelatedToProperty(); + relatedToProperty.setPropertyKey("propertyKey"); + relatedToProperty.setPropertyValue("propertyValue"); + assertEquals("propertyKey", relatedToProperty.getPropertyKey()); + assertEquals("propertyValue", relatedToProperty.getPropertyValue()); + String relatedToPropertyString = relatedToProperty.toString(); + assertTrue(relatedToPropertyString.contains("[propertyKey=propertyKey,propertyValue=propertyValue]")); + } + + @Test + public void testRelatedToPropertyIsEqual() { + RelatedToProperty relatedToProperty1 = new RelatedToProperty("propertyKey1", "propertyValue1"); + RelatedToProperty relatedToProperty2 = new RelatedToProperty("propertyKey2", "propertyValue2"); + RelatedToProperty relatedToProperty3 = new RelatedToProperty("propertyKey1", "propertyValue1"); + assertTrue(relatedToProperty1.equals(relatedToProperty1)); + assertTrue(!relatedToProperty1.equals(relatedToProperty2)); + assertTrue(relatedToProperty1.equals(relatedToProperty3)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java new file mode 100644 index 0000000..4fdf979 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipDatumTest.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum; + +public class RelationshipDatumTest { + @Test + public void testRelationshipDatum() { + RelationshipDatum relationshipDatum = new RelationshipDatum(); + + relationshipDatum.setRelationshipKey("relationshipKey"); + relationshipDatum.setRelationshipValue("relationshipValue"); + + assertEquals("relationshipKey", relationshipDatum.getRelationshipKey()); + assertEquals("relationshipValue", relationshipDatum.getRelationshipValue()); + } + + @Test + public void testRelationshipDatumWithParameters() { + RelationshipDatum relationshipDatum = new RelationshipDatum("relationshipKey", "relationshipValue"); + + assertEquals("relationshipKey", relationshipDatum.getRelationshipKey()); + assertEquals("relationshipValue", relationshipDatum.getRelationshipValue()); + String relationshipDatumString = relationshipDatum.toString(); + assertTrue(relationshipDatumString.contains("[relationshipKey=relationshipKey," + + "relationshipValue=relationshipValue]")); + } + + @Test + public void testRelationshipDatumEqual() { + RelationshipDatum relationshipDatum1 = new RelationshipDatum("relationshipKey1", "relationshipValue1"); + RelationshipDatum relationshipDatum2 = new RelationshipDatum("relationshipKey2", "relationshipValue2"); + RelationshipDatum relationshipDatum3 = new RelationshipDatum("relationshipKey1", "relationshipValue1"); + + assertTrue(relationshipDatum1.equals(relationshipDatum1)); + assertTrue(!relationshipDatum1.equals(relationshipDatum2)); + assertTrue(relationshipDatum1.equals(relationshipDatum3)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java new file mode 100644 index 0000000..59cc0c5 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipListTest.java @@ -0,0 +1,101 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty; +import org.onap.pomba.contextbuilder.aai.datatype.Relationship; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; + +public class RelationshipListTest { + @Test + public void testRelationshipList() { + RelationshipList relationshipList = new RelationshipList(); + Relationship relationship = new Relationship(); + List<Relationship> list = new ArrayList<Relationship>(); + list.add(relationship); + relationshipList.setRelationship(list); + + assertTrue(relationshipList.getRelationship().size() == 1); + + relationship.setRelatedLink("relatedLink"); + relationship.setRelatedTo("relatedTo"); + + RelatedToProperty relatedToProperty = new RelatedToProperty(); + List<RelatedToProperty> relatedToPropertyList = new ArrayList<RelatedToProperty>(); + relatedToPropertyList.add(relatedToProperty); + relationship.setRelatedToProperty(relatedToPropertyList); + list.add(relationship); + relationshipList.setRelationship(list); + + String relationshipListString = relationshipList.toString(); + assertTrue(relationshipListString.contains("[relationship=")); + + } + + @Test + public void testRelationshipListWithParameters() { + Relationship relationship = new Relationship("relatedTo", + "relatedLink", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + List<Relationship> listOfRelationship = new ArrayList<Relationship>(); + listOfRelationship.add(relationship); + RelationshipList relationshipList = new RelationshipList(listOfRelationship); + + assertTrue(relationshipList.getRelationship().size() == 1); + } + + @Test + public void testRelationshipListEquals() { + + Relationship relationship1 = new Relationship("relatedTo1", + "relatedLink1", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + List<Relationship> listOfRelationship = new ArrayList<Relationship>(); + listOfRelationship.add(relationship1); + RelationshipList relationshipList1 = new RelationshipList(listOfRelationship); + + Relationship relationship2 = new Relationship("relatedTo2", + "relatedLink2", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + List<Relationship> listOfRelationship2 = new ArrayList<Relationship>(); + listOfRelationship.add(relationship2); + RelationshipList relationshipList2 = new RelationshipList(listOfRelationship2); + + Relationship relationship3 = new Relationship("relatedTo1", + "relatedLink1", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + List<Relationship> listOfRelationship3 = new ArrayList<Relationship>(); + listOfRelationship.add(relationship3); + RelationshipList relationshipList3 = new RelationshipList(listOfRelationship3); + + assertTrue(relationshipList1.equals(relationshipList1)); + assertTrue(!relationshipList1.equals(relationshipList2)); + assertTrue(!relationshipList1.equals(relationshipList3)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java new file mode 100644 index 0000000..14195d9 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/RelationshipTest.java @@ -0,0 +1,89 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty; +import org.onap.pomba.contextbuilder.aai.datatype.Relationship; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum; + +public class RelationshipTest { + + @Test + public void testRelationshipWithParameters() { + List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>(); + List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>(); + Relationship relationship = new Relationship("relatedTo", "relatedLink", relationshipDatum, relatedToProperty); + + assertEquals("relatedTo", relationship.getRelatedTo()); + assertEquals("relatedLink", relationship.getRelatedLink()); + assertTrue(relationship.getRelationshipData().isEmpty()); + assertTrue(relationship.getRelatedToProperty().isEmpty()); + } + + @Test + public void testRelationship() { + Relationship relationship = new Relationship(); + List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>(); + List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>(); + + relationship.setRelatedLink("relatedLink"); + relationship.setRelatedTo("relatedTo"); + relationship.setRelatedToProperty(relatedToProperty); + relationship.setRelationshipData(relationshipDatum); + + assertEquals("relatedTo", relationship.getRelatedTo()); + assertEquals("relatedLink", relationship.getRelatedLink()); + assertTrue(relationship.getRelationshipData().isEmpty()); + assertTrue(relationship.getRelatedToProperty().isEmpty()); + + String relationshipString = relationship.toString(); + assertTrue(relationshipString.contains("[relatedTo=relatedTo," + + "relatedLink=relatedLink," + + "relationshipData=[]," + + "relatedToProperty=[]]")); + } + + @Test + public void testRelationshipEquals() { + List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>(); + List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>(); + Relationship relationship1 = new Relationship("relatedTo1", + "relatedLink1", + relationshipDatum, + relatedToProperty); + Relationship relationship2 = new Relationship("relatedTo2", + "relatedLink2", + relationshipDatum, + relatedToProperty); + Relationship relationship3 = new Relationship("relatedTo1", + "relatedLink1", + relationshipDatum, + relatedToProperty); + assertTrue(relationship1.equals(relationship1)); + assertTrue(!relationship1.equals(relationship2)); + assertTrue(relationship1.equals(relationship3)); + } + +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java new file mode 100644 index 0000000..f852d76 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/ServiceInstanceTest.java @@ -0,0 +1,145 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty; +import org.onap.pomba.contextbuilder.aai.datatype.Relationship; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; +import org.onap.pomba.contextbuilder.aai.datatype.ServiceInstance; + +public class ServiceInstanceTest { + @Test + public void testServiceInstance() { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + serviceInstance.setServiceInstanceName("serviceInstanceName"); + serviceInstance.setServiceType("serviceType"); + serviceInstance.setServiceRole("serviceRole"); + serviceInstance.setEnvironmentContext("environmentContext"); + serviceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInvariantId("modelInvariantId"); + serviceInstance.setModelVersionId("modelVersionId"); + serviceInstance.setResourceVersion("resourceVersion"); + serviceInstance.setOrchestrationStatus("orchestrationStatus"); + RelationshipList relationshipList = new RelationshipList(); + List<Relationship> listOfRelationship = new ArrayList<Relationship>(); + Relationship relationship = new Relationship("relatedTo", + "relatedLink", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + listOfRelationship.add(relationship); + relationshipList.setRelationship(listOfRelationship); + + serviceInstance.setRelationshipList(relationshipList); + + assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId()); + assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName()); + assertEquals("serviceType", serviceInstance.getServiceType()); + assertEquals("serviceRole", serviceInstance.getServiceRole()); + assertEquals("environmentContext", serviceInstance.getEnvironmentContext()); + assertEquals("workloadContext", serviceInstance.getWorkloadContext()); + assertEquals("modelInvariantId", serviceInstance.getModelInvariantId()); + assertEquals("modelVersionId", serviceInstance.getModelVersionId()); + assertEquals("resourceVersion", serviceInstance.getResourceVersion()); + assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus()); + assertEquals("relatedTo", serviceInstance.getRelationshipList().getRelationship().get(0).getRelatedTo()); + } + + @Test + public void testServiceInstanceWithParameters() { + ServiceInstance serviceInstance = new ServiceInstance("serviceInstanceId", + "serviceInstanceName", + "serviceType", + "serviceRole", + "environmentContext", + "workloadContext", + "modelInvariantId", + "modelVersionId", + "resourceVersion", + "orchestrationStatus", + new RelationshipList()); + + assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId()); + assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName()); + assertEquals("serviceType", serviceInstance.getServiceType()); + assertEquals("serviceRole", serviceInstance.getServiceRole()); + assertEquals("environmentContext", serviceInstance.getEnvironmentContext()); + assertEquals("workloadContext", serviceInstance.getWorkloadContext()); + assertEquals("modelInvariantId", serviceInstance.getModelInvariantId()); + assertEquals("modelVersionId", serviceInstance.getModelVersionId()); + assertEquals("resourceVersion", serviceInstance.getResourceVersion()); + assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus()); + + String serviceInstanceString = serviceInstance.toString(); + assertTrue(serviceInstanceString.contains("[serviceInstanceId=serviceInstanceId," + + "serviceInstanceName=serviceInstanceName,serviceType=serviceType," + + "serviceRole=serviceRole,environmentContext=environmentContext," + + "workloadContext=workloadContext,modelInvariantId=modelInvariantId," + + "modelVersionId=modelVersionId,resourceVersion=resourceVersion," + + "orchestrationStatus=orchestrationStatus,")); + } + + @Test + public void testServiceInstanceEquals() { + ServiceInstance serviceInstance1 = new ServiceInstance("serviceInstanceId1", + "serviceInstanceName1", + "serviceType1", + "serviceRole1", + "environmentContext1", + "workloadContext1", + "modelInvariantId1", + "modelVersionId1", + "resourceVersion1", + "orchestrationStatus1", + new RelationshipList()); + ServiceInstance serviceInstance2 = new ServiceInstance("serviceInstanceId2", + "serviceInstanceName2", + "serviceType2", + "serviceRole2", + "environmentContext2", + "workloadContext2", + "modelInvariantId2", + "modelVersionId2", + "resourceVersion2", + "orchestrationStatus2", + new RelationshipList()); + ServiceInstance serviceInstance3 = new ServiceInstance("serviceInstanceId1", + "serviceInstanceName1", + "serviceType1", + "serviceRole1", + "environmentContext1", + "workloadContext1", + "modelInvariantId1", + "modelVersionId1", + "resourceVersion1", + "orchestrationStatus1", + new RelationshipList()); + + assertTrue(serviceInstance1.equals(serviceInstance1)); + assertTrue(!serviceInstance1.equals(serviceInstance2)); + assertTrue(serviceInstance1.equals(serviceInstance3)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java new file mode 100644 index 0000000..3be2346 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModuleTest.java @@ -0,0 +1,152 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.L3networkInstance; +import org.onap.pomba.contextbuilder.aai.datatype.RelatedToProperty; +import org.onap.pomba.contextbuilder.aai.datatype.Relationship; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipDatum; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; +import org.onap.pomba.contextbuilder.aai.datatype.VfModule; + +public class VfModuleTest { + @Test + public void testVfModule() { + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setHeatStackId("heatStackId"); + vfModule.setOrchestrationStatus("orchestrationStatus"); + vfModule.setIsBaseVfModule(true); + vfModule.setResourceVersion("resourceVersion"); + vfModule.setModelInvariantId("modelInvariantId"); + vfModule.setModelVersionId("modelVersionId"); + vfModule.setModelCustomizationId("modelCustomizationId"); + vfModule.setModuleIndex(1); + + RelationshipList relationshipList = new RelationshipList(); + List<Relationship> listOfRelationship = new ArrayList<Relationship>(); + Relationship relationship = new Relationship("relatedTo", + "relatedLink", + new ArrayList<RelationshipDatum>(), + new ArrayList<RelatedToProperty>()); + listOfRelationship.add(relationship); + relationshipList.setRelationship(listOfRelationship); + + vfModule.setRelationshipList(relationshipList); + + assertEquals("vfModuleId", vfModule.getVfModuleId()); + assertEquals("vfModuleName", vfModule.getVfModuleName()); + assertEquals("heatStackId", vfModule.getHeatStackId()); + assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus()); + assertTrue(vfModule.getIsBaseVfModule()); + assertEquals("resourceVersion", vfModule.getResourceVersion()); + assertEquals("modelInvariantId", vfModule.getModelInvariantId()); + assertEquals("modelVersionId", vfModule.getModelVersionId()); + assertEquals("modelCustomizationId", vfModule.getModelCustomizationId()); + assertEquals(new Integer(1), vfModule.getModuleIndex()); + assertEquals("relatedTo", vfModule.getRelationshipList().getRelationship().get(0).getRelatedTo()); + } + + @Test + public void testVfModuleWithParameters() { + VfModule vfModule = new VfModule("vfModuleId", + "vfModuleName", + "heatStackId", + "orchestrationStatus", + true, + "resourceVersion", + "modelInvariantId", + "modelVersionId", + "modelCustomizationId", + 1, + new RelationshipList() , + new ArrayList<L3networkInstance>()); + + assertEquals("vfModuleId", vfModule.getVfModuleId()); + assertEquals("vfModuleName", vfModule.getVfModuleName()); + assertEquals("heatStackId", vfModule.getHeatStackId()); + assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus()); + assertTrue(vfModule.getIsBaseVfModule()); + assertEquals("resourceVersion", vfModule.getResourceVersion()); + assertEquals("modelInvariantId", vfModule.getModelInvariantId()); + assertEquals("modelVersionId", vfModule.getModelVersionId()); + assertEquals("modelCustomizationId", vfModule.getModelCustomizationId()); + assertEquals(new Integer(1), vfModule.getModuleIndex()); + + String vfModuleString = vfModule.toString(); + assertTrue(vfModuleString.contains("[vfModuleId=vfModuleId,vfModuleName=vfModuleName,heatStackId=heatStackId," + + "orchestrationStatus=orchestrationStatus,isBaseVfModule=true," + + "resourceVersion=resourceVersion,modelInvariantId=modelInvariantId," + + "modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId," + + "moduleIndex=1")); + + } + + @Test + public void testVfModuleEquals() { + VfModule vfModule1 = new VfModule("vfModuleId1", + "vfModuleName1", + "heatStackId1", + "orchestrationStatus1", + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + "modelCustomizationId1", + 1, + new RelationshipList() , + new ArrayList<L3networkInstance>()); + VfModule vfModule2 = new VfModule("vfModuleId2", + "vfModuleName2", + "heatStackId2", + "orchestrationStatus2", + true, + "resourceVersion2", + "modelInvariantId2", + "modelVersionId2", + "modelCustomizationId2", + 1, + new RelationshipList() , + new ArrayList<L3networkInstance>()); + VfModule vfModule3 = new VfModule("vfModuleId1", + "vfModuleName1", + "heatStackId1", + "orchestrationStatus1", + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + "modelCustomizationId1", + 1, + new RelationshipList() , + new ArrayList<L3networkInstance>()); + + assertTrue(vfModule1.equals(vfModule1)); + assertTrue(!vfModule1.equals(vfModule2)); + assertTrue(vfModule1.equals(vfModule3)); + } + +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java new file mode 100644 index 0000000..0202359 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VfModulesTest.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.VfModule; +import org.onap.pomba.contextbuilder.aai.datatype.VfModules; + +public class VfModulesTest { + @Test + public void testVfModules() { + VfModules vfModules = new VfModules(); + + List<VfModule> vfModuleList = new ArrayList<VfModule>(); + vfModuleList.add(new VfModule()); + vfModules.setVfModule(vfModuleList); + + assertTrue(vfModules.getVfModule().get(0) instanceof VfModule); + } + + @Test + public void testVfModulesWithParameters() { + VfModules vfModules = new VfModules(new ArrayList<VfModule>()); + + String vfModulesString = vfModules.toString(); + assertTrue(vfModulesString.contains("[vfModule=")); + } + + @Test + public void testVfModulesEquals() { + VfModules vfModules1 = new VfModules(new ArrayList<VfModule>()); + VfModules vfModules2 = new VfModules(new ArrayList<VfModule>()); + + assertTrue(vfModules1.equals(vfModules1)); + assertTrue(vfModules1.equals(vfModules2)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java new file mode 100644 index 0000000..7e022f5 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfInstanceTest.java @@ -0,0 +1,259 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; +import org.onap.pomba.contextbuilder.aai.datatype.VfModules; +import org.onap.pomba.contextbuilder.aai.datatype.VnfInstance; + +public class VnfInstanceTest { + @Test + public void testVnfInstance() { + VnfInstance vnfInstance = new VnfInstance(); + + vnfInstance.setServiceId("serviceId"); + vnfInstance.setModelCustomizationId("modelCustomizationId"); + vnfInstance.setVnfType("vnfType"); + vnfInstance.setIpv4Loopback0Address("ipv4Loopback0Address"); + vnfInstance.setNfFunction("nfFunction"); + vnfInstance.setModelInvariantId("modelInvariantId"); + vnfInstance.setResourceVersion("resourceVersion"); + vnfInstance.setVnfName2("vnfName2"); + vnfInstance.setRelationshipList(new RelationshipList()); + vnfInstance.setNmLanV6Address("nmLanV6Address"); + vnfInstance.setNfRole("nfRole"); + vnfInstance.setNfType("nfType"); + vnfInstance.setModelVersionId("modelVersionId"); + vnfInstance.setIpv4OamAddress("ipv4OamAddress"); + vnfInstance.setVnfName("vnfName"); + vnfInstance.setInMaintenance(true); + vnfInstance.setMsoCatalogKey("msoCatalogKey"); + vnfInstance.setProvisionStatus("provisionStatus"); + vnfInstance.setVfModules(new VfModules()); + vnfInstance.setEquipmentRole("equipmentRole"); + vnfInstance.setVnfId("vnfId"); + vnfInstance.setOrchestrationStatus("orchestrationStatus"); + vnfInstance.setNfNamingCode("nfNamingCode"); + vnfInstance.setHeatStackId("heatStackId"); + vnfInstance.setIsClosedLoopDisabled(true); + vnfInstance.setLicenseKey("licenseKey"); + vnfInstance.setManagementV6Address("managementV6Address"); + + assertEquals("serviceId", vnfInstance.getServiceId()); + assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId()); + assertEquals("vnfType", vnfInstance.getVnfType()); + assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address()); + assertEquals("nfFunction", vnfInstance.getNfFunction()); + assertEquals("modelInvariantId", vnfInstance.getModelInvariantId()); + assertEquals("resourceVersion", vnfInstance.getResourceVersion()); + assertEquals("vnfName2", vnfInstance.getVnfName2()); + assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList); + assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address()); + assertEquals("nfRole", vnfInstance.getNfRole()); + assertEquals("nfType", vnfInstance.getNfType()); + assertEquals("modelVersionId", vnfInstance.getModelVersionId()); + assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress()); + assertEquals("vnfName", vnfInstance.getVnfName()); + assertTrue(vnfInstance.getInMaintenance()); + assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey()); + assertEquals("provisionStatus", vnfInstance.getProvisionStatus()); + assertTrue(vnfInstance.getVfModules() instanceof VfModules); + assertEquals("equipmentRole", vnfInstance.getEquipmentRole()); + assertEquals("vnfId", vnfInstance.getVnfId()); + assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus()); + assertEquals("nfNamingCode", vnfInstance.getNfNamingCode()); + assertEquals("heatStackId", vnfInstance.getHeatStackId()); + assertTrue(vnfInstance.getIsClosedLoopDisabled()); + assertEquals("licenseKey", vnfInstance.getLicenseKey()); + assertEquals("managementV6Address", vnfInstance.getManagementV6Address()); + + } + + @Test + public void testVnfInstanceWithParameters() { + VnfInstance vnfInstance = new VnfInstance("vnfId", + "vnfName", + "vnfName2", + "vnfType", + "serviceId", + "provisionStatus", + "licenseKey", + "equipmentRole", + "orchestrationStatus", + "heatStackId", + "msoCatalogKey", + "ipv4OamAddress", + "ipv4Loopback0Address", + "nmLanV6Address", + "managementV6Address", + true, + true, + "resourceVersion", + "modelInvariantId", + "modelVersionId", + "modelCustomizationId", + "nfType", + "nfFunction", + "nfRole", + "nfNamingCode", + new RelationshipList(), + new VfModules(), + new LInterfaceInstanceList()); + + assertEquals("serviceId", vnfInstance.getServiceId()); + assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId()); + assertEquals("vnfType", vnfInstance.getVnfType()); + assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address()); + assertEquals("nfFunction", vnfInstance.getNfFunction()); + assertEquals("modelInvariantId", vnfInstance.getModelInvariantId()); + assertEquals("resourceVersion", vnfInstance.getResourceVersion()); + assertEquals("vnfName2", vnfInstance.getVnfName2()); + assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList); + assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address()); + assertEquals("nfRole", vnfInstance.getNfRole()); + assertEquals("nfType", vnfInstance.getNfType()); + assertEquals("modelVersionId", vnfInstance.getModelVersionId()); + assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress()); + assertEquals("vnfName", vnfInstance.getVnfName()); + assertTrue(vnfInstance.getInMaintenance()); + assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey()); + assertEquals("provisionStatus", vnfInstance.getProvisionStatus()); + assertTrue(vnfInstance.getVfModules() instanceof VfModules); + assertEquals("equipmentRole", vnfInstance.getEquipmentRole()); + assertEquals("vnfId", vnfInstance.getVnfId()); + assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus()); + assertEquals("nfNamingCode", vnfInstance.getNfNamingCode()); + assertEquals("heatStackId", vnfInstance.getHeatStackId()); + assertTrue(vnfInstance.getIsClosedLoopDisabled()); + assertEquals("licenseKey", vnfInstance.getLicenseKey()); + assertEquals("managementV6Address", vnfInstance.getManagementV6Address()); + + String vnfInstanceString = vnfInstance.toString(); + assertTrue(vnfInstanceString.contains("[vnfId=vnfId,vnfName=vnfName,vnfName2=vnfName2,vnfType=vnfType," + + "serviceId=serviceId,provisionStatus=provisionStatus," + + "licenseKey=licenseKey,equipmentRole=equipmentRole," + + "orchestrationStatus=orchestrationStatus,heatStackId=heatStackId," + + "msoCatalogKey=msoCatalogKey,ipv4OamAddress=ipv4OamAddress," + + "ipv4Loopback0Address=ipv4Loopback0Address," + + "nmLanV6Address=nmLanV6Address,managementV6Address=managementV6Address," + + "inMaintenance=true,isClosedLoopDisabled=true," + + "resourceVersion=resourceVersion,modelInvariantId=modelInvariantId," + + "modelVersionId=modelVersionId," + + "modelCustomizationId=modelCustomizationId,nfType=nfType," + + "nfFunction=nfFunction,nfRole=nfRole,nfNamingCode=nfNamingCode,")); + } + + @Test + public void testVnfInstanceEquals() { + VnfInstance vnfInstance1 = new VnfInstance("vnfId1", + "vnfName1", + "vnfName2-1", + "vnfType1", + "serviceId1", + "provisionStatus1", + "licenseKey1", + "equipmentRole1", + "orchestrationStatus1", + "heatStackId1", + "msoCatalogKey1", + "ipv4OamAddress1", + "ipv4Loopback0Address1", + "nmLanV6Address1", + "managementV6Address1", + true, + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + "modelCustomizationId1", + "nfType1", + "nfFunction1", + "nfRole1", + "nfNamingCode1", + new RelationshipList(), + new VfModules(), + new LInterfaceInstanceList()); + VnfInstance vnfInstance2 = new VnfInstance("vnfId2", + "vnfName2", + "vnfName2-2", + "vnfType2", + "serviceId2", + "provisionStatus2", + "licenseKey2", + "equipmentRole2", + "orchestrationStatus2", + "heatStackId2", + "msoCatalogKey2", + "ipv4OamAddress2", + "ipv4Loopback0Address2", + "nmLanV6Address2", + "managementV6Address2", + true, + true, + "resourceVersion2", + "modelInvariantId2", + "modelVersionId2", + "modelCustomizationId2", + "nfType2", + "nfFunction2", + "nfRole2", + "nfNamingCode2", + new RelationshipList(), + new VfModules(), + new LInterfaceInstanceList()); + VnfInstance vnfInstance3 = new VnfInstance("vnfId1", + "vnfName1", + "vnfName2-1", + "vnfType1", + "serviceId1", + "provisionStatus1", + "licenseKey1", + "equipmentRole1", + "orchestrationStatus1", + "heatStackId1", + "msoCatalogKey1", + "ipv4OamAddress1", + "ipv4Loopback0Address1", + "nmLanV6Address1", + "managementV6Address1", + true, + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + "modelCustomizationId1", + "nfType1", + "nfFunction1", + "nfRole1", + "nfNamingCode1", + new RelationshipList(), + new VfModules(), + new LInterfaceInstanceList()); + + assertTrue(vnfInstance1.equals(vnfInstance1)); + assertTrue(!vnfInstance1.equals(vnfInstance2)); + assertTrue(vnfInstance1.equals(vnfInstance3)); + + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java new file mode 100644 index 0000000..d9f6509 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VnfcInstanceTest.java @@ -0,0 +1,132 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; +import org.onap.pomba.contextbuilder.aai.datatype.VnfcInstance; + +public class VnfcInstanceTest { + @Test + public void testVnfcInstance() { + VnfcInstance vnfcInstance = new VnfcInstance(); + vnfcInstance.setVnfcName("vnfcName"); + vnfcInstance.setNfcNamingCode("nfcNamingCode"); + vnfcInstance.setNfcFunction("nfcFunction"); + vnfcInstance.setProvisionStatus("provisionStatus"); + vnfcInstance.setOrchestrationStatus("orchestrationStatus"); + vnfcInstance.setInMaintenance(true); + vnfcInstance.setIsClosedLoopDisabled(true); + vnfcInstance.setResourceVersion("resourceVersion"); + vnfcInstance.setModelInvariantId("modelInvariantId"); + vnfcInstance.setModelVersionId("modelVersionId"); + vnfcInstance.setRelationshipList(new RelationshipList()); + + assertEquals("vnfcName", vnfcInstance.getVnfcName()); + assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode()); + assertEquals("nfcFunction", vnfcInstance.getNfcFunction()); + assertEquals("provisionStatus", vnfcInstance.getProvisionStatus()); + assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus()); + assertTrue(vnfcInstance.getInMaintenance()); + assertTrue(vnfcInstance.getIsClosedLoopDisabled()); + assertEquals("resourceVersion", vnfcInstance.getResourceVersion()); + assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId()); + assertEquals("modelVersionId", vnfcInstance.getModelVersionId()); + assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList); + + } + + @Test + public void testVnfcInstanceWithParameters() { + VnfcInstance vnfcInstance = new VnfcInstance("vnfcName", + "nfcNamingCode", + "nfcFunction", + "provisionStatus", + "orchestrationStatus", + true, + true, + "resourceVersion", + "modelInvariantId", + "modelVersionId", + new RelationshipList()); + + assertEquals("vnfcName", vnfcInstance.getVnfcName()); + assertEquals("nfcNamingCode", vnfcInstance.getNfcNamingCode()); + assertEquals("nfcFunction", vnfcInstance.getNfcFunction()); + assertEquals("provisionStatus", vnfcInstance.getProvisionStatus()); + assertEquals("orchestrationStatus", vnfcInstance.getOrchestrationStatus()); + assertTrue(vnfcInstance.getInMaintenance()); + assertTrue(vnfcInstance.getIsClosedLoopDisabled()); + assertEquals("resourceVersion", vnfcInstance.getResourceVersion()); + assertEquals("modelInvariantId", vnfcInstance.getModelInvariantId()); + assertEquals("modelVersionId", vnfcInstance.getModelVersionId()); + assertTrue(vnfcInstance.getRelationshipList() instanceof RelationshipList); + + String vnfcInstanceString = vnfcInstance.toString(); + assertTrue(vnfcInstanceString.contains("[vnfcName=vnfcName,nfcNamingCode=nfcNamingCode," + + "nfcFunction=nfcFunction,provisionStatus=provisionStatus," + + "orchestration_status=orchestrationStatus,inMaintenance=true," + + "isClosedLoopDisabled=true,resourceVersion=resourceVersion," + + "modelInvariantId=modelInvariantId,modelVersionId=modelVersionId,")); + } + + @Test + public void testVnfcInstanceEquals() { + VnfcInstance vnfcInstance1 = new VnfcInstance("vnfcName1", + "nfcNamingCode1", + "nfcFunction1", + "provisionStatus1", + "orchestrationStatus1", + true, + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + new RelationshipList()); + VnfcInstance vnfcInstance2 = new VnfcInstance("vnfcName2", + "nfcNamingCode2", + "nfcFunction2", + "provisionStatus2", + "orchestrationStatus2", + true, + true, + "resourceVersion2", + "modelInvariantId2", + "modelVersionId2", + new RelationshipList()); + VnfcInstance vnfcInstance3 = new VnfcInstance("vnfcName1", + "nfcNamingCode1", + "nfcFunction1", + "provisionStatus1", + "orchestrationStatus1", + true, + true, + "resourceVersion1", + "modelInvariantId1", + "modelVersionId1", + new RelationshipList()); + + assertTrue(vnfcInstance1.equals(vnfcInstance1)); + assertTrue(!vnfcInstance1.equals(vnfcInstance2)); + assertTrue(vnfcInstance1.equals(vnfcInstance3)); + } +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java new file mode 100644 index 0000000..34c81bd --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/VserverTest.java @@ -0,0 +1,129 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.datatype.LInterfaceInstanceList; +import org.onap.pomba.contextbuilder.aai.datatype.Relationship; +import org.onap.pomba.contextbuilder.aai.datatype.RelationshipList; +import org.onap.pomba.contextbuilder.aai.datatype.Vserver; + +public class VserverTest { + + @Test + public void testVserver() { + Vserver aVServer = new Vserver(); + aVServer.setVserverId("vserverId"); + aVServer.setVserverName("vserverName"); + aVServer.setVserverName2("vserverName2"); + aVServer.setVserverSelflink("vserverSelflink"); + aVServer.setInMaint(true); + aVServer.setIsClosedLoopDisabled(true); + aVServer.setProvStatus("provStatus"); + Relationship relationship = new Relationship(); + List<Relationship> list = new ArrayList<Relationship>(); + list.add(relationship); + RelationshipList relationshipList = new RelationshipList(list); + aVServer.setRelationshipList(relationshipList); + aVServer.setResourceVersion("resourceVersion"); + + assertEquals("vserverId", aVServer.getVserverId()); + assertEquals("vserverName", aVServer.getVserverName()); + assertEquals("vserverName2", aVServer.getVserverName2()); + assertEquals("vserverSelflink", aVServer.getVserverSelflink()); + assertEquals(true, aVServer.getInMaint()); + assertEquals(true, aVServer.getIsClosedLoopDisabled()); + assertEquals("provStatus", aVServer.getProvStatus()); + assertTrue(aVServer.getRelationshipList().getRelationship().size() == 1); + assertEquals("resourceVersion", aVServer.getResourceVersion()); + + String vserverToString = aVServer.toString(); + assertTrue(vserverToString.contains("[vserverId=vserverId,vserverName=vserverName,vserverName2=vserverName2" + + ",provStatus=provStatus,vserverSelflink=vserverSelflink,inMaint=true," + + "isClosedLoopDisabled=true,resourceVersion=resourceVersion")); + } + + @Test + public void testVserverWithParameters() { + Vserver aVServer = new Vserver("vserverId", + "vserverName", + "vserverName2", + "provStatus", + "vserverSelflink", + true, + true, + "resourceVersion", + new RelationshipList(), + new LInterfaceInstanceList()); + + assertEquals("vserverId", aVServer.getVserverId()); + assertEquals("vserverName", aVServer.getVserverName()); + assertEquals("vserverName2", aVServer.getVserverName2()); + assertEquals("vserverSelflink", aVServer.getVserverSelflink()); + assertEquals(true, aVServer.getInMaint()); + assertEquals(true, aVServer.getIsClosedLoopDisabled()); + assertEquals("provStatus", aVServer.getProvStatus()); + assertEquals("resourceVersion", aVServer.getResourceVersion()); + } + + @Test + public void testVserverEquals() { + Vserver aVServer1 = new Vserver("vserverId1", + "vserverName1", + "vserverName2", + "provStatus1", + "vserverSelflink1", + true, + true, + "resourceVersion1", + new RelationshipList(), + new LInterfaceInstanceList()); + Vserver aVServer2 = new Vserver("vserverId2", + "vserverName2", + "vserverName2", + "provStatus2", + "vserverSelflink2", + false, + false, + "resourceVersion2", + new RelationshipList(), + new LInterfaceInstanceList()); + Vserver aVServer3 = new Vserver("vserverId1", + "vserverName1", + "vserverName2", + "provStatus1", + "vserverSelflink1", + true, + true, + "resourceVersion1", + new RelationshipList(), + new LInterfaceInstanceList()); + + assertTrue(aVServer1.equals(aVServer1)); + assertFalse(aVServer1.equals(aVServer2)); + assertTrue(aVServer1.equals(aVServer3)); + } + +} diff --git a/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java new file mode 100644 index 0000000..65c0ede --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/aai/test/datatype/WebConfigurationTest.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * 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.onap.pomba.contextbuilder.aai.test.datatype; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import org.junit.Test; +import org.onap.pomba.contextbuilder.aai.WebConfiguration; +import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +public class WebConfigurationTest { + @Test + public void runTest() { + WebConfiguration webConfiguration = new WebConfiguration(); + WebMvcConfigurerAdapter webMvConfigurationAdapter = webConfiguration.forwardToIndex(); + ViewResolverRegistry registry = mock(ViewResolverRegistry.class); + webMvConfigurationAdapter.configureViewResolvers(registry); + assertEquals(false, registry.hasRegistrations()); + } + +} |