summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java2
-rw-r--r--src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java5
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml4
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml3
4 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java b/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java
index d0b116f71..5d8cbb05e 100644
--- a/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java
+++ b/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java
@@ -27,7 +27,6 @@ package org.onap.policy.clamp.clds.config.sdc;
import com.google.gson.JsonObject;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@@ -38,7 +37,6 @@ import org.onap.policy.clamp.clds.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
-import org.springframework.core.io.Resource;
/**
* This class maps the SDC config JSON file. This JSON can have multiple
diff --git a/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java b/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java
index 95d1fe182..6479cf767 100644
--- a/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java
+++ b/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java
@@ -36,6 +36,7 @@ import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatName;
import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.IOHelper;
+import org.apache.commons.io.IOUtils;
import org.onap.policy.clamp.clds.util.JsonUtils;
public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
@@ -113,7 +114,9 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D
public Object unmarshal(final Exchange exchange, final InputStream stream) throws Exception {
try (final InputStreamReader isr = new InputStreamReader(stream, StandardCharsets.UTF_8);
final BufferedReader reader = IOHelper.buffered(isr)) {
- if (unmarshalGenericType == null) {
+ if (unmarshalType.equals(String.class)) {
+ return IOUtils.toString(reader);
+ } else if (unmarshalGenericType == null) {
return gson.fromJson(reader, unmarshalType);
} else {
return gson.fromJson(reader, unmarshalGenericType);
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 3238822d3..c789735d2 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -1501,7 +1501,7 @@
</route>
</put>
- <post uri="/v2/policies/policytype" consumes="application/yaml">
+ <post uri="/v2/policies/policytype" type="java.lang.String" consumes="plain/text">
<route>
<removeHeaders pattern="*"/>
<doTry>
@@ -1514,6 +1514,8 @@
</setProperty>
<to uri="direct:create-policy-type"/>
<to
+ uri="bean:org.onap.policy.clamp.policy.downloader.PolicyEngineController?method=synchronizeAllPolicies()"/>
+ <to
uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/>
<doCatch>
<exception>java.lang.Exception</exception>
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index 19092bfac..01862692c 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -624,6 +624,9 @@
<setHeader name="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
+ <setHeader name="Content-Type">
+ <constant>application/yaml</constant>
+ </setHeader>
<setHeader name="X-ONAP-RequestID">
<simple>${exchangeProperty[X-ONAP-RequestID]}
</simple>