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/06/02 05:16:25 UTC
[5/7] incubator-geode git commit: Change AssertionFailedError to
AssertionError and general cleanup.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
index c53360d..ebd0b95 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
@@ -16,15 +16,8 @@
*/
package com.gemstone.gemfire.distributed;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
import static org.junit.Assert.*;
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -34,8 +27,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.SystemFailure;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
@@ -52,7 +45,6 @@ import com.gemstone.gemfire.distributed.internal.locks.RemoteThread;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.util.StopWatch;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
@@ -63,32 +55,24 @@ import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.experimental.categories.Category;
-
/**
* This class tests distributed ownership via the DistributedLockService api.
*/
@Category(DistributedTest.class)
public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
-
- protected static DistributedSystem dlstSystem;
+
+ private static DistributedSystem dlstSystem;
private static DistributedLockBlackboard blackboard;
- protected static Object monitor = new Object();
+ private static Object monitor = new Object();
private int hits = 0;
private int completes = 0;
private boolean done;
private boolean got;
-
- public DistributedLockServiceDUnitTest() {
- super();
- }
-
- /////////// Test lifecycle //////////
-
/**
* Returns a previously created (or new, if this is the first
* time this method is called in this VM) distributed system
@@ -141,8 +125,6 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
DLockService.dumpAllServices();
}
- ///////// Remote setup/teardown support
-
/**
* Connects a DistributedSystem, saves it in static variable "system"
*/
@@ -150,8 +132,6 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
dlstSystem = (new DistributedLockServiceDUnitTest()).getSystem();
}
- ///////// Public test methods
-
@Test
public void testBasic() {
String serviceName = getUniqueName();
@@ -286,6 +266,7 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
protected static volatile boolean stop_testFairness;
protected static volatile boolean[] done_testFairness = new boolean[16];
static { Arrays.fill(done_testFairness, true); }
+
@Test
public void testFairness() throws Exception {
final String serviceName = "testFairness_" + getUniqueName();
@@ -587,7 +568,7 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
logInfo("[testBasicGrantorRecovery] succeeded attempt " + attempt);
break; // success
}
- catch (AssertionFailedError e) {
+ catch (AssertionError e) {
logInfo("[testBasicGrantorRecovery] failed attempt " + attempt);
if (attempt == attempts-1) throw e;
}
@@ -1004,13 +985,13 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
service.lock(objName, -1, -1);
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.isHeldByCurrentThread(objName));
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
@Test
@@ -1049,22 +1030,22 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, -1));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, -1));
+ assertTrue(service.isHeldByCurrentThread(objName));
// recursion +1...
- Assert.assertTrue(service.lock(objName, -1, -1));
+ assertTrue(service.lock(objName, -1, -1));
// recursion -1...
service.unlock(objName);
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
@Test
@@ -1079,19 +1060,19 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// recursion +1...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// expire...
sleep(waitBeforeLockingMs);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// should fail...
try {
@@ -1101,31 +1082,31 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
}
// relock it...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock to verify no recursion...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName)); // throws failure!!
+ assertTrue(!service.isHeldByCurrentThread(objName)); // throws failure!!
// go thru again in different order...
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// expire...
sleep(waitBeforeLockingMs);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// relock it...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock to verify no recursion...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
@Test
@@ -1162,7 +1143,7 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
sleep(waitBeforeLockingMs);
if (waitBeforeLockingMs > leaseMs) {
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
LogWriterUtils.getLogWriter().fine("[testLeaseExpires] acquire lock that expired");
@@ -1172,7 +1153,7 @@ public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
public void run() {
resultHolder[0] = service.lock(objName, -1, -1);
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
});
thread.start();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigJUnitTest.java
index 543574a..d862392 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/SSLConfigJUnitTest.java
@@ -16,15 +16,12 @@
*/
package com.gemstone.gemfire.internal;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.*;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import junit.framework.AssertionFailedError;
-
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -34,7 +31,6 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Test that DistributionConfigImpl handles SSL options correctly.
- *
*/
@Category(IntegrationTest.class)
public class SSLConfigJUnitTest {
@@ -49,7 +45,6 @@ public class SSLConfigJUnitTest {
private static final Properties GATEWAY_SSL_PROPS_MAP = new Properties();
private static final Properties GATEWAY_PROPS_SUBSET_MAP = new Properties();
-
static {
SSL_PROPS_MAP.put("javax.net.ssl.keyStoreType", "jks");
@@ -104,8 +99,6 @@ public class SSLConfigJUnitTest {
}
- //----- test methods ------
-
@Test
public void testMCastPortWithSSL() throws Exception {
Properties props = new Properties( );
@@ -143,7 +136,7 @@ public class SSLConfigJUnitTest {
}
@Test
- public void testConfigCopyWithSSL( ) throws Exception {
+ public void testConfigCopyWithSSL() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
@@ -332,7 +325,6 @@ public class SSLConfigJUnitTest {
isEqual( config.getGatewaySSLRequireAuthentication(), gatewaySslRequireAuth );
}
-
@Test
public void testManagerConfig() throws Exception {
boolean sslenabled = false;
@@ -383,7 +375,6 @@ public class SSLConfigJUnitTest {
isEqual( config.getJmxManagerSSLRequireAuthentication(), jmxManagerSslRequireAuth );
}
-
@Test
public void testCacheServerConfig() throws Exception {
boolean sslenabled = false;
@@ -456,7 +447,6 @@ public class SSLConfigJUnitTest {
@Test
public void testCustomizedClusterSslConfig() throws Exception {
-
boolean sslenabled = true;
String sslprotocols = "SSLv1";
String sslciphers = "RSA_WITH_NOTHING";
@@ -622,7 +612,6 @@ public class SSLConfigJUnitTest {
clusterSSLProperties = config.getClusterSSLProperties();
isEqual( SSL_PROPS_MAP, clusterSSLProperties );
-
}
@Test
@@ -691,7 +680,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.SERVER_SSL_CIPHERS_NAME, cacheServerSslciphers);
gemFireProps.put(DistributionConfig.SERVER_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(cacheServerSslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforCS(false));
+ gemFireProps.putAll(getGfSecurityPropertiesForCS(false));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -734,7 +723,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME, gatewaySslciphers);
gemFireProps.put(DistributionConfig.GATEWAY_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(gatewaySslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforGateway(false));
+ gemFireProps.putAll(getGfSecurityPropertiesForGateway(false));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -752,7 +741,6 @@ public class SSLConfigJUnitTest {
isEqual( GATEWAY_SSL_PROPS_MAP.get("gateway-ssl-keystore-password"), config.getGatewaySSLKeyStorePassword());
isEqual( GATEWAY_SSL_PROPS_MAP.get("gateway-ssl-truststore"), config.getGatewaySSLTrustStore());
isEqual( GATEWAY_SSL_PROPS_MAP.get("gateway-ssl-truststore-password"),config.getGatewaySSLTrustStorePassword());
-
}
@Test
@@ -804,7 +792,6 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getJmxManagerSSLTrustStorePassword());
}
-
@Test
public void testPartialCustomizedCacheServerSslConfig() throws Exception {
boolean sslenabled = false;
@@ -828,7 +815,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.SERVER_SSL_CIPHERS_NAME, cacheServerSslciphers);
gemFireProps.put(DistributionConfig.SERVER_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(cacheServerSslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforCS(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForCS(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -877,7 +864,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME, gatewaySslciphers);
gemFireProps.put(DistributionConfig.GATEWAY_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(gatewaySslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforGateway(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForGateway(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -901,11 +888,10 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-keystore-password"), config.getGatewaySSLKeyStorePassword());
isEqual( GATEWAY_PROPS_SUBSET_MAP.get("gateway-ssl-truststore"), config.getGatewaySSLTrustStore());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getGatewaySSLTrustStorePassword());
-
}
@Test
- public void testP2pSSLPropsOverriden_ServerPropsNotOverriden(){
+ public void testP2pSSLPropsOverriden_ServerPropsNotOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
@@ -923,7 +909,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.CLUSTER_SSL_CIPHERS_NAME, sslciphers);
gemFireProps.put(DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(requireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforCS(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForCS(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -954,11 +940,10 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-keystore-password"), config.getServerSSLKeyStorePassword());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore"), config.getServerSSLTrustStore());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getServerSSLTrustStorePassword());
-
}
@Test
- public void testP2pSSLPropsOverriden_ServerPropsOverriden(){
+ public void testP2pSSLPropsOverriden_ServerPropsOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
@@ -981,7 +966,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.SERVER_SSL_CIPHERS_NAME, cacheServerSslciphers);
gemFireProps.put(DistributionConfig.SERVER_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(cacheServerSslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforCS(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForCS(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -1015,7 +1000,7 @@ public class SSLConfigJUnitTest {
}
@Test
- public void testClusterSSLPropsOverriden_GatewayPropsNotOverriden(){
+ public void testClusterSSLPropsOverriden_GatewayPropsNotOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
@@ -1033,7 +1018,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.CLUSTER_SSL_CIPHERS_NAME, sslciphers);
gemFireProps.put(DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(requireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforGateway(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForGateway(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -1064,11 +1049,10 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-keystore-password"), config.getGatewaySSLKeyStorePassword());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore"), config.getGatewaySSLTrustStore());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getGatewaySSLTrustStorePassword());
-
}
@Test
- public void testP2pSSLPropsOverriden_GatewayPropsOverriden(){
+ public void testP2pSSLPropsOverriden_GatewayPropsOverridden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
@@ -1091,7 +1075,7 @@ public class SSLConfigJUnitTest {
gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME, gatewayServerSslciphers);
gemFireProps.put(DistributionConfig.GATEWAY_SSL_REQUIRE_AUTHENTICATION_NAME, String.valueOf(gatewayServerSslRequireAuth));
- gemFireProps.putAll(getGfSecurityPropertiesforGateway(true));
+ gemFireProps.putAll(getGfSecurityPropertiesForGateway(true));
DistributionConfigImpl config = new DistributionConfigImpl( gemFireProps );
isEqual( config.getClusterSSLEnabled(), sslenabled );
@@ -1117,11 +1101,10 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-keystore-password"), config.getGatewaySSLKeyStorePassword());
isEqual( GATEWAY_PROPS_SUBSET_MAP.get("gateway-ssl-truststore"), config.getGatewaySSLTrustStore());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getGatewaySSLTrustStorePassword());
-
}
@Test
- public void testP2pSSLPropsOverriden_JMXPropsNotOverriden(){
+ public void testP2pSSLPropsOverriden_JMXPropsNotOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
@@ -1170,7 +1153,6 @@ public class SSLConfigJUnitTest {
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-keystore-password"), config.getJmxManagerSSLKeyStorePassword());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore"), config.getJmxManagerSSLTrustStore());
isEqual( CLUSTER_SSL_PROPS_MAP.get("cluster-ssl-truststore-password"),config.getJmxManagerSSLTrustStorePassword());
-
}
private static Properties getGfSecurityPropertiesSSL() {
@@ -1224,7 +1206,7 @@ public class SSLConfigJUnitTest {
return gfSecurityProps;
}
- private static Properties getGfSecurityPropertiesforCS(boolean partialCSSslConfigOverride) {
+ private static Properties getGfSecurityPropertiesForCS(boolean partialCSSslConfigOverride) {
Properties gfSecurityProps = new Properties();
Set<Entry<Object, Object>> entrySet = CLUSTER_SSL_PROPS_MAP.entrySet();
@@ -1245,7 +1227,7 @@ public class SSLConfigJUnitTest {
return gfSecurityProps;
}
- private static Properties getGfSecurityPropertiesforGateway(boolean partialGatewaySslConfigOverride) {
+ private static Properties getGfSecurityPropertiesForGateway(boolean partialGatewaySslConfigOverride) {
Properties gfSecurityProps = new Properties();
Set<Entry<Object, Object>> entrySet = CLUSTER_SSL_PROPS_MAP.entrySet();
@@ -1265,11 +1247,11 @@ public class SSLConfigJUnitTest {
return gfSecurityProps;
}
- public void isEqual( boolean a, boolean e ) throws AssertionFailedError {
- assertEquals( a, e );
+ private void isEqual(boolean a, boolean e) {
+ assertEquals(a,e );
}
- public void isEqual( Object a, Object e ) throws AssertionFailedError {
+ private void isEqual(Object a,Object e ) {
assertEquals( a, e );
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug34179TooManyFilesOpenJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug34179TooManyFilesOpenJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug34179TooManyFilesOpenJUnitTest.java
index 4eea76d..cbc5e4c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug34179TooManyFilesOpenJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug34179TooManyFilesOpenJUnitTest.java
@@ -14,25 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.util.Arrays;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
/**
* Disk region perf test for Persist only with Async writes and Buffer.
* Set Rolling oplog to true and setMaxOplogSize to 10240
@@ -43,25 +36,25 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* The disk properties will ensure that very many oplog files are created.
*
* This test is currently not being executed and is marked with an underscore
- *
*/
@Category(IntegrationTest.class)
-public class Bug34179TooManyFilesOpenJUnitTest extends DiskRegionTestingBase
-{
+public class Bug34179TooManyFilesOpenJUnitTest extends DiskRegionTestingBase {
- LogWriter log = null;
+ private static int ENTRY_SIZE = 1024;
+
+ private static int OP_COUNT = 100000;
- DiskRegionProperties diskProps = new DiskRegionProperties();
+ private LogWriter log = null;
+
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
+ @Override
+ protected final void postSetUp() throws Exception {
File file1 = new File("testingDirectory/" + getName()+ "1");
file1.mkdir();
file1.deleteOnExit();
- dirs = new File[1];
- dirs[0] = file1;
+ dirs = new File[1];
+ dirs[0] = file1;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(true);
@@ -75,43 +68,24 @@ public class Bug34179TooManyFilesOpenJUnitTest extends DiskRegionTestingBase
log = ds.getLogWriter();
}
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
-
- }
-
-
- private static int ENTRY_SIZE = 1024;
-
- private static int OP_COUNT = 100000;
-
/**
* currently not being executed for congo but after transition to JDK 1.5, this test should be executed.
- *
*/
- public void _testPopulate1kbwrites()
- {
- try {
- final byte[] value = new byte[ENTRY_SIZE];
- Arrays.fill(value, (byte)77);
- for (int i = 0; i < OP_COUNT; i++) {
- region.put(new Integer(i), value);
- }
- closeDown(); // closes disk file which will flush all buffers
- }
- catch (Exception ex) {
- fail("IOException occured due to " + ex);
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testPopulate1kbwrites() {
+ final byte[] value = new byte[ENTRY_SIZE];
+ Arrays.fill(value, (byte)77);
+ for (int i = 0; i < OP_COUNT; i++) {
+ region.put(new Integer(i), value);
}
-
+ closeDown(); // closes disk file which will flush all buffers
}
+
/**
* cleans all the directory of all the files present in them
- *
*/
- protected static void deleteFiles()
- {
+ protected static void deleteFiles() {
for (int i = 0; i < dirs.length; i++) {
File[] files = dirs[i].listFiles();
for (int j = 0; j < files.length; j++) {
@@ -120,11 +94,4 @@ public class Bug34179TooManyFilesOpenJUnitTest extends DiskRegionTestingBase
}
}
- @Test
- public void testDoNothing(){
- //dummy method to ensure at least one test is present in this file if the other tests are commented
- }
-
-
}// end of Bug34179TooManyFilesOpenJUnitTest
-
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
index bc33f3a..1506f96 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
@@ -16,43 +16,31 @@
*/
package com.gemstone.gemfire.internal.cache;
-import org.junit.After;
-import org.junit.Before;
+import static org.junit.Assert.*;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.StatisticsFactory;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.DirectoryHolder;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Unit testing for ComplexDiskRegion API's
- *
- *
- *
*/
@Category(IntegrationTest.class)
-public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
-{
+public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase {
- DiskRegionProperties diskProps = new DiskRegionProperties();
-
-
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
@Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
DiskStoreImpl.SET_IGNORE_PREALLOCATE = true;
}
- @After
- public void tearDown() throws Exception {
- super.tearDown();
+ @Override
+ protected final void postTearDown() throws Exception {
DiskStoreImpl.SET_IGNORE_PREALLOCATE = false;
}
@@ -63,8 +51,7 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
* The test will test that an oplog is correctly being added to be rolled
*/
@Test
- public void testAddToBeCompacted()
- {
+ public void testAddToBeCompacted() {
deleteFiles();
diskProps.setRolling(false);
diskProps.setAllowForceCompaction(true);
@@ -113,11 +100,9 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
oplog3.destroy();
closeDown();
deleteFiles();
-
}
/**
- *
* Test method for
* 'com.gemstone.gemfire.internal.cache.ComplexDiskRegion.removeFirstOplog(Oplog)'
*
@@ -125,8 +110,7 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
* the firs to be rolled).
*/
@Test
- public void testRemoveFirstOplog()
- {
+ public void testRemoveFirstOplog() {
deleteFiles();
diskProps.setRolling(false);
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
index 0cab6f9..aeef265 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
@@ -16,12 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-import junit.framework.Assert;
+import static org.junit.Assert.*;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -36,25 +32,9 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* A region operation is done on the same key that is about to be rolled or has
* just been rolled and the region operation is verified to have been correctly
* executed.
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
- DiskRegionTestingBase
-{
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
+public class ConcurrentFlushingAndRegionOperationsJUnitTest extends DiskRegionTestingBase {
protected boolean alreadyComeHere = false;
@@ -84,8 +64,8 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value2", region.get("Key"));
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", region.get("Key"));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -118,7 +98,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -320,7 +300,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
long newOplogOffset = id.getOffsetInOplog();
id.setOplogId(oldOplogId);
id.setOffsetInOplog(oldOplogOffset);
- Assert.assertEquals("Value1", ((LocalRegion)region).getDiskRegion()
+ assertEquals("Value1", ((LocalRegion)region).getDiskRegion()
.getNoBuffer(id));
id.setOplogId(newOplogId);
id.setOffsetInOplog(newOplogOffset);
@@ -336,7 +316,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
// region.getCache().getLogger().info("getting value2");
- Assert.assertEquals("Value2", region.get("Key"));
+ assertEquals("Value2", region.get("Key"));
}
catch (Exception e) {
logWriter.error("Exception occured", e);
@@ -346,7 +326,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -372,7 +352,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
index 4fb244a..cbc6784 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
@@ -14,20 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- *
- */
package com.gemstone.gemfire.internal.cache;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
import java.io.DataInput;
import java.io.DataOutput;
@@ -37,7 +26,9 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
-import junit.framework.AssertionFailedError;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.Delta;
import com.gemstone.gemfire.InvalidDeltaException;
@@ -54,29 +45,29 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.client.internal.DestroyOp;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
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.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* tests for the concurrentMapOperations. there are more tests in ClientServerMiscDUnitTest
- *
*/
@Category(DistributedTest.class)
public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
- protected static final String REP_REG_NAME = "repRegion";
- protected static final String PR_REG_NAME = "prRegion";
+ private static final String REP_REG_NAME = "repRegion";
+ private static final String PR_REG_NAME = "prRegion";
private static final int MAX_ENTRIES = 113;
enum OP {PUTIFABSENT, REPLACE, REMOVE}
@@ -101,11 +92,11 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
});
}
- protected Region createReplicateRegion() {
+ private Region createReplicateRegion() {
return getCache().createRegionFactory(RegionShortcut.REPLICATE).setConcurrencyChecksEnabled(true).create(REP_REG_NAME);
}
- protected Region createPartitionedRegion() {
+ private Region createPartitionedRegion() {
return getCache().createRegionFactory(RegionShortcut.PARTITION).setConcurrencyChecksEnabled(true).create(PR_REG_NAME);
}
@@ -173,8 +164,8 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
}
});
}
-
- static abstract class AbstractConcMapOpsListener implements CacheListener<Integer, String> {
+
+ private static abstract class AbstractConcMapOpsListener implements CacheListener<Integer, String> {
public void afterCreate(EntryEvent<Integer, String> event) {
validate(event);
}
@@ -201,15 +192,15 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
}
abstract void validate(EntryEvent event);
}
-
- static class NotInvokedListener extends AbstractConcMapOpsListener {
+
+ private static class NotInvokedListener extends AbstractConcMapOpsListener {
@Override
void validate(EntryEvent event) {
fail("should not be called. Event="+event);
}
}
- static class InitialCreatesListener extends AbstractConcMapOpsListener {
+ private static class InitialCreatesListener extends AbstractConcMapOpsListener {
AtomicInteger numCreates = new AtomicInteger();
@Override
void validate(EntryEvent event) {
@@ -219,12 +210,6 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
numCreates.incrementAndGet();
}
}
- /**
- * @param name
- */
- public ConcurrentMapOpsDUnitTest() {
- super();
- }
// test for bug #42164
@Test
@@ -397,7 +382,7 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
final Region r = getCache().getRegion(REP_REG_NAME);
final Region pr = getCache().getRegion(PR_REG_NAME);
WaitCriterion wc = new WaitCriterion() {
- AssertionFailedError e = null;
+ AssertionError e = null;
public boolean done() {
try {
if (!emptyClient) {
@@ -414,7 +399,7 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
assertNull(pr.putIfAbsent("keyForNull", null));
assertNull(r.putIfAbsent("clientNullKey", null));
assertNull(pr.putIfAbsent("clientNullKey", null));
- } catch (AssertionFailedError ex) {
+ } catch (AssertionError ex) {
r.getCache().getLoggerI18n().fine("SWAP:caught ", ex);
e = ex;
return false;
@@ -449,7 +434,7 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
final Region r = getCache().getRegion(REP_REG_NAME);
final Region pr = getCache().getRegion(PR_REG_NAME);
WaitCriterion wc = new WaitCriterion() {
- AssertionFailedError e = null;
+ AssertionError e = null;
public boolean done() {
try {
assertEquals("value2", r.putIfAbsent("key0", null));
@@ -463,7 +448,7 @@ public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
assertNull(r.replace("NoKeyOnServer", "value"));
assertTrue(r.replace("clientNullKey", null, "newValue"));
assertTrue(pr.replace("clientNullKey", null, "newValue"));
- } catch (AssertionFailedError ex) {
+ } catch (AssertionError ex) {
e = ex;
return false;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
index 754fb34..1e63ea1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
@@ -108,9 +108,7 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
private static int counter = 0;
@Before
- public void setUp() throws Exception
- {
- super.setUp();
+ protected final void postsetUp() throws Exception {
counter++;
if (longTest) {
TIME_TO_RUN = 10000;
@@ -122,12 +120,6 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
}
}
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
@Test
public void testPersistSyncConcurrency()
{
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
index 4a8210f..fa6c3f9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
@@ -16,31 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
-
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.EntryNotFoundException;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.CacheObserver;
-import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
-import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
-import com.gemstone.gemfire.internal.cache.DiskEntry;
-import com.gemstone.gemfire.internal.cache.DiskRegionHelperFactory;
-import com.gemstone.gemfire.internal.cache.DiskRegionProperties;
-import com.gemstone.gemfire.internal.cache.DiskRegionTestingBase;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.RegionEntry;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@@ -51,13 +38,9 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* A region operation is done on the same key that is about to be rolled or has
* just been rolled and the region operation is verified to have been correctly
* executed.
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConcurrentRollingAndRegionOperationsJUnitTest extends
- DiskRegionTestingBase
-{
+public class ConcurrentRollingAndRegionOperationsJUnitTest extends DiskRegionTestingBase {
protected volatile boolean hasBeenNotified;
@@ -65,12 +48,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
protected boolean encounteredFailure = false;
-
- @Before
- public void setUp() throws Exception
- {
+ @Override
+ protected final void preSetUp() throws Exception {
this.hasBeenNotified = false;
- super.setUp();
}
void putBeforeRoll(final Region region)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
index d7493de..238d641 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
@@ -34,7 +34,6 @@ import static org.junit.Assert.*;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
- *
* This test does a check that conflation in the buffer happen correctly
*
* Conflation cases tested include:
@@ -47,198 +46,164 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* <li> create, invalidate, modify
* </ul>
* The test is done for persist only, overflow only and persist + overflow only (async modes).
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConflationJUnitTest extends DiskRegionTestingBase
-{
+public class ConflationJUnitTest extends DiskRegionTestingBase {
+
private DiskRegionProperties diskProps = new DiskRegionProperties();
+ private long flushCount;
+
@Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
diskProps.setBytesThreshold(100000000);
diskProps.setTimeInterval(100000000);
diskProps.setSynchronous(false);
}
-
-
- protected void createOverflowOnly()
- {
- region = DiskRegionHelperFactory.getAsyncOverFlowOnlyRegion(cache,
- diskProps);
- }
-
- protected void createPersistOnly()
- {
+ private void createPersistOnly() {
region = DiskRegionHelperFactory
.getAsyncPersistOnlyRegion(cache, diskProps);
}
- protected void createOverflowAndPersist()
- {
+ private void createOverflowAndPersist() {
region = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache,
diskProps);
}
/**
* do a put followed by a put
- *
*/
- void putAndPut()
- {
+ private void putAndPut() {
region.put(new Integer(1), new Integer(1));
region.put(new Integer(1), new Integer(2));
}
/**
* do a put followed by a destroy on the same entry
- *
*/
- void putAndDestroy()
- {
+ private void putAndDestroy() {
region.put(new Integer(1), new Integer(1));
try {
region.destroy(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
+ logWriter.error("Exception occurred",e);
fail(" failed to destory Integer");
}
}
/**
* do a put destroy the same entry and put it again
- *
*/
- void putDestroyPut()
- {
+ private void putDestroyPut() {
putAndDestroy();
region.put(new Integer(1), new Integer(2));
}
/**
* put a key and then invalidate it
- *
*/
- void putAndInvalidate()
- {
+ private void putAndInvalidate() {
region.put(new Integer(1), new Integer(1));
try {
region.invalidate(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to invalidate Integer");
+ logWriter.error("Exception occurred",e);
+ throw new AssertionError(" failed to invalidate Integer", e);
}
}
/**
* put a key, invalidate it and the perform a put on it
- *
*/
- void putInvalidatePut()
- {
+ private void putInvalidatePut() {
putAndInvalidate();
region.put(new Integer(1), new Integer(2));
}
/**
* do a create and then a put on the same key
- *
*/
- void createAndPut()
- {
+ private void createAndPut() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred",e);
+ throw new AssertionError(" failed in trying to create", e);
}
region.put(new Integer(1), new Integer(2));
}
/**
* do a create and then a destroy
- *
*/
- void createAndDestroy()
- {
+ private void createAndDestroy() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
try {
region.destroy(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to destory Integer");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed to destroy Integer", e);
}
}
/**
* do a create then destroy the entry and create it again
- *
*/
- void createDestroyCreate()
- {
+ private void createDestroyCreate() {
createAndDestroy();
try {
region.create(new Integer(1), new Integer(2));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
}
/**
* create an entry and then invalidate it
- *
*/
- void createAndInvalidate()
- {
+ private void createAndInvalidate() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
try {
region.invalidate(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to invalidate Integer");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed to invalidate Integer", e);
}
}
/**
* create an entry, invalidate it and then perform a put on the same key
- *
*/
- void createInvalidatePut()
- {
+ private void createInvalidatePut() {
createAndInvalidate();
region.put(new Integer(1), new Integer(2));
}
/**
* validate whether a modification of an entry was correctly done
- *
*/
- void validateModification()
- {
+ private void validateModification() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is not so");
@@ -247,16 +212,14 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
DiskId id = ((DiskEntry)entry).getDiskId();
Object obj = ((LocalRegion)region).getDiskRegion().get(id);
if (!(obj.equals(new Integer(2)))) {
- fail(" incorrect modification");
+ fail("incorrect modification");
}
}
/**
* validate whether nothing was written
- */
-
- void validateNothingWritten()
- {
+ */
+ private void validateNothingWritten() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
//We actually will have a tombstone in the region, hence
//the 1 entry
@@ -264,19 +227,12 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
fail("expected size to be 1 but is " + entries.size());
}
assertEquals(this.flushCount, getCurrentFlushCount());
-// Oplog oplog = ((LocalRegion)region).getDiskRegion().getChild();
-// if (oplog.getOplogSize() != 0) {
-// fail(" expected zero bytes to have been written but is "
-// + oplog.getOplogSize());
-// }
}
/**
* validate whether invalidate was done
- *
*/
- void validateTombstone()
- {
+ private void validateTombstone() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is " + entries.size());
@@ -289,10 +245,8 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
/**
* validate whether invalidate was done
- *
*/
- void validateInvalidate()
- {
+ private void validateInvalidate() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is " + entries.size());
@@ -305,31 +259,26 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
}
}
- private long flushCount;
-
private long getCurrentFlushCount() {
return ((LocalRegion)region).getDiskStore().getStats().getFlushes();
}
- void pauseFlush() {
+
+ private void pauseFlush() {
((LocalRegion)region).getDiskRegion().pauseFlusherForTesting();
this.flushCount = getCurrentFlushCount();
}
/**
* force a flush on the region
- *
*/
- void forceFlush()
- {
+ private void forceFlush() {
((LocalRegion)region).getDiskRegion().flushForTesting();
}
/**
* all the operations done here
- *
*/
- void allTest()
- {
+ private void allTest() {
pauseFlush();
createAndPut();
forceFlush();
@@ -370,16 +319,13 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
forceFlush();
validateInvalidate();
region.clear();
-
}
/**
* test conflation for perist only
- *
*/
@Test
- public void testPersistOnlyConflation()
- {
+ public void testPersistOnlyConflation() throws Exception {
createPersistOnly();
allTest();
closeDown();
@@ -387,22 +333,11 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
/**
* test conflation for overflow and persist
- *
*/
@Test
- public void testOverFlowAndPersistOnlyConflation()
- {
- try {
- createOverflowAndPersist();
- allTest();
- closeDown();
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.toString());
- }
+ public void testOverFlowAndPersistOnlyConflation() throws Exception {
+ createOverflowAndPersist();
+ allTest();
+ closeDown();
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRandomOperationsAndRecoveryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRandomOperationsAndRecoveryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRandomOperationsAndRecoveryJUnitTest.java
index 93e8731..43fe7b0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRandomOperationsAndRecoveryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRandomOperationsAndRecoveryJUnitTest.java
@@ -38,39 +38,29 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-/**
- *
- *
- */
-@Category(IntegrationTest.class)
-public class DiskRandomOperationsAndRecoveryJUnitTest extends DiskRegionTestingBase
-{
- DiskRegionProperties diskProps = new DiskRegionProperties();
- private static int ENTRY_SIZE = 1024;
- final static byte[] valueBytes = new byte[ENTRY_SIZE];
+@
+ Category(IntegrationTest.class)
+public class DiskRandomOperationsAndRecoveryJUnitTest extends DiskRegionTestingBase {
+
+ private static final int ENTRY_SIZE = 1024;
+
+ private static final byte[] valueBytes = new byte[ENTRY_SIZE];
static {
Arrays.fill(valueBytes, (byte)32);
}
- final static private Object value = new String(valueBytes);
- // private static final boolean debug = false;
+ private static final Object value = new String(valueBytes);
- private static int testId=0;
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
+ private static int testId = 0;
+
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
+
+ @Override
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
testId++;
}
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
private final static int ITERATIONS = 4;
private final static long MAX_OPLOG_SIZE_IN_BYTES = 1024*16;
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCachexmlGeneratorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCachexmlGeneratorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCachexmlGeneratorJUnitTest.java
index c0f269f..47004a6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCachexmlGeneratorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCachexmlGeneratorJUnitTest.java
@@ -18,6 +18,7 @@ package com.gemstone.gemfire.internal.cache;
import java.io.File;
import java.io.FileWriter;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;
@@ -39,67 +40,41 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* This test is for testing Disk attributes set programmatically
* The generated cacheXml is used to create a cache and teh region
* properties retested.
- *
*/
@Category(IntegrationTest.class)
-public class DiskRegCachexmlGeneratorJUnitTest extends DiskRegionTestingBase
-{
- PrintWriter pw;
-
- DiskRegionProperties diskProps = new DiskRegionProperties();
-
- DiskRegionProperties diskProps1 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps2 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps3 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps4 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps5 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps6 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps7 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps8 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps9 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps10 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps11 = new DiskRegionProperties();
-
- DiskRegionProperties diskProps12 = new DiskRegionProperties();
-
- Region region1;
-
- Region region2;
-
- Region region3;
-
- Region region4;
-
- Region region5;
-
- Region region6;
-
- Region region7;
-
- Region region8;
-
- Region region9;
-
- Region region10;
-
- Region region11;
-
- Region region12;
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
+public class DiskRegCachexmlGeneratorJUnitTest extends DiskRegionTestingBase {
+
+ private PrintWriter pw;
+
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
+ private DiskRegionProperties diskProps1 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps2 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps3 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps4 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps5 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps6 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps7 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps8 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps9 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps10 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps11 = new DiskRegionProperties();
+ private DiskRegionProperties diskProps12 = new DiskRegionProperties();
+
+ private Region region1;
+ private Region region2;
+ private Region region3;
+ private Region region4;
+ private Region region5;
+ private Region region6;
+ private Region region7;
+ private Region region8;
+ private Region region9;
+ private Region region10;
+ private Region region11;
+ private Region region12;
+
+ @Override
+ protected final void postSetUp() throws Exception {
diskDirSize = new int[4];
diskDirSize[0] = Integer.MAX_VALUE;
diskDirSize[1] = Integer.MAX_VALUE;
@@ -119,15 +94,7 @@ public class DiskRegCachexmlGeneratorJUnitTest extends DiskRegionTestingBase
diskProps12.setDiskDirs(dirs);
}
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
-
- }
-
- public void createCacheXML()
- {
+ private void createCacheXML() throws IOException {
// create the region1 which is SyncPersistOnly and set DiskWriteAttibutes
diskProps1.setRolling(true);
diskProps1.setMaxOplogSize(1073741824L);
@@ -220,23 +187,14 @@ public class DiskRegCachexmlGeneratorJUnitTest extends DiskRegionTestingBase
region12 = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache,
diskProps12);
-
//cacheXmlGenerator: generates cacheXml file
- try {
- FileWriter fw = new FileWriter(new File("DiskRegCachexmlGeneratorJUnitTest.xml"));
- PrintWriter pw = new PrintWriter(fw);
- CacheXmlGenerator.generate(cache, pw);
- }
- catch (Exception ex) {
- logWriter.error("Exception occured",ex);
- fail("FAILED While cache xml generation");
- }
-
+ FileWriter fw = new FileWriter(new File("DiskRegCachexmlGeneratorJUnitTest.xml"));
+ PrintWriter pw = new PrintWriter(fw);
+ CacheXmlGenerator.generate(cache, pw);
}
@Test
- public void testVerifyCacheXml() throws Exception
- {
+ public void testVerifyCacheXml() throws Exception {
createCacheXML();
ds.disconnect();
// Connect to the GemFire distributed system
@@ -299,4 +257,3 @@ public class DiskRegCachexmlGeneratorJUnitTest extends DiskRegionTestingBase
}
}// end of DiskRegCachexmlGeneratorJUnitTest
-
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCbkChkJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCbkChkJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCbkChkJUnitTest.java
index 34d540d..75701e1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCbkChkJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegCbkChkJUnitTest.java
@@ -16,10 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -30,30 +28,16 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
- * * Tests if callbacks are getting invoked correctly
- * * for 'create', 'update' and 'destroy' of disk region entries
- * * with concurrent 'clear'
- * *
+ * Tests if callbacks are getting invoked correctly
+ * for 'create', 'update' and 'destroy' of disk region entries
+ * with concurrent 'clear'
*/
@Category(IntegrationTest.class)
-public class DiskRegCbkChkJUnitTest extends DiskRegionTestingBase
-{
+public class DiskRegCbkChkJUnitTest extends DiskRegionTestingBase {
- volatile static boolean intoCreateAfterCbk = false;
- volatile static boolean intoUpdateAfterCbk = false;
- volatile static boolean intoDestroyAfterCbk = false;
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
+ private static volatile boolean intoCreateAfterCbk = false;
+ private static volatile boolean intoUpdateAfterCbk = false;
+ private static volatile boolean intoDestroyAfterCbk = false;
private DiskRegionProperties getDiskRegionProperties(){
DiskRegionProperties diskProperties = new DiskRegionProperties();
@@ -64,8 +48,7 @@ public class DiskRegCbkChkJUnitTest extends DiskRegionTestingBase
}
@Test
- public void testAfterCallbacks()
- {
+ public void testAfterCallbacks() {
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
getDiskRegionProperties(), Scope.LOCAL);
@@ -112,6 +95,5 @@ public class DiskRegCbkChkJUnitTest extends DiskRegionTestingBase
region.create("key3", "createValue");
region.destroy("key3");
assertTrue("Destroy callback not called", intoDestroyAfterCbk);
-
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bb91dedc/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegOplogSwtchingAndRollerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegOplogSwtchingAndRollerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegOplogSwtchingAndRollerJUnitTest.java
index ba3af6a..99ab7e6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegOplogSwtchingAndRollerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegOplogSwtchingAndRollerJUnitTest.java
@@ -16,16 +16,11 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.File;
import java.util.Arrays;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -39,44 +34,31 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Miscellaneous disk tests
- *
- *
- *
*/
@Category(IntegrationTest.class)
-public class DiskRegOplogSwtchingAndRollerJUnitTest extends
- DiskRegionTestingBase
-{
+public class DiskRegOplogSwtchingAndRollerJUnitTest extends DiskRegionTestingBase {
- DiskRegionProperties diskProps = new DiskRegionProperties();
+ private static File[] dirs1 = null;
- protected boolean encounteredException = false;
+ private static int[] diskDirSize1 = null;
- protected volatile boolean hasBeenNotified = false;
+ private volatile boolean hasBeenNotified = false;
- protected static File[] dirs1 = null;
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
- protected static int[] diskDirSize1 = null;
+ private boolean encounteredException = false;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- }
+ private Object forWaitNotify = new Object();
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
+ private boolean gotNotification = false;
+
+ private Object getValOnDsk = null;
/**
- * tests non occurence of DiskAccessException
- *
+ * tests non occurrence of DiskAccessException
*/
@Test
- public void testSyncPersistRegionDAExp()
- {
+ public void testSyncPersistRegionDAExp() {
File testingDirectory1 = new File("testingDirectory1");
testingDirectory1.mkdir();
testingDirectory1.deleteOnExit();
@@ -114,8 +96,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}// end of testSyncPersistRegionDAExp
@Test
- public void testAsyncPersistRegionDAExp()
- {
+ public void testAsyncPersistRegionDAExp() {
File testingDirectory1 = new File("testingDirectory1");
testingDirectory1.mkdir();
testingDirectory1.deleteOnExit();
@@ -151,8 +132,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
}// end of testAsyncPersistRegionDAExp
- private void diskAccessExpHelpermethod(final Region region)
- {
+ private void diskAccessExpHelpermethod(final Region region) {
final byte[] value = new byte[990];
Arrays.fill(value, (byte)77);
try {
@@ -172,18 +152,11 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}
}
- protected Object forWaitNotify = new Object();
-
- protected boolean gotNotification = false;
-
/**
* DiskRegionRollingJUnitTest :
- *
- *
*/
@Test
- public void testSyncRollingHappening()
- {
+ public void testSyncRollingHappening() {
try {
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -235,8 +208,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}
@Test
- public void testSyncRollingNotHappening()
- {
+ public void testSyncRollingNotHappening() {
try {
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -277,8 +249,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}
@Test
- public void testAsyncRollingHappening()
- {
+ public void testAsyncRollingHappening() {
try {
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -334,8 +305,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}
@Test
- public void testAsyncRollingNotHappening()
- {
+ public void testAsyncRollingNotHappening() {
try {
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -374,8 +344,6 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
}
- protected Object getValOnDsk = null;
-
/**
* DiskRegOplog1OverridingOplog2JUnitTest: Disk Region test : oplog1 flush
* overriding oplog2 flush
@@ -383,11 +351,9 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
* This test will hold the flush of oplog1 and flush oplog2 before it. After
* that oplog1 is allowed to flush. A get of an entry which was first put in
* oplog1 and then in oplog2 should result in the get being done from oplog2.
- *
*/
@Test
- public void testOplog1FlushOverridingOplog2Flush()
- {
+ public void testOplog1FlushOverridingOplog2Flush() {
hasBeenNotified = false;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(true);
@@ -468,8 +434,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}// end of testOplog1FlushOverridingOplog2Flush
- class DoesFlush implements Runnable
- {
+ private class DoesFlush implements Runnable {
private Region region;
@@ -477,15 +442,14 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
this.region = region;
}
- public void run()
- {
+ @Override
+ public void run() {
((LocalRegion)region).getDiskRegion().flushForTesting();
synchronized (region) {
region.notify();
hasBeenNotified = true;
}
}
-
}
/**
@@ -493,8 +457,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
* the time rolling has started , the entry exists in the current oplog
*/
@Test
- public void testEntryExistsinCurrentOplog()
- {
+ public void testEntryExistsinCurrentOplog() {
hasBeenNotified = false;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(true);
@@ -585,11 +548,9 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
/**
* Entries deleted in current Oplog are recorded correctly during the rolling
* of that oplog
- *
*/
@Test
- public void testEntryDeletedinCurrentOplog()
- {
+ public void testEntryDeletedinCurrentOplog() {
hasBeenNotified = false;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(true);
@@ -690,28 +651,15 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
// region.close();
}// end of testEntryDeletedinCurrentOplog
-
- /**
- *
- * @param region
- * get LRU statistics
- */
- protected LRUStatistics getLRUStats(Region region)
- {
+ private LRUStatistics getLRUStats(Region region) {
return ((LocalRegion)region).getEvictionController().getLRUHelper()
.getStats();
}
/**
* to validate the get operation performed on a byte array.
- *
- * @param key
- * @param region
- * @return
*/
-
- private boolean getByteArrVal(Long key, Region region)
- {
+ private boolean getByteArrVal(Long key, Region region) {
Object val = null;
byte[] val2 = new byte[1024];
Arrays.fill(val2, (byte)77);
@@ -742,12 +690,10 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
* Roller should wait for asynch writer to terminate if asynch flush is going
* on , before deleting the oplog
*/
- protected boolean afterWritingBytes = false;
+ private boolean afterWritingBytes = false;
@Test
- public void testOplogRollerWaitingForAsyncWriter()
- {
-
+ public void testOplogRollerWaitingForAsyncWriter() {
hasBeenNotified = false;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(true);
@@ -838,8 +784,7 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
}// end of testOplogRollerWaitingForAsyncWriter
- class DoesFlush1 implements Runnable
- {
+ private class DoesFlush1 implements Runnable {
private Region region;
@@ -847,27 +792,22 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
this.region = region;
}
- public void run()
- {
+ @Override
+ public void run() {
((LocalRegion)region).getDiskRegion().flushForTesting();
synchronized (region) {
region.notify();
hasBeenNotified = true;
}
}
-
}
/**
* Task 125: Ensuring that retrieval of evicted entry data for rolling
* purposes is correct & does not cause any eviction sort of things
- *
- * @throws EntryNotFoundException
- *
*/
@Test
- public void testGetEvictedEntry() throws EntryNotFoundException
- {
+ public void testGetEvictedEntry() throws EntryNotFoundException {
hasBeenNotified = false;
diskProps.setDiskDirs(dirs);
diskProps.setPersistBackup(false);
@@ -969,10 +909,8 @@ public class DiskRegOplogSwtchingAndRollerJUnitTest extends
* DiskAccessException doesn't occur even when amount of put data exceeds the
* max dir sizes.
*/
-
@Test
- public void testDiskFullExcep()
- {
+ public void testDiskFullExcep() {
boolean exceptionOccured = false;
int[] diskDirSize1 = new int[4];
diskDirSize1[0] = 1048576;