summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/test/java
diff options
context:
space:
mode:
authorrama-huawei <rama.subba.reddy.s@huawei.com>2018-09-07 17:37:19 +0530
committerrama-huawei <rama.subba.reddy.s@huawei.com>2018-09-07 18:53:29 +0530
commit904bb036bbcf1fb0e2ac5bc30cde7bfa94dd5de0 (patch)
treeeda6eba40c9ac0b6b4561e3f8b6a9a099ee59771 /holmes-actions/src/test/java
parent310a77fb3e99c4057b80098d0bcec7ecda62680d (diff)
Fixed integration issues for CCVPN usecase
1) Currently holmes is updating the AAI record without resource-version 2) Also corrected some of the AAI URL's Issue-ID: HOLMES-164 Change-Id: I7b0ba5cc786e57a282ee917bed07030dd9e74678 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'holmes-actions/src/test/java')
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java39
1 files changed, 33 insertions, 6 deletions
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java
index 52593aa..c094e4f 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java
@@ -18,7 +18,11 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.easymock.EasyMock;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.onap.holmes.common.aai.config.AaiConfig;
@@ -28,16 +32,23 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
-import javax.ws.rs.client.*;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.Invocation.Builder;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
-import java.util.Map;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
@@ -245,7 +256,7 @@ public class AaiQuery4CcvpnTest {
PowerMock.replayAll();
JSONArray instances = (JSONArray) Whitebox.invokeMethod(aai, "getServiceInstances",
- "custom-1", "service-type-1");
+ "custom-1", "service-type-1");
PowerMock.verifyAll();
@@ -265,7 +276,7 @@ public class AaiQuery4CcvpnTest {
PowerMock.replayAll();
JSONArray instances = (JSONArray) Whitebox.invokeMethod(aai, "getServiceInstances",
- "custom-1", "service-type-1");
+ "custom-1", "service-type-1");
PowerMock.verifyAll();
@@ -276,6 +287,10 @@ public class AaiQuery4CcvpnTest {
@Test
public void test_updateTerminalPointStatus() throws CorrelationException {
+ mockGetMethod();
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.toJSONString());
+ EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
+
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
@@ -288,6 +303,10 @@ public class AaiQuery4CcvpnTest {
@Test
public void test_updateTerminalPointStatus_exception() throws CorrelationException {
+ mockGetMethod();
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.toJSONString());
+ EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
+
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the TP information.");
@@ -303,6 +322,10 @@ public class AaiQuery4CcvpnTest {
@Test
public void test_updateLogicLinkStatus() throws CorrelationException {
+ mockGetMethod();
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.toJSONString());
+ EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
+
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
@@ -315,6 +338,10 @@ public class AaiQuery4CcvpnTest {
@Test
public void test_updateLogicLinkStatus_exception() throws CorrelationException {
+ mockGetMethod();
+ EasyMock.expect(response.readEntity(String.class)).andReturn(data.toJSONString());
+ EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
+
mockPatchMethod();
EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the logic link information.");