This is an automated email from the ASF dual-hosted git repository.
rhoughton pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 41e271e Geode 5803 distributed test (#2613)
41e271e is described below
commit 41e271e7bcafbc91aee58764e55db916a74fd92a
Author: Robert Houghton <[email protected]>
AuthorDate: Wed Oct 17 22:10:24 2018 -0700
Geode 5803 distributed test (#2613)
* GEODE-5803 Make geode-core:integrationTest not need geode-core:test
Move-refactor only, plus build.gradle to point integration at junit and
geode-core:distributedTest to use geode-core:test explicitly (to be
changed in next commit)
Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
* GEODE-5803 geode-core:distributedTest does not need test or
integrationTest
Move refactors only
Gradle changes to trigger
Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
* GEODE-5803 Move refactor many test resources to the correct sourceSet
Continue breaking the dependency between integrationTest and test
sourceSets
Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
* GEODE-5803 Update assembly-content for new items in geode-junit
Move-refactor into geode-junit:main sourceSet has caused new classes to
appear on the assemblycontent test.
Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
---
.../integrationTest/resources/assembly_content.txt | 1 +
geode-core/build.gradle | 12 ++++-
.../geode/pdx/JSONPdxClientServerDUnitTest.java | 2 +-
.../apache/geode/pdx/JSONFormatterJUnitTest.java | 53 +-------------------
.../internal/index/IndexTrackingTestHook.java | 0
.../gms/membership/GMSJoinLeaveTestHelper.java | 0
.../apache/geode/pdx/JSONFormatVerifyUtility.java | 57 ++++++++++++++++++++++
7 files changed, 70 insertions(+), 55 deletions(-)
diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt
b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index 8560754..3b90d8c 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -988,6 +988,7 @@
javadoc/org/apache/geode/pdx/DomainObjectPdxAutoNoDefaultConstructor.Day.html
javadoc/org/apache/geode/pdx/DomainObjectPdxAutoNoDefaultConstructor.html
javadoc/org/apache/geode/pdx/Employee.html
javadoc/org/apache/geode/pdx/FieldType.html
+javadoc/org/apache/geode/pdx/JSONFormatVerifyUtility.html
javadoc/org/apache/geode/pdx/JSONFormatter.html
javadoc/org/apache/geode/pdx/JSONFormatterException.html
javadoc/org/apache/geode/pdx/NestedPdx.html
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 7a1a75f..216f5f1 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -274,6 +274,9 @@ dependencies {
testRuntime('com.pholser:junit-quickcheck-generators:' +
project.'junit-quickcheck.version')
+ integrationTestCompile(project(':geode-junit')) {
+ exclude module: 'geode-core'
+ }
integrationTestCompile(project(':geode-dunit')) {
exclude module: 'geode-core'
}
@@ -290,7 +293,12 @@ dependencies {
integrationTestRuntime('xerces:xercesImpl:' + project.'xercesImpl.version')
- distributedTestCompile(project(':geode-dunit'))
+ distributedTestCompile(project(':geode-junit')) {
+ exclude module: 'geode-core'
+ }
+ distributedTestCompile(project(':geode-dunit')) {
+ exclude module: 'geode-core'
+ }
distributedTestCompile('redis.clients:jedis:' + project.'jedis.version')
distributedTestCompile('pl.pragmatists:JUnitParams:' +
project.'JUnitParams.version')
distributedTestCompile('com.jayway.jsonpath:json-path-assert:' +
project.'json-path-assert.version')
@@ -304,7 +312,7 @@ dependencies {
performanceTestCompile(project(':geode-junit'))
-
+
// Distributed Tests
distributedTestCompile(sourceSets.test.output) // To be removed
by GEODE-5803
distributedTestCompile(sourceSets.integrationTest.output) // To be removed
by GEODE-5803
diff --git
a/geode-core/src/distributedTest/java/org/apache/geode/pdx/JSONPdxClientServerDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/pdx/JSONPdxClientServerDUnitTest.java
index 786a053..7a4d7a5 100755
---
a/geode-core/src/distributedTest/java/org/apache/geode/pdx/JSONPdxClientServerDUnitTest.java
+++
b/geode-core/src/distributedTest/java/org/apache/geode/pdx/JSONPdxClientServerDUnitTest.java
@@ -194,7 +194,7 @@ public class JSONPdxClientServerDUnitTest extends
JUnit4CacheTestCase {
PdxInstance pi = (PdxInstance) result;
String json = JSONFormatter.toJSON(pi);
- JSONFormatterJUnitTest.verifyJsonWithJavaObject(json, testObject);
+ JSONFormatVerifyUtility.verifyJsonWithJavaObject(json, testObject);
// TestCase-2 : Validate Java-->JSON-->PdxInstance --> Java Mapping
TestObjectForJSONFormatter actualTestObject = new
TestObjectForJSONFormatter();
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/pdx/JSONFormatterJUnitTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/pdx/JSONFormatterJUnitTest.java
index 3df5ec3..925597a 100755
---
a/geode-core/src/integrationTest/java/org/apache/geode/pdx/JSONFormatterJUnitTest.java
+++
b/geode-core/src/integrationTest/java/org/apache/geode/pdx/JSONFormatterJUnitTest.java
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONException;
-import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -75,7 +74,7 @@ public class JSONFormatterJUnitTest {
PdxInstance pi = (PdxInstance) receivedObject;
String json = JSONFormatter.toJSON(pi);
- verifyJsonWithJavaObject(json, actualTestObject);
+ JSONFormatVerifyUtility.verifyJsonWithJavaObject(json, actualTestObject);
}
@Test
@@ -147,56 +146,6 @@ public class JSONFormatterJUnitTest {
actualTestObject);
}
- static void verifyJsonWithJavaObject(String json, TestObjectForJSONFormatter
testObject) {
- JSONObject jsonObject = new JSONObject(json);
-
- // Testcase-1: Validate json string against the pdxInstance.
- // validation for primitive types
- assertEquals("VerifyPdxInstanceToJson: Int type values are not matched",
testObject.getP_int(),
- jsonObject.getInt(testObject.getP_intFN()));
- assertEquals("VerifyPdxInstanceToJson: long type values are not matched",
- testObject.getP_long(), jsonObject.getLong(testObject.getP_longFN()));
-
- // validation for wrapper types
- assertEquals("VerifyPdxInstanceToJson: Boolean type values are not
matched",
- testObject.getW_bool().booleanValue(),
jsonObject.getBoolean(testObject.getW_boolFN()));
- assertEquals("VerifyPdxInstanceToJson: Float type values are not matched",
- testObject.getW_double().doubleValue(),
jsonObject.getDouble(testObject.getW_doubleFN()),
- 0);
- assertEquals("VerifyPdxInstanceToJson: bigDec type values are not matched",
- testObject.getW_bigDec().longValue(),
jsonObject.getLong(testObject.getW_bigDecFN()));
-
- // vlidation for array types
- assertEquals("VerifyPdxInstanceToJson: Byte[] type values are not matched",
- (int) testObject.getW_byteArray()[1],
- jsonObject.getJSONArray(testObject.getW_byteArrayFN()).getInt(1));
- assertEquals("VerifyPdxInstanceToJson: Double[] type values are not
matched",
- testObject.getW_doubleArray()[0],
- jsonObject.getJSONArray(testObject.getW_doubleArrayFN()).getDouble(0),
0);
- assertEquals("VerifyPdxInstanceToJson: String[] type values are not
matched",
- testObject.getW_strArray()[2],
- jsonObject.getJSONArray(testObject.getW_strArrayFN()).getString(2));
-
- // validation for collection types
- assertEquals("VerifyPdxInstanceToJson: list type values are not matched",
- testObject.getC_list().get(0),
- jsonObject.getJSONArray(testObject.getC_listFN()).getString(0));
-
- assertEquals("VerifyPdxInstanceToJson: stack type values are not matched",
- testObject.getC_stack().get(2),
- jsonObject.getJSONArray(testObject.getC_stackFN()).getString(2));
-
- // validation for Map
- assertEquals("VerifyPdxInstanceToJson: Map type values are not matched",
- testObject.getM_empByCity().get("Ahmedabad").get(0).getFname(),
-
jsonObject.getJSONObject(testObject.getM_empByCityFN()).getJSONArray("Ahmedabad")
- .getJSONObject(0).getString("fname"));
-
- // validation Enum
- assertEquals("VerifyPdxInstanceToJson: Enum type values are not matched",
- testObject.getDay().toString(),
jsonObject.getString(testObject.getDayFN()));
- }
-
/**
* this test validates json document, where field has value and null Then it
verifies we create
* only one pdx type id for that
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexTrackingTestHook.java
b/geode-dunit/src/main/java/org/apache/geode/cache/query/internal/index/IndexTrackingTestHook.java
similarity index 100%
rename from
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexTrackingTestHook.java
rename to
geode-dunit/src/main/java/org/apache/geode/cache/query/internal/index/IndexTrackingTestHook.java
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
b/geode-dunit/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
similarity index 100%
rename from
geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
rename to
geode-dunit/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveTestHelper.java
diff --git
a/geode-dunit/src/main/java/org/apache/geode/pdx/JSONFormatVerifyUtility.java
b/geode-dunit/src/main/java/org/apache/geode/pdx/JSONFormatVerifyUtility.java
new file mode 100644
index 0000000..7d48ba1
--- /dev/null
+++
b/geode-dunit/src/main/java/org/apache/geode/pdx/JSONFormatVerifyUtility.java
@@ -0,0 +1,57 @@
+package org.apache.geode.pdx;
+
+import org.json.JSONObject;
+import org.junit.Assert;
+
+public class JSONFormatVerifyUtility {
+ static void verifyJsonWithJavaObject(String json, TestObjectForJSONFormatter
testObject) {
+ JSONObject jsonObject = new JSONObject(json);
+
+ // Testcase-1: Validate json string against the pdxInstance.
+ // validation for primitive types
+ Assert.assertEquals("VerifyPdxInstanceToJson: Int type values are not
matched",
+ testObject.getP_int(),
+ jsonObject.getInt(testObject.getP_intFN()));
+ Assert.assertEquals("VerifyPdxInstanceToJson: long type values are not
matched",
+ testObject.getP_long(), jsonObject.getLong(testObject.getP_longFN()));
+
+ // validation for wrapper types
+ Assert.assertEquals("VerifyPdxInstanceToJson: Boolean type values are not
matched",
+ testObject.getW_bool().booleanValue(),
jsonObject.getBoolean(testObject.getW_boolFN()));
+ Assert.assertEquals("VerifyPdxInstanceToJson: Float type values are not
matched",
+ testObject.getW_double().doubleValue(),
jsonObject.getDouble(testObject.getW_doubleFN()),
+ 0);
+ Assert.assertEquals("VerifyPdxInstanceToJson: bigDec type values are not
matched",
+ testObject.getW_bigDec().longValue(),
jsonObject.getLong(testObject.getW_bigDecFN()));
+
+ // vlidation for array types
+ Assert.assertEquals("VerifyPdxInstanceToJson: Byte[] type values are not
matched",
+ (int) testObject.getW_byteArray()[1],
+ jsonObject.getJSONArray(testObject.getW_byteArrayFN()).getInt(1));
+ Assert.assertEquals("VerifyPdxInstanceToJson: Double[] type values are not
matched",
+ testObject.getW_doubleArray()[0],
+ jsonObject.getJSONArray(testObject.getW_doubleArrayFN()).getDouble(0),
0);
+ Assert.assertEquals("VerifyPdxInstanceToJson: String[] type values are not
matched",
+ testObject.getW_strArray()[2],
+ jsonObject.getJSONArray(testObject.getW_strArrayFN()).getString(2));
+
+ // validation for collection types
+ Assert.assertEquals("VerifyPdxInstanceToJson: list type values are not
matched",
+ testObject.getC_list().get(0),
+ jsonObject.getJSONArray(testObject.getC_listFN()).getString(0));
+
+ Assert.assertEquals("VerifyPdxInstanceToJson: stack type values are not
matched",
+ testObject.getC_stack().get(2),
+ jsonObject.getJSONArray(testObject.getC_stackFN()).getString(2));
+
+ // validation for Map
+ Assert.assertEquals("VerifyPdxInstanceToJson: Map type values are not
matched",
+ testObject.getM_empByCity().get("Ahmedabad").get(0).getFname(),
+
jsonObject.getJSONObject(testObject.getM_empByCityFN()).getJSONArray("Ahmedabad")
+ .getJSONObject(0).getString("fname"));
+
+ // validation Enum
+ Assert.assertEquals("VerifyPdxInstanceToJson: Enum type values are not
matched",
+ testObject.getDay().toString(),
jsonObject.getString(testObject.getDayFN()));
+ }
+}