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/02/09 19:44:24 UTC
[14/51] [partial] incubator-geode git commit: GEODE-773: Extract
static methods from DistributedTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java
index ccdf782..911454a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationDUnitTest.java
@@ -32,7 +32,10 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
import security.DummyCredentialGenerator;
@@ -81,7 +84,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
client1 = host.getVM(2);
client2 = host.getVM(3);
- addExpectedException("Connection refused: connect");
+ IgnoredException.addIgnoredException("Connection refused: connect");
server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
new Object[] { serverExpectedExceptions });
@@ -212,11 +215,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testValidCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testValidCredentials: Using authenticator: " + authenticator);
- getLogWriter().info("testValidCredentials: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info("testValidCredentials: Using authinit: " + authInit);
// Start the servers
Integer locPort1 = SecurityTestUtil.getLocatorPort();
@@ -234,12 +237,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start the clients with valid credentials
Properties credentials1 = gen.getValidCredentials(1);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testValidCredentials: For first client credentials: " + credentials1
+ " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(2);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testValidCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -278,11 +281,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info("testNoCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoCredentials: Using authenticator: " + authenticator);
- getLogWriter().info("testNoCredentials: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info("testNoCredentials: Using authinit: " + authInit);
// Start the servers
Integer locPort1 = SecurityTestUtil.getLocatorPort();
@@ -300,7 +303,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start first client with valid credentials
Properties credentials1 = gen.getValidCredentials(1);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoCredentials: For first client credentials: " + credentials1
+ " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -343,11 +346,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidCredentials: Using authenticator: " + authenticator);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info("testInvalidCredentials: Using authinit: " + authInit);
// Start the servers
@@ -366,7 +369,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start first client with valid credentials
Properties credentials1 = gen.getValidCredentials(1);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -382,7 +385,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// exception
Properties credentials2 = gen.getInvalidCredentials(1);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -401,9 +404,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties javaProps = gen.getJavaProperties();
String authenticator = gen.getAuthenticator();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthInit: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthInit: Using authenticator: " + authenticator);
// Start the server
@@ -416,7 +419,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties credentials = gen.getValidCredentials(1);
javaProps = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthInit: For first client credentials: " + credentials
+ " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -437,9 +440,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthInitWithCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthInitWithCredentials: Using authenticator: "
+ authenticator);
@@ -459,12 +462,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start the clients with valid credentials
Properties credentials1 = gen.getValidCredentials(1);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthInitWithCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(2);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthInitWithCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -495,9 +498,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties javaProps = gen.getJavaProperties();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthenticator: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthenticator: Using authinit: " + authInit);
// Start the server with invalid authenticator
@@ -511,7 +514,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Trying to create the region on client should throw a security exception
Properties credentials = gen.getValidCredentials(1);
javaProps = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthenticator: For first client credentials: "
+ credentials + " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -523,7 +526,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Also test with invalid credentials
credentials = gen.getInvalidCredentials(1);
javaProps = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAuthenticator: For first client credentials: "
+ credentials + " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -543,10 +546,10 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthenticatorWithCredentials: Using scheme: "
+ gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthenticatorWithCredentials: Using authinit: " + authInit);
// Start the servers with no authenticator
@@ -564,12 +567,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// valid/invalid credentials when none are required on the server side
Properties credentials1 = gen.getValidCredentials(3);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthenticatorWithCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getInvalidCredentials(5);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testNoAuthenticatorWithCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -599,11 +602,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: Using authinit: " + authInit);
// Start the first server
@@ -622,12 +625,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start the clients with valid credentials
Properties credentials1 = gen.getValidCredentials(5);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(6);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -680,7 +683,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Verify that the creation of region throws security exception
credentials1 = gen.getInvalidCredentials(7);
javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsWithFailover: For first client invalid credentials: "
+ credentials1 + " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -708,12 +711,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Using authenticator: "
+ authenticator);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Using authinit: " + authInit);
// Start the first server
@@ -732,12 +735,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Start the clients with valid credentials
Properties credentials1 = gen.getValidCredentials(3);
Properties javaProps1 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(4);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -768,7 +771,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
server1.invoke(SecurityTestUtil.class, "closeCache");
// Wait for failover to complete
- pause(500);
+ Wait.pause(500);
// Perform some create/update operations from client1
client1.invoke(SecurityTestUtil.class, "doNPuts",
@@ -803,7 +806,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Verify that the creation of region throws security exception
credentials2 = gen.getInvalidCredentials(3);
javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: For second client invalid credentials: "
+ credentials2 + " : " + javaProps2);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -843,7 +846,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) });
}
else {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Skipping invalid authenticator for scheme ["
+ gen.classCode() + "] which has no authInit");
}
@@ -874,7 +877,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) });
}
else {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Skipping null authInit for scheme ["
+ gen.classCode() + "] which has no authInit");
}
@@ -934,7 +937,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Object[] { new Integer(4) });
}
else {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testCredentialsForNotifications: Skipping scheme ["
+ gen.classCode() + "] which has no authenticator");
}
@@ -953,9 +956,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
//////////////////////////////////////////////////////////////////////////////
@Override
- public void tearDown2() throws Exception {
-
- super.tearDown2();
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(SecurityTestUtil.class, "closeCache");
client2.invoke(SecurityTestUtil.class, "closeCache");
@@ -963,5 +964,4 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
server1.invoke(SecurityTestUtil.class, "closeCache");
server2.invoke(SecurityTestUtil.class, "closeCache");
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
index c434a2a..2774e35 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
@@ -34,6 +34,8 @@ import security.XmlAuthzCredentialGenerator;
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
import templates.security.UserPasswordAuthInit;
@@ -111,7 +113,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
fail("executeRIOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeRIOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -159,7 +161,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
extraAuthzProps });
// Start the client with valid credentials but allowed or disallowed to
// perform an operation
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeRIOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
if (useThisVM) {
@@ -212,10 +214,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testAllowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -232,7 +234,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testAllowPutsGets: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -244,7 +246,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 2);
javaProps = cGen.getJavaProperties();
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"testAllowPutsGets: For second client credentials: "
+ getCredentials);
@@ -272,10 +274,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testDisallowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testDisallowPutsGets: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testDisallowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testDisallowPutsGets: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testDisallowPutsGets: Using accessor: " + accessor);
// Check that we indeed can obtain valid credentials not allowed to do
// gets
@@ -283,7 +285,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testDisallowPutsGets: For first client credentials: "
+ createCredentials);
Properties getCredentials = gen.getDisallowedCredentials(
@@ -291,7 +293,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new String[] { regionName }, 2);
Properties getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testDisallowPutsGets: For second client disallowed GET credentials: "
+ getCredentials);
@@ -328,7 +330,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 5);
getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testDisallowPutsGets: For second client with GET credentials: "
+ getCredentials);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -354,8 +356,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testInvalidAccessor: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testInvalidAccessor: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testInvalidAccessor: Using authenticator: " + authenticator);
// Start server1 with invalid accessor
@@ -372,14 +374,14 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 3);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAccessor: For first client CREATE credentials: "
+ createCredentials);
Properties getCredentials = gen.getAllowedCredentials(
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 7);
Properties getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testInvalidAccessor: For second client GET credentials: "
+ getCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -396,7 +398,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new Integer(1), new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) });
// Now start server2 that has valid accessor
- getLogWriter().info("testInvalidAccessor: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testInvalidAccessor: Using accessor: " + accessor);
serverProps = buildProperties(authenticator, accessor, false,
extraAuthProps, extraAuthzProps);
server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
@@ -431,11 +433,11 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: Using accessor: " + accessor);
// Start servers with all required properties
@@ -454,7 +456,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -466,7 +468,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 5);
Properties getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: For second client credentials: "
+ getCredentials);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -499,7 +501,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new String[] { regionName }, 9);
getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testPutsGetsWithFailover: For second client disallowed GET credentials: "
+ noGetCredentials);
@@ -624,10 +626,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllOpsWithFailover: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testAllOpsWithFailover: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testAllOpsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info("testAllOpsWithFailover: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testAllOpsWithFailover: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -679,7 +681,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
public void testAllOpsWithFailover() {
- addExpectedException("Read timed out");
+ IgnoredException.addIgnoredException("Read timed out");
OperationWithAction[] allOps = {
// Test CREATE and verify with a GET
@@ -783,9 +785,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
// End Region: Tests
@Override
- public void tearDown2() throws Exception {
-
- super.tearDown2();
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(SecurityTestUtil.class, "closeCache");
client2.invoke(SecurityTestUtil.class, "closeCache");
@@ -794,5 +794,4 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
server1.invoke(SecurityTestUtil.class, "closeCache");
server2.invoke(SecurityTestUtil.class, "closeCache");
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
index 4796203..665867f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
@@ -59,8 +59,12 @@ import com.gemstone.gemfire.internal.AvailablePort.Keeper;
import com.gemstone.gemfire.internal.cache.AbstractRegionEntry;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.util.Callable;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import security.DummyCredentialGenerator;
import security.XmlAuthzCredentialGenerator;
@@ -263,7 +267,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
policy = InterestResultPolicy.NONE;
}
final int numOps = indices.length;
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got doOp for op: " + op.toString() + ", numOps: " + numOps
+ ", indices: " + indicesToString(indices) + ", expect: " + expectedResult);
boolean exceptionOccured = false;
@@ -303,7 +307,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
// server
if ((flags & OpFlags.CHECK_NOKEY) > 0) {
AbstractRegionEntry entry = (AbstractRegionEntry)((LocalRegion)region).getRegionEntry(searchKey);
- getLogWriter().info(""+keyNum+": key is " + searchKey + " and entry is " + entry);
+ LogWriterUtils.getLogWriter().info(""+keyNum+": key is " + searchKey + " and entry is " + entry);
assertFalse(region.containsKey(searchKey));
}
else {
@@ -561,7 +565,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 3 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 3 * 1000, 200, true);
if ((flags & OpFlags.CHECK_FAIL) > 0) {
assertEquals(0, listener.getNumUpdates());
}
@@ -644,7 +648,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
}
catch (RegionDestroyedException ex) {
// harmless to ignore this
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"doOp: sub-region " + region.getFullPath()
+ " already destroyed");
operationOmitted = true;
@@ -671,20 +675,20 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
|| ex instanceof QueryInvocationTargetException || ex instanceof CqException)
&& (expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"doOp: Got expected NotAuthorizedException when doing operation ["
+ op + "] with flags " + OpFlags.description(flags)
+ ": " + ex.getCause());
continue;
}
else if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"doOp: Got expected exception when doing operation: "
+ ex.toString());
continue;
}
else {
- fail("doOp: Got unexpected exception when doing operation. Policy = "
+ Assert.fail("doOp: Got unexpected exception when doing operation. Policy = "
+ policy + " flags = " + OpFlags.description(flags), ex);
}
}
@@ -724,7 +728,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
fail("executeOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -760,7 +764,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
extraAuthzProps });
// Start the client with valid credentials but allowed or disallowed to
// perform an operation
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
boolean setupDynamicRegionFactory = (opFlags & OpFlags.ENABLE_DRF) > 0;
@@ -844,9 +848,9 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
String accessor = gen.getAuthorizationCallback();
TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(gen);
- getLogWriter().info(testName + ": Using authinit: " + authInit);
- getLogWriter().info(testName + ": Using authenticator: " + authenticator);
- getLogWriter().info(testName + ": Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info(testName + ": Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(testName + ": Using authenticator: " + authenticator);
+ LogWriterUtils.getLogWriter().info(testName + ": Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
index 9120a1f..f175d98 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
@@ -35,6 +35,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.execute.PRClientServerTestBase;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
@@ -75,10 +76,10 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testOps1: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testOps1: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testOps1: Using authenticator: " + authenticator);
- getLogWriter().info("testOps1: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testOps1: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -149,21 +150,21 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
gen.getDisallowedCredentials(new OperationCode[] {client1OpCodes[1]},
new String[] {regionName}, 1)};
if (client1Credentials[0] == null || client1Credentials[0].size() == 0) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with "
+ client1OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
if (client1Credentials[1] == null || client1Credentials[1].size() == 0) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with no "
+ client1OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: For first client credentials: " + client1Credentials[0]
+ "\n" + client1Credentials[1]);
client1.invoke(SecurityTestUtil.class, "createCacheClientForMultiUserMode",
@@ -178,21 +179,21 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
gen.getDisallowedCredentials(client2OpCodes,
new String[] {regionName}, 9)};
if (client2Credentials[0] == null || client2Credentials[0].size() == 0) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with "
+ client2OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
if (client2Credentials[1] == null || client2Credentials[1].size() == 0) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with no "
+ client2OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps1: For second client credentials: " + client2Credentials[0]
+ "\n" + client2Credentials[1]);
if (bothClientsInMultiuserMode) {
@@ -354,9 +355,9 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testOps2: Using authinit: " + authInit);
- getLogWriter().info("testOps2: Using authenticator: " + authenticator);
- getLogWriter().info("testOps2: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testOps2: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info("testOps2: Using authenticator: " + authenticator);
+ LogWriterUtils.getLogWriter().info("testOps2: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -383,7 +384,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
};
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps2: For first client credentials: " + client1Credentials[0]
+ "\n" + client1Credentials[1]);
client1.invoke(SecurityTestUtil.class,
@@ -400,7 +401,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
new String[] {regionName}, 9)};
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testOps2: For second client credentials: " + client2Credentials[0]
+ "\n" + client2Credentials[1]);
client2.invoke(SecurityTestUtil.class,
@@ -484,10 +485,10 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testOpsWithClientsInDifferentModes: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testOpsWithClientsInDifferentModes: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testOpsWithClientsInDifferentModes: Using authenticator: " + authenticator);
- getLogWriter().info("testOpsWithClientsInDifferentModes: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testOpsWithClientsInDifferentModes: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -521,9 +522,8 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
// End Region: Tests
- public void tearDown2() throws Exception {
-
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(SecurityTestUtil.class, "closeCache");
client2.invoke(SecurityTestUtil.class, "closeCache");
@@ -532,5 +532,4 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
server1.invoke(SecurityTestUtil.class, "closeCache");
server2.invoke(SecurityTestUtil.class, "closeCache");
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
index 42fe897..2b44631 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
@@ -32,7 +32,9 @@ import com.gemstone.gemfire.cache.client.NoAvailableServersException;
import com.gemstone.gemfire.cache.client.ServerConnectivityException;
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
import com.gemstone.gemfire.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
/**
* @since 6.1
@@ -113,8 +115,8 @@ public class DeltaClientAuthorizationDUnitTest extends
SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(SecurityTestUtil.class, "closeCache");
client2.invoke(SecurityTestUtil.class, "closeCache");
@@ -134,10 +136,10 @@ public class DeltaClientAuthorizationDUnitTest extends
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
+ LogWriterUtils.getLogWriter().info(
"testAllowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
+ LogWriterUtils.getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -154,7 +156,7 @@ public class DeltaClientAuthorizationDUnitTest extends
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testAllowPutsGets: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -166,7 +168,7 @@ public class DeltaClientAuthorizationDUnitTest extends
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 2);
javaProps = cGen.getJavaProperties();
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"testAllowPutsGets: For second client credentials: "
+ getCredentials);
@@ -196,10 +198,10 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing puts: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- fail("Got unexpected exception when doing puts", ex);
+ Assert.fail("Got unexpected exception when doing puts", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
@@ -214,50 +216,50 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (NoAvailableServersException ex) {
if (expectedResult.intValue() == SecurityTestUtil.NO_AVAILABLE_SERVERS) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected NoAvailableServers when doing puts: "
+ ex.getCause());
continue;
}
else {
- fail("Got unexpected exception when doing puts", ex);
+ Assert.fail("Got unexpected exception when doing puts", ex);
}
}
catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected NotAuthorizedException when doing puts: "
+ ex.getCause());
continue;
}
if ((expectedResult.intValue() == SecurityTestUtil.AUTHREQ_EXCEPTION)
&& (ex.getCause() instanceof AuthenticationRequiredException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected AuthenticationRequiredException when doing puts: "
+ ex.getCause());
continue;
}
if ((expectedResult.intValue() == SecurityTestUtil.AUTHFAIL_EXCEPTION)
&& (ex.getCause() instanceof AuthenticationFailedException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected AuthenticationFailedException when doing puts: "
+ ex.getCause());
continue;
}
else if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing puts: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- fail("Got unexpected exception when doing puts", ex);
+ Assert.fail("Got unexpected exception when doing puts", ex);
}
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing puts: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
- fail("Got unexpected exception when doing puts", ex);
+ Assert.fail("Got unexpected exception when doing puts", ex);
}
}
}
@@ -274,10 +276,10 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing gets: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- fail("Got unexpected exception when doing gets", ex);
+ Assert.fail("Got unexpected exception when doing gets", ex);
}
}
for (int index = 0; index < num.intValue(); ++index) {
@@ -295,36 +297,36 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch(NoAvailableServersException ex) {
if(expectedResult.intValue() == SecurityTestUtil.NO_AVAILABLE_SERVERS) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected NoAvailableServers when doing puts: "
+ ex.getCause());
continue;
}
else {
- fail("Got unexpected exception when doing puts", ex);
+ Assert.fail("Got unexpected exception when doing puts", ex);
}
}
catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got expected NotAuthorizedException when doing gets: "
+ ex.getCause());
continue;
}
else if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing gets: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- fail("Got unexpected exception when doing gets", ex);
+ Assert.fail("Got unexpected exception when doing gets", ex);
}
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing gets: " + ex);
+ LogWriterUtils.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
- fail("Got unexpected exception when doing gets", ex);
+ Assert.fail("Got unexpected exception when doing gets", ex);
}
}
assertNotNull(value);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
index 94b603e..fe3cec6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
@@ -40,7 +40,10 @@ import com.gemstone.gemfire.cache.query.CqException;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.util.Callable;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -74,9 +77,8 @@ public class DeltaClientPostAuthorizationDUnitTest extends
SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
}
- public void tearDown2() throws Exception {
-
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(SecurityTestUtil.class, "closeCache");
client2.invoke(SecurityTestUtil.class, "closeCache");
@@ -87,8 +89,8 @@ public class DeltaClientPostAuthorizationDUnitTest extends
}
public void testPutPostOpNotifications() throws Exception {
- addExpectedException("Unexpected IOException");
- addExpectedException("SocketException");
+ IgnoredException.addIgnoredException("Unexpected IOException");
+ IgnoredException.addIgnoredException("SocketException");
OperationWithAction[] allOps = {
// Test CREATE and verify with a GET
@@ -134,11 +136,11 @@ public class DeltaClientPostAuthorizationDUnitTest extends
String accessor = gen.getAuthorizationCallback();
TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(gen);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testAllOpsNotifications: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testAllOpsNotifications: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"testAllOpsNotifications: Using accessor: " + accessor);
// Start servers with all required properties
@@ -217,7 +219,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
fail("executeOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -253,7 +255,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
extraAuthzProps });
// Start the client with valid credentials but allowed or disallowed to
// perform an operation
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"executeOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
boolean setupDynamicRegionFactory = (opFlags & OpFlags.ENABLE_DRF) > 0;
@@ -374,7 +376,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
policy = InterestResultPolicy.NONE;
}
final int numOps = indices.length;
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Got doOp for op: " + op.toString() + ", numOps: " + numOps
+ ", indices: " + indicesToString(indices) + ", expect: " + expectedResult);
boolean exceptionOccured = false;
@@ -512,20 +514,20 @@ public class DeltaClientPostAuthorizationDUnitTest extends
|| ex instanceof QueryInvocationTargetException || ex instanceof CqException)
&& (expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"doOp: Got expected NotAuthorizedException when doing operation ["
+ op + "] with flags " + OpFlags.description(flags)
+ ": " + ex.getCause());
continue;
}
else if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"doOp: Got expected exception when doing operation: "
+ ex.toString());
continue;
}
else {
- fail("doOp: Got unexpected exception when doing operation. Policy = "
+ Assert.fail("doOp: Got unexpected exception when doing operation. Policy = "
+ policy + " flags = " + OpFlags.description(flags), ex);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
index 5ba7044..07bd7c7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
@@ -40,7 +40,11 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManage
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* Tests peer to peer authentication in Gemfire
@@ -94,7 +98,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "26753");
props.setProperty(DistributionConfig.LOCATORS_NAME,
- DistributedTestCase.getIPLiteral() + "[" + port + "]");
+ NetworkUtils.getIPLiteral() + "[" + port + "]");
props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
"templates.security.UserPasswordAuthInit.create");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -111,7 +115,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "26753");
props.setProperty(DistributionConfig.LOCATORS_NAME,
- DistributedTestCase.getIPLiteral() +"[" + port + "]");
+ NetworkUtils.getIPLiteral() +"[" + port + "]");
props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
"templates.security.LdapUserAuthenticator.create");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -162,7 +166,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
}
String authInit = " Incorrect_AuthInitialize";
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() + "[" + port + "]";
+ final String locators = NetworkUtils.getIPLiteral() + "[" + port + "]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -173,7 +177,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions});
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, null);
@@ -200,7 +204,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props = new Properties();
}
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -211,7 +215,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions });
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, javaProps);
@@ -240,7 +244,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props = new Properties();
}
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -251,7 +255,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions });
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, null);
@@ -278,7 +282,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props = new Properties();
}
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -306,7 +310,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
throws Exception {
disconnectAllFromDS();
- addExpectedException("Authentication failed");
+ IgnoredException.addIgnoredException("Authentication failed");
CredentialGenerator gen = new DummyCredentialGenerator();
Properties props = gen.getSystemProperties();
@@ -316,7 +320,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props = new Properties();
}
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -336,7 +340,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
javaProps = gen.getJavaProperties();
props.putAll(credentials);
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, javaProps);
@@ -398,7 +402,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
// Start the locator with the LDAP authenticator
Properties props = new Properties();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
authInit);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
@@ -446,7 +450,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props, javaProps });
// wait for view propagation
- pause(2000);
+ Wait.pause(2000);
// Verify the number of members on all peers and locator
locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
new Object[] { new Integer(4) });
@@ -458,7 +462,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
// Disconnect the first peer and check again
disconnectFromDS();
- pause(2000);
+ Wait.pause(2000);
locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
new Object[] { new Integer(3) });
peer2.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
@@ -468,7 +472,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
// Disconnect the second peer and check again
peer2.invoke(DistributedTestCase.class, "disconnectFromDS");
- pause(2000);
+ Wait.pause(2000);
locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
new Object[] { new Integer(2) });
peer3.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
@@ -476,7 +480,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
// Same for last peer
peer3.invoke(DistributedTestCase.class, "disconnectFromDS");
- pause(2000);
+ Wait.pause(2000);
locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
new Object[] { new Integer(1) });
@@ -512,7 +516,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
// Start the locator with the Dummy authenticator
Properties props = new Properties();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String locators = DistributedTestCase.getIPLiteral() +"["+port+"]";
+ final String locators = NetworkUtils.getIPLiteral() +"["+port+"]";
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
authInit);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
@@ -548,7 +552,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props.putAll(credentials);
props.putAll(extraProps);
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(
new String[] { IllegalArgumentException.class.getName() }, dsLogger);
try {
@@ -580,7 +584,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props, javaProps });
// wait for view propagation
- pause(2000);
+ Wait.pause(2000);
// Verify the number of members on all peers and locator
locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
new Object[] { new Integer(4) });