geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [18/37] incubator-geode git commit: GEODE-246: Add new assertions and simply use of JUnitParams to one test.
Date Tue, 01 Sep 2015 16:48:56 GMT
GEODE-246: Add new assertions and simply use of JUnitParams to one test.


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

Branch: refs/heads/feature/GEODE-77
Commit: d669d05c053c2d501575ab6aa69fe64e57a93d65
Parents: 19732b2
Author: Kirk Lund <klund@pivotal.io>
Authored: Fri Aug 21 09:29:00 2015 -0700
Committer: Kirk Lund <klund@pivotal.io>
Committed: Fri Aug 21 09:29:00 2015 -0700

----------------------------------------------------------------------
 .../WanCommandsControllerJUnitTest.java         | 78 +++++---------------
 1 file changed, 20 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d669d05c/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
index fb39d8c..8086b26 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
@@ -33,28 +33,6 @@ public class WanCommandsControllerJUnitTest {
     this.wanCommandsController = new TestableWanCommandsController();
   }
   
-  private static final Object[] getParametersWithGroups() {
-    return $(
-        new Object[] { "sender1", new String[] { "group1" }, new String[] { }, true, false
},
-        new Object[] { "sender2", new String[] { "group1, group2" }, new String[] { }, true,
false }
-    );
-  }
-
-  private static final Object[] getParametersWithMembers() {
-    return $(
-        new Object[] { "sender3", new String[] { }, new String[] { "member1" }, false, true
},
-        new Object[] { "sender4", new String[] { }, new String[] { "member1, member2" },
false, true }
-    );
-  }
-  
-  private static final Object[] getParametersWithGroupsAndMembers() {
-    return $(
-        new Object[] { "sender5", new String[] { "group1" }, new String[] { "member1" },
true, true },
-        new Object[] { "sender6", new String[] { "group1,group2" }, new String[] { "member1,member2"
}, true, true },
-        new Object[] { "sender7", new String[] { "group1, group2" }, new String[] { "member1,
member2" }, true, true }
-    );
-  }
-  
   @Test
   public void shouldDefineStartGatewayReceiverCommandWithNulls() {
     this.wanCommandsController.startGatewaySender(null, null, null);
@@ -66,48 +44,20 @@ public class WanCommandsControllerJUnitTest {
   }
   
   @Test
-  @Parameters(method = "getParametersWithGroups")
-  public void shouldDefineStartGatewayReceiverCommandWithGroups(final String gatewaySenderId,
final String[] groups, final String[] members, final boolean containsGroups, final boolean
containsMembers) {
-    this.wanCommandsController.startGatewaySender(gatewaySenderId, groups, members);
-    
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYSENDER);
-    assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYSENDER__ID+"="+gatewaySenderId);
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYRECEIVER__GROUP);
-    assertThat(this.wanCommandsController.testableCommand).doesNotContain(START_GATEWAYRECEIVER__MEMBER);
-  }
-  
-  @Test
-  @Parameters(method = "getParametersWithMembers")
-  public void shouldDefineStartGatewayReceiverCommandWithMembers(final String gatewaySenderId,
final String[] groups, final String[] members, final boolean containsGroups, final boolean
containsMembers) {
-    this.wanCommandsController.startGatewaySender(gatewaySenderId, groups, members);
-    
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYSENDER);
-    assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYSENDER__ID+"="+gatewaySenderId);
-    assertThat(this.wanCommandsController.testableCommand).doesNotContain(START_GATEWAYRECEIVER__GROUP);
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYRECEIVER__MEMBER);
-  }
-  
-  @Test
   @Parameters(method = "getParametersWithGroupsAndMembers")
   public void shouldDefineStartGatewayReceiverCommandWithGroupsAndMembers(final String gatewaySenderId,
final String[] groups, final String[] members, final boolean containsGroups, final boolean
containsMembers) {
     this.wanCommandsController.startGatewaySender(gatewaySenderId, groups, members);
     
     assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYSENDER);
     assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYSENDER__ID+"="+gatewaySenderId);
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYRECEIVER__GROUP);
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYRECEIVER__MEMBER);
-  }
-  
-  @Test
-  public void shouldDefineStartGatewayReceiverCommandWithOutGroupsOrMembers() {
-    final String gatewaySenderId = "senderA";
-        
-    this.wanCommandsController.startGatewaySender("senderA", new String[] {}, new String[]
{});
-    
-    assertThat(this.wanCommandsController.testableCommand).contains(START_GATEWAYSENDER);
-    assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYSENDER__ID+"="+gatewaySenderId);
-    assertThat(this.wanCommandsController.testableCommand).doesNotContain(START_GATEWAYRECEIVER__GROUP);
-    assertThat(this.wanCommandsController.testableCommand).doesNotContain(START_GATEWAYRECEIVER__MEMBER);
+    assertThat(this.wanCommandsController.testableCommand.contains(START_GATEWAYRECEIVER__GROUP)).isEqualTo(containsGroups);
+    assertThat(this.wanCommandsController.testableCommand.contains(START_GATEWAYRECEIVER__MEMBER)).isEqualTo(containsMembers);
+    if (containsGroups) {
+      assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYRECEIVER__GROUP+"="+groups[0]);
+    }
+    if (containsMembers) {
+      assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYRECEIVER__MEMBER+"="+members[0]);
+    }
   }
   
   /**
@@ -144,6 +94,18 @@ public class WanCommandsControllerJUnitTest {
     assertThat(this.wanCommandsController.testableCommand).contains("--"+START_GATEWAYSENDER__ID+"="+"");
   }
   
+  private static final Object[] getParametersWithGroupsAndMembers() {
+    return $(
+        new Object[] { "sender1", new String[] { }, new String[] { }, false, false },
+        new Object[] { "sender2", new String[] { "group1" }, new String[] { }, true, false
},
+        new Object[] { "sender3", new String[] { "group1", "group2" }, new String[] { },
true, false },
+        new Object[] { "sender4", new String[] { }, new String[] { "member1" }, false, true
},
+        new Object[] { "sender5", new String[] { }, new String[] { "member1", "member2" },
false, true },
+        new Object[] { "sender6", new String[] { "group1" }, new String[] { "member1" },
true, true },
+        new Object[] { "sender7", new String[] { "group1", "group2" }, new String[] { "member1",
"member2" }, true, true }
+    );
+  }
+  
   /**
    * It would be ideal to refactor AbstractCommandsController such that 
    * defining of command strings and submitting them for execution are


Mime
View raw message