From 6e5c6ba6ffe156ca230d8b37e89905014dfe63f8 Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Thu, 28 Jan 2021 15:29:51 +0100 Subject: [PATCH] Serialization utils --- CHANGELOG.md | 4 ++++ pom.xml | 2 +- .../application/geoportal/client/utils/Serialization.java | 4 ++++ .../geoportal/common/model/StatefulClientTests.java | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 048dc31..344f7a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for org.gcube.application.geoportal-client +## [v1.0.4-SNAPSHOT] - 2020-11-11 +Serialization utils + + ## [v1.0.3] - 2020-11-11 Stateful Concessioni Manager client over mongo diff --git a/pom.xml b/pom.xml index ec1c689..5ad090e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.gcube.application geoportal-client - 1.0.3 + 1.0.4-SNAPSHOT Geoportal Client diff --git a/src/main/java/org/gcube/application/geoportal/client/utils/Serialization.java b/src/main/java/org/gcube/application/geoportal/client/utils/Serialization.java index 93426de..7a72703 100644 --- a/src/main/java/org/gcube/application/geoportal/client/utils/Serialization.java +++ b/src/main/java/org/gcube/application/geoportal/client/utils/Serialization.java @@ -24,4 +24,8 @@ public static final DateTimeFormatter FULL_FORMATTER=DateTimeFormatter.ofPattern return mapper.readerFor(clazz).readValue(jsonString); } + + public static String write(Object obj) throws JsonProcessingException, IOException { + return mapper.writeValueAsString(obj); + } } diff --git a/src/test/java/org/gcube/application/geoportal/common/model/StatefulClientTests.java b/src/test/java/org/gcube/application/geoportal/common/model/StatefulClientTests.java index a97ad28..cba35b5 100644 --- a/src/test/java/org/gcube/application/geoportal/common/model/StatefulClientTests.java +++ b/src/test/java/org/gcube/application/geoportal/common/model/StatefulClientTests.java @@ -8,6 +8,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI; +import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.common.model.legacy.Concessione; import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor; import org.gcube.application.geoportal.common.model.legacy.LayerConcessione; @@ -80,6 +81,9 @@ public class StatefulClientTests extends BasicVreTests{ assertNotNull(l.getWmsLink()); assertNotNull(published.getCentroidLat()); assertNotNull(published.getCentroidLong()); + + System.out.println(Serialization.write(published)); + System.out.println(Serialization.write(published.getReport())); } @Test -- 2.17.1