summaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2020-02-26 16:43:04 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-26 16:43:04 +0000
commit9f75b598b3e0946cf4065bced39f9ea77a9dc3d7 (patch)
tree310fc3df70ea160b7aad027f896560fb4a14dcfe /feature-lifecycle/src
parenta0a97b52416729cc9bc6da6d43c3bd03b29faa96 (diff)
parent04520679c94796757c5dda423ec52b78486e3186 (diff)
Merge "narrow rest server data response for lifecycle"
Diffstat (limited to 'feature-lifecycle/src')
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java17
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java10
2 files changed, 19 insertions, 8 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
index 9aea0450..44113779 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,11 +41,19 @@ import org.onap.policy.drools.lifecycle.LifecycleFsm;
public class RestLifecycleManager {
@GET
- @Path("engine/lifecycle/fsm")
+ @Path("engine/lifecycle/fsm/group")
@ApiOperation(value = "Retrieves the Lifecycle FSM",
notes = "Lifecycle FSM", response = LifecycleFsm.class)
- public Response fsm() {
- return Response.status(Response.Status.OK).entity(LifecycleFeature.fsm).build();
+ public Response group() {
+ return Response.status(Response.Status.OK).entity(LifecycleFeature.fsm.getGroup()).build();
+ }
+
+ @GET
+ @Path("engine/lifecycle/fsm/subgroup")
+ @ApiOperation(value = "Retrieves the Lifecycle FSM",
+ notes = "Lifecycle FSM", response = LifecycleFsm.class)
+ public Response subgroup() {
+ return Response.status(Response.Status.OK).entity(LifecycleFeature.fsm.getSubgroup()).build();
}
@GET
@@ -55,5 +63,4 @@ public class RestLifecycleManager {
public Response state() {
return Response.status(Response.Status.OK).entity(LifecycleFeature.fsm.state()).build();
}
-
}
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
index cb65b57f..ae62095e 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
@@ -19,7 +19,6 @@
package org.onap.policy.drools.server.restful;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@@ -33,6 +32,7 @@ import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.network.NetworkUtil;
+import org.onap.policy.drools.lifecycle.LifecycleFeature;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
import org.onap.policy.models.pdp.enums.PdpState;
@@ -80,8 +80,12 @@ public class RestLifecycleManagerTest {
@Test
public void testFsm() {
- Response response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm");
- assertNotNull(HttpClient.getBody(response, String.class));
+ Response response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm/group");
+ assertEquals(LifecycleFeature.fsm.getGroup(), HttpClient.getBody(response, String.class));
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
+
+ response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm/subgroup");
+ assertEquals("", HttpClient.getBody(response, String.class));
assertEquals(Status.OK.getStatusCode(), response.getStatus());
response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm/state");