geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [2/3] geode git commit: GEODE-2197: refactor cluster config and fix the test failures
Date Tue, 03 Jan 2017 21:02:28 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/30891423/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
index 8fd888d..2e733a7 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationDUnitTest.java
@@ -86,132 +86,117 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase
{
     final int locator1Port = ports[0];
     final String locator1Name = "locator1" + locator1Port;
 
-    locator1Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator1Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "fine");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-
-        try {
-          final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
-              locatorLogFile, null, locatorProps);
-
-          WaitCriterion wc = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              return locator.isSharedConfigurationRunning();
-            }
-
-            @Override
-            public String description() {
-              return "Waiting for shared configuration to be started";
-            }
-          };
-          waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        } catch (IOException e) {
-          fail("Unable to create a locator with a shared configuration", e);
-        }
-
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        InternalDistributedMember me = cache.getMyId();
-        DM dm = cache.getDistributionManager();
-
-        Map<InternalDistributedMember, Collection<String>> hostedLocators =
-            dm.getAllHostedLocators();
-        assertFalse(hostedLocators.isEmpty());
-
-        Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
-            dm.getAllHostedLocatorsWithSharedConfiguration();
-        assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
-
-        assertNotNull(hostedLocators.get(me));
-        assertNotNull(hostedLocatorsWithSharedConfiguration.get(me));
-        return null;
+    locator1Vm.invoke(() -> {
+      final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
+
+      final Properties locatorProps = new Properties();
+      locatorProps.setProperty(NAME, locator1Name);
+      locatorProps.setProperty(MCAST_PORT, "0");
+      locatorProps.setProperty(LOG_LEVEL, "fine");
+      locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+
+      try {
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
+            locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+      } catch (IOException e) {
+        fail("Unable to create a locator with a shared configuration", e);
       }
+
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      InternalDistributedMember me = cache.getMyId();
+      DM dm = cache.getDistributionManager();
+
+      Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators();
+      assertFalse(hostedLocators.isEmpty());
+
+      Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
+          dm.getAllHostedLocatorsWithSharedConfiguration();
+      assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
+
+      assertNotNull(hostedLocators.get(me));
+      assertNotNull(hostedLocatorsWithSharedConfiguration.get(me));
+      return null;
     });
 
     final int locator2Port = ports[1];
     final String locator2Name = "locator2" + locator2Port;
 
-    locator2Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException {
-        final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
+    locator2Vm.invoke(() -> {
+      final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
 
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, locator2Name);
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "fine");
-        locatorProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
+      final Properties locatorProps = new Properties();
+      locatorProps.setProperty(NAME, locator2Name);
+      locatorProps.setProperty(MCAST_PORT, "0");
+      locatorProps.setProperty(LOG_LEVEL, "fine");
+      locatorProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
+      locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
 
-        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port,
-            locatorLogFile, null, locatorProps);
+      final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port,
+          locatorLogFile, null, locatorProps);
 
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        InternalDistributedMember me = cache.getMyId();
-        DM dm = cache.getDistributionManager();
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      InternalDistributedMember me = cache.getMyId();
+      DM dm = cache.getDistributionManager();
 
-        Map<InternalDistributedMember, Collection<String>> hostedLocators =
-            dm.getAllHostedLocators();
-        assertFalse(hostedLocators.isEmpty());
+      Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators();
+      assertFalse(hostedLocators.isEmpty());
 
-        Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
-            dm.getAllHostedLocatorsWithSharedConfiguration();
-        assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
-        assertNotNull(hostedLocators.get(me));
-        assertNull(hostedLocatorsWithSharedConfiguration.get(me));
-        assertTrue(hostedLocators.size() == 2);
-        assertTrue(hostedLocatorsWithSharedConfiguration.size() == 1);
+      Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
+          dm.getAllHostedLocatorsWithSharedConfiguration();
+      assertFalse(hostedLocatorsWithSharedConfiguration.isEmpty());
+      assertNotNull(hostedLocators.get(me));
+      assertNull(hostedLocatorsWithSharedConfiguration.get(me));
+      assertTrue(hostedLocators.size() == 2);
+      assertTrue(hostedLocatorsWithSharedConfiguration.size() == 1);
 
-        Set<InternalDistributedMember> locatorsWithSharedConfig =
-            hostedLocatorsWithSharedConfiguration.keySet();
-        Set<String> locatorsWithSharedConfigNames = new HashSet<String>();
+      Set<InternalDistributedMember> locatorsWithSharedConfig =
+          hostedLocatorsWithSharedConfiguration.keySet();
+      Set<String> locatorsWithSharedConfigNames = new HashSet<String>();
 
-        for (InternalDistributedMember locatorWithSharedConfig : locatorsWithSharedConfig)
{
-          locatorsWithSharedConfigNames.add(locatorWithSharedConfig.getName());
-        }
-        assertTrue(locatorsWithSharedConfigNames.contains(locator1Name));
-
-        return null;
+      for (InternalDistributedMember locatorWithSharedConfig : locatorsWithSharedConfig)
{
+        locatorsWithSharedConfigNames.add(locatorWithSharedConfig.getName());
       }
+      assertTrue(locatorsWithSharedConfigNames.contains(locator1Name));
+
+      return null;
     });
 
-    locator1Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        InternalLocator locator = (InternalLocator) Locator.getLocator();
-        SharedConfiguration sharedConfig = locator.getSharedConfiguration();
-        sharedConfig.destroySharedConfiguration();
-        locator.stop();
-        return null;
-      }
+    locator1Vm.invoke(() -> {
+      InternalLocator locator = (InternalLocator) Locator.getLocator();
+      SharedConfiguration sharedConfig = locator.getSharedConfiguration();
+      sharedConfig.destroySharedConfiguration();
+      locator.stop();
+      return null;
     });
 
-    locator2Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-        InternalDistributedMember me = cache.getMyId();
-        DM dm = cache.getDistributionManager();
-        Map<InternalDistributedMember, Collection<String>> hostedLocators =
-            dm.getAllHostedLocators();
-        assertFalse(hostedLocators.isEmpty());
-        Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
-            dm.getAllHostedLocatorsWithSharedConfiguration();
-        assertTrue(hostedLocatorsWithSharedConfiguration.isEmpty());
-        assertNotNull(hostedLocators.get(me));
-        assertNull(hostedLocatorsWithSharedConfiguration.get(me));
-        assertTrue(hostedLocators.size() == 1);
-        assertTrue(hostedLocatorsWithSharedConfiguration.size() == 0);
-        return null;
-      }
+    locator2Vm.invoke(() -> {
+      GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+      InternalDistributedMember me = cache.getMyId();
+      DM dm = cache.getDistributionManager();
+      Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators();
+      assertFalse(hostedLocators.isEmpty());
+      Map<InternalDistributedMember, Collection<String>> hostedLocatorsWithSharedConfiguration
=
+          dm.getAllHostedLocatorsWithSharedConfiguration();
+      assertTrue(hostedLocatorsWithSharedConfiguration.isEmpty());
+      assertNotNull(hostedLocators.get(me));
+      assertNull(hostedLocatorsWithSharedConfiguration.get(me));
+      assertTrue(hostedLocators.size() == 1);
+      assertTrue(hostedLocatorsWithSharedConfiguration.size() == 0);
+      return null;
     });
   }
 
@@ -225,217 +210,204 @@ public class SharedConfigurationDUnitTest extends JUnit4CacheTestCase
{
     final String testName = getName();
 
     final VM locator1Vm = getHost(0).getVM(1);
-    final VM locator2Vm = getHost(0).getVM(3);
     final VM dataMemberVm = getHost(0).getVM(2);
+    final VM locator2Vm = getHost(0).getVM(3);
 
     final int[] ports = getRandomAvailableTCPPorts(3);
     final int locator1Port = ports[0];
 
-    locator1Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, "Locator1");
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "info");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-
-        try {
-          final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
-              locatorLogFile, null, locatorProps);
-
-          WaitCriterion wc = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              return locator.isSharedConfigurationRunning();
-            }
-
-            @Override
-            public String description() {
-              return "Waiting for shared configuration to be started";
-            }
-          };
-          waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        } catch (IOException e) {
-          fail("Unable to create a locator with a shared configuration", e);
-        }
-
-        return null;
+    locator1Vm.invoke(() -> {
+      final File locatorLogFile = new File(testName + "-locator-" + locator1Port + ".log");
+
+      final Properties locatorProps = new Properties();
+      locatorProps.setProperty(NAME, "Locator1");
+      locatorProps.setProperty(MCAST_PORT, "0");
+      locatorProps.setProperty(LOG_LEVEL, "info");
+      locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+
+      try {
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator1Port,
+            locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+      } catch (IOException e) {
+        fail("Unable to create a locator with a shared configuration", e);
       }
+
+      return null;
     });
 
-    dataMemberVm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() {
-        Properties localProps = new Properties();
-        localProps.setProperty(MCAST_PORT, "0");
-        localProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
-        localProps.setProperty(GROUPS, testGroup);
-
-        getSystem(localProps);
-        Cache cache = getCache();
-        assertNotNull(cache);
-
-        DiskStoreFactory dsFactory = cache.createDiskStoreFactory();
-        File dsDir = new File("dsDir");
-        if (!dsDir.exists()) {
-          dsDir.mkdir();
-        }
-        dsFactory.setDiskDirs(new File[] {dsDir});
-        dsFactory.create(DISKSTORENAME);
-
-        RegionFactory regionFactory = getCache().createRegionFactory(RegionShortcut.REPLICATE);
-        regionFactory.create(REGION1);
-
-        XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", REGION1);
-        final SharedConfigurationWriter scw = new SharedConfigurationWriter();
-        assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
-
-        xmlEntity = new XmlEntity(CacheXml.DISK_STORE, "name", DISKSTORENAME);
-        assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
-        // Modify property and cache attributes
-        Properties clusterProperties = new Properties();
-        clusterProperties.setProperty(LOG_LEVEL, clusterLogLevel);
-        XmlEntity cacheEntity = XmlEntity.builder().withType(CacheXml.CACHE).build();
-        Map<String, String> cacheAttributes = new HashMap<String, String>();
-        cacheAttributes.put(CacheXml.COPY_ON_READ, "true");
-
-        // assertTrue(scw.modifyProperties(clusterProperties, null)); // TODO: why is this
commented
-        // out?
-        assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity,
null));
-
-        clusterProperties.setProperty(LOG_LEVEL, groupLogLevel);
-        assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity,
-            new String[] {testGroup}));
-
-        // Add a jar
-        byte[][] jarBytes = new byte[1][];
-        jarBytes[0] = "Hello".getBytes();
-        assertTrue(scw.addJars(new String[] {"foo.jar"}, jarBytes, null));
-
-        // Add a jar for the group
-        jarBytes = new byte[1][];
-        jarBytes[0] = "Hello".getBytes();
-        assertTrue(scw.addJars(new String[] {"bar.jar"}, jarBytes, new String[] {testGroup}));
-        return null;
+    dataMemberVm.invoke(() -> {
+      Properties localProps = new Properties();
+      localProps.setProperty(MCAST_PORT, "0");
+      localProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
+      localProps.setProperty(GROUPS, testGroup);
+
+      getSystem(localProps);
+      Cache cache = getCache();
+      assertNotNull(cache);
+
+      DiskStoreFactory dsFactory = cache.createDiskStoreFactory();
+      File dsDir = new File("dsDir");
+      if (!dsDir.exists()) {
+        dsDir.mkdir();
       }
+      dsFactory.setDiskDirs(new File[] {dsDir});
+      dsFactory.create(DISKSTORENAME);
+
+      RegionFactory regionFactory = getCache().createRegionFactory(RegionShortcut.REPLICATE);
+      regionFactory.create(REGION1);
+
+      XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", REGION1);
+      final SharedConfigurationWriter scw = new SharedConfigurationWriter();
+      assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
+
+      xmlEntity = new XmlEntity(CacheXml.DISK_STORE, "name", DISKSTORENAME);
+      assertTrue(scw.addXmlEntity(xmlEntity, new String[] {testGroup}));
+      // Modify property and cache attributes
+      Properties clusterProperties = new Properties();
+      clusterProperties.setProperty(LOG_LEVEL, clusterLogLevel);
+      XmlEntity cacheEntity = XmlEntity.builder().withType(CacheXml.CACHE).build();
+      Map<String, String> cacheAttributes = new HashMap<String, String>();
+      cacheAttributes.put(CacheXml.COPY_ON_READ, "true");
+
+      assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity, null));
+
+      clusterProperties.setProperty(LOG_LEVEL, groupLogLevel);
+      assertTrue(scw.modifyPropertiesAndCacheAttributes(clusterProperties, cacheEntity,
+          new String[] {testGroup}));
+
+      // Add a jar
+      byte[][] jarBytes = new byte[1][];
+      jarBytes[0] = "Hello".getBytes();
+      assertTrue(scw.addJars(new String[] {"foo.jar"}, jarBytes, null));
+
+      // Add a jar for the group
+      jarBytes = new byte[1][];
+      jarBytes[0] = "Hello".getBytes();
+      assertTrue(scw.addJars(new String[] {"bar.jar"}, jarBytes, new String[] {testGroup}));
+      return null;
     });
 
     final int locator2Port = ports[1];
 
     // Create another locator in VM2
-    locator2Vm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
-
-        final Properties locatorProps = new Properties();
-        locatorProps.setProperty(NAME, "Locator2");
-        locatorProps.setProperty(MCAST_PORT, "0");
-        locatorProps.setProperty(LOG_LEVEL, "info");
-        locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-        locatorProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
-
-        try {
-          final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port,
-              locatorLogFile, null, locatorProps);
-
-          WaitCriterion wc = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              return locator.isSharedConfigurationRunning();
-            }
-
-            @Override
-            public String description() {
-              return "Waiting for shared configuration to be started";
-            }
-          };
-          waitForCriterion(wc, TIMEOUT, INTERVAL, true);
-
-        } catch (IOException e) {
-          fail("Unable to create a locator with a shared configuration", e);
-        }
-
-        InternalLocator locator = (InternalLocator) Locator.getLocator();
-        SharedConfiguration sharedConfig = locator.getSharedConfiguration();
-        Map<String, Configuration> entireConfiguration = sharedConfig.getEntireConfiguration();
-        Configuration clusterConfig = entireConfiguration.get(SharedConfiguration.CLUSTER_CONFIG);
-        assertNotNull(clusterConfig);
-        assertNotNull(clusterConfig.getJarNames());
-        assertTrue(clusterConfig.getJarNames().contains("foo.jar"));
-        assertTrue(
-            clusterConfig.getGemfireProperties().getProperty(LOG_LEVEL).equals(clusterLogLevel));
-        assertNotNull(clusterConfig.getCacheXmlContent());
-
-        Configuration testGroupConfiguration = entireConfiguration.get(testGroup);
-        assertNotNull(testGroupConfiguration);
-        assertNotNull(testGroupConfiguration.getJarNames());
-        assertTrue(testGroupConfiguration.getJarNames().contains("bar.jar"));
-        assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
-            .equals(groupLogLevel));
-        assertNotNull(testGroupConfiguration.getCacheXmlContent());
-        assertTrue(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
-
-        Map<String, byte[]> jarData = sharedConfig.getAllJarsFromThisLocator(entireConfiguration.keySet());
-        String[] jarNames = jarData.keySet().stream().toArray(String[]::new);
-        byte[][] jarBytes = jarData.values().toArray(new byte[jarNames.length][]);
-
-        assertNotNull(jarNames);
-        assertNotNull(jarBytes);
-
-        return null;
+    locator2Vm.invoke(() -> {
+      final File locatorLogFile = new File(testName + "-locator-" + locator2Port + ".log");
+
+      final Properties locatorProps = new Properties();
+      locatorProps.setProperty(NAME, "Locator2");
+      locatorProps.setProperty(MCAST_PORT, "0");
+      locatorProps.setProperty(LOG_LEVEL, "info");
+      locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+      locatorProps.setProperty(LOCATORS, "localhost[" + locator1Port + "]");
+
+      try {
+        final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locator2Port,
+            locatorLogFile, null, locatorProps);
+
+        WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            return locator.isSharedConfigurationRunning();
+          }
+
+          @Override
+          public String description() {
+            return "Waiting for shared configuration to be started";
+          }
+        };
+        waitForCriterion(wc, TIMEOUT, INTERVAL, true);
+
+      } catch (IOException e) {
+        fail("Unable to create a locator with a shared configuration", e);
       }
+
+      InternalLocator locator = (InternalLocator) Locator.getLocator();
+      SharedConfiguration sharedConfig = locator.getSharedConfiguration();
+      Map<String, Configuration> entireConfiguration = sharedConfig.getEntireConfiguration();
+      Configuration clusterConfig = entireConfiguration.get(SharedConfiguration.CLUSTER_CONFIG);
+      assertNotNull(clusterConfig);
+      assertNotNull(clusterConfig.getJarNames());
+      assertTrue(clusterConfig.getJarNames().contains("foo.jar"));
+      assertTrue(
+          clusterConfig.getGemfireProperties().getProperty(LOG_LEVEL).equals(clusterLogLevel));
+      assertNotNull(clusterConfig.getCacheXmlContent());
+
+      Configuration testGroupConfiguration = entireConfiguration.get(testGroup);
+      assertNotNull(testGroupConfiguration);
+      assertNotNull(testGroupConfiguration.getJarNames());
+      assertTrue(testGroupConfiguration.getJarNames().contains("bar.jar"));
+      assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
+          .equals(groupLogLevel));
+      assertNotNull(testGroupConfiguration.getCacheXmlContent());
+      assertTrue(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
+
+      Map<String, byte[]> jarData =
+          sharedConfig.getAllJarsFromThisLocator(entireConfiguration.keySet());
+      String[] jarNames = jarData.keySet().stream().toArray(String[]::new);
+      byte[][] jarBytes = jarData.values().toArray(new byte[jarNames.length][]);
+
+      assertNotNull(jarNames);
+      assertNotNull(jarBytes);
+
+      return null;
     });
 
-    dataMemberVm.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws IOException, ClassNotFoundException {
-        SharedConfigurationWriter scw = new SharedConfigurationWriter();
-        scw.deleteXmlEntity(new XmlEntity(CacheXml.REGION, "name", REGION1),
-            new String[] {testGroup});
-        scw.deleteJars(new String[] {"foo.jar"}, null);
-        scw.deleteJars(null, null);
-
-        Set<String> groups = new HashSet<String>();
-        groups.add(testGroup);
-        ConfigurationRequest configRequest = new ConfigurationRequest(groups);
-        ConfigurationResponse configResponse = (ConfigurationResponse) new TcpClient()
-            .requestToServer(InetAddress.getByName("localhost"), locator2Port, configRequest,
1000);
-        assertNotNull(configResponse);
-
-        Map<String, Configuration> requestedConfiguration =
-            configResponse.getRequestedConfiguration();
-        Configuration clusterConfiguration =
-            requestedConfiguration.get(SharedConfiguration.CLUSTER_CONFIG);
-        assertNotNull(clusterConfiguration);
-        assertNull(configResponse.getJarNames());
-        assertNull(configResponse.getJars());
-        assertTrue(clusterConfiguration.getJarNames().isEmpty());
-        assertTrue(clusterConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
-            .equals(clusterLogLevel));
-
-        Configuration testGroupConfiguration = requestedConfiguration.get(testGroup);
-        assertNotNull(testGroupConfiguration);
-        assertFalse(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
-        assertTrue(testGroupConfiguration.getJarNames().isEmpty());
-        assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
-            .equals(groupLogLevel));
-
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        Map<InternalDistributedMember, Collection<String>> locatorsWithSharedConfiguration
=
-            cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration();
-        assertFalse(locatorsWithSharedConfiguration.isEmpty());
-        assertTrue(locatorsWithSharedConfiguration.size() == 2);
-        Set<InternalDistributedMember> locatorMembers = locatorsWithSharedConfiguration.keySet();
-        for (InternalDistributedMember locatorMember : locatorMembers) {
-          System.out.println(locatorMember);
-        }
-        return null;
+    dataMemberVm.invoke(() -> {
+      SharedConfigurationWriter scw = new SharedConfigurationWriter();
+      scw.deleteXmlEntity(new XmlEntity(CacheXml.REGION, "name", REGION1),
+          new String[] {testGroup});
+      scw.deleteJars(new String[] {"foo.jar"}, null);
+      scw.deleteJars(null, null);
+
+      Set<String> groups = new HashSet<String>();
+      groups.add(testGroup);
+      ConfigurationRequest configRequest = new ConfigurationRequest(groups);
+      ConfigurationResponse configResponse = (ConfigurationResponse) new TcpClient()
+          .requestToServer(InetAddress.getByName("localhost"), locator2Port, configRequest,
1000);
+      assertNotNull(configResponse);
+
+      Map<String, Configuration> requestedConfiguration =
+          configResponse.getRequestedConfiguration();
+      Configuration clusterConfiguration =
+          requestedConfiguration.get(SharedConfiguration.CLUSTER_CONFIG);
+      assertNotNull(clusterConfiguration);
+      assertTrue(configResponse.getJarNames().length == 0);
+      assertTrue(configResponse.getJars().length == 0);
+      assertTrue(clusterConfiguration.getJarNames().isEmpty());
+      assertTrue(clusterConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
+          .equals(clusterLogLevel));
+
+      Configuration testGroupConfiguration = requestedConfiguration.get(testGroup);
+      assertNotNull(testGroupConfiguration);
+      assertFalse(testGroupConfiguration.getCacheXmlContent().contains(REGION1));
+      assertTrue(testGroupConfiguration.getJarNames().isEmpty());
+      assertTrue(testGroupConfiguration.getGemfireProperties().getProperty(LOG_LEVEL)
+          .equals(groupLogLevel));
+
+      GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
+      Map<InternalDistributedMember, Collection<String>> locatorsWithSharedConfiguration
=
+          cache.getDistributionManager().getAllHostedLocatorsWithSharedConfiguration();
+      assertFalse(locatorsWithSharedConfiguration.isEmpty());
+      assertTrue(locatorsWithSharedConfiguration.size() == 2);
+      Set<InternalDistributedMember> locatorMembers = locatorsWithSharedConfiguration.keySet();
+      for (InternalDistributedMember locatorMember : locatorMembers) {
+        System.out.println(locatorMember);
       }
+      return null;
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/30891423/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 6af9cf2..9e46ad0 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -121,14 +121,6 @@ public class GfshShellConnectionRule extends DescribedExternalResource
{
     CliUtil.isGfshVM = false;
   }
 
-  public void closeQuietly() {
-    try {
-      this.close();
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
   public HeadlessGfsh getGfsh() {
     return gfsh;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/30891423/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
index d6b770f..1ad82c6 100755
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
@@ -629,8 +629,8 @@ org/apache/geode/management/internal/configuration/functions/AddJarFunction,true
 org/apache/geode/management/internal/configuration/functions/AddXmlEntityFunction,true,1
 org/apache/geode/management/internal/configuration/functions/DeleteJarFunction,true,1
 org/apache/geode/management/internal/configuration/functions/DeleteXmlEntityFunction,true,1
-org/apache/geode/management/internal/configuration/functions/GetAllJarsFunction,true,1
-org/apache/geode/management/internal/configuration/functions/ModifyPropertiesFunction,true,1
+org/apache/geode/management/internal/configuration/functions/ModifyXmlAndPropertiesFunction,true,1
+org/apache/geode/management/internal/configuration/functions/UploadJarFunction,true,1
 org/apache/geode/management/internal/web/domain/Link,false,href:java/net/URI,method:org/apache/geode/management/internal/web/http/HttpMethod,relation:java/lang/String
 org/apache/geode/management/internal/web/domain/QueryParameterSource,true,34131123582155,objectName:javax/management/ObjectName,queryExpression:javax/management/QueryExp
 org/apache/geode/management/internal/web/http/HttpHeader,false,name:java/lang/String


Mime
View raw message