xiaojian zhou created GEODE-6518:
------------------------------------
Summary: if the region's data policy is empty, create jdbc-mapping
will failed with NPE
Key: GEODE-6518
URL: https://issues.apache.org/jira/browse/GEODE-6518
Project: Geode
Issue Type: Bug
Components: jdbc
Reporter: xiaojian zhou
{noformat}
We never had a test case to create a region on one member with data, and on
another member as accessor (i.e. data policy is empty). Then create a
jdbc-mapping. This is a valid use case.
Apply the following diff, it will modify the test case to test above scenario.
diff --git
a/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/CreateMappingCommandDUnitTest.java
b/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/CreateMappingCommandDUnitTest.java
index 06043f1657..ccb79b56c6 100644
---
a/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/CreateMappingCommandDUnitTest.java
+++
b/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/CreateMappingCommandDUnitTest.java
@@ -119,7 +119,7 @@ public class CreateMappingCommandDUnitTest {
server1 = startupRule.startServerVM(1, locator.getPort());
server2 = startupRule.startServerVM(2, TEST_GROUP1, locator.getPort());
server3 = startupRule.startServerVM(3, TEST_GROUP2, locator.getPort());
- server4 = startupRule.startServerVM(4, TEST_GROUP1 + "," + TEST_GROUP2,
locator.getPort());
+ server4 = startupRule.startServerVM(4, "Gester", locator.getPort());
gfsh.connectAndVerify(locator);
setupDatabase();
@@ -196,10 +196,10 @@ public class CreateMappingCommandDUnitTest {
.statusIsSuccess();
}
- private void setupGroupPartition(String regionName, String groupNames) {
+ private void setupGroupPartition(String regionName, String groupNames,
boolean isAccessor) {
gfsh.executeAndAssertThat(
- "create region --name=" + regionName + " --type=PARTITION --groups=" +
groupNames)
- .statusIsSuccess();
+ "create region --name=" + regionName + (isAccessor ? "
--type=PARTITION_PROXY"
+ : " --type=PARTITION") + " --groups=" +
groupNames).statusIsSuccess();
}
private void setupAsyncEventQueue(String regionName) {
@@ -346,7 +346,7 @@ public class CreateMappingCommandDUnitTest {
@Test
public void
createMappingPartitionedUpdatesServiceAndClusterConfigForServerGroup() {
String regionName = GROUP2_REGION;
- setupGroupPartition(regionName, TEST_GROUP2);
+ setupGroupPartition(regionName, TEST_GROUP2, false);
CommandStringBuilder csb = new CommandStringBuilder(CREATE_MAPPING);
csb.addOption(REGION_NAME, regionName);
csb.addOption(DATA_SOURCE_NAME, "connection");
@@ -424,7 +424,8 @@ public class CreateMappingCommandDUnitTest {
@Test
public void
createMappingPartitionedUpdatesServiceAndClusterConfigForMultiServerGroup() {
String regionName = "/" + GROUP1_GROUP2_REGION;
- setupGroupPartition(regionName, TEST_GROUP1 + "," + TEST_GROUP2);
+ setupGroupPartition(regionName, TEST_GROUP1, false);
+ setupGroupPartition(regionName, TEST_GROUP2, true);
CommandStringBuilder csb = new CommandStringBuilder(CREATE_MAPPING);
csb.addOption(REGION_NAME, regionName);
csb.addOption(DATA_SOURCE_NAME, "connection");
{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)