diff --git a/api/src/main/java/ca/bc/gov/educ/api/graduation/util/JsonTransformer.java b/api/src/main/java/ca/bc/gov/educ/api/graduation/util/JsonTransformer.java index cb7f2e44..4c8d6f1a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/graduation/util/JsonTransformer.java +++ b/api/src/main/java/ca/bc/gov/educ/api/graduation/util/JsonTransformer.java @@ -9,12 +9,12 @@ import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; @Component public class JsonTransformer implements Transformer { private static final Logger log = LoggerFactory.getLogger(JsonTransformer.class); + private static final String MARSHALLING_MSG = "Time taken for unmarshalling response from String to {} is {} ms"; final ObjectMapper objectMapper; @@ -36,35 +36,6 @@ public Object unmarshall(byte[] input, Class clazz) { return result; } - public Object unmarshallWithWrapper(String input, Class clazz) { - final ObjectReader reader = objectMapper.readerFor(clazz); - Object result = null; - long start = System.currentTimeMillis(); - try { - result = reader - .with(DeserializationFeature.UNWRAP_ROOT_VALUE) - .with(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY) - .readValue(input); - } catch (IOException e) { - log.error(e.getLocalizedMessage(), e); - } - log.debug("Time taken for unmarshalling response from String to {} is {} ms", clazz.getSimpleName(), (System.currentTimeMillis() - start)); - return result; - } - - public String marshallWithWrapper(Object input) { - ObjectWriter prettyPrinter = objectMapper.writer(); - String result = null; - try { - result = prettyPrinter - .with(SerializationFeature.WRAP_ROOT_VALUE) - .writeValueAsString(input); - } catch (IOException e) { - log.error(e.getLocalizedMessage(), e); - } - - return result; - } @Override public Object unmarshall(String input, Class clazz) { @@ -75,7 +46,7 @@ public Object unmarshall(String input, Class clazz) { } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } - log.debug("Time taken for unmarshalling response from String to {} is {} ms", clazz.getName(), (System.currentTimeMillis() - start)); + log.debug(MARSHALLING_MSG, clazz.getName(), (System.currentTimeMillis() - start)); return result; } @@ -88,7 +59,7 @@ public Object unmarshall(String input, TypeReference valueTypeRef) { } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } - log.debug("Time taken for unmarshalling response from String to {} is {} ms", valueTypeRef.getType().getTypeName(), (System.currentTimeMillis() - start)); + log.debug(MARSHALLING_MSG, valueTypeRef.getType().getTypeName(), (System.currentTimeMillis() - start)); return result; } @@ -107,17 +78,12 @@ public Object unmarshall(InputStream input, Class clazz) { @Override public String marshall(Object input) { - ObjectWriter prettyPrinter = objectMapper.writerWithDefaultPrettyPrinter(); String result = null; try { - result = prettyPrinter - .with(SerializationFeature.INDENT_OUTPUT) - .with(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS) - .writeValueAsString(input); + result = objectMapper.writeValueAsString(input); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } - return result; } diff --git a/tools/config/update-configmap.sh b/tools/config/update-configmap.sh index ceb8d1eb..bef5cee3 100644 --- a/tools/config/update-configmap.sh +++ b/tools/config/update-configmap.sh @@ -23,7 +23,7 @@ FLB_CONFIG="[SERVICE] Exclude_Path *.gz,*.zip Parser docker Mem_Buf_Limit 20MB - Buffer_Max_Size 1MB + Buffer_Max_Size 4MB [FILTER] Name record_modifier Match *