geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhem...@apache.org
Subject [geode] 16/18: Teardown stops all started servers
Date Mon, 22 Jul 2019 22:09:29 GMT
This is an automated email from the ASF dual-hosted git repository.

dhemery pushed a commit to branch GEODE-7001-region-entry-count
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 5587b6e5c237b367755e343cd7b9faa909193082
Author: Dale Emery <demery@pivotal.io>
AuthorDate: Fri Jul 19 16:25:34 2019 -0700

    Teardown stops all started servers
    
    To make it easier to start additional servers in some tests:
    - Collect the folders of any server a test starts
    - Teardown stops the servers in all collected folders.
    
    Co-Authored-By: Mark Hanson <mhanson@pivotal.io>
---
 .../geode/metrics/RegionEntriesGaugeTest.java      | 28 +++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
index 348754b..7c0910d 100644
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
+++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/metrics/RegionEntriesGaugeTest.java
@@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
@@ -74,9 +75,8 @@ public class RegionEntriesGaugeTest {
 
   private static final String SPACE = " ";
 
+  private final List<File> serverFolders = new ArrayList<>();
   private File folderForLocator;
-  private File folderForServer1;
-  private File folderForServer2;
   private String locatorString;
   private ClientCache clientCache;
 
@@ -92,8 +92,10 @@ public class RegionEntriesGaugeTest {
     locatorString = "localhost[" + locatorPort + "]";
 
     folderForLocator = temporaryFolder.newFolder("locator");
-    folderForServer1 = temporaryFolder.newFolder("server1");
-    folderForServer2 = temporaryFolder.newFolder("server2");
+    File folderForServer1 = temporaryFolder.newFolder("server1");
+    File folderForServer2 = temporaryFolder.newFolder("server2");
+    serverFolders.add(folderForServer1);
+    serverFolders.add(folderForServer2);
 
     String startLocatorCommand = String.join(SPACE,
         "start locator",
@@ -137,12 +139,20 @@ public class RegionEntriesGaugeTest {
 
     String connectToLocatorCommand = "connect --locator=" + locatorString;
 
-    String stopServer1Command = "stop server --dir=" + folderForServer1.getAbsolutePath();
-    String stopServer2Command = "stop server --dir=" + folderForServer2.getAbsolutePath();
-    String stopLocatorCommand = "stop locator --dir=" + folderForLocator.getAbsolutePath();
+    List<String> commands = new ArrayList<>();
+    commands.add(connectToLocatorCommand);
 
-    gfshRule.execute(connectToLocatorCommand, stopServer1Command, stopServer2Command,
-        stopLocatorCommand);
+    serverFolders.stream()
+        .map(RegionEntriesGaugeTest::stopServerCommand)
+        .forEach(commands::add);
+
+    commands.add("stop locator --dir=" + folderForLocator.getAbsolutePath());
+
+    gfshRule.execute(commands.toArray(new String[0]));
+  }
+
+  private static String stopServerCommand(File folder) {
+    return "stop server --dir=" + folder.getAbsolutePath();
   }
 
   @Test


Mime
View raw message