change the @api path in rest transactions api 22/106822/2
authorjhh <jorge.hernandez-herrero@att.com>
Wed, 29 Apr 2020 16:41:25 +0000 (11:41 -0500)
committerjhh <jorge.hernandez-herrero@att.com>
Wed, 29 Apr 2020 17:04:49 +0000 (12:04 -0500)
Issue-ID: POLICY-2530
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: If21e0607edcf75f491be61012779ddfa5d880105
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java
controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java

index b954167..3521e9f 100644 (file)
@@ -40,7 +40,7 @@ import org.onap.policy.drools.apps.controlloop.feature.trans.ControlLoopMetricsM
  * REST Transaction Tracker.
  */
 
-@Path("/policy/pdp/engine/controllers")
+@Path("/policy/pdp/engine/controllers/transactions")
 @Produces({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML})
 @Consumes({MediaType.APPLICATION_JSON, YamlMessageBodyHandler.APPLICATION_YAML})
 @Api
@@ -51,7 +51,7 @@ public class RestTransactionTracker {
      */
 
     @GET
-    @Path("transactions")
+    @Path("inprogress")
     @ApiOperation(value = "Retrieve in-progress transactions", responseContainer = "List")
     public Response transactions() {
         return Response.status(Response.Status.OK)
@@ -63,7 +63,7 @@ public class RestTransactionTracker {
      */
 
     @GET
-    @Path("transactions/{transactionId}")
+    @Path("inprogress/{transactionId}")
     @ApiOperation(value = "Retrieve an in-progress transaction", response = VirtualControlLoopNotification.class)
     public Response transactionId(
           @ApiParam(value = "UUID", required = true) @PathParam("transactionId") String transactionId) {
@@ -78,7 +78,7 @@ public class RestTransactionTracker {
      */
 
     @PUT
-    @Path("transactions/cacheSize/{cacheSize}")
+    @Path("cacheSize/{cacheSize}")
     @ApiOperation(value = "Sets the cache size", response = Integer.class)
     public Response cacheSize(
             @ApiParam(value = "cache size", required = true) @PathParam("cacheSize") int cacheSize) {
@@ -93,7 +93,7 @@ public class RestTransactionTracker {
      */
 
     @GET
-    @Path("transactions/cacheSize")
+    @Path("cacheSize")
     @ApiOperation(value = "Gets the cache size", response = Integer.class)
     public Response cacheSize() {
         return Response.status(Response.Status.OK)
@@ -105,7 +105,7 @@ public class RestTransactionTracker {
      */
 
     @PUT
-    @Path("transactions/timeout/{timeoutSecs}")
+    @Path("timeout/{timeoutSecs}")
     @ApiOperation(value = "Sets the timeout in seconds", response = Integer.class)
     public Response timeout(
             @ApiParam(value = "timeout", required = true) @PathParam("timeoutSecs") long timeoutSecs) {
@@ -120,7 +120,7 @@ public class RestTransactionTracker {
      */
 
     @GET
-    @Path("transactions/timeout")
+    @Path("timeout")
     @ApiOperation(value = "Gets the cache timeout", response = Long.class)
     public Response timeout() {
         return Response.status(Response.Status.OK)
index 2fa4ed5..d05b975 100644 (file)
@@ -113,12 +113,13 @@ public class RestTransactionTrackerTest {
 
     @Test
     public void testTransactions() {
-        equals(get("/", Response.Status.OK.getStatusCode()), List.class, Collections.emptyList());
+        equals(get("/inprogress", Response.Status.OK.getStatusCode()), List.class, Collections.emptyList());
 
         ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
 
-        assertTrue(HttpClient.getBody(get("/", Response.Status.OK.getStatusCode()), List.class).isEmpty());
-        get("/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.NOT_FOUND.getStatusCode());
+        assertTrue(HttpClient.getBody(get("/inprogress", Response.Status.OK.getStatusCode()),
+                List.class).isEmpty());
+        get("/inprogress/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.NOT_FOUND.getStatusCode());
 
         String activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
         VirtualControlLoopNotification active =
@@ -126,8 +127,10 @@ public class RestTransactionTrackerTest {
         feature.beforeDeliver(testController, Topic.CommInfrastructure.DMAAP, "POLICY-CL-MGT", active);
         assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
 
-        assertFalse(HttpClient.getBody(get("/", Response.Status.OK.getStatusCode()), List.class).isEmpty());
-        notNull(get("/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.OK.getStatusCode()), String.class);
+        assertFalse(HttpClient.getBody(get("/inprogress", Response.Status.OK.getStatusCode()),
+                List.class).isEmpty());
+        notNull(get("/inprogress/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.OK.getStatusCode()),
+                String.class);
     }
 
     private Response get(String contextPath, int statusCode) {