aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index 103eb4ca..665616b5 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -34,6 +34,7 @@ import java.lang.reflect.Modifier;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Properties;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@@ -44,6 +45,7 @@ import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
@@ -135,6 +137,19 @@ public class TestApiRestServer {
private static final String OPS_POLICIES_VFIREWALL_VERSION = "policytypes/"
+ "onap.policies.controlloop.Guard/versions/1.0.0/policies/operational.modifyconfig/versions/1";
+ private static final String GET_DEPLOYED_VERSION_OF_POLICY =
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/"
+ + "1.0.0/policies/onap.restart.tca/versions/deployed";
+ private static final String GET_LATEST_VERSION_OF_OPERATIONAL_POLICY =
+ "policytypes/onap.policies.controlloop.Operational/versions/"
+ + "1.0.0/policies/operational.scaleout/versions/latest";
+ private static final String GET_SPECIFIC_VERSION_OF_OPERATIONAL_POLICY =
+ "policytypes/onap.policies.controlloop.Operational/versions/"
+ + "1.0.0/policies/operational.scaleout/versions/3";
+ private static final String DEL_SPECIFIC_VERSION_OF_OPERATIONAL_POLICY =
+ "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/"
+ + "policies/operational.scaleout/versions/1";
+
private static final String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore";
private static final CommonTestData COMMON_TEST_DATA = new CommonTestData();
private Main main;
@@ -619,6 +634,42 @@ public class TestApiRestServer {
}).doesNotThrowAnyException();
}
+ @Test
+ public void testGetDeployedVersionsOfPolicy() {
+ assertThatCode(() -> {
+ main = startApiService(true);
+ Response rawResponse = readResource(GET_DEPLOYED_VERSION_OF_POLICY, true);
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus());
+ }).doesNotThrowAnyException();
+ }
+
+ @Test
+ public void testGetLatestVersionOfOperationalPolicy() {
+ assertThatCode(() -> {
+ main = startApiService(true);
+ Response rawResponse = readResource(GET_LATEST_VERSION_OF_OPERATIONAL_POLICY, true);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
+ }).doesNotThrowAnyException();
+ }
+
+ @Test
+ public void testGetSpecificVersionOfOperationalPolicy() {
+ assertThatCode(() -> {
+ main = startApiService(true);
+ Response rawResponse = readResource(GET_SPECIFIC_VERSION_OF_OPERATIONAL_POLICY, true);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
+ }).doesNotThrowAnyException();
+ }
+
+ @Test
+ public void testDeleteSpecificVersionOfOperationalPolicy() {
+ assertThatCode(() -> {
+ main = startApiService(true);
+ Response rawResponse = deleteResource(DEL_SPECIFIC_VERSION_OF_OPERATIONAL_POLICY, true);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
+ }).doesNotThrowAnyException();
+ }
+
private Response createResource(String endpoint, String resourceName, boolean http) throws Exception {
ToscaServiceTemplate rawServiceTemplate = standardCoder.decode(