diff options
author | sebdet <sebastien.determe@intl.att.com> | 2021-04-21 16:28:33 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2021-04-23 17:35:17 +0200 |
commit | d1ed0a9ba6ffea4006fadf3847495563d11dc12e (patch) | |
tree | 4ced12d9a953aa0fddd1c6a8002836964020d94d /src/main/java/org/onap | |
parent | 5ce5937197df5eed3895e2590ea31b23207026b4 (diff) |
ToscaFileSelector
The UI code that manages the tosca file selector that will be sent to clamp be + fix Rest Camel endpoint that always want ot convert http body to JSON (due to Camel upgrade)
Issue-ID: POLICY-3229
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I6148276d4c527f29db904a76655055c19d4e2023
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java | 5 |
2 files changed, 4 insertions, 3 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); |