From 473de893246a3ee0087ad42a306d3dd715152c29 Mon Sep 17 00:00:00 2001 From: Abraham Elmahrek Date: Wed, 22 Jul 2015 16:21:52 -0700 Subject: [PATCH] SQOOP-2422: Sqoop2: Test TestJSONIntermediateDataFormat is failing on JDK8 (Jarek Jarcec Cecho via Abraham Elmahrek) --- .../connector/idf/TestJSONIntermediateDataFormat.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java index e2768e2e..bcc1f959 100644 --- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java +++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java @@ -26,6 +26,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.connector.common.SqoopIDFUtils; +import org.apache.sqoop.json.JSONUtils; import org.apache.sqoop.schema.Schema; import org.apache.sqoop.schema.type.Array; import org.apache.sqoop.schema.type.Binary; @@ -90,9 +91,12 @@ public void testInputAsCSVTextInAndDataOut() { + "','ENUM'," + csvArray + "," + map + ",true," + dateTime + "," + time + "," + date + ",13.44," + csvSet; dataFormat.setCSVTextData(csvText); - String jsonExpected = "{\"15\":[[11,12],[14,15]],\"13\":\"2014-10-01\",\"14\":13.44,\"11\":\"2014-10-01 12:00:00.000\"," + // Different JDK version will have different order of the key/value pars as that is technically undefined + // Hence we're parsing the expected string and then serializing it back to string to get the JVM expected + // order. Future enhancement would be to provide assertJson(). + String jsonExpected = JSONUtils.parse("{\"15\":[[11,12],[14,15]],\"13\":\"2014-10-01\",\"14\":13.44,\"11\":\"2014-10-01 12:00:00.000\"," + "\"12\":\"12:59:59\",\"3\":\"54\",\"2\":34,\"1\":10,\"10\":true,\"7\":\"ENUM\",\"6\":\"10\",\"5\":\"kDY=\",\"4\":\"random data\"," - + "\"9\":{\"testKey\":\"testValue\"},\"8\":[[11,11],[14,15]]}"; + + "\"9\":{\"testKey\":\"testValue\"},\"8\":[[11,11],[14,15]]}").toJSONString(); assertEquals(jsonExpected, dataFormat.getData().toJSONString()); }