Fix: resolve address conflict issue by extending ResourceTest

Change-Id: Ia1bdbefc715c1c4f120136e5cb21fdbb3cc54617
diff --git a/apps/ofagent/BUCK b/apps/ofagent/BUCK
index fedf257..e16cb7e 100644
--- a/apps/ofagent/BUCK
+++ b/apps/ofagent/BUCK
@@ -20,6 +20,7 @@
     '//core/common:onos-core-common-tests',
     '//lib:TEST_REST',
     '//lib:jersey-server',
+    '//web/api:onos-rest-tests',
 ]
 
 EXCLUDED_BUNDLES = [
diff --git a/apps/ofagent/pom.xml b/apps/ofagent/pom.xml
index 8b66199..6b222a6 100644
--- a/apps/ofagent/pom.xml
+++ b/apps/ofagent/pom.xml
@@ -134,6 +134,8 @@
             <groupId>org.onosproject</groupId>
             <artifactId>onos-rest</artifactId>
             <version>${project.version}</version>
+            <scope>test</scope>
+            <type>jar</type>
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
diff --git a/apps/ofagent/src/test/java/org/onosproject/ofagent/rest/OFAgentWebResourceTest.java b/apps/ofagent/src/test/java/org/onosproject/ofagent/rest/OFAgentWebResourceTest.java
index 026a9bc..6620c63 100644
--- a/apps/ofagent/src/test/java/org/onosproject/ofagent/rest/OFAgentWebResourceTest.java
+++ b/apps/ofagent/src/test/java/org/onosproject/ofagent/rest/OFAgentWebResourceTest.java
@@ -20,7 +20,6 @@
 import com.eclipsesource.json.JsonObject;
 import com.google.common.collect.Sets;
 import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.test.JerseyTest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,6 +35,7 @@
 import org.onosproject.ofagent.api.OFController;
 import org.onosproject.ofagent.impl.DefaultOFAgent;
 import org.onosproject.ofagent.impl.DefaultOFController;
+import org.onosproject.rest.resources.ResourceTest;
 
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.client.WebTarget;
@@ -46,18 +46,25 @@
 import java.net.HttpURLConnection;
 import java.util.Set;
 
-import static org.easymock.EasyMock.*;
-import static org.hamcrest.Matchers.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
 import static org.onosproject.ofagent.api.OFAgent.State.STOPPED;
 
-
 /**
  * Test class for OFAgent application REST resource.
  */
-public class OFAgentWebResourceTest extends JerseyTest {
-
+public class OFAgentWebResourceTest extends ResourceTest {
 
     private static final Set<OFController> CONTROLLER_SET_1 = Sets.newHashSet(
             DefaultOFController.of(
@@ -138,7 +145,7 @@
     /**
      * Tests the result of the rest api GET when there are OFAgents.
      *
-     * @throws IOException
+     * @throws IOException IO exception
      */
     @Test
     public void testNonEmptyOFAgentSet() throws IOException {
@@ -177,7 +184,7 @@
     /**
      * Tests the result of the rest api GET when there are no OFAgents.
      *
-     * @throws IOException
+     * @throws IOException IO exception
      */
     @Test
     public void testEmptyOFAgentSet() throws IOException {
@@ -199,7 +206,7 @@
     /**
      * Tests the result of the rest api GET for OFAgent.
      *
-     * @throws IOException
+     * @throws IOException IO exception
      */
     @Test
     public void testOFAgent() throws IOException {
@@ -223,7 +230,7 @@
     /**
      * Tests the result of the rest api GET for non-existent OFAgent.
      *
-     * @throws IOException
+     * @throws IOException IO exception
      */
     @Test
     public void testNonExistentOFAgent() throws IOException {