aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/test
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-05-31 15:56:32 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-05-31 15:56:44 -0400
commita8e40692a53109fde1eb6e977947db907a611287 (patch)
treebb070e9203b971784212f18560ccf6d206dd8033 /common/src/test
parent89b396152a7f5ca62175d13342c1b3a1a9067ccb (diff)
apih resume request handling more generic
getInstanceName throws exception if requestScope doesn't match modelType Updated to combine separate return statements Replaced if statements for modelType and added tests Replace if statements for modelType in ResumeOrchestrationRequest and added tests Added coverage for setId in ModelType Updated to use ModelType setters/getters model type can now get and set generically Added modelInfo to RequestBody for resume request Added getModelType call and unit tests Moved getModelType from ServiceInstances Moved getModelType and added unit tests Added tests for getIsBaseVfModule Added more tests for isBaseVfModule Began adding tests for getIsBaseVfModule Updated currentActiveRequest creation and isBaseVfModule Updated recipe lookup and setting of aLaCarte to be more general Updated concurrency control to include other resources Change-Id: I12ad011d0a021c3ee066e16b4c8a4526d040cbe3 Issue-ID: SO-1963 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/test')
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java38
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java24
2 files changed, 62 insertions, 0 deletions
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
new file mode 100644
index 0000000000..e4b694cd15
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
@@ -0,0 +1,38 @@
+package org.onap.so.serviceinstancebeans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class ModelTypeTest {
+
+
+
+ @Test
+ public void reflectionTest() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+ TestServiceInstanceBean b = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+
+ b.setServiceInstanceId("my-id-b");
+ b.setServiceInstanceName("my-name-b");
+
+ assertEquals("my-id-a", ModelType.service.getId(a));
+ assertEquals("my-name-a", ModelType.service.getName(a));
+ ModelType.service.setName(a, ModelType.service.getName(b));
+ ModelType.service.setId(a, ModelType.service.getId(b));
+ assertEquals("my-name-b", ModelType.service.getName(a));
+ assertEquals("my-id-b", ModelType.service.getId(a));
+ }
+
+ @Test
+ public void testSilentFail() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+ assertNull(ModelType.service.get(a, "NoField"));
+ }
+}
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
new file mode 100644
index 0000000000..b8cf6141e3
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
@@ -0,0 +1,24 @@
+package org.onap.so.serviceinstancebeans;
+
+public class TestServiceInstanceBean {
+
+ private String serviceInstanceId;
+ private String serviceInstanceName;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+}