[ONOS-4042] Bump up Jersey from 1.19 to 2.22.2
- Fix unit test errors of web/api
- Fix default page redirection problem
- Fix compilation errors of web/gui
- Fix configuration of aaa, acl, cordfabric, cord-gui, dhcp, mfwd,
olt, openstack, segmentrouting, vtn, virtualbng, xos-integration
- Fix unit test errors of cpman, vtn, acl, faultmanagement
- Fix compilation errors of openstack, virtualbng, xos-integration,
REST SB controller
- Rearrange features.xml to resolve bundle dependencies
- Remove all of stale Jersey 1.x libraries
- Rearrange web.xml to point new Jersey 2.x servlet
Change-Id: Ic17f461ede0aa36fa8d470546d8069152dc1d134
diff --git a/web/api/src/test/java/org/onosproject/rest/StatisticsResourceTest.java b/web/api/src/test/java/org/onosproject/rest/StatisticsResourceTest.java
index 65ebd7d..0d682d8 100644
--- a/web/api/src/test/java/org/onosproject/rest/StatisticsResourceTest.java
+++ b/web/api/src/test/java/org/onosproject/rest/StatisticsResourceTest.java
@@ -15,10 +15,11 @@
*/
package org.onosproject.rest;
-import java.util.HashMap;
-import java.util.stream.IntStream;
-
import com.eclipsesource.json.Json;
+import com.eclipsesource.json.JsonArray;
+import com.eclipsesource.json.JsonObject;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import org.junit.Before;
import org.junit.Test;
import org.onlab.osgi.ServiceDirectory;
@@ -31,11 +32,11 @@
import org.onosproject.net.statistic.DefaultLoad;
import org.onosproject.net.statistic.StatisticService;
-import com.eclipsesource.json.JsonArray;
-import com.eclipsesource.json.JsonObject;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.sun.jersey.api.client.WebResource;
+import javax.ws.rs.client.WebTarget;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.stream.IntStream;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@@ -105,14 +106,14 @@
* @param device expected device ID
*/
private void checkValues(JsonObject load, int rate, int latest,
- boolean valid, String device) {
+ boolean valid, String device) throws UnsupportedEncodingException {
assertThat(load, notNullValue());
assertThat(load.get("rate").asInt(), is(rate));
assertThat(load.get("latest").asInt(), is(latest));
assertThat(load.get("valid").asBoolean(), is(valid));
assertThat(load.get("time").asLong(),
lessThanOrEqualTo((System.currentTimeMillis())));
- assertThat(load.get("link").asString(),
+ assertThat(URLDecoder.decode(load.get("link").asString(), "UTF-8"),
containsString("device=of:" + device));
}
@@ -120,11 +121,12 @@
* Tests GET of a single Load statistics object.
*/
@Test
- public void testSingleLoadGet() {
- final WebResource rs = resource();
- final String response = rs.path("statistics/flows/link")
+ public void testSingleLoadGet() throws UnsupportedEncodingException {
+ final WebTarget wt = target();
+ final String response = wt.path("statistics/flows/link")
.queryParam("device", "of:0000000000000001")
.queryParam("port", "2")
+ .request()
.get(String.class);
final JsonObject result = Json.parse(response).asObject();
@@ -145,9 +147,9 @@
* Tests GET of all Load statistics objects.
*/
@Test
- public void testLoadsGet() {
- final WebResource rs = resource();
- final String response = rs.path("statistics/flows/link/").get(String.class);
+ public void testLoadsGet() throws UnsupportedEncodingException {
+ final WebTarget wt = target();
+ final String response = wt.path("statistics/flows/link/").request().get(String.class);
final JsonObject result = Json.parse(response).asObject();
assertThat(result, notNullValue());