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/02 21:21:21 UTC
[14/44] incubator-geode git commit: Refactor dunit
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/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 6a0a7d7..aa8ed58 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
@@ -33,7 +33,9 @@ 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.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
import security.DummyCredentialGenerator;
@@ -82,7 +84,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
client1 = host.getVM(2);
client2 = host.getVM(3);
- IgnoredException.addExpectedException("Connection refused: connect");
+ IgnoredException.addIgnoredException("Connection refused: connect");
server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
new Object[] { serverExpectedExceptions });
@@ -213,11 +215,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testValidCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testValidCredentials: Using authenticator: " + authenticator);
- getLogWriter().info("testValidCredentials: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info("testValidCredentials: Using authinit: " + authInit);
// Start the servers
Integer locPort1 = SecurityTestUtil.getLocatorPort();
@@ -235,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(
+ LogWriterSupport.getLogWriter().info(
"testValidCredentials: For first client credentials: " + credentials1
+ " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(2);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testValidCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -279,11 +281,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info("testNoCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoCredentials: Using authenticator: " + authenticator);
- getLogWriter().info("testNoCredentials: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info("testNoCredentials: Using authinit: " + authInit);
// Start the servers
Integer locPort1 = SecurityTestUtil.getLocatorPort();
@@ -301,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(
+ LogWriterSupport.getLogWriter().info(
"testNoCredentials: For first client credentials: " + credentials1
+ " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -344,11 +346,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidCredentials: Using authenticator: " + authenticator);
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info("testInvalidCredentials: Using authinit: " + authInit);
// Start the servers
@@ -367,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(
+ LogWriterSupport.getLogWriter().info(
"testInvalidCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -383,7 +385,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// exception
Properties credentials2 = gen.getInvalidCredentials(1);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -402,9 +404,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties javaProps = gen.getJavaProperties();
String authenticator = gen.getAuthenticator();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthInit: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthInit: Using authenticator: " + authenticator);
// Start the server
@@ -417,7 +419,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties credentials = gen.getValidCredentials(1);
javaProps = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthInit: For first client credentials: " + credentials
+ " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -438,9 +440,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthInitWithCredentials: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthInitWithCredentials: Using authenticator: "
+ authenticator);
@@ -460,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(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthInitWithCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(2);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthInitWithCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -496,9 +498,9 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
Properties javaProps = gen.getJavaProperties();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthenticator: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthenticator: Using authinit: " + authInit);
// Start the server with invalid authenticator
@@ -512,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(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthenticator: For first client credentials: "
+ credentials + " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -524,7 +526,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
// Also test with invalid credentials
credentials = gen.getInvalidCredentials(1);
javaProps = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAuthenticator: For first client credentials: "
+ credentials + " : " + javaProps);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -544,10 +546,10 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthenticatorWithCredentials: Using scheme: "
+ gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthenticatorWithCredentials: Using authinit: " + authInit);
// Start the servers with no authenticator
@@ -565,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(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthenticatorWithCredentials: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getInvalidCredentials(5);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testNoAuthenticatorWithCredentials: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -600,11 +602,11 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: Using authinit: " + authInit);
// Start the first server
@@ -623,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(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(6);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -681,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(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsWithFailover: For first client invalid credentials: "
+ credentials1 + " : " + javaProps1);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -709,12 +711,12 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
String authenticator = gen.getAuthenticator();
String authInit = gen.getAuthInit();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Using scheme: " + gen.classCode());
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Using authenticator: "
+ authenticator);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Using authinit: " + authInit);
// Start the first server
@@ -733,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(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: For first client credentials: "
+ credentials1 + " : " + javaProps1);
Properties credentials2 = gen.getValidCredentials(4);
Properties javaProps2 = gen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: For second client credentials: "
+ credentials2 + " : " + javaProps2);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -769,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",
@@ -804,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(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: For second client invalid credentials: "
+ credentials2 + " : " + javaProps2);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -844,7 +846,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) });
}
else {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Skipping invalid authenticator for scheme ["
+ gen.classCode() + "] which has no authInit");
}
@@ -875,7 +877,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Integer(SecurityTestUtil.AUTHREQ_EXCEPTION) });
}
else {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Skipping null authInit for scheme ["
+ gen.classCode() + "] which has no authInit");
}
@@ -935,7 +937,7 @@ public class ClientAuthenticationDUnitTest extends DistributedTestCase {
new Object[] { new Integer(4) });
}
else {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testCredentialsForNotifications: Skipping scheme ["
+ gen.classCode() + "] which has no authenticator");
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/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 608170f..9b764ea 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
@@ -35,6 +35,7 @@ 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.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
import templates.security.UserPasswordAuthInit;
@@ -112,7 +113,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
fail("executeRIOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"executeRIOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -160,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(
+ LogWriterSupport.getLogWriter().info(
"executeRIOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
if (useThisVM) {
@@ -213,10 +214,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testAllowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
+ LogWriterSupport.getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -233,7 +234,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testAllowPutsGets: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -245,7 +246,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 2);
javaProps = cGen.getJavaProperties();
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info(
"testAllowPutsGets: For second client credentials: "
+ getCredentials);
@@ -273,10 +274,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testDisallowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info("testDisallowPutsGets: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testDisallowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testDisallowPutsGets: Using accessor: " + accessor);
+ LogWriterSupport.getLogWriter().info("testDisallowPutsGets: Using accessor: " + accessor);
// Check that we indeed can obtain valid credentials not allowed to do
// gets
@@ -284,7 +285,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testDisallowPutsGets: For first client credentials: "
+ createCredentials);
Properties getCredentials = gen.getDisallowedCredentials(
@@ -292,7 +293,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new String[] { regionName }, 2);
Properties getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testDisallowPutsGets: For second client disallowed GET credentials: "
+ getCredentials);
@@ -329,7 +330,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 5);
getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testDisallowPutsGets: For second client with GET credentials: "
+ getCredentials);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -355,8 +356,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testInvalidAccessor: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info("testInvalidAccessor: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testInvalidAccessor: Using authenticator: " + authenticator);
// Start server1 with invalid accessor
@@ -373,14 +374,14 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 3);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info(
"testInvalidAccessor: For second client GET credentials: "
+ getCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -397,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);
+ LogWriterSupport.getLogWriter().info("testInvalidAccessor: Using accessor: " + accessor);
serverProps = buildProperties(authenticator, accessor, false,
extraAuthProps, extraAuthzProps);
server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
@@ -432,11 +433,11 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: Using accessor: " + accessor);
// Start servers with all required properties
@@ -455,7 +456,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
Properties createJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -467,7 +468,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 5);
Properties getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: For second client credentials: "
+ getCredentials);
client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -500,7 +501,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
new String[] { regionName }, 9);
getJavaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testPutsGetsWithFailover: For second client disallowed GET credentials: "
+ noGetCredentials);
@@ -625,10 +626,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllOpsWithFailover: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info("testAllOpsWithFailover: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testAllOpsWithFailover: Using authenticator: " + authenticator);
- getLogWriter().info("testAllOpsWithFailover: Using accessor: " + accessor);
+ LogWriterSupport.getLogWriter().info("testAllOpsWithFailover: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -680,7 +681,7 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
public void testAllOpsWithFailover() {
- IgnoredException.addExpectedException("Read timed out");
+ IgnoredException.addIgnoredException("Read timed out");
OperationWithAction[] allOps = {
// Test CREATE and verify with a GET
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/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 51e11b1..d664dd5 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
@@ -61,7 +61,10 @@ 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.LogWriterSupport;
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;
@@ -264,7 +267,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
policy = InterestResultPolicy.NONE;
}
final int numOps = indices.length;
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got doOp for op: " + op.toString() + ", numOps: " + numOps
+ ", indices: " + indicesToString(indices) + ", expect: " + expectedResult);
boolean exceptionOccured = false;
@@ -304,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);
+ LogWriterSupport.getLogWriter().info(""+keyNum+": key is " + searchKey + " and entry is " + entry);
assertFalse(region.containsKey(searchKey));
}
else {
@@ -562,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());
}
@@ -645,7 +648,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
}
catch (RegionDestroyedException ex) {
// harmless to ignore this
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"doOp: sub-region " + region.getFullPath()
+ " already destroyed");
operationOmitted = true;
@@ -672,14 +675,14 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
|| ex instanceof QueryInvocationTargetException || ex instanceof CqException)
&& (expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info(
"doOp: Got expected exception when doing operation: "
+ ex.toString());
continue;
@@ -725,7 +728,7 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
fail("executeOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"executeOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -761,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(
+ LogWriterSupport.getLogWriter().info(
"executeOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
boolean setupDynamicRegionFactory = (opFlags & OpFlags.ENABLE_DRF) > 0;
@@ -845,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);
+ LogWriterSupport.getLogWriter().info(testName + ": Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(testName + ": Using authenticator: " + authenticator);
+ LogWriterSupport.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/76e324b5/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..5c3f7a6 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.LogWriterSupport;
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(
+ LogWriterSupport.getLogWriter().info("testOps1: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testOps1: Using authenticator: " + authenticator);
- getLogWriter().info("testOps1: Using accessor: " + accessor);
+ LogWriterSupport.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(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with no "
+ client1OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.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(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info(
"testOps1: Unable to obtain valid credentials with no "
+ client2OpCodes[0].toString()
+ " permission; skipping this combination.");
return false;
}
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.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);
+ LogWriterSupport.getLogWriter().info("testOps2: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info("testOps2: Using authenticator: " + authenticator);
+ LogWriterSupport.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(
+ LogWriterSupport.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(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info("testOpsWithClientsInDifferentModes: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testOpsWithClientsInDifferentModes: Using authenticator: " + authenticator);
- getLogWriter().info("testOpsWithClientsInDifferentModes: Using accessor: " + accessor);
+ LogWriterSupport.getLogWriter().info("testOpsWithClientsInDifferentModes: 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/76e324b5/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 1630379..a2a08bd 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
@@ -34,6 +34,7 @@ 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.LogWriterSupport;
/**
* @since 6.1
@@ -135,10 +136,10 @@ public class DeltaClientAuthorizationDUnitTest extends
String authInit = cGen.getAuthInit();
String accessor = gen.getAuthorizationCallback();
- getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info("testAllowPutsGets: Using authinit: " + authInit);
+ LogWriterSupport.getLogWriter().info(
"testAllowPutsGets: Using authenticator: " + authenticator);
- getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
+ LogWriterSupport.getLogWriter().info("testAllowPutsGets: Using accessor: " + accessor);
// Start servers with all required properties
Properties serverProps = buildProperties(authenticator, accessor, false,
@@ -155,7 +156,7 @@ public class DeltaClientAuthorizationDUnitTest extends
new OperationCode[] { OperationCode.PUT },
new String[] { regionName }, 1);
javaProps = cGen.getJavaProperties();
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testAllowPutsGets: For first client credentials: "
+ createCredentials);
client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
@@ -167,7 +168,7 @@ public class DeltaClientAuthorizationDUnitTest extends
new OperationCode[] { OperationCode.GET },
new String[] { regionName }, 2);
javaProps = cGen.getJavaProperties();
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info(
"testAllowPutsGets: For second client credentials: "
+ getCredentials);
@@ -197,7 +198,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing puts: " + ex);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing puts", ex);
@@ -215,7 +216,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (NoAvailableServersException ex) {
if (expectedResult.intValue() == SecurityTestUtil.NO_AVAILABLE_SERVERS) {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got expected NoAvailableServers when doing puts: "
+ ex.getCause());
continue;
@@ -227,27 +228,27 @@ public class DeltaClientAuthorizationDUnitTest extends
catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got expected NotAuthorizedException when doing puts: "
+ ex.getCause());
continue;
}
if ((expectedResult.intValue() == SecurityTestUtil.AUTHREQ_EXCEPTION)
&& (ex.getCause() instanceof AuthenticationRequiredException)) {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got expected AuthenticationRequiredException when doing puts: "
+ ex.getCause());
continue;
}
if ((expectedResult.intValue() == SecurityTestUtil.AUTHFAIL_EXCEPTION)
&& (ex.getCause() instanceof AuthenticationFailedException)) {
- getLogWriter().info(
+ LogWriterSupport.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);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing puts", ex);
@@ -255,7 +256,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing puts: " + ex);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing puts: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing puts", ex);
@@ -275,7 +276,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing gets: " + ex);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing gets", ex);
@@ -296,7 +297,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch(NoAvailableServersException ex) {
if(expectedResult.intValue() == SecurityTestUtil.NO_AVAILABLE_SERVERS) {
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got expected NoAvailableServers when doing puts: "
+ ex.getCause());
continue;
@@ -308,13 +309,13 @@ public class DeltaClientAuthorizationDUnitTest extends
catch (ServerConnectivityException ex) {
if ((expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterSupport.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);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing gets", ex);
@@ -322,7 +323,7 @@ public class DeltaClientAuthorizationDUnitTest extends
}
catch (Exception ex) {
if (expectedResult.intValue() == SecurityTestUtil.OTHER_EXCEPTION) {
- getLogWriter().info("Got expected exception when doing gets: " + ex);
+ LogWriterSupport.getLogWriter().info("Got expected exception when doing gets: " + ex);
}
else {
Assert.fail("Got unexpected exception when doing gets", ex);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/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 23a900b..a37ccda 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
@@ -43,6 +43,7 @@ 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.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -89,8 +90,8 @@ public class DeltaClientPostAuthorizationDUnitTest extends
}
public void testPutPostOpNotifications() throws Exception {
- IgnoredException.addExpectedException("Unexpected IOException");
- IgnoredException.addExpectedException("SocketException");
+ IgnoredException.addIgnoredException("Unexpected IOException");
+ IgnoredException.addIgnoredException("SocketException");
OperationWithAction[] allOps = {
// Test CREATE and verify with a GET
@@ -136,11 +137,11 @@ public class DeltaClientPostAuthorizationDUnitTest extends
String accessor = gen.getAuthorizationCallback();
TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(gen);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testAllOpsNotifications: Using authinit: " + authInit);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testAllOpsNotifications: Using authenticator: " + authenticator);
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"testAllOpsNotifications: Using accessor: " + accessor);
// Start servers with all required properties
@@ -219,7 +220,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
fail("executeOpBlock: Unknown client number " + clientNum);
break;
}
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"executeOpBlock: performing operation number ["
+ currentOp.getOpNum() + "]: " + currentOp);
if ((opFlags & OpFlags.USE_OLDCONN) == 0) {
@@ -255,7 +256,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
extraAuthzProps });
// Start the client with valid credentials but allowed or disallowed to
// perform an operation
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"executeOpBlock: For client" + clientNum + credentialsTypeStr
+ " credentials: " + opCredentials);
boolean setupDynamicRegionFactory = (opFlags & OpFlags.ENABLE_DRF) > 0;
@@ -376,7 +377,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends
policy = InterestResultPolicy.NONE;
}
final int numOps = indices.length;
- getLogWriter().info(
+ LogWriterSupport.getLogWriter().info(
"Got doOp for op: " + op.toString() + ", numOps: " + numOps
+ ", indices: " + indicesToString(indices) + ", expect: " + expectedResult);
boolean exceptionOccured = false;
@@ -514,14 +515,14 @@ public class DeltaClientPostAuthorizationDUnitTest extends
|| ex instanceof QueryInvocationTargetException || ex instanceof CqException)
&& (expectedResult.intValue() == SecurityTestUtil.NOTAUTHZ_EXCEPTION)
&& (ex.getCause() instanceof NotAuthorizedException)) {
- getLogWriter().info(
+ LogWriterSupport.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(
+ LogWriterSupport.getLogWriter().info(
"doOp: Got expected exception when doing operation: "
+ ex.toString());
continue;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/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 e585177..e8dea76 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
@@ -41,7 +41,10 @@ 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.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* Tests peer to peer authentication in Gemfire
@@ -95,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 + "]");
+ NetworkSupport.getIPLiteral() + "[" + port + "]");
props.setProperty(DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
"templates.security.UserPasswordAuthInit.create");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -112,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 + "]");
+ NetworkSupport.getIPLiteral() +"[" + port + "]");
props.setProperty(DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
"templates.security.LdapUserAuthenticator.create");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -163,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 = NetworkSupport.getIPLiteral() + "[" + port + "]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -174,7 +177,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions});
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterSupport.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, null);
@@ -201,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -212,7 +215,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions });
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterSupport.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, javaProps);
@@ -241,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -252,7 +255,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
getUniqueName(), new Integer(port), props, javaProps,
expectedExceptions });
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterSupport.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, null);
@@ -279,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -307,7 +310,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
throws Exception {
disconnectAllFromDS();
- IgnoredException.addExpectedException("Authentication failed");
+ IgnoredException.addIgnoredException("Authentication failed");
CredentialGenerator gen = new DummyCredentialGenerator();
Properties props = gen.getSystemProperties();
@@ -317,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
@@ -337,7 +340,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
javaProps = gen.getJavaProperties();
props.putAll(credentials);
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterSupport.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
try {
new SecurityTestUtil("tmp").createSystem(props, javaProps);
@@ -399,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
authInit);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
@@ -447,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) });
@@ -459,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",
@@ -469,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",
@@ -477,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) });
@@ -513,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 = NetworkSupport.getIPLiteral() +"["+port+"]";
setProperty(props, DistributionConfig.SECURITY_PEER_AUTH_INIT_NAME,
authInit);
setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
@@ -549,7 +552,7 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
props.putAll(credentials);
props.putAll(extraProps);
- LogWriter dsLogger = createLogWriter(props);
+ LogWriter dsLogger = LogWriterSupport.createLogWriter(props);
SecurityTestUtil.addExpectedExceptions(
new String[] { IllegalArgumentException.class.getName() }, dsLogger);
try {
@@ -581,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) });