Fix buck tests

Change-Id: I3d681e6e5c1d3e98c87ccb3d20a619b216ae6133
diff --git a/apps/cpman/api/BUCK b/apps/cpman/api/BUCK
index fb4f6f5..156a545 100644
--- a/apps/cpman/api/BUCK
+++ b/apps/cpman/api/BUCK
@@ -10,7 +10,7 @@
  ]
 
 TEST_DEPS = [
-    '//lib:TEST',
+    '//lib:TEST_ADAPTERS',
 ]
 
 java_library(
diff --git a/apps/cpman/app/BUCK b/apps/cpman/app/BUCK
index c23153e..7a78bab 100644
--- a/apps/cpman/app/BUCK
+++ b/apps/cpman/app/BUCK
@@ -16,7 +16,8 @@
 ]
 
 TEST_DEPS = [
-    '//lib:TEST',
+    '//lib:TEST_REST',
+    '//web/api:onos-rest-tests',
 ]
 
 java_library(
@@ -33,4 +34,6 @@
            TEST_DEPS +
            [CURRENT_TARGET],
     source_under_test = [CURRENT_TARGET],
+    resources_root = 'src/test/resources',
+    resources = glob(['src/test/resources/**']),
 )
diff --git a/apps/cpman/app/pom.xml b/apps/cpman/app/pom.xml
index 8ec1f1f..25150b7 100644
--- a/apps/cpman/app/pom.xml
+++ b/apps/cpman/app/pom.xml
@@ -154,6 +154,13 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-rest</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -181,4 +188,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsCollectorResourceTest.java b/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsCollectorResourceTest.java
index 42c73cc..a0ef91c 100644
--- a/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsCollectorResourceTest.java
+++ b/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsCollectorResourceTest.java
@@ -15,8 +15,16 @@
  */
 package org.onosproject.cpman.rest;
 
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.util.Optional;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
 import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.test.JerseyTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.osgi.ServiceDirectory;
@@ -26,14 +34,7 @@
 import org.onosproject.cpman.SystemInfo;
 import org.onosproject.cpman.impl.SystemInfoFactory;
 import org.onosproject.net.DeviceId;
-
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.util.Optional;
+import org.onosproject.rest.resources.ResourceTest;
 
 import static org.easymock.EasyMock.anyInt;
 import static org.easymock.EasyMock.anyObject;
@@ -48,7 +49,7 @@
 /**
  * Unit test for ControlMetricsCollector.
  */
-public class ControlMetricsCollectorResourceTest extends JerseyTest {
+public class ControlMetricsCollectorResourceTest extends ResourceTest {
 
     final ControlPlaneMonitorService mockControlPlaneMonitorService =
                                      createMock(ControlPlaneMonitorService.class);
diff --git a/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsResourceTest.java b/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsResourceTest.java
index 62e5924..e78d3cd 100644
--- a/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsResourceTest.java
+++ b/apps/cpman/app/src/test/java/org/onosproject/cpman/rest/ControlMetricsResourceTest.java
@@ -15,9 +15,12 @@
  */
 package org.onosproject.cpman.rest;
 
-import com.google.common.collect.ImmutableSet;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import javax.ws.rs.client.WebTarget;
+
 import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.test.JerseyTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.osgi.ServiceDirectory;
@@ -32,10 +35,9 @@
 import org.onosproject.cpman.ControlLoad;
 import org.onosproject.cpman.ControlPlaneMonitorService;
 import org.onosproject.cpman.codec.ControlLoadCodec;
+import org.onosproject.rest.resources.ResourceTest;
 
-import javax.ws.rs.client.WebTarget;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
+import com.google.common.collect.ImmutableSet;
 
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.anyString;
@@ -49,7 +51,7 @@
 /**
  * Unit test for ControlMetrics REST API.
  */
-public class ControlMetricsResourceTest extends JerseyTest {
+public class ControlMetricsResourceTest extends ResourceTest {
 
     final ControlPlaneMonitorService mockControlPlaneMonitorService =
             createMock(ControlPlaneMonitorService.class);