summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--holmes-actions/pom.xml5
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java4
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java11
-rw-r--r--pom.xml7
4 files changed, 20 insertions, 7 deletions
diff --git a/holmes-actions/pom.xml b/holmes-actions/pom.xml
index d5f5d59..d9d2fc3 100644
--- a/holmes-actions/pom.xml
+++ b/holmes-actions/pom.xml
@@ -140,13 +140,16 @@
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
- <version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
</dependency>
<dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
index 75b1bfc..0e444c1 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
@@ -28,6 +28,7 @@ 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 org.glassfish.jersey.client.HttpUrlConnectorProvider;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
@@ -237,7 +238,8 @@ public class AaiQuery4Ccvpn {
private Response patch(String host, String path, Map<String, Object> body) {
Client client = ClientBuilder.newClient();
WebTarget target = client.target(host).path(path);
- return target.request().headers(getAaiHeaders()).method("PATCH", Entity.json(body));
+ return target.request().headers(getAaiHeaders()).build("PATCH", Entity.json(body))
+ .property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true).invoke();
}
private JSONObject getInfo(String response, String pField, String field) {
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 ef12982..43cb517 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
@@ -17,6 +17,7 @@ package org.onap.holmes.common.aai;
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.rules.ExpectedException;
import org.junit.runner.RunWith;
@@ -36,6 +37,7 @@ import java.io.*;
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;
@@ -235,7 +237,7 @@ public class AaiQuery4CcvpnTest {
PowerMock.replayAll();
- JSONArray instances = (JSONArray)Whitebox.invokeMethod(aai, "getServiceInstances",
+ JSONArray instances = (JSONArray) Whitebox.invokeMethod(aai, "getServiceInstances",
"custom-1", "service-type-1");
PowerMock.verifyAll();
@@ -255,7 +257,7 @@ public class AaiQuery4CcvpnTest {
PowerMock.replayAll();
- JSONArray instances = (JSONArray)Whitebox.invokeMethod(aai, "getServiceInstances",
+ JSONArray instances = (JSONArray) Whitebox.invokeMethod(aai, "getServiceInstances",
"custom-1", "service-type-1");
PowerMock.verifyAll();
@@ -325,7 +327,10 @@ public class AaiQuery4CcvpnTest {
private void mockPatchMethod() {
initCommonMock();
- EasyMock.expect(builder.method(EasyMock.anyObject(String.class), EasyMock.anyObject(Entity.class))).andReturn(response);
+ Invocation invocation = PowerMock.createMock(Invocation.class);
+ EasyMock.expect(builder.build(EasyMock.anyObject(String.class), EasyMock.anyObject(Entity.class))).andReturn(invocation);
+ EasyMock.expect(invocation.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true)).andReturn(invocation);
+ EasyMock.expect(invocation.invoke()).andReturn(response);
}
private void initCommonMock() {
diff --git a/pom.xml b/pom.xml
index bacc2c9..e342997 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,16 +54,19 @@
<version>1.1.1</version>
</dependency>
<dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>${jersey.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>