From ef7de3edf23a0c6fba6e6fb3e175798adc532d78 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Thu, 26 Oct 2017 19:36:45 +0530 Subject: Fix the sample file name align with schema CLI-55 Change-Id: I84533921d6a2bbfd818e0c68b723d6f131a21b2c Signed-off-by: Kanagaraj Manickam k00365106 --- .../src/main/java/org/onap/cli/http/mock/MockJsonGenerator.java | 5 +---- .../src/main/java/org/onap/cli/http/mock/MockResponse.java | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'validate/sample-mock-generator') diff --git a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockJsonGenerator.java b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockJsonGenerator.java index c3006e32..4b2e116c 100644 --- a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockJsonGenerator.java +++ b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockJsonGenerator.java @@ -17,9 +17,7 @@ package org.onap.cli.http.mock; import java.io.File; import java.io.IOException; -import java.text.SimpleDateFormat; import java.util.Arrays; -import java.util.Date; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.ObjectMapper; @@ -35,8 +33,7 @@ public class MockJsonGenerator { ObjectMapper mapper = new ObjectMapper(); ObjectWriter writer = mapper.writer(new DefaultPrettyPrinter()); - String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date()); - writer.writeValue(new File(jsonFilePath + "-" + timeStamp + "-moco.json"), + writer.writeValue(new File(jsonFilePath), Arrays.asList(mockObject)); } } diff --git a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java index 2b8fa826..7e8cdca8 100644 --- a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java +++ b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockResponse.java @@ -38,7 +38,7 @@ public class MockResponse { } public void setJson(String json) throws IOException { - if (!json.isEmpty()) { + if (json != null && !json.isEmpty()) { ObjectMapper objectMapper = new ObjectMapper(); this.json = objectMapper.readTree(json); } -- cgit 1.2.3-korg