Add priority to Jbehave steps

Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0ff26e83
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0ff26e83
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0ff26e83

Branch: refs/heads/feature/e2e-testing
Commit: 0ff26e83d1f66fe0181d5bdf4005b5c041796a64
Parents: 946ff2c
Author: Jens Deppe <jde...@pivotal.io>
Authored: Mon Oct 10 07:32:48 2016 -0700
Committer: Jens Deppe <jde...@pivotal.io>
Committed: Mon Oct 10 07:32:48 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/e2e/GetPutSteps.java  | 11 ++++---
 .../geode/e2e/container/DockerCluster.java      | 32 +++++++++++++++-----
 .../org/apache/geode/e2e/get_put.story          |  3 +-
 3 files changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0ff26e83/geode-core/src/test/java/org/apache/geode/e2e/GetPutSteps.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/e2e/GetPutSteps.java 
b/geode-core/src/test/java/org/apache/geode/e2e/GetPutSteps.java
index d427670..b6242d3 100644
--- a/geode-core/src/test/java/org/apache/geode/e2e/GetPutSteps.java
+++ b/geode-core/src/test/java/org/apache/geode/e2e/GetPutSteps.java
@@ -1,12 +1,9 @@
 package org.apache.geode.e2e;
 
-import static 
org.apache.geode.internal.cache.execute.DistributedRegionFunctionExecutionDUnitTest.region;
-import static org.bouncycastle.crypto.tls.ConnectionEnd.client;
 import static org.junit.Assert.assertEquals;
 
 import com.spotify.docker.client.exceptions.DockerException;
 import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.cache.client.ClientCacheFactory;
@@ -51,6 +48,11 @@ public class GetPutSteps {
     cluster.gfshCommand(String.format("create region --name=%s --type=%s", 
name, type));
   }
 
+  @Given(value = "region $name is created as $type with redundancy 
$redundancy", priority = 1)
+  public void createRegionWithRedundancy(String name, String type, Integer 
redundancy) throws Exception {
+    cluster.gfshCommand(String.format("create region --name=%s --type=%s 
--redundancy=%d", name, type, redundancy));
+  }
+
   @Given("server $idx is killed")
   public void killServer(int idx) throws Exception {
     cluster.killServer(idx);
@@ -70,6 +72,7 @@ public class GetPutSteps {
     ClientCache cache = getClientCache();
     Region region = cache.getRegion(name);
 
+    assertEquals(count, region.keySetOnServer().size());
     for (int i = 0; i < count; i++) {
       assertEquals("value_" + i, region.get("key_" + i));
     }
@@ -85,7 +88,7 @@ public class GetPutSteps {
     }
 
     cache = new ClientCacheFactory().
-      set("log-level", "fine").
+      set("log-level", "warn").
       addPoolLocator("localhost", cluster.getLocatorPort()).
       create();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0ff26e83/geode-core/src/test/java/org/apache/geode/e2e/container/DockerCluster.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/e2e/container/DockerCluster.java 
b/geode-core/src/test/java/org/apache/geode/e2e/container/DockerCluster.java
index 875fa78..96dae81 100644
--- a/geode-core/src/test/java/org/apache/geode/e2e/container/DockerCluster.java
+++ b/geode-core/src/test/java/org/apache/geode/e2e/container/DockerCluster.java
@@ -11,6 +11,7 @@ import java.util.Map;
 import com.spotify.docker.client.DefaultDockerClient;
 import com.spotify.docker.client.DockerClient;
 import com.spotify.docker.client.LogStream;
+import com.spotify.docker.client.exceptions.ContainerNotFoundException;
 import com.spotify.docker.client.exceptions.DockerException;
 import com.spotify.docker.client.messages.Container;
 import com.spotify.docker.client.messages.ContainerConfig;
@@ -18,7 +19,6 @@ import com.spotify.docker.client.messages.ContainerCreation;
 import com.spotify.docker.client.messages.HostConfig;
 import com.spotify.docker.client.messages.NetworkSettings;
 import com.spotify.docker.client.messages.PortBinding;
-import com.sun.javaws.exceptions.InvalidArgumentException;
 
 public class DockerCluster {
 
@@ -93,7 +93,8 @@ public class DockerCluster {
       String[] command = {
         "/tmp/work/bin/gfsh",
         "start locator",
-        String.format("--name=%s-locator-%d", name, i)
+        String.format("--name=%s-locator-%d", name, i),
+        
"--J=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
       };
 
       Map<String, List<PortBinding>> ports = new HashMap<>();
@@ -101,6 +102,10 @@ public class DockerCluster {
       binding.add(PortBinding.of("HostPort", (10334 + i) + ""));
       ports.put((10334 + i) + "/tcp", binding);
 
+      List<PortBinding> debugBinding = new ArrayList<>();
+      debugBinding.add(PortBinding.of("HostPort", (5005 + i) + ""));
+      ports.put("5005/tcp", debugBinding);
+
       String id = startContainer(i, ports);
       execCommand(id, true, null, command);
 
@@ -117,18 +122,25 @@ public class DockerCluster {
   public void startServers() throws DockerException, InterruptedException {
     String locatorAddress = String.format("%s[10334]", 
docker.inspectContainer(nodeIds.get(0)).networkSettings().ipAddress());
     for (int i = 0; i < serverCount; i++) {
+      String serverPort = Integer.toString(40404 + i);
       String[] command = {
         "/tmp/work/bin/gfsh",
         "start server",
         String.format("--name=%s-server-%d", name, i),
-        String.format("--locators=%s", locatorAddress),
-        "--hostname-for-clients=localhost"
+        "--locators=" + locatorAddress,
+        "--server-port=" + serverPort,
+        "--hostname-for-clients=localhost",
+        
"--J=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
       };
 
       Map<String, List<PortBinding>> ports = new HashMap<>();
       List<PortBinding> binding = new ArrayList<>();
-      binding.add(PortBinding.of("HostPort", (40404 + i) + ""));
-      ports.put((40404 + i) + "/tcp", binding);
+      binding.add(PortBinding.of("HostPort", serverPort));
+      ports.put(serverPort + "/tcp", binding);
+
+      List<PortBinding> debugBinding = new ArrayList<>();
+      debugBinding.add(PortBinding.of("HostPort", (5005 + i + locatorCount) + 
""));
+      ports.put("5005/tcp", debugBinding);
 
       String id = startContainer(i, ports);
       execCommand(id, true, null, command);
@@ -215,8 +227,12 @@ public class DockerCluster {
 
   public void stop() throws DockerException, InterruptedException {
     for (String id : nodeIds) {
-      docker.killContainer(id);
-      docker.removeContainer(id);
+      try {
+        docker.killContainer(id);
+        docker.removeContainer(id);
+      } catch (ContainerNotFoundException nex) {
+        // Ignored because a container may have already been killed by the test
+      }
     }
     docker.close();
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0ff26e83/geode-core/src/test/resources/org/apache/geode/e2e/get_put.story
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/e2e/get_put.story 
b/geode-core/src/test/resources/org/apache/geode/e2e/get_put.story
index 8cad6e9..44d5062 100644
--- a/geode-core/src/test/resources/org/apache/geode/e2e/get_put.story
+++ b/geode-core/src/test/resources/org/apache/geode/e2e/get_put.story
@@ -1,10 +1,11 @@
 Scenario: gfsh can start and manage a cluster
+
 Given cluster is started with 1 locators and 3 servers
 Given region FOO is created as REPLICATE
 When I put 100 entries into region FOO
 Then I can get 100 entries from region FOO
 
-Given region BAR is created as PARTITION
+Given region BAR is created as PARTITION with redundancy 1
 When I put 100 entries into region BAR
 Then I can get 100 entries from region BAR
 

Reply via email to