aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/test/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-11 14:56:03 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-11 14:56:19 -0500
commita9ceeefef9a561937b42ed23bc5797930d5efefe (patch)
tree3e878cb893deecd8e8f310297cfa22078da3611e /common/src/test/java
parentb80f29cbbeb5ec218b0278deef872f7b5350e292 (diff)
restructured a&ai client
made generics a bit safer and updated groovy tests Change-Id: I6d7a2567cd9bf795e0cfa4914a7674a4ed5f50c4 Issue-ID: SO-1493 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/test/java')
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java (renamed from common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java)16
4 files changed, 15 insertions, 10 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
index ad15417b71..95b30f934b 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
@@ -41,6 +41,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -68,7 +69,7 @@ public class AAIRestClientTest {
public void verifyPatchValidation() throws URISyntaxException {
AAIRestClient client = new AAIRestClient(props, new URI(""));
AAIRestClient spy = spy(client);
- AAIPatchConverter patchValidatorMock = mock(AAIPatchConverter.class);
+ GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class);
doReturn(patchValidatorMock).when(spy).getPatchConverter();
String payload = "{}";
doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any());
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
index 428fa276db..27637126c6 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
@@ -45,6 +45,7 @@ import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRespon
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
@@ -117,7 +118,7 @@ public class AAISingleTransactionClientTest {
@Test
public void confirmPatchFormat() {
AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(AAIVersion.LATEST));
- AAIPatchConverter mock = mock(AAIPatchConverter.class);
+ GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
doReturn(mock).when(singleTransaction).getPatchConverter();
singleTransaction.update(uriA, "{}");
verify(mock, times(1)).convertPatchFormat(any());
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index 621375882b..342e3b1aa4 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -43,6 +43,7 @@ import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -143,7 +144,7 @@ public class AAITransactionalClientTest {
@Test
public void confirmPatchFormat() {
AAITransactionalClient client = spy(new AAITransactionalClient(AAIVersion.LATEST));
- AAIPatchConverter mock = mock(AAIPatchConverter.class);
+ GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
doReturn(mock).when(client).getPatchConverter();
client.update(uriA, "{}");
verify(mock, times(1)).convertPatchFormat(any());
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java b/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
index 0d4490f51d..d24b3ff147 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
+++ b/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.aai;
+package org.onap.so.client.graphinventory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -35,6 +35,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -42,13 +44,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
-public class AAIPatchConverterTest {
+public class GraphInventoryPatchConverterTest {
private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
@Test
public void convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
GenericVnf vnf = new GenericVnf();
vnf.setIpv4Loopback0Address("");
String result = validator.marshallObjectToPatchFormat(vnf);
@@ -60,7 +62,7 @@ public class AAIPatchConverterTest {
@Test
public void convertStringToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String payload = "{\"ipv4-loopback0-address\":\"\"}";
String result = validator.marshallObjectToPatchFormat(payload);
@@ -69,7 +71,7 @@ public class AAIPatchConverterTest {
@Test
public void convertStringToPatchFormatNull_Test() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String payload = "{\"ipv4-loopback0-address\": null}";
String result = validator.marshallObjectToPatchFormat(payload);
System.out.println(result);
@@ -78,7 +80,7 @@ public class AAIPatchConverterTest {
@Test
public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
HashMap<String, String> map = new HashMap<>();
map.put("ipv4-loopback0-address", "");
map.put("ipv4-loopback1-address", "192.168.1.1");
@@ -89,7 +91,7 @@ public class AAIPatchConverterTest {
@Test
public void hasComplexObjectTest() {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }";
String noNesting = "{ \"hello\" : \"world\" }";
String arrayCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}";