From f4935739fd40cb7aa233d2b8605f239cef226713 Mon Sep 17 00:00:00 2001 From: baubakg Date: Tue, 8 Oct 2024 11:53:01 +0200 Subject: [PATCH] fixed #189 : removed preprint --- README.md | 3 ++- .../com/adobe/campaign/tests/logparser/core/LogData.java | 2 +- .../com/adobe/campaign/tests/logparser/core/SDKTests.java | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1422ce9..9d687a6 100644 --- a/README.md +++ b/README.md @@ -470,8 +470,9 @@ You can get a print out of the command line options by running the command with All reports are stored in the directory `log-parser-reports/export/`. ## Changelog -### 1.11.1 +### 1.11.2 - [#188](https://github.com/adobe/log-parser/issues/188) We solved problems with exporting when the directory hierarchy is not present. +- [#189](https://github.com/adobe/log-parser/issues/189) The generated JSON when exporting results included unnecessary elements. ### 1.11.0 - **(new feature)** [#10](https://github.com/adobe/log-parser/issues/10) We now have an executable for the log-parser. You can perform a log parsing using the command line. For more information please read the section on [Command-line Execution of the Log-Parser](#command-line-execution-of-the-log-parser). diff --git a/src/main/java/com/adobe/campaign/tests/logparser/core/LogData.java b/src/main/java/com/adobe/campaign/tests/logparser/core/LogData.java index c8bcd35..d682ee5 100644 --- a/src/main/java/com/adobe/campaign/tests/logparser/core/LogData.java +++ b/src/main/java/com/adobe/campaign/tests/logparser/core/LogData.java @@ -552,7 +552,7 @@ public File exportLogDataToJSON(Collection in_headerSet, String in_jsonF ObjectMapper objectMapper = new ObjectMapper(); objectMapper.writeValue(l_exportFile, - objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonList)); + objectMapper.writeValueAsString(jsonList)); } catch (IOException e) { throw new LogDataExportToFileException("Encountered error while exporting the log data to a JSON file.", e); } diff --git a/src/test/java/com/adobe/campaign/tests/logparser/core/SDKTests.java b/src/test/java/com/adobe/campaign/tests/logparser/core/SDKTests.java index 7a04153..cfa8556 100644 --- a/src/test/java/com/adobe/campaign/tests/logparser/core/SDKTests.java +++ b/src/test/java/com/adobe/campaign/tests/logparser/core/SDKTests.java @@ -14,6 +14,7 @@ import com.adobe.campaign.tests.logparser.exceptions.LogParserSDKDefinitionException; import com.adobe.campaign.tests.logparser.exceptions.StringParseException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.hamcrest.Matchers; import org.testng.Assert; import org.testng.annotations.Test; @@ -233,7 +234,11 @@ public void testSimpleLogACC_SDK_exportDateTimeJSON() throws StringParseExceptio ObjectMapper objectMapper = new ObjectMapper(); String values = objectMapper.readValue(l_exportedFile, String.class); - assertThat("JSON file contains correct verb definition", values.contains("\"timeStamp\" : \"2024-06-13T03:00:19.727Z\"")); + assertThat("JSON file contains correct verb definition and is not prettified", values.contains("\"timeStamp\":\"2024-06-13T03:00:19.727Z\"")); + assertThat("JSON file does not contain prettified elements", !values.contains("\n")); + assertThat("JSON file does not contain prettified elements", !values.contains("\t")); + boolean containsNewline = values.contains("\n"); + System.out.println("Contains newline: " + containsNewline); } finally { l_exportedFile.delete();