From b078c9d89a9d6c07f7cb6e7196b34caf797138d6 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Thu, 15 Nov 2018 11:59:54 +0900 Subject: Rename test classes in drools-applications Make test classes name consistence by putting 'Test' at end as per google java style guide Issue-ID: POLICY-1258 Change-Id: Id79e5d3fe3688f7f2569b7996613595cc6b746e7 Signed-off-by: Parshad Patel --- .../org/onap/policy/sdc/ResourceInstanceTest.java | 155 +++++++++++++++++++ .../java/org/onap/policy/sdc/ResourceTest.java | 152 ++++++++++++++++++ .../org/onap/policy/sdc/ServiceInstanceTest.java | 170 +++++++++++++++++++++ .../test/java/org/onap/policy/sdc/ServiceTest.java | 137 +++++++++++++++++ .../java/org/onap/policy/sdc/TestResource.java | 152 ------------------ .../org/onap/policy/sdc/TestResourceInstance.java | 155 ------------------- .../test/java/org/onap/policy/sdc/TestService.java | 137 ----------------- .../org/onap/policy/sdc/TestServiceInstance.java | 170 --------------------- 8 files changed, 614 insertions(+), 614 deletions(-) create mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java create mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java create mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java create mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestService.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestServiceInstance.java (limited to 'controlloop/common/model-impl/sdc/src') diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java new file mode 100644 index 000000000..572a1186a --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * + * ================================================================================ + * 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.policy.sdc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.UUID; + +import org.junit.Test; + +public class ResourceInstanceTest { + + @Test + public void testConstructors() { + ResourceInstance ri = new ResourceInstance(); + assertEquals(null, ri.getResourceInstanceName()); + assertEquals(null, ri.getResourceUuid()); + assertEquals(null, ri.getResourceInvariantUUID()); + assertEquals(null, ri.getResourceName()); + assertEquals(null, ri.getResourceType()); + assertEquals(null, ri.getResourceVersion()); + + ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null); + assertEquals(null, ri2.getResourceInstanceName()); + assertEquals(null, ri2.getResourceUuid()); + assertEquals(null, ri2.getResourceInvariantUUID()); + assertEquals(null, ri2.getResourceName()); + assertEquals(null, ri2.getResourceType()); + assertEquals(null, ri2.getResourceVersion()); + + ri2 = new ResourceInstance(ri); + assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName()); + assertEquals(ri2.getResourceUuid(), ri.getResourceUuid()); + assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID()); + assertEquals(ri2.getResourceName(), ri.getResourceName()); + assertEquals(ri2.getResourceType(), ri.getResourceType()); + assertEquals(ri2.getResourceVersion(), ri.getResourceVersion()); + } + + @Test + public void testInstanceName() { + ResourceInstance ri = new ResourceInstance(); + String name = "nameTestInstance"; + ri.setResourceInstanceName(name);; + assertEquals(name, ri.getResourceInstanceName()); + } + + @Test + public void testUuid() { + ResourceInstance ri = new ResourceInstance(); + UUID uuid = UUID.randomUUID(); + ri.setResourceUuid(uuid); + assertEquals(uuid, ri.getResourceUuid()); + } + + @Test + public void testInvariantUuid() { + ResourceInstance ri = new ResourceInstance(); + UUID uuid = UUID.randomUUID(); + ri.setResourceInvariantUUID(uuid); + assertEquals(uuid, ri.getResourceInvariantUUID()); + } + + @Test + public void testName() { + ResourceInstance ri = new ResourceInstance(); + String name = "nameTest"; + ri.setResourceName(name); + assertEquals(name, ri.getResourceName()); + } + + @Test + public void testVersion() { + ResourceInstance ri = new ResourceInstance(); + String version = "versionTest"; + ri.setResourceVersion(version); + assertEquals(version, ri.getResourceVersion()); + } + + @Test + public void testType() { + ResourceInstance ri = new ResourceInstance(); + ri.setResourceType(ResourceType.CP); + assertEquals(ResourceType.CP, ri.getResourceType()); + } + + @Test + public void testEquals() { + ResourceInstance ri1 = new ResourceInstance(); + ResourceInstance ri2 = new ResourceInstance(ri1); + assertTrue(ri1.equals(ri2)); + assertTrue(ri2.equals(ri1)); + + ri1.setResourceInstanceName("instance"); + ri1.setResourceName("resource"); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceVersion("0.0.0"); + ri1.setResourceType(ResourceType.VL); + ri2 = new ResourceInstance(ri1); + assertTrue(ri1.equals(ri2)); + assertTrue(ri2.equals(ri1)); + } + + @Test + public void testToString() { + ResourceInstance ri1 = new ResourceInstance(); + ResourceInstance ri2 = new ResourceInstance(ri1); + assertEquals(ri1.toString(), ri2.toString()); + + ri1.setResourceInstanceName("instance"); + ri1.setResourceName("resource"); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceVersion("0.0.0"); + ri1.setResourceType(ResourceType.VL); + ri2 = new ResourceInstance(ri1); + assertEquals(ri1.toString(), ri2.toString()); + } + + @Test + public void testHashCode() { + ResourceInstance ri1 = new ResourceInstance(); + ResourceInstance ri2 = new ResourceInstance(ri1); + assertEquals(ri1.hashCode(), ri2.hashCode()); + + ri1.setResourceInstanceName("instance"); + ri1.setResourceName("resource"); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceVersion("0.0.0"); + ri1.setResourceType(ResourceType.VL); + ri2 = new ResourceInstance(ri1); + assertEquals(ri1.hashCode(), ri2.hashCode()); + } +} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java new file mode 100644 index 000000000..0ee68a11e --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * + * ================================================================================ + * 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.policy.sdc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.UUID; + +import org.junit.Test; + +public class ResourceTest { + + @Test + public void testConstructors() { + Resource res = new Resource(); + assertEquals(null, res.getResourceUuid()); + assertEquals(null, res.getResourceInvariantUuid()); + assertEquals(null, res.getResourceName()); + assertEquals(null, res.getResourceType()); + assertEquals(null, res.getResourceVersion()); + + UUID uuid = UUID.randomUUID(); + res = new Resource(uuid); + assertEquals(uuid, res.getResourceUuid()); + assertEquals(null, res.getResourceInvariantUuid()); + assertEquals(null, res.getResourceName()); + assertEquals(null, res.getResourceType()); + assertEquals(null, res.getResourceVersion()); + + String name = "constTest"; + res = new Resource(name, ResourceType.CP); + assertEquals(null, res.getResourceUuid()); + assertEquals(name, res.getResourceName()); + assertEquals(ResourceType.CP, res.getResourceType()); + assertEquals(null, res.getResourceInvariantUuid()); + assertEquals(null, res.getResourceVersion()); + + uuid = UUID.randomUUID(); + UUID uuidInvariant = UUID.randomUUID(); + name = "constTestUUID"; + String version = "0.0.1"; + res = new Resource(uuid, uuidInvariant, name, version, ResourceType.VF); + assertEquals(uuid, res.getResourceUuid()); + assertEquals(uuidInvariant, res.getResourceInvariantUuid()); + assertEquals(name, res.getResourceName()); + assertEquals(ResourceType.VF, res.getResourceType()); + assertEquals(version, res.getResourceVersion()); + + Resource r2 = new Resource(res); + assertEquals(uuid, r2.getResourceUuid()); + assertEquals(uuidInvariant, r2.getResourceInvariantUuid()); + assertEquals(name, r2.getResourceName()); + assertEquals(ResourceType.VF, r2.getResourceType()); + assertEquals(version, r2.getResourceVersion()); + } + + @Test + public void testUuid() { + Resource res = new Resource(); + UUID uuid = UUID.randomUUID(); + res.setResourceUuid(uuid); + assertEquals(uuid, res.getResourceUuid()); + } + + @Test + public void testInvariantUuid() { + Resource res = new Resource(); + UUID uuid = UUID.randomUUID(); + res.setResourceInvariantUuid(uuid); + assertEquals(uuid, res.getResourceInvariantUuid()); + } + + @Test + public void testName() { + Resource res = new Resource(); + String name = "nameTest"; + res.setResourceName(name); + assertEquals(name, res.getResourceName()); + } + + @Test + public void testVersion() { + Resource res = new Resource(); + String version = "versionTest"; + res.setResourceVersion(version); + assertEquals(version, res.getResourceVersion()); + } + + @Test + public void testType() { + Resource res = new Resource(); + res.setResourceType(ResourceType.CP); + assertEquals(ResourceType.CP, res.getResourceType()); + } + + @Test + public void testEquals() { + Resource r1 = new Resource(); + Resource r2 = new Resource(r1); + assertTrue(r1.equals(r2)); + assertTrue(r2.equals(r1)); + + r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", + ResourceType.VFC); + r2 = new Resource(r1); + assertTrue(r1.equals(r2)); + assertTrue(r2.equals(r1)); + } + + @Test + public void testToString() { + Resource r1 = new Resource(); + Resource r2 = new Resource(r1); + assertEquals(r1.toString(), r2.toString()); + + r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", + ResourceType.VFC); + r2 = new Resource(r1); + assertEquals(r1.toString(), r2.toString()); + } + + @Test + public void testHashCode() { + Resource r1 = new Resource(); + Resource r2 = new Resource(r1); + assertEquals(r1.hashCode(), r2.hashCode()); + + r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", + ResourceType.VFC); + r2 = new Resource(r1); + assertEquals(r1.hashCode(), r2.hashCode()); + } +} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java new file mode 100644 index 000000000..14f2d3d37 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * + * ================================================================================ + * 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.policy.sdc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.UUID; + +import org.junit.Test; + +public class ServiceInstanceTest { + + @Test + public void testConstructors() { + ServiceInstance si = new ServiceInstance(); + assertEquals(null, si.getServiceInstanceName()); + assertEquals(null, si.getServiceUUID()); + assertEquals(null, si.getServiceInstanceUUID()); + assertEquals(null, si.getServiceName()); + assertEquals(null, si.getPersonaModelUUID()); + assertEquals(null, si.getWidgetModelUUID()); + assertEquals(null, si.getWidgetModelVersion()); + + ServiceInstance si2 = new ServiceInstance((ServiceInstance) null); + assertEquals(null, si2.getServiceInstanceName()); + assertEquals(null, si2.getServiceUUID()); + assertEquals(null, si2.getServiceInstanceUUID()); + assertEquals(null, si2.getServiceName()); + assertEquals(null, si2.getPersonaModelUUID()); + assertEquals(null, si2.getWidgetModelUUID()); + assertEquals(null, si2.getWidgetModelVersion()); + + si2 = new ServiceInstance(si); + assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName()); + assertEquals(si2.getServiceUUID(), si.getServiceUUID()); + assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID()); + assertEquals(si2.getServiceName(), si.getServiceName()); + assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID()); + assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID()); + assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion()); + } + + @Test + public void testInstanceName() { + ServiceInstance si = new ServiceInstance(); + String name = "nameTestInstance"; + si.setServiceInstanceName(name);; + assertEquals(name, si.getServiceInstanceName()); + } + + @Test + public void testUuid() { + ServiceInstance si = new ServiceInstance(); + UUID uuid = UUID.randomUUID(); + si.setServiceUUID(uuid); + assertEquals(uuid, si.getServiceUUID()); + } + + @Test + public void testInstanceUuid() { + ServiceInstance si = new ServiceInstance(); + UUID uuid = UUID.randomUUID(); + si.setServiceInstanceUUID(uuid); + assertEquals(uuid, si.getServiceInstanceUUID()); + } + + @Test + public void testName() { + ServiceInstance si = new ServiceInstance(); + String name = "nameTest"; + si.setServiceName(name); + assertEquals(name, si.getServiceName()); + } + + @Test + public void testPersonaModelUuid() { + ServiceInstance si = new ServiceInstance(); + UUID uuid = UUID.randomUUID(); + si.setPersonaModelUUID(uuid); + assertEquals(uuid, si.getPersonaModelUUID()); + } + + @Test + public void testWidgetModelUuid() { + ServiceInstance si = new ServiceInstance(); + UUID uuid = UUID.randomUUID(); + si.setWidgetModelUUID(uuid); + assertEquals(uuid, si.getWidgetModelUUID()); + } + + @Test + public void testWidgetModelVersion() { + ServiceInstance si = new ServiceInstance(); + String version = "2.2.2"; + si.setWidgetModelVersion(version);; + assertEquals(version, si.getWidgetModelVersion()); + } + + @Test + public void testEquals() { + ServiceInstance si1 = new ServiceInstance(); + ServiceInstance si2 = new ServiceInstance(si1); + assertTrue(si1.equals(si2)); + assertTrue(si2.equals(si1)); + + si1.setServiceInstanceName("instance"); + si1.setServiceName("service"); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); + si1.setWidgetModelVersion("3.3.3"); + si2 = new ServiceInstance(si1); + assertTrue(si1.equals(si2)); + assertTrue(si2.equals(si1)); + } + + @Test + public void testToString() { + ServiceInstance si1 = new ServiceInstance(); + ServiceInstance si2 = new ServiceInstance(si1); + assertEquals(si1.toString(), si2.toString()); + + si1.setServiceInstanceName("instance"); + si1.setServiceName("service"); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); + si1.setWidgetModelVersion("3.3.3"); + si2 = new ServiceInstance(si1); + assertEquals(si1.toString(), si2.toString()); + } + + @Test + public void testHashCode() { + ServiceInstance si1 = new ServiceInstance(); + ServiceInstance si2 = new ServiceInstance(si1); + assertEquals(si1.hashCode(), si2.hashCode()); + + si1.setServiceInstanceName("instance"); + si1.setServiceName("service"); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); + si1.setWidgetModelVersion("3.3.3"); + si2 = new ServiceInstance(si1); + assertEquals(si1.hashCode(), si2.hashCode()); + } +} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java new file mode 100644 index 000000000..a7d223d18 --- /dev/null +++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * sdc + * ================================================================================ + * + * ================================================================================ + * 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.policy.sdc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.UUID; + +import org.junit.Test; + +public class ServiceTest { + + @Test + public void testConstructors() { + Service svc = new Service(); + assertEquals(null, svc.getServiceUUID()); + assertEquals(null, svc.getServiceInvariantUUID()); + assertEquals(null, svc.getServiceName()); + assertEquals(null, svc.getServiceVersion()); + + UUID uuid = UUID.randomUUID(); + svc = new Service(uuid); + assertEquals(uuid, svc.getServiceUUID()); + assertEquals(null, svc.getServiceInvariantUUID()); + assertEquals(null, svc.getServiceName()); + assertEquals(null, svc.getServiceVersion()); + + String name = "constTest"; + svc = new Service(name); + assertEquals(null, svc.getServiceUUID()); + assertEquals(name, svc.getServiceName()); + assertEquals(null, svc.getServiceInvariantUUID()); + assertEquals(null, svc.getServiceVersion()); + + uuid = UUID.randomUUID(); + UUID uuidInvariant = UUID.randomUUID(); + name = "constTestUUID"; + String version = "0.0.1"; + svc = new Service(uuid, uuidInvariant, name, version); + assertEquals(uuid, svc.getServiceUUID()); + assertEquals(uuidInvariant, svc.getServiceInvariantUUID()); + assertEquals(name, svc.getServiceName()); + assertEquals(version, svc.getServiceVersion()); + + Service s2 = new Service(svc); + assertEquals(uuid, s2.getServiceUUID()); + assertEquals(uuidInvariant, s2.getServiceInvariantUUID()); + assertEquals(name, s2.getServiceName()); + assertEquals(version, s2.getServiceVersion()); + } + + @Test + public void testUuid() { + Service svc = new Service(); + UUID uuid = UUID.randomUUID(); + svc.setServiceUUID(uuid); + assertEquals(uuid, svc.getServiceUUID()); + } + + @Test + public void testInvariantUuid() { + Service svc = new Service(); + UUID uuid = UUID.randomUUID(); + svc.setServiceInvariantUUID(uuid); + assertEquals(uuid, svc.getServiceInvariantUUID()); + } + + @Test + public void testName() { + Service svc = new Service(); + String name = "nameTest"; + svc.setServiceName(name); + assertEquals(name, svc.getServiceName()); + } + + @Test + public void testVersion() { + Service svc = new Service(); + String version = "versionTest"; + svc.setServiceVersion(version); + assertEquals(version, svc.getServiceVersion()); + } + + @Test + public void testEquals() { + Service s1 = new Service(); + Service s2 = new Service(s1); + assertTrue(s1.equals(s2)); + assertTrue(s2.equals(s1)); + + s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); + s2 = new Service(s1); + assertTrue(s1.equals(s2)); + assertTrue(s2.equals(s1)); + } + + @Test + public void testToString() { + Service s1 = new Service(); + Service s2 = new Service(s1); + assertEquals(s1.toString(), s2.toString()); + + s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); + s2 = new Service(s1); + assertEquals(s1.toString(), s2.toString()); + } + + @Test + public void testHashCode() { + Service s1 = new Service(); + Service s2 = new Service(s1); + assertEquals(s1.hashCode(), s2.hashCode()); + + s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); + s2 = new Service(s1); + assertEquals(s1.hashCode(), s2.hashCode()); + } +} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java deleted file mode 100644 index 7b3a3e1f6..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.policy.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class TestResource { - - @Test - public void testConstructors() { - Resource res = new Resource(); - assertEquals(null, res.getResourceUuid()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceName()); - assertEquals(null, res.getResourceType()); - assertEquals(null, res.getResourceVersion()); - - UUID uuid = UUID.randomUUID(); - res = new Resource(uuid); - assertEquals(uuid, res.getResourceUuid()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceName()); - assertEquals(null, res.getResourceType()); - assertEquals(null, res.getResourceVersion()); - - String name = "constTest"; - res = new Resource(name, ResourceType.CP); - assertEquals(null, res.getResourceUuid()); - assertEquals(name, res.getResourceName()); - assertEquals(ResourceType.CP, res.getResourceType()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceVersion()); - - uuid = UUID.randomUUID(); - UUID uuidInvariant = UUID.randomUUID(); - name = "constTestUUID"; - String version = "0.0.1"; - res = new Resource(uuid, uuidInvariant, name, version, ResourceType.VF); - assertEquals(uuid, res.getResourceUuid()); - assertEquals(uuidInvariant, res.getResourceInvariantUuid()); - assertEquals(name, res.getResourceName()); - assertEquals(ResourceType.VF, res.getResourceType()); - assertEquals(version, res.getResourceVersion()); - - Resource r2 = new Resource(res); - assertEquals(uuid, r2.getResourceUuid()); - assertEquals(uuidInvariant, r2.getResourceInvariantUuid()); - assertEquals(name, r2.getResourceName()); - assertEquals(ResourceType.VF, r2.getResourceType()); - assertEquals(version, r2.getResourceVersion()); - } - - @Test - public void testUuid() { - Resource res = new Resource(); - UUID uuid = UUID.randomUUID(); - res.setResourceUuid(uuid); - assertEquals(uuid, res.getResourceUuid()); - } - - @Test - public void testInvariantUuid() { - Resource res = new Resource(); - UUID uuid = UUID.randomUUID(); - res.setResourceInvariantUuid(uuid); - assertEquals(uuid, res.getResourceInvariantUuid()); - } - - @Test - public void testName() { - Resource res = new Resource(); - String name = "nameTest"; - res.setResourceName(name); - assertEquals(name, res.getResourceName()); - } - - @Test - public void testVersion() { - Resource res = new Resource(); - String version = "versionTest"; - res.setResourceVersion(version); - assertEquals(version, res.getResourceVersion()); - } - - @Test - public void testType() { - Resource res = new Resource(); - res.setResourceType(ResourceType.CP); - assertEquals(ResourceType.CP, res.getResourceType()); - } - - @Test - public void testEquals() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); - } - - @Test - public void testToString() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertEquals(r1.toString(), r2.toString()); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertEquals(r1.toString(), r2.toString()); - } - - @Test - public void testHashCode() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertEquals(r1.hashCode(), r2.hashCode()); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertEquals(r1.hashCode(), r2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java deleted file mode 100644 index 2a1dc42b3..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.policy.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class TestResourceInstance { - - @Test - public void testConstructors() { - ResourceInstance ri = new ResourceInstance(); - assertEquals(null, ri.getResourceInstanceName()); - assertEquals(null, ri.getResourceUuid()); - assertEquals(null, ri.getResourceInvariantUUID()); - assertEquals(null, ri.getResourceName()); - assertEquals(null, ri.getResourceType()); - assertEquals(null, ri.getResourceVersion()); - - ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null); - assertEquals(null, ri2.getResourceInstanceName()); - assertEquals(null, ri2.getResourceUuid()); - assertEquals(null, ri2.getResourceInvariantUUID()); - assertEquals(null, ri2.getResourceName()); - assertEquals(null, ri2.getResourceType()); - assertEquals(null, ri2.getResourceVersion()); - - ri2 = new ResourceInstance(ri); - assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName()); - assertEquals(ri2.getResourceUuid(), ri.getResourceUuid()); - assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID()); - assertEquals(ri2.getResourceName(), ri.getResourceName()); - assertEquals(ri2.getResourceType(), ri.getResourceType()); - assertEquals(ri2.getResourceVersion(), ri.getResourceVersion()); - } - - @Test - public void testInstanceName() { - ResourceInstance ri = new ResourceInstance(); - String name = "nameTestInstance"; - ri.setResourceInstanceName(name);; - assertEquals(name, ri.getResourceInstanceName()); - } - - @Test - public void testUuid() { - ResourceInstance ri = new ResourceInstance(); - UUID uuid = UUID.randomUUID(); - ri.setResourceUuid(uuid); - assertEquals(uuid, ri.getResourceUuid()); - } - - @Test - public void testInvariantUuid() { - ResourceInstance ri = new ResourceInstance(); - UUID uuid = UUID.randomUUID(); - ri.setResourceInvariantUUID(uuid); - assertEquals(uuid, ri.getResourceInvariantUUID()); - } - - @Test - public void testName() { - ResourceInstance ri = new ResourceInstance(); - String name = "nameTest"; - ri.setResourceName(name); - assertEquals(name, ri.getResourceName()); - } - - @Test - public void testVersion() { - ResourceInstance ri = new ResourceInstance(); - String version = "versionTest"; - ri.setResourceVersion(version); - assertEquals(version, ri.getResourceVersion()); - } - - @Test - public void testType() { - ResourceInstance ri = new ResourceInstance(); - ri.setResourceType(ResourceType.CP); - assertEquals(ResourceType.CP, ri.getResourceType()); - } - - @Test - public void testEquals() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); - } - - @Test - public void testToString() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertEquals(ri1.toString(), ri2.toString()); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertEquals(ri1.toString(), ri2.toString()); - } - - @Test - public void testHashCode() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertEquals(ri1.hashCode(), ri2.hashCode()); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertEquals(ri1.hashCode(), ri2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestService.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestService.java deleted file mode 100644 index e5760236b..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestService.java +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.policy.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class TestService { - - @Test - public void testConstructors() { - Service svc = new Service(); - assertEquals(null, svc.getServiceUUID()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceName()); - assertEquals(null, svc.getServiceVersion()); - - UUID uuid = UUID.randomUUID(); - svc = new Service(uuid); - assertEquals(uuid, svc.getServiceUUID()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceName()); - assertEquals(null, svc.getServiceVersion()); - - String name = "constTest"; - svc = new Service(name); - assertEquals(null, svc.getServiceUUID()); - assertEquals(name, svc.getServiceName()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceVersion()); - - uuid = UUID.randomUUID(); - UUID uuidInvariant = UUID.randomUUID(); - name = "constTestUUID"; - String version = "0.0.1"; - svc = new Service(uuid, uuidInvariant, name, version); - assertEquals(uuid, svc.getServiceUUID()); - assertEquals(uuidInvariant, svc.getServiceInvariantUUID()); - assertEquals(name, svc.getServiceName()); - assertEquals(version, svc.getServiceVersion()); - - Service s2 = new Service(svc); - assertEquals(uuid, s2.getServiceUUID()); - assertEquals(uuidInvariant, s2.getServiceInvariantUUID()); - assertEquals(name, s2.getServiceName()); - assertEquals(version, s2.getServiceVersion()); - } - - @Test - public void testUuid() { - Service svc = new Service(); - UUID uuid = UUID.randomUUID(); - svc.setServiceUUID(uuid); - assertEquals(uuid, svc.getServiceUUID()); - } - - @Test - public void testInvariantUuid() { - Service svc = new Service(); - UUID uuid = UUID.randomUUID(); - svc.setServiceInvariantUUID(uuid); - assertEquals(uuid, svc.getServiceInvariantUUID()); - } - - @Test - public void testName() { - Service svc = new Service(); - String name = "nameTest"; - svc.setServiceName(name); - assertEquals(name, svc.getServiceName()); - } - - @Test - public void testVersion() { - Service svc = new Service(); - String version = "versionTest"; - svc.setServiceVersion(version); - assertEquals(version, svc.getServiceVersion()); - } - - @Test - public void testEquals() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); - } - - @Test - public void testToString() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertEquals(s1.toString(), s2.toString()); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertEquals(s1.toString(), s2.toString()); - } - - @Test - public void testHashCode() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertEquals(s1.hashCode(), s2.hashCode()); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertEquals(s1.hashCode(), s2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestServiceInstance.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestServiceInstance.java deleted file mode 100644 index 5ee4a9de8..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestServiceInstance.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.policy.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class TestServiceInstance { - - @Test - public void testConstructors() { - ServiceInstance si = new ServiceInstance(); - assertEquals(null, si.getServiceInstanceName()); - assertEquals(null, si.getServiceUUID()); - assertEquals(null, si.getServiceInstanceUUID()); - assertEquals(null, si.getServiceName()); - assertEquals(null, si.getPersonaModelUUID()); - assertEquals(null, si.getWidgetModelUUID()); - assertEquals(null, si.getWidgetModelVersion()); - - ServiceInstance si2 = new ServiceInstance((ServiceInstance) null); - assertEquals(null, si2.getServiceInstanceName()); - assertEquals(null, si2.getServiceUUID()); - assertEquals(null, si2.getServiceInstanceUUID()); - assertEquals(null, si2.getServiceName()); - assertEquals(null, si2.getPersonaModelUUID()); - assertEquals(null, si2.getWidgetModelUUID()); - assertEquals(null, si2.getWidgetModelVersion()); - - si2 = new ServiceInstance(si); - assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName()); - assertEquals(si2.getServiceUUID(), si.getServiceUUID()); - assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID()); - assertEquals(si2.getServiceName(), si.getServiceName()); - assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID()); - assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID()); - assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion()); - } - - @Test - public void testInstanceName() { - ServiceInstance si = new ServiceInstance(); - String name = "nameTestInstance"; - si.setServiceInstanceName(name);; - assertEquals(name, si.getServiceInstanceName()); - } - - @Test - public void testUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setServiceUUID(uuid); - assertEquals(uuid, si.getServiceUUID()); - } - - @Test - public void testInstanceUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setServiceInstanceUUID(uuid); - assertEquals(uuid, si.getServiceInstanceUUID()); - } - - @Test - public void testName() { - ServiceInstance si = new ServiceInstance(); - String name = "nameTest"; - si.setServiceName(name); - assertEquals(name, si.getServiceName()); - } - - @Test - public void testPersonaModelUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setPersonaModelUUID(uuid); - assertEquals(uuid, si.getPersonaModelUUID()); - } - - @Test - public void testWidgetModelUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setWidgetModelUUID(uuid); - assertEquals(uuid, si.getWidgetModelUUID()); - } - - @Test - public void testWidgetModelVersion() { - ServiceInstance si = new ServiceInstance(); - String version = "2.2.2"; - si.setWidgetModelVersion(version);; - assertEquals(version, si.getWidgetModelVersion()); - } - - @Test - public void testEquals() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); - } - - @Test - public void testToString() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertEquals(si1.toString(), si2.toString()); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertEquals(si1.toString(), si2.toString()); - } - - @Test - public void testHashCode() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertEquals(si1.hashCode(), si2.hashCode()); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertEquals(si1.hashCode(), si2.hashCode()); - } -} -- cgit 1.2.3-korg