summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java8
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java11
-rw-r--r--pom.xml2
3 files changed, 17 insertions, 4 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
index c4b7b4a4..43b6b48b 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PapRestControllerV1.java
@@ -43,7 +43,7 @@ import org.onap.policy.models.base.PfModelException;
// @formatter:off
@Path("/policy/pap/v1")
@Api(value = "Policy Administration (PAP) API")
-@Produces(MediaType.APPLICATION_JSON)
+@Produces({MediaType.APPLICATION_JSON, PapRestControllerV1.APPLICATION_YAML})
@SwaggerDefinition(
info = @Info(description =
"Policy Administration is responsible for the deployment life cycle of policies as well as "
@@ -52,13 +52,15 @@ import org.onap.policy.models.base.PfModelException;
+ " ensuring that policies are available to users, that policies are executing correctly,"
+ " and that the state and status of policies is monitored", version = "v1.0",
title = "Policy Administration"),
- consumes = {MediaType.APPLICATION_JSON},
- produces = {MediaType.APPLICATION_JSON},
+ consumes = {MediaType.APPLICATION_JSON, PapRestControllerV1.APPLICATION_YAML},
+ produces = {MediaType.APPLICATION_JSON, PapRestControllerV1.APPLICATION_YAML},
schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
tags = {@Tag(name = "policy-administration", description = "Policy Administration Service Operations")},
securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
// @formatter:on
public class PapRestControllerV1 {
+ public static final String APPLICATION_YAML = "application/yaml";
+
public static final String EXTENSION_NAME = "interface info";
public static final String API_VERSION_NAME = "api-version";
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java b/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java
index 317ab1c1..d8e6963f 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/PapRestControllerV1Test.java
@@ -20,10 +20,13 @@
package org.onap.policy.pap.main.rest;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.UUID;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import org.junit.Before;
@@ -41,6 +44,14 @@ public class PapRestControllerV1Test {
}
@Test
+ public void testProduces() {
+ Produces annotation = PapRestControllerV1.class.getAnnotation(Produces.class);
+ assertNotNull(annotation);
+ assertThat(annotation.value()).contains(MediaType.APPLICATION_JSON)
+ .contains(PapRestControllerV1.APPLICATION_YAML);
+ }
+
+ @Test
public void testAddVersionControlHeaders() {
Response resp = ctlr.addVersionControlHeaders(bldr).build();
assertEquals("0", resp.getHeaderString(PapRestControllerV1.VERSION_MINOR_NAME));
diff --git a/pom.xml b/pom.xml
index 24a4a4e5..f4e6d5b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,7 @@
<sonar.jacoco.itReportPath>${project.basedir}/../target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
- <policy.common.version>1.5.2</policy.common.version>
+ <policy.common.version>1.6.0-SNAPSHOT</policy.common.version>
<policy.models.version>2.1.3</policy.models.version>
</properties>