summaryrefslogtreecommitdiffstats
path: root/gson
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-03-14 14:24:14 +0000
committerliamfallon <liam.fallon@est.tech>2019-03-14 14:24:14 +0000
commit8640a6e4b2d50cf2068207b1ddec965c07cec3aa (patch)
tree83e3a348f68a56f56e0b8dc5ad0f78bb99bb3701 /gson
parenta1f00c1cf93edb412b7bfeb276dbb76557e6c0a8 (diff)
Add support for TOSCA JSON Parsing
Added a getter to allow the Gson object to be retrieved from a GSON message body handler, useful for testing. Moved the TextFileUtils utility class from APEX utilites to policy common utils Issue-ID: POLICY-1195 Change-Id: I7c8074e8177a90b292c6dfd6e7f0d352063818e7 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'gson')
-rw-r--r--gson/pom.xml5
-rw-r--r--gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java7
2 files changed, 11 insertions, 1 deletions
diff --git a/gson/pom.xml b/gson/pom.xml
index d02ede1f..7d7797a2 100644
--- a/gson/pom.xml
+++ b/gson/pom.xml
@@ -47,6 +47,11 @@
<artifactId>gson</artifactId>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
diff --git a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
index fc8e23ef..9dad6db8 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java
@@ -21,6 +21,7 @@
package org.onap.policy.common.gson;
import com.google.gson.Gson;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -36,6 +37,9 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+
+import lombok.Getter;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +56,8 @@ public class GsonMessageBodyHandler implements MessageBodyReader<Object>, Messag
/**
* Object to be used to serialize and de-serialize.
*/
- private Gson gson;
+ @Getter
+ private final Gson gson;
/**
* Constructs the object, using a plain Gson object.