You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/03/29 00:48:37 UTC
[3/8] incubator-geode git commit: Keep
Keep
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5a321ffd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5a321ffd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5a321ffd
Branch: refs/heads/feature/GEODE-693
Commit: 5a321ffdf4f8276b6e3e5363f125c6c4438f233e
Parents: 6924ad4
Author: Kirk Lund <kl...@apache.org>
Authored: Wed Mar 23 14:10:14 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed Mar 23 14:10:14 2016 -0700
----------------------------------------------------------------------
.../security/ClientAuthorizationDUnitTest.java | 51 +--
.../security/ClientAuthorizationTestBase.java | 77 +++-
.../security/ClientMultiUserAuthzDUnitTest.java | 35 +-
.../DeltaClientAuthorizationDUnitTest.java | 140 +++---
.../gemfire/security/SecurityTestUtil.java | 277 ++++++------
.../ClientAuthorizationTwoDUnitTest.java | 204 ++++-----
.../security/ClientAuthzObjectModDUnitTest.java | 431 +++++++------------
.../ClientCQPostAuthorizationDUnitTest.java | 341 +++++----------
.../ClientPostAuthorizationDUnitTest.java | 376 ++++++++--------
.../gemfire/security/MultiuserAPIDUnitTest.java | 238 ++++------
.../MultiuserDurableCQAuthzDUnitTest.java | 294 +++++--------
11 files changed, 996 insertions(+), 1468 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
index bcb3d3d..b39fe34 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
@@ -52,18 +52,14 @@ import org.junit.experimental.categories.Category;
public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
@Override
- public final void postSetUp() throws Exception {
- final Host host = Host.getHost(0);
- server1 = host.getVM(0);
- server2 = host.getVM(1);
- client1 = host.getVM(2);
- client2 = host.getVM(3);
-
- server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- client1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
+ public final void preTearDownClientAuthorizationTestBase() throws Exception {
+ // close the clients first
+ client1.invoke(() -> SecurityTestUtil.closeCache());
+ client2.invoke(() -> SecurityTestUtil.closeCache());
+ SecurityTestUtil.closeCache();
+ // then close the servers
+ server1.invoke(() -> SecurityTestUtil.closeCache());
+ server2.invoke(() -> SecurityTestUtil.closeCache());
}
private Properties getUserPassword(String userName) {
@@ -566,7 +562,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
public void testUnregisterInterestWithFailover() {
OperationWithAction[] unregisterOps = {
- // Register interest in all keys using one key at a time
+ // Register interest in all KEYS using one key at a time
new OperationWithAction(OperationCode.REGISTER_INTEREST,
OperationCode.UNREGISTER_INTEREST, 3, OpFlags.NONE, 4),
new OperationWithAction(OperationCode.REGISTER_INTEREST, 2),
@@ -575,7 +571,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
| OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using one key at a time
+ // Unregister interest in all KEYS using one key at a time
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 3,
OpFlags.USE_OLDCONN | OpFlags.CHECK_NOTAUTHZ, 4),
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2,
@@ -588,7 +584,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
OperationWithAction.OPBLOCK_END,
- // Register interest in all keys using list
+ // Register interest in all KEYS using list
new OperationWithAction(OperationCode.REGISTER_INTEREST,
OperationCode.UNREGISTER_INTEREST, 3, OpFlags.USE_LIST, 4),
new OperationWithAction(OperationCode.REGISTER_INTEREST, 1,
@@ -598,7 +594,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationWithAction(OperationCode.GET, 1, OpFlags.USE_OLDCONN
| OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using list
+ // Unregister interest in all KEYS using list
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 3,
OpFlags.USE_OLDCONN | OpFlags.USE_LIST | OpFlags.CHECK_NOTAUTHZ, 4),
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 1,
@@ -611,7 +607,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
OperationWithAction.OPBLOCK_END,
- // Register interest in all keys using regular expression
+ // Register interest in all KEYS using regular expression
new OperationWithAction(OperationCode.REGISTER_INTEREST,
OperationCode.UNREGISTER_INTEREST, 3, OpFlags.USE_REGEX, 4),
new OperationWithAction(OperationCode.REGISTER_INTEREST, 2,
@@ -621,7 +617,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
| OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using regular expression
+ // Unregister interest in all KEYS using regular expression
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 3,
OpFlags.USE_OLDCONN | OpFlags.USE_REGEX | OpFlags.CHECK_NOTAUTHZ, 4),
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2,
@@ -742,7 +738,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationWithAction(OperationCode.CONTAINS_KEY, 3,
OpFlags.CHECK_NOTAUTHZ, 4),
new OperationWithAction(OperationCode.CONTAINS_KEY),
- // Destroy the keys and check for failure in CONTAINS_KEY
+ // Destroy the KEYS and check for failure in CONTAINS_KEY
new OperationWithAction(OperationCode.DESTROY, 2),
new OperationWithAction(OperationCode.CONTAINS_KEY, 3,
OpFlags.CHECK_FAIL | OpFlags.CHECK_NOTAUTHZ, 4),
@@ -767,7 +763,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
OperationWithAction.OPBLOCK_END,
- // Register interest in all keys using one key at a time
+ // Register interest in all KEYS using one key at a time
new OperationWithAction(OperationCode.REGISTER_INTEREST, 3,
OpFlags.CHECK_NOTAUTHZ, 4),
new OperationWithAction(OperationCode.REGISTER_INTEREST, 2),
@@ -776,7 +772,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
| OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using one key at a time
+ // Unregister interest in all KEYS using one key at a time
new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2,
OpFlags.USE_OLDCONN, 4),
// UPDATE and test with GET for no updates
@@ -795,17 +791,4 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
runOpsWithFailover(allOps, "testAllOpsWithFailover");
}
-
- // End Region: Tests
-
- @Override
- public final void preTearDown() throws Exception {
- // close the clients first
- client1.invoke(() -> SecurityTestUtil.closeCache());
- client2.invoke(() -> SecurityTestUtil.closeCache());
- SecurityTestUtil.closeCache();
- // then close the servers
- server1.invoke(() -> SecurityTestUtil.closeCache());
- server2.invoke(() -> SecurityTestUtil.closeCache());
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
index 67f98aa..5689993 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
@@ -18,6 +18,7 @@
*/
package com.gemstone.gemfire.security;
+//import static com.gemstone.gemfire.security.SecurityTestUtil.*;
import static com.gemstone.gemfire.test.dunit.Assert.*;
import java.util.ArrayList;
@@ -59,7 +60,7 @@ import com.gemstone.gemfire.security.generator.AuthzCredentialGenerator.ClassCod
import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
import com.gemstone.gemfire.security.generator.XmlAuthzCredentialGenerator;
-import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
@@ -74,18 +75,14 @@ import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
protected static VM server1 = null;
-
protected static VM server2 = null;
-
protected static VM client1 = null;
-
protected static VM client2 = null;
- protected static final String regionName = SecurityTestUtil.regionName;
-
+ protected static final String regionName = SecurityTestUtil.REGION_NAME;
protected static final String subregionName = "AuthSubregion";
- protected static final String[] serverExpectedExceptions = {
+ private static final String[] serverIgnoredExceptions = {
"Connection refused",
AuthenticationRequiredException.class.getName(),
AuthenticationFailedException.class.getName(),
@@ -94,11 +91,57 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
RegionDestroyedException.class.getName(),
ClassNotFoundException.class.getName() };
- protected static final String[] clientExpectedExceptions = {
+ private static final String[] clientIgnoredExceptions = {
AuthenticationFailedException.class.getName(),
NotAuthorizedException.class.getName(),
RegionDestroyedException.class.getName() };
+ @Override
+ public final void preSetUp() throws Exception {
+ }
+
+ @Override
+ public final void postSetUp() throws Exception {
+ preSetUpClientAuthorizationTestBase();
+ setUpClientAuthorizationTestBase();
+ postSetUpClientAuthorizationTestBase();
+ }
+
+ private final void setUpClientAuthorizationTestBase() throws Exception {
+ final Host host = Host.getHost(0);
+ server1 = host.getVM(0);
+ server2 = host.getVM(1);
+ client1 = host.getVM(2);
+ client2 = host.getVM(3);
+
+ server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions(serverIgnoredExceptions));
+ server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions(serverIgnoredExceptions));
+ client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions(clientIgnoredExceptions));
+ SecurityTestUtil.registerExpectedExceptions(clientIgnoredExceptions);
+ }
+
+ protected void preSetUpClientAuthorizationTestBase() throws Exception {
+ }
+
+ protected void postSetUpClientAuthorizationTestBase() throws Exception {
+ }
+
+ @Override
+ public final void preTearDown() throws Exception {
+ preTearDownClientAuthorizationTestBase();
+ postTearDownClientAuthorizationTestBase();
+ }
+
+ @Override
+ public final void postTearDown() throws Exception {
+ }
+
+ protected void preTearDownClientAuthorizationTestBase() throws Exception {
+ }
+
+ protected void postTearDownClientAuthorizationTestBase() throws Exception {
+ }
+
protected static Properties buildProperties(String authenticator,
String accessor, boolean isAccessorPP, Properties extraAuthProps,
Properties extraAuthzProps) {
@@ -244,7 +287,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
else {
assertNotNull(region);
}
- final String[] keys = SecurityTestUtil.keys;
+ final String[] keys = SecurityTestUtil.KEYS;
final String[] vals;
if ((flags & OpFlags.USE_NEWVAL) > 0) {
vals = SecurityTestUtil.nvalues;
@@ -293,7 +336,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
int keyNum = indices[keyNumIndex];
searchKey = keys[keyNum];
keyList.add(searchKey);
- // local invalidate some keys to force fetch of those keys from
+ // local invalidate some KEYS to force fetch of those KEYS from
// server
if ((flags & OpFlags.CHECK_NOKEY) > 0) {
AbstractRegionEntry entry = (AbstractRegionEntry)((LocalRegion)region).getRegionEntry(searchKey);
@@ -678,7 +721,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
continue;
}
else {
- Assert.fail("doOp: Got unexpected exception when doing operation. Policy = "
+ fail("doOp: Got unexpected exception when doing operation. Policy = "
+ policy + " flags = " + OpFlags.description(flags), ex);
}
}
@@ -984,7 +1027,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
boolean foundKey = false;
while (eventIter.hasNext()) {
CqEvent event = (CqEvent)eventIter.next();
- if (SecurityTestUtil.keys[index].equals(event.getKey())) {
+ if (SecurityTestUtil.KEYS[index].equals(event.getKey())) {
assertEquals(vals[index], event.getNewValue());
foundKey = true;
break;
@@ -1036,7 +1079,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
public static final int USE_NEWVAL = 0x10;
/**
- * Register all keys. For GET operations indicates using getAll().
+ * Register all KEYS. For GET operations indicates using getAll().
*/
public static final int USE_ALL_KEYS = 0x20;
@@ -1046,7 +1089,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
public static final int USE_REGEX = 0x40;
/**
- * Register a list of keys.
+ * Register a list of KEYS.
*/
public static final int USE_LIST = 0x80;
@@ -1185,7 +1228,7 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
private int flags;
/**
- * Indices of the keys array to be used for operations.
+ * Indices of the KEYS array to be used for operations.
*/
private int[] indices;
@@ -1328,14 +1371,14 @@ public class ClientAuthorizationTestBase extends JUnit4DistributedTestCase {
/**
* Get allowed credentials for the given set of operations in the given
- * regions and indices of keys in the <code>keys</code> array
+ * regions and indices of KEYS in the <code>KEYS</code> array
*/
public Properties getAllowedCredentials(OperationCode[] opCodes,
String[] regionNames, int[] keyIndices, int num);
/**
* Get disallowed credentials for the given set of operations in the given
- * regions and indices of keys in the <code>keys</code> array
+ * regions and indices of KEYS in the <code>KEYS</code> array
*/
public Properties getDisallowedCredentials(OperationCode[] opCodes,
String[] regionNames, int[] keyIndices, int num);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
index 18da345..7a5b49d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
@@ -29,7 +29,6 @@ import com.gemstone.gemfire.internal.cache.execute.PRClientServerTestBase;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.security.generator.AuthzCredentialGenerator;
import com.gemstone.gemfire.security.generator.CredentialGenerator;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@@ -40,17 +39,14 @@ import org.junit.experimental.categories.Category;
public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
@Override
- public final void postSetUp() throws Exception {
- final Host host = Host.getHost(0);
- server1 = host.getVM(0);
- server2 = host.getVM(1);
- client1 = host.getVM(2);
- client2 = host.getVM(3);
-
- server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
+ public final void preTearDownClientAuthorizationTestBase() throws Exception {
+ // close the clients first
+ client1.invoke(() -> SecurityTestUtil.closeCache());
+ client2.invoke(() -> SecurityTestUtil.closeCache());
+ SecurityTestUtil.closeCache();
+ // then close the servers
+ server1.invoke(() -> SecurityTestUtil.closeCache());
+ server2.invoke(() -> SecurityTestUtil.closeCache());
}
/**
@@ -328,7 +324,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
}
public static void doPuts() {
- Region region = GemFireCacheImpl.getInstance().getRegion(SecurityTestUtil.regionName);
+ Region region = GemFireCacheImpl.getInstance().getRegion(SecurityTestUtil.REGION_NAME);
region.put("key1", "value1");
region.put("key2", "value2");
}
@@ -506,17 +502,4 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
verifyContainsKeyDestroys(false, false);
}
}
-
- // End Region: Tests
-
- @Override
- public final void preTearDown() throws Exception {
- // close the clients first
- client1.invoke(() -> SecurityTestUtil.closeCache());
- client2.invoke(() -> SecurityTestUtil.closeCache());
- SecurityTestUtil.closeCache();
- // then close the servers
- server1.invoke(() -> SecurityTestUtil.closeCache());
- server2.invoke(() -> SecurityTestUtil.closeCache());
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
index a2ed3fd..4ffac74 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
@@ -31,7 +31,6 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegionLocalMaxMemoryDUnitT
import com.gemstone.gemfire.security.generator.AuthzCredentialGenerator;
import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import org.junit.Test;
@@ -46,76 +45,13 @@ public class DeltaClientAuthorizationDUnitTest extends
private DeltaTestImpl[] deltas = new DeltaTestImpl[8];
- private final void setUpDeltas() {
- for (int i = 0; i < 8; i++) {
- deltas[i] = new DeltaTestImpl(0, "0", new Double(0), new byte[0],
- new TestObject1("0", 0));
- }
- deltas[1].setIntVar(5);
- deltas[2].setIntVar(5);
- deltas[3].setIntVar(5);
- deltas[4].setIntVar(5);
- deltas[5].setIntVar(5);
- deltas[6].setIntVar(5);
- deltas[7].setIntVar(5);
-
- deltas[2].resetDeltaStatus();
- deltas[2].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
- deltas[3].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
- deltas[4].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
- deltas[5].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
- //deltas[6].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
- //deltas[7].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
-
- deltas[3].resetDeltaStatus();
- deltas[3].setDoubleVar(new Double(5));
- deltas[4].setDoubleVar(new Double(5));
- deltas[5].setDoubleVar(new Double(5));
- deltas[6].setDoubleVar(new Double(5));
- deltas[7].setDoubleVar(new Double(5));
-
- deltas[4].resetDeltaStatus();
- deltas[4].setStr("str changed");
- deltas[5].setStr("str changed");
- deltas[6].setStr("str changed");
- //deltas[7].setStr("str changed");
-
- deltas[5].resetDeltaStatus();
- deltas[5].setIntVar(100);
- deltas[5].setTestObj(new TestObject1("CHANGED", 100));
- deltas[6].setTestObj(new TestObject1("CHANGED", 100));
- deltas[7].setTestObj(new TestObject1("CHANGED", 100));
-
- deltas[6].resetDeltaStatus();
- deltas[6].setByteArr(new byte[] { 1, 2, 3 });
- deltas[7].setByteArr(new byte[] { 1, 2, 3 });
-
- deltas[7].resetDeltaStatus();
- deltas[7].setStr("delta string");
-
- }
-
@Override
- public final void preSetUp() throws Exception {
+ protected final void preSetUpClientAuthorizationTestBase() throws Exception {
setUpDeltas();
}
@Override
- public final void postSetUp() throws Exception {
- final Host host = Host.getHost(0);
- server1 = host.getVM(0);
- server2 = host.getVM(1);
- client1 = host.getVM(2);
- client2 = host.getVM(3);
-
- server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
- }
-
- @Override
- public final void preTearDown() throws Exception {
+ public final void preTearDownClientAuthorizationTestBase() throws Exception {
// close the clients first
client1.invoke(() -> SecurityTestUtil.closeCache());
client2.invoke(() -> SecurityTestUtil.closeCache());
@@ -179,36 +115,36 @@ public class DeltaClientAuthorizationDUnitTest extends
new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION), Boolean.FALSE ));
}
- protected void createClient2(Properties javaProps, String authInit,
+ private void createClient2(Properties javaProps, String authInit,
Integer port1, Integer port2, Properties getCredentials) {
client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, javaProps, port1, port2,
null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
}
- protected void createClient1(Properties javaProps, String authInit,
+ private void createClient1(Properties javaProps, String authInit,
Integer port1, Integer port2, Properties createCredentials) {
client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, javaProps, port1, port2,
null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
}
- protected Integer createServer2(Properties javaProps,
+ private Integer createServer2(Properties javaProps,
Properties serverProps) {
Integer port2 = ((Integer)server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
return port2;
}
- protected Integer createServer1(Properties javaProps,
+ private Integer createServer1(Properties javaProps,
Properties serverProps) {
Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
return port1;
}
- public void doPuts(Integer num, Integer expectedResult,
+ private void doPuts(Integer num, Integer expectedResult,
boolean newVals) {
- assertTrue(num.intValue() <= SecurityTestUtil.keys.length);
+ assertTrue(num.intValue() <= SecurityTestUtil.KEYS.length);
Region region = null;
try {
region = SecurityTestUtil.getCache().getRegion(regionName);
@@ -223,11 +159,11 @@ public class DeltaClientAuthorizationDUnitTest extends
}
}
for (int index = 0; index < num.intValue(); ++index) {
- region.put(SecurityTestUtil.keys[index], deltas[0]);
+ region.put(SecurityTestUtil.KEYS[index], deltas[0]);
}
for (int index = 0; index < num.intValue(); ++index) {
try {
- region.put(SecurityTestUtil.keys[index], deltas[index]);
+ region.put(SecurityTestUtil.KEYS[index], deltas[index]);
if (expectedResult.intValue() != SecurityTestUtil.NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing puts");
}
@@ -283,10 +219,10 @@ public class DeltaClientAuthorizationDUnitTest extends
}
}
- public void doGets(Integer num, Integer expectedResult,
+ private void doGets(Integer num, Integer expectedResult,
boolean newVals) {
- assertTrue(num.intValue() <= SecurityTestUtil.keys.length);
+ assertTrue(num.intValue() <= SecurityTestUtil.KEYS.length);
Region region = null;
try {
region = SecurityTestUtil.getCache().getRegion(regionName);
@@ -304,11 +240,11 @@ public class DeltaClientAuthorizationDUnitTest extends
Object value = null;
try {
try {
- region.localInvalidate(SecurityTestUtil.keys[index]);
+ region.localInvalidate(SecurityTestUtil.KEYS[index]);
}
catch (Exception ex) {
}
- value = region.get(SecurityTestUtil.keys[index]);
+ value = region.get(SecurityTestUtil.KEYS[index]);
if (expectedResult.intValue() != SecurityTestUtil.NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing gets");
}
@@ -352,4 +288,52 @@ public class DeltaClientAuthorizationDUnitTest extends
}
}
+ private final void setUpDeltas() {
+ for (int i = 0; i < 8; i++) {
+ deltas[i] = new DeltaTestImpl(0, "0", new Double(0), new byte[0],
+ new TestObject1("0", 0));
+ }
+ deltas[1].setIntVar(5);
+ deltas[2].setIntVar(5);
+ deltas[3].setIntVar(5);
+ deltas[4].setIntVar(5);
+ deltas[5].setIntVar(5);
+ deltas[6].setIntVar(5);
+ deltas[7].setIntVar(5);
+
+ deltas[2].resetDeltaStatus();
+ deltas[2].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+ deltas[3].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+ deltas[4].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+ deltas[5].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+ //deltas[6].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+ //deltas[7].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
+
+ deltas[3].resetDeltaStatus();
+ deltas[3].setDoubleVar(new Double(5));
+ deltas[4].setDoubleVar(new Double(5));
+ deltas[5].setDoubleVar(new Double(5));
+ deltas[6].setDoubleVar(new Double(5));
+ deltas[7].setDoubleVar(new Double(5));
+
+ deltas[4].resetDeltaStatus();
+ deltas[4].setStr("str changed");
+ deltas[5].setStr("str changed");
+ deltas[6].setStr("str changed");
+ //deltas[7].setStr("str changed");
+
+ deltas[5].resetDeltaStatus();
+ deltas[5].setIntVar(100);
+ deltas[5].setTestObj(new TestObject1("CHANGED", 100));
+ deltas[6].setTestObj(new TestObject1("CHANGED", 100));
+ deltas[7].setTestObj(new TestObject1("CHANGED", 100));
+
+ deltas[6].resetDeltaStatus();
+ deltas[6].setByteArr(new byte[] { 1, 2, 3 });
+ deltas[7].setByteArr(new byte[] { 1, 2, 3 });
+
+ deltas[7].resetDeltaStatus();
+ deltas[7].setStr("delta string");
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtil.java b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtil.java
index af8c0fe..80a8f6d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtil.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtil.java
@@ -1,5 +1,3 @@
-package com.gemstone.gemfire.security;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -8,9 +6,9 @@ package com.gemstone.gemfire.security;
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -18,7 +16,12 @@ package com.gemstone.gemfire.security;
* specific language governing permissions and limitations
* under the License.
*/
+package com.gemstone.gemfire.security;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
import java.io.File;
import java.io.FileOutputStream;
@@ -82,11 +85,7 @@ import com.gemstone.gemfire.internal.util.Callable;
import com.gemstone.gemfire.pdx.PdxReader;
import com.gemstone.gemfire.pdx.PdxSerializable;
import com.gemstone.gemfire.pdx.PdxWriter;
-import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
@@ -96,42 +95,29 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
* @author sumedh
* @since 5.5
*/
-public class SecurityTestUtil extends DistributedTestCase {
+public final class SecurityTestUtil {
- public SecurityTestUtil(String name) {
- super(name);
- }
+ private final DistributedTestCase distributedTestCase = new DistributedTestCase(getClass().getSimpleName()) {};
private static Locator locator = null;
-
private static Cache cache = null;
-
private static Properties currentJavaProps = null;
-
private static String locatorString = null;
-
private static Integer mcastPort = null;
public static final int NO_EXCEPTION = 0;
-
public static final int AUTHREQ_EXCEPTION = 1;
-
public static final int AUTHFAIL_EXCEPTION = 2;
-
public static final int CONNREFUSED_EXCEPTION = 3;
-
public static final int NOTAUTHZ_EXCEPTION = 4;
-
public static final int OTHER_EXCEPTION = 5;
-
public static final int NO_AVAILABLE_SERVERS = 6;
-
// Indicates that AuthReqException may not necessarily be thrown
public static final int NOFORCE_AUTHREQ_EXCEPTION = 16;
- protected static final String regionName = "AuthRegion";
+ protected static final String REGION_NAME = "AuthRegion";
- protected static final String[] keys = { "key1", "key2", "key3", "key4",
+ protected static final String[] KEYS = { "key1", "key2", "key3", "key4",
"key5", "key6", "key7", "key8" };
protected static final String[] values = { "value1", "value2", "value3",
@@ -141,6 +127,9 @@ public class SecurityTestUtil extends DistributedTestCase {
"nvalue4", "nvalue5", "nvalue6", "nvalue7", "nvalue8" };
static String[] expectedExceptions = null;
+ static String[] expectedExceptions() {
+ return expectedExceptions;
+ }
private static Pool pool = null;
@@ -149,6 +138,9 @@ public class SecurityTestUtil extends DistributedTestCase {
private static final int numberOfUsers = 1;
static ProxyCache[] proxyCaches = new ProxyCache[numberOfUsers];
+ static ProxyCache[] proxyCaches() {
+ return proxyCaches();
+ }
private static Region regionRef = null;
@@ -172,6 +164,9 @@ public class SecurityTestUtil extends DistributedTestCase {
}
}
+ public SecurityTestUtil(String name) {
+ }
+
public static void setJavaProps(Properties javaProps) {
removeJavaProperties(currentJavaProps);
@@ -185,7 +180,7 @@ public class SecurityTestUtil extends DistributedTestCase {
clearStaticSSLContext();
setJavaProps(javaProps);
- DistributedSystem dsys = getSystem(sysProps);
+ DistributedSystem dsys = distributedTestCase.getSystem(sysProps);
assertNotNull(dsys);
addExpectedExceptions(SecurityTestUtil.expectedExceptions, dsys
.getLogWriter());
@@ -194,9 +189,9 @@ public class SecurityTestUtil extends DistributedTestCase {
void openCache() {
- assertNotNull(basicGetSystem());
- assertTrue(basicGetSystem().isConnected());
- cache = CacheFactory.create(basicGetSystem());
+ assertNotNull(distributedTestCase.basicGetSystem());
+ assertTrue(distributedTestCase.basicGetSystem().isConnected());
+ cache = CacheFactory.create(distributedTestCase.basicGetSystem());
assertNotNull(cache);
}
@@ -216,7 +211,7 @@ public class SecurityTestUtil extends DistributedTestCase {
Integer locatorPort = new Integer(AvailablePort
.getRandomAvailablePort(AvailablePort.SOCKET));
- String addr = NetworkUtils.getIPLiteral();
+ String addr = getIPLiteral();
if (locatorString == null) {
locatorString = addr + "[" + locatorPort + ']';
}
@@ -296,10 +291,10 @@ public class SecurityTestUtil extends DistributedTestCase {
authProps.setProperty(DistributionConfig.LOCATORS_NAME, locatorString);
if (locatorPort != null) {
authProps.setProperty(DistributionConfig.START_LOCATOR_NAME,
- NetworkUtils.getIPLiteral() + "[" + locatorPort.toString() + ']');
+ getIPLiteral() + "[" + locatorPort.toString() + ']');
}
} else {
- authProps.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
+ authProps.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
}
authProps.setProperty(DistributionConfig.SECURITY_LOG_LEVEL_NAME, "finest");
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Set the server properties to: " + authProps);
@@ -318,7 +313,7 @@ public class SecurityTestUtil extends DistributedTestCase {
return new Integer(0);
}
else {
- Assert.fail("Got unexpected exception when starting peer", ex);
+ fail("Got unexpected exception when starting peer", ex);
}
}
catch (AuthenticationFailedException ex) {
@@ -327,11 +322,11 @@ public class SecurityTestUtil extends DistributedTestCase {
return new Integer(0);
}
else {
- Assert.fail("Got unexpected exception when starting peer", ex);
+ fail("Got unexpected exception when starting peer", ex);
}
}
catch (Exception ex) {
- Assert.fail("Got unexpected exception when starting peer", ex);
+ fail("Got unexpected exception when starting peer", ex);
}
if (setupDynamicRegionFactory.booleanValue()) {
@@ -342,7 +337,7 @@ public class SecurityTestUtil extends DistributedTestCase {
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
- cache.createRegion(regionName, attrs);
+ cache.createRegion(REGION_NAME, attrs);
int port;
if (serverPort == null || serverPort.intValue() <= 0) {
port = 0;
@@ -357,7 +352,7 @@ public class SecurityTestUtil extends DistributedTestCase {
server1.start();
}
catch (Exception ex) {
- Assert.fail("Got unexpected exception when starting CacheServer", ex);
+ fail("Got unexpected exception when starting CacheServer", ex);
}
return new Integer(server1.getPort());
}
@@ -431,7 +426,7 @@ public class SecurityTestUtil extends DistributedTestCase {
//poolFactory.setSubscriptionEnabled(false);
}
pool = ClientServerTestCase.configureConnectionPoolWithNameAndFactory(factory,
- NetworkUtils.getIPLiteral(), portsI, subscriptionEnabled, 0,
+ getIPLiteral(), portsI, subscriptionEnabled, 0,
numConnections == null ? -1 : numConnections.intValue(), null, null,
poolFactory);
@@ -450,7 +445,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected UnsupportedOperationException in single-user mode");
}
else {
- Assert.fail("Got unexpected exception in multi-user mode ", uoe);
+ fail("Got unexpected exception in multi-user mode ", uoe);
}
}
@@ -459,7 +454,7 @@ public class SecurityTestUtil extends DistributedTestCase {
factory.setDataPolicy(DataPolicy.EMPTY);
}
RegionAttributes attrs = factory.create();
- cache.createRegion(regionName, attrs);
+ cache.createRegion(REGION_NAME, attrs);
if (expectedResult.intValue() != NO_EXCEPTION
&& expectedResult.intValue() != NOFORCE_AUTHREQ_EXCEPTION) {
@@ -475,7 +470,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (AuthenticationFailedException ex) {
@@ -484,7 +479,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (ServerRefusedConnectionException ex) {
@@ -493,11 +488,11 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (Exception ex) {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
@@ -573,7 +568,7 @@ public class SecurityTestUtil extends DistributedTestCase {
poolFactory.setMultiuserAuthentication(multiUserAuthMode);
poolFactory.setSubscriptionEnabled(true);
pool = ClientServerTestCase.configureConnectionPoolWithNameAndFactory(factory,
- NetworkUtils.getIPLiteral(), portsI, true, 1,
+ getIPLiteral(), portsI, true, 1,
numConnections == null ? -1 : numConnections.intValue(), null, null,
poolFactory);
@@ -588,7 +583,7 @@ public class SecurityTestUtil extends DistributedTestCase {
factory.setScope(Scope.LOCAL);
factory.setDataPolicy(DataPolicy.EMPTY);
RegionAttributes attrs = factory.create();
- cache.createRegion(regionName, attrs);
+ cache.createRegion(REGION_NAME, attrs);
if (expectedResult.intValue() != NO_EXCEPTION
&& expectedResult.intValue() != NOFORCE_AUTHREQ_EXCEPTION) {
@@ -604,7 +599,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (AuthenticationFailedException ex) {
@@ -613,7 +608,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (ServerRefusedConnectionException ex) {
@@ -622,11 +617,11 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected exception when starting client: " + ex);
}
else {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
catch (Exception ex) {
- Assert.fail("Got unexpected exception when starting client", ex);
+ fail("Got unexpected exception when starting client", ex);
}
}
@@ -656,7 +651,7 @@ public class SecurityTestUtil extends DistributedTestCase {
server.start();
}
catch (Exception ex) {
- Assert.fail("Unexpected exception when restarting cache servers", ex);
+ fail("Unexpected exception when restarting cache servers", ex);
}
assertTrue(server.isRunning());
}
@@ -673,7 +668,7 @@ public class SecurityTestUtil extends DistributedTestCase {
}
authProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
authProps.setProperty(DistributionConfig.LOCATORS_NAME,
- NetworkUtils.getIPLiteral() + "[" + port + "]");
+ getIPLiteral() + "[" + port + "]");
authProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
clearStaticSSLContext();
setJavaProps((Properties)javaProps);
@@ -687,7 +682,7 @@ public class SecurityTestUtil extends DistributedTestCase {
authProps);
}
catch (IOException ex) {
- Assert.fail("While starting locator on port " + port.intValue(), ex);
+ fail("While starting locator on port " + port.intValue(), ex);
}
}
@@ -699,7 +694,7 @@ public class SecurityTestUtil extends DistributedTestCase {
.getDistributedSystem().getLogWriter());
}
catch (Exception ex) {
- Assert.fail("While stopping locator on port " + port.intValue(), ex);
+ fail("While stopping locator on port " + port.intValue(), ex);
}
}
@@ -721,7 +716,7 @@ public class SecurityTestUtil extends DistributedTestCase {
return ((Boolean)cond.call()).booleanValue();
}
catch (Exception e) {
- Assert.fail("Unexpected exception", e);
+ fail("Unexpected exception", e);
}
return false; // NOTREACHED
}
@@ -729,7 +724,7 @@ public class SecurityTestUtil extends DistributedTestCase {
return null;
}
};
- Wait.waitForCriterion(ev, sleepMillis * numTries, 200, true);
+ waitForCriterion(ev, sleepMillis * numTries, 200, true);
}
public static Object getLocalValue(Region region, Object key) {
@@ -752,15 +747,15 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doPutsP(Integer num, Integer multiUserIndex,
Integer expectedResult, boolean newVals) {
- assertTrue(num.intValue() <= keys.length);
+ assertTrue(num.intValue() <= KEYS.length);
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
regionRef = region;
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -769,16 +764,16 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing puts", ex);
+ fail("Got unexpected exception when doing puts", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
try {
if (newVals) {
- region.put(keys[index], nvalues[index]);
+ region.put(KEYS[index], nvalues[index]);
}
else {
- region.put(keys[index], values[index]);
+ region.put(KEYS[index], values[index]);
}
if (expectedResult.intValue() != NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing puts");
@@ -792,7 +787,7 @@ public class SecurityTestUtil extends DistributedTestCase {
continue;
}
else {
- Assert.fail("Got unexpected exception when doing puts", ex);
+ fail("Got unexpected exception when doing puts", ex);
}
}
catch (ServerConnectivityException ex) {
@@ -821,7 +816,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing puts", ex);
+ fail("Got unexpected exception when doing puts", ex);
}
}
catch (Exception ex) {
@@ -829,7 +824,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing puts", ex);
+ fail("Got unexpected exception when doing puts", ex);
}
}
}
@@ -868,7 +863,7 @@ public class SecurityTestUtil extends DistributedTestCase {
}
public static void doPutAllP() throws Exception {
- Region region = getCache().getRegion(regionName);
+ Region region = getCache().getRegion(REGION_NAME);
assertNotNull(region);
Map map = new LinkedHashMap();
map.put("1010L", new Employee(1010L, "John", "Doe"));
@@ -880,10 +875,10 @@ public class SecurityTestUtil extends DistributedTestCase {
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -892,7 +887,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing getAll: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing getAll", ex);
+ fail("Got unexpected exception when doing getAll", ex);
}
}
try {
@@ -922,7 +917,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected NoAvailableServers when doing getAll: "
+ ex.getCause());
} else {
- Assert.fail("Got unexpected exception when doing getAll", ex);
+ fail("Got unexpected exception when doing getAll", ex);
}
} catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -933,13 +928,13 @@ public class SecurityTestUtil extends DistributedTestCase {
} else if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing getAll: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing getAll", ex);
+ fail("Got unexpected exception when doing getAll", ex);
}
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing getAll: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing getAll", ex);
+ fail("Got unexpected exception when doing getAll", ex);
}
}
}
@@ -952,14 +947,14 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doGetsP(Integer num, Integer multiUserIndex,
Integer expectedResult, boolean newVals) {
- assertTrue(num.intValue() <= keys.length);
+ assertTrue(num.intValue() <= KEYS.length);
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -968,18 +963,18 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing gets", ex);
+ fail("Got unexpected exception when doing gets", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
Object value = null;
try {
try {
- region.localInvalidate(keys[index]);
+ region.localInvalidate(KEYS[index]);
}
catch (Exception ex) {
}
- value = region.get(keys[index]);
+ value = region.get(KEYS[index]);
if (expectedResult.intValue() != NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing gets");
}
@@ -992,7 +987,7 @@ public class SecurityTestUtil extends DistributedTestCase {
continue;
}
else {
- Assert.fail("Got unexpected exception when doing gets", ex);
+ fail("Got unexpected exception when doing gets", ex);
}
}
catch (ServerConnectivityException ex) {
@@ -1007,7 +1002,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing gets", ex);
+ fail("Got unexpected exception when doing gets", ex);
}
}
catch (Exception ex) {
@@ -1015,7 +1010,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing gets", ex);
+ fail("Got unexpected exception when doing gets", ex);
}
}
assertNotNull(value);
@@ -1030,15 +1025,15 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doLocalGetsP(int num, boolean checkNVals) {
- assertTrue(num <= keys.length);
+ assertTrue(num <= KEYS.length);
String[] vals = values;
if (checkNVals) {
vals = nvalues;
}
- final Region region = getCache().getRegion(regionName);
+ final Region region = getCache().getRegion(REGION_NAME);
assertNotNull(region);
for (int index = 0; index < num; ++index) {
- final String key = keys[index];
+ final String key = KEYS[index];
final String expectedVal = vals[index];
waitForCondition(new Callable() {
public Object call() throws Exception {
@@ -1048,7 +1043,7 @@ public class SecurityTestUtil extends DistributedTestCase {
}, 1000, 30 / num);
}
for (int index = 0; index < num; ++index) {
- Region.Entry entry = region.getEntry(keys[index]);
+ Region.Entry entry = region.getEntry(KEYS[index]);
assertNotNull(entry);
assertEquals(vals[index], entry.getValue());
}
@@ -1059,9 +1054,9 @@ public class SecurityTestUtil extends DistributedTestCase {
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiuserIndex].getRegion(regionName);
+ region = proxyCaches[multiuserIndex].getRegion(REGION_NAME);
} else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
} catch (Exception ex) {
@@ -1069,7 +1064,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when doing region destroy: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing region destroy", ex);
+ fail("Got unexpected exception when doing region destroy", ex);
}
}
@@ -1079,9 +1074,9 @@ public class SecurityTestUtil extends DistributedTestCase {
fail("Expected a NotAuthorizedException while doing region destroy");
}
if (multiUserAuthMode) {
- region = proxyCaches[multiuserIndex].getRegion(regionName);
+ region = proxyCaches[multiuserIndex].getRegion(REGION_NAME);
} else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNull(region);
} catch (NoAvailableServersException ex) {
@@ -1090,7 +1085,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected NoAvailableServers when doing region destroy: "
+ ex.getCause());
} else {
- Assert.fail("Got unexpected exception when doing region destroy", ex);
+ fail("Got unexpected exception when doing region destroy", ex);
}
} catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1102,14 +1097,14 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when doing region destroy: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing region destroy", ex);
+ fail("Got unexpected exception when doing region destroy", ex);
}
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when doing region destroy: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing region destroy", ex);
+ fail("Got unexpected exception when doing region destroy", ex);
}
}
}
@@ -1117,14 +1112,14 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doDestroysP(Integer num, Integer multiUserIndex,
Integer expectedResult, boolean newVals) {
- assertTrue(num.intValue() <= keys.length);
+ assertTrue(num.intValue() <= KEYS.length);
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -1133,12 +1128,12 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing destroys: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing destroys", ex);
+ fail("Got unexpected exception when doing destroys", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
try {
- region.destroy(keys[index]);
+ region.destroy(KEYS[index]);
if (expectedResult.intValue() != NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing destroys");
}
@@ -1151,7 +1146,7 @@ public class SecurityTestUtil extends DistributedTestCase {
continue;
}
else {
- Assert.fail("Got unexpected exception when doing destroys", ex);
+ fail("Got unexpected exception when doing destroys", ex);
}
}
catch (ServerConnectivityException ex) {
@@ -1166,7 +1161,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing destroys: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing destroys", ex);
+ fail("Got unexpected exception when doing destroys", ex);
}
}
catch (Exception ex) {
@@ -1174,7 +1169,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing destroys: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing destroys", ex);
+ fail("Got unexpected exception when doing destroys", ex);
}
}
}
@@ -1183,14 +1178,14 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doInvalidatesP(Integer num, Integer multiUserIndex,
Integer expectedResult, boolean newVals) {
- assertTrue(num.intValue() <= keys.length);
+ assertTrue(num.intValue() <= KEYS.length);
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -1199,12 +1194,12 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing invalidates: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing invalidates", ex);
+ fail("Got unexpected exception when doing invalidates", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
try {
- region.invalidate(keys[index]);
+ region.invalidate(KEYS[index]);
if (expectedResult.intValue() != NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing invalidates");
}
@@ -1217,7 +1212,7 @@ public class SecurityTestUtil extends DistributedTestCase {
continue;
}
else {
- Assert.fail("Got unexpected exception when doing invalidates", ex);
+ fail("Got unexpected exception when doing invalidates", ex);
}
}
catch (ServerConnectivityException ex) {
@@ -1232,7 +1227,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing invalidates: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing invalidates", ex);
+ fail("Got unexpected exception when doing invalidates", ex);
}
}
catch (Exception ex) {
@@ -1240,7 +1235,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing invalidates: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing invalidates", ex);
+ fail("Got unexpected exception when doing invalidates", ex);
}
}
}
@@ -1249,14 +1244,14 @@ public class SecurityTestUtil extends DistributedTestCase {
private static void doContainsKeysP(Integer num, Integer multiUserIndex,
Integer expectedResult, boolean newVals, boolean expectedValue) {
- assertTrue(num.intValue() <= keys.length);
+ assertTrue(num.intValue() <= KEYS.length);
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
}
else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
}
@@ -1265,13 +1260,13 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing containsKey: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing containsKey", ex);
+ fail("Got unexpected exception when doing containsKey", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
boolean result = false;
try {
- result = region.containsKeyOnServer(keys[index]);
+ result = region.containsKeyOnServer(KEYS[index]);
if (expectedResult.intValue() != NO_EXCEPTION) {
fail("Expected a NotAuthorizedException while doing containsKey");
}
@@ -1284,7 +1279,7 @@ public class SecurityTestUtil extends DistributedTestCase {
continue;
}
else {
- Assert.fail("Got unexpected exception when doing containsKey", ex);
+ fail("Got unexpected exception when doing containsKey", ex);
}
}
catch (ServerConnectivityException ex) {
@@ -1299,7 +1294,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing containsKey: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing containsKey", ex);
+ fail("Got unexpected exception when doing containsKey", ex);
}
}
catch (Exception ex) {
@@ -1307,7 +1302,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing containsKey: " + ex);
}
else {
- Assert.fail("Got unexpected exception when doing containsKey", ex);
+ fail("Got unexpected exception when doing containsKey", ex);
}
}
assertEquals(expectedValue, result);
@@ -1319,16 +1314,16 @@ public class SecurityTestUtil extends DistributedTestCase {
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
} else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing queries: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing queries", ex);
+ fail("Got unexpected exception when doing queries", ex);
}
}
String queryStr = "SELECT DISTINCT * FROM " + region.getFullPath();
@@ -1345,7 +1340,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected NoAvailableServers when doing queries: "
+ ex.getCause());
} else {
- Assert.fail("Got unexpected exception when doing queries", ex);
+ fail("Got unexpected exception when doing queries", ex);
}
} catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1356,7 +1351,7 @@ public class SecurityTestUtil extends DistributedTestCase {
} else if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing queries: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing queries", ex);
+ fail("Got unexpected exception when doing queries", ex);
}
} catch (QueryInvocationTargetException qite) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1367,13 +1362,13 @@ public class SecurityTestUtil extends DistributedTestCase {
} else if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing queries: " + qite);
} else {
- Assert.fail("Got unexpected exception when doing queries", qite);
+ fail("Got unexpected exception when doing queries", qite);
}
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Got expected exception when doing queries: " + ex);
} else {
- Assert.fail("Got unexpected exception when doing queries", ex);
+ fail("Got unexpected exception when doing queries", ex);
}
}
}
@@ -1384,9 +1379,9 @@ public class SecurityTestUtil extends DistributedTestCase {
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
} else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
} catch (Exception ex) {
@@ -1394,7 +1389,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing function: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing function", ex);
+ fail("Got unexpected exception when executing function", ex);
}
}
try {
@@ -1425,7 +1420,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected NoAvailableServers when executing function: "
+ ex.getCause());
} else {
- Assert.fail("Got unexpected exception when executing function", ex);
+ fail("Got unexpected exception when executing function", ex);
}
} catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1437,7 +1432,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing function: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing function", ex);
+ fail("Got unexpected exception when executing function", ex);
}
} catch (FunctionException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1451,14 +1446,14 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing function: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing function", ex);
+ fail("Got unexpected exception when executing function", ex);
}
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing function: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing function", ex);
+ fail("Got unexpected exception when executing function", ex);
}
}
}
@@ -1468,9 +1463,9 @@ public class SecurityTestUtil extends DistributedTestCase {
Region region = null;
try {
if (multiUserAuthMode) {
- region = proxyCaches[multiUserIndex].getRegion(regionName);
+ region = proxyCaches[multiUserIndex].getRegion(REGION_NAME);
} else {
- region = getCache().getRegion(regionName);
+ region = getCache().getRegion(REGION_NAME);
}
assertNotNull(region);
} catch (Exception ex) {
@@ -1478,7 +1473,7 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing query: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing query", ex);
+ fail("Got unexpected exception when executing query", ex);
}
}
try {
@@ -1501,7 +1496,7 @@ public class SecurityTestUtil extends DistributedTestCase {
"Got expected NoAvailableServers when executing query: "
+ ex.getCause());
} else {
- Assert.fail("Got unexpected exception when executing query", ex);
+ fail("Got unexpected exception when executing query", ex);
}
} catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == NOTAUTHZ_EXCEPTION)
@@ -1513,14 +1508,14 @@ public class SecurityTestUtil extends DistributedTestCase {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing query: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing query", ex);
+ fail("Got unexpected exception when executing query", ex);
}
} catch (Exception ex) {
if (expectedResult.intValue() == OTHER_EXCEPTION) {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(
"Got expected exception when executing query: " + ex);
} else {
- Assert.fail("Got unexpected exception when executing query", ex);
+ fail("Got unexpected exception when executing query", ex);
}
}
}
@@ -1748,7 +1743,7 @@ public class SecurityTestUtil extends DistributedTestCase {
}
} catch (Exception e) {
if (!e.getClass().getSimpleName().endsWith(expectedResult)) {
- Assert.fail("Expected " + expectedResult + " but found "
+ fail("Expected " + expectedResult + " but found "
+ e.getClass().getSimpleName() + " in doSimplePut()", e);
} else {
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().fine(
@@ -1875,7 +1870,7 @@ public class SecurityTestUtil extends DistributedTestCase {
private static LogWriter getLogger() {
LogWriter logger = null;
- DistributedSystem dsys = getSystemStatic();
+ DistributedSystem dsys = DistributedTestCase.getSystemStatic();
if (dsys == null || !dsys.isConnected()) {
while ((dsys = InternalDistributedSystem.getAnyInstance()) != null
&& !dsys.isConnected()) {
@@ -1899,7 +1894,7 @@ public class SecurityTestUtil extends DistributedTestCase {
sys.disconnect();
cache = null;
}
- disconnectFromDS();
+ DistributedTestCase.disconnectFromDS();
}
public static void closeCache(Boolean keepAlive) {
@@ -1913,7 +1908,7 @@ public class SecurityTestUtil extends DistributedTestCase {
sys.disconnect();
cache = null;
}
- disconnectFromDS();
+ DistributedTestCase.disconnectFromDS();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a321ffd/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
index a1a4414..270d0a7 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
@@ -35,199 +35,139 @@ import org.junit.experimental.categories.Category;
* @since 5.5
*/
@Category(DistributedTest.class)
-public class ClientAuthorizationTwoDUnitTest extends
- ClientAuthorizationTestBase {
+public class ClientAuthorizationTwoDUnitTest extends ClientAuthorizationTestBase {
@Override
- public final void postSetUp() throws Exception {
- final Host host = Host.getHost(0);
- server1 = host.getVM(0);
- server2 = host.getVM(1);
- client1 = host.getVM(2);
- client2 = host.getVM(3);
-
- server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
- client1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
- SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
- }
-
- @Test
- public void testAllOpsWithFailover2() {
+ public final void postSetUpClientAuthorizationTestBase() throws Exception {
IgnoredException.addIgnoredException("Read timed out");
IgnoredException.addIgnoredException("Connection reset");
IgnoredException.addIgnoredException("SocketTimeoutException");
IgnoredException.addIgnoredException("ServerConnectivityException");
IgnoredException.addIgnoredException("Socket Closed");
+ }
+
+ @Override
+ public final void preTearDownClientAuthorizationTestBase() throws Exception {
+ // close the clients first
+ client1.invoke(() -> SecurityTestUtil.closeCache());
+ client2.invoke(() -> SecurityTestUtil.closeCache());
+ SecurityTestUtil.closeCache();
+ // then close the servers
+ server1.invoke(() -> SecurityTestUtil.closeCache());
+ server2.invoke(() -> SecurityTestUtil.closeCache());
+ }
- OperationWithAction[] allOps = {
- // Register interest in all keys using list
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 3,
- OpFlags.USE_LIST | OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 1,
- OpFlags.USE_LIST, 4),
+ @Test
+ public void testAllOpsWithFailover2() {
+ runOpsWithFailover(allOps(), "testAllOpsWithFailover2");
+ }
+
+ private OperationWithAction[] allOps() {
+ return new OperationWithAction[] {
+ // Register interest in all KEYS using list
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 3, OpFlags.USE_LIST | OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 1, OpFlags.USE_LIST, 4),
// UPDATE and test with GET
new OperationWithAction(OperationCode.PUT, 2),
- new OperationWithAction(OperationCode.GET, 1, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.GET, 1, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using list
- new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 1,
- OpFlags.USE_OLDCONN | OpFlags.USE_LIST, 4),
+ // Unregister interest in all KEYS using list
+ new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 1, OpFlags.USE_OLDCONN | OpFlags.USE_LIST, 4),
// UPDATE and test with GET for no updates
- new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN
- | OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.GET, 1, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.GET, 1, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
OperationWithAction.OPBLOCK_END,
- // Register interest in all keys using regular expression
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 3,
- OpFlags.USE_REGEX | OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 2,
- OpFlags.USE_REGEX, 4),
+ // Register interest in all KEYS using regular expression
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 3, OpFlags.USE_REGEX | OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 2, OpFlags.USE_REGEX, 4),
// UPDATE and test with GET
new OperationWithAction(OperationCode.PUT),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using regular expression
- new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2,
- OpFlags.USE_OLDCONN | OpFlags.USE_REGEX, 4),
+ // Unregister interest in all KEYS using regular expression
+ new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2, OpFlags.USE_OLDCONN | OpFlags.USE_REGEX, 4),
// UPDATE and test with GET for no updates
- new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN
- | OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
OperationWithAction.OPBLOCK_END,
- // Register interest in all keys using ALL_KEYS
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 3,
- OpFlags.USE_ALL_KEYS | OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.REGISTER_INTEREST, 2,
- OpFlags.USE_ALL_KEYS, 4),
+ // Register interest in all KEYS using ALL_KEYS
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 3, OpFlags.USE_ALL_KEYS | OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.REGISTER_INTEREST, 2, OpFlags.USE_ALL_KEYS, 4),
// UPDATE and test with GET
new OperationWithAction(OperationCode.PUT),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
- // Unregister interest in all keys using ALL_KEYS
- new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2,
- OpFlags.USE_OLDCONN | OpFlags.USE_ALL_KEYS, 4),
+ // Unregister interest in all KEYS using ALL_KEYS
+ new OperationWithAction(OperationCode.UNREGISTER_INTEREST, 2, OpFlags.USE_OLDCONN | OpFlags.USE_ALL_KEYS, 4),
// UPDATE and test with GET for no updates
- new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN
- | OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
- | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
OperationWithAction.OPBLOCK_END,
// Register CQ
new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 3,
- OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 3, OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_NEWVAL, 4),
// UPDATE and test with GET
new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
// Stop CQ
- new OperationWithAction(OperationCode.STOP_CQ, 3, OpFlags.USE_OLDCONN
- | OpFlags.CHECK_EXCEPTION, 4),
- new OperationWithAction(OperationCode.STOP_CQ, 1, OpFlags.USE_OLDCONN,
- 4),
+ new OperationWithAction(OperationCode.STOP_CQ, 3, OpFlags.USE_OLDCONN | OpFlags.CHECK_EXCEPTION, 4),
+ new OperationWithAction(OperationCode.STOP_CQ, 1, OpFlags.USE_OLDCONN, 4),
// UPDATE and test with GET for no updates
- new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN
- | OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_OLDCONN | OpFlags.CHECK_FAIL | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_OLDCONN | OpFlags.CHECK_FAIL | OpFlags.LOCAL_OP, 4),
// Restart the CQ
- new OperationWithAction(OperationCode.EXECUTE_CQ, 3, OpFlags.USE_NEWVAL
- | OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 3, OpFlags.USE_NEWVAL | OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
// UPDATE and test with GET
new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_OLDCONN | OpFlags.LOCAL_OP, 4),
// Close CQ
- new OperationWithAction(OperationCode.CLOSE_CQ, 3, OpFlags.USE_OLDCONN,
- 4),
- new OperationWithAction(OperationCode.CLOSE_CQ, 1, OpFlags.USE_OLDCONN,
- 4),
+ new OperationWithAction(OperationCode.CLOSE_CQ, 3, OpFlags.USE_OLDCONN, 4),
+ new OperationWithAction(OperationCode.CLOSE_CQ, 1, OpFlags.USE_OLDCONN, 4),
// UPDATE and test with GET for no updates
- new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN
- | OpFlags.USE_NEWVAL, 4),
- new OperationWithAction(OperationCode.EXECUTE_CQ, 1,
- OpFlags.USE_OLDCONN | OpFlags.CHECK_FAIL | OpFlags.LOCAL_OP, 4),
+ new OperationWithAction(OperationCode.PUT, 2, OpFlags.USE_OLDCONN | OpFlags.USE_NEWVAL, 4),
+ new OperationWithAction(OperationCode.EXECUTE_CQ, 1, OpFlags.USE_OLDCONN | OpFlags.CHECK_FAIL | OpFlags.LOCAL_OP, 4),
OperationWithAction.OPBLOCK_END,
// Do REGION_CLEAR and check with GET
- new OperationWithAction(OperationCode.REGION_CLEAR, 3,
- OpFlags.CHECK_NOTAUTHZ, 1),
+ new OperationWithAction(OperationCode.REGION_CLEAR, 3, OpFlags.CHECK_NOTAUTHZ, 1),
new OperationWithAction(OperationCode.REGION_CLEAR, 1, OpFlags.NONE, 1),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY
- | OpFlags.CHECK_FAIL, 8),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY | OpFlags.CHECK_FAIL, 8),
// Repopulate the region
new OperationWithAction(OperationCode.PUT),
OperationWithAction.OPBLOCK_END,
// Do REGION_CREATE and check with CREATE/GET
- new OperationWithAction(OperationCode.REGION_CREATE, 3,
- OpFlags.ENABLE_DRF | OpFlags.CHECK_NOTAUTHZ, 1),
- new OperationWithAction(OperationCode.REGION_CREATE, 1,
- OpFlags.ENABLE_DRF, 1),
- new OperationWithAction(OperationCode.PUT, 3, OpFlags.USE_OLDCONN
- | OpFlags.USE_SUBREGION | OpFlags.CHECK_NOTAUTHZ, 4),
- new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN
- | OpFlags.USE_SUBREGION, 4),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY
- | OpFlags.USE_SUBREGION, 4),
+ new OperationWithAction(OperationCode.REGION_CREATE, 3, OpFlags.ENABLE_DRF | OpFlags.CHECK_NOTAUTHZ, 1),
+ new OperationWithAction(OperationCode.REGION_CREATE, 1, OpFlags.ENABLE_DRF, 1),
+ new OperationWithAction(OperationCode.PUT, 3, OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION | OpFlags.CHECK_NOTAUTHZ, 4),
+ new OperationWithAction(OperationCode.PUT, 1, OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION, 4),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY | OpFlags.USE_SUBREGION, 4),
// Do REGION_DESTROY of the sub-region and check with GET
- new OperationWithAction(OperationCode.REGION_DESTROY, 3,
- OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION
- | OpFlags.NO_CREATE_SUBREGION | OpFlags.CHECK_NOTAUTHZ, 1),
- new OperationWithAction(OperationCode.REGION_DESTROY, 1,
- OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION
- | OpFlags.NO_CREATE_SUBREGION, 1),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN
- | OpFlags.USE_SUBREGION | OpFlags.CHECK_EXCEPTION, 4),
+ new OperationWithAction(OperationCode.REGION_DESTROY, 3, OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION | OpFlags.NO_CREATE_SUBREGION | OpFlags.CHECK_NOTAUTHZ, 1),
+ new OperationWithAction(OperationCode.REGION_DESTROY, 1, OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION | OpFlags.NO_CREATE_SUBREGION, 1),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.USE_OLDCONN | OpFlags.USE_SUBREGION | OpFlags.CHECK_EXCEPTION, 4),
// Do REGION_DESTROY of the region and check with GET
- new OperationWithAction(OperationCode.REGION_DESTROY, 3,
- OpFlags.CHECK_NOTAUTHZ, 1),
- new OperationWithAction(OperationCode.REGION_DESTROY, 1, OpFlags.NONE,
- 1),
- new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY
- | OpFlags.CHECK_EXCEPTION, 4),
+ new OperationWithAction(OperationCode.REGION_DESTROY, 3, OpFlags.CHECK_NOTAUTHZ, 1),
+ new OperationWithAction(OperationCode.REGION_DESTROY, 1, OpFlags.NONE, 1),
+ new OperationWithAction(OperationCode.GET, 2, OpFlags.CHECK_NOKEY | OpFlags.CHECK_EXCEPTION, 4),
// Skip failover for region destroy since it shall fail
// without restarting the server
OperationWithAction.OPBLOCK_NO_FAILOVER };
-
- runOpsWithFailover(allOps, "testAllOpsWithFailover2");
- }
-
- // End Region: Tests
-
- @Override
- public final void preTearDown() throws Exception {
- // close the clients first
- client1.invoke(() -> SecurityTestUtil.closeCache());
- client2.invoke(() -> SecurityTestUtil.closeCache());
- SecurityTestUtil.closeCache();
- // then close the servers
- server1.invoke(() -> SecurityTestUtil.closeCache());
- server2.invoke(() -> SecurityTestUtil.closeCache());
}
}