Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-6518

if the region's data policy is empty, create jdbc-mapping will failed with NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.10.0
    • extensions, jdbc
    • None

    Description

      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");
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            zhouxj Xiaojian Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h 20m
                4h 20m