aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/test/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-27 10:40:07 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-27 10:40:22 -0500
commit1e05b82f5633a6430761e053701264dd4ec4468b (patch)
tree5eae512f874b86560935089a5e0717b8281f9f67 /common/src/test/java/org/onap
parent9c03f8c7dbc74b0306fc4a8be0ce22be1d2521ca (diff)
add custom object support to a ai client
enhanced custom support of objects in client simplified the way objects are added to the type map attempt to search all packages with ClasspathHelper do not allow reflections to log so much former enums are now serializable again added the ability to create custom object types for A&AI client Change-Id: I47aae99bc42ccb0ab3d60d4d5d1fe0558cd1a273 Issue-ID: SO-1429 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/test/java/org/onap')
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java14
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java20
2 files changed, 34 insertions, 0 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index ea842719e8..d4eaf0873b 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -28,6 +28,20 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIObjectTypeTest {
+
+ @Test
+ public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
+ AAIObjectType type = AAIObjectType.fromTypeName("allotted-resource");
+ assertEquals("allotted-resource", type.typeName());
+
+ }
+
+ @Test
+ public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
+ AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name");
+ assertEquals("my-custom-name", type.typeName());
+
+ }
@Test
public void verifyDefaultCase() {
assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName());
diff --git a/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java b/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
new file mode 100644
index 0000000000..b964e905de
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
@@ -0,0 +1,20 @@
+package org.onap.so.client.aai.objects;
+
+import org.onap.so.client.aai.AAINamespaceConstants;
+import org.onap.so.client.aai.AAIObjectType;
+
+public class CustomAAIObjectType extends AAIObjectType {
+
+ private static final long serialVersionUID = 1919729212831978098L;
+
+ public static final AAIObjectType CUSTOM = new CustomAAIObjectType(AAINamespaceConstants.NETWORK, "my-url", "my-custom-name");
+
+ /* Default constructor automatically called by AAIObjectType */
+ public CustomAAIObjectType() {
+ super();
+ }
+ protected CustomAAIObjectType(String parent, String uri, String name) {
+ super(parent, uri, name);
+ }
+
+}