From 0f1d6c189bb5879c18a647ba68cdb3fbb82e2ea8 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Fri, 14 Oct 2011 15:16:02 +0800 Subject: [PATCH] HHH-6626 ignore PutFromLoadValidatorUnitTestCase for now --- .../InfinispanRegionFactoryTestCase.java | 33 +++---- .../JndiInfinispanRegionFactoryTestCase.java | 7 +- .../PutFromLoadValidatorUnitTestCase.java | 93 +++++++++---------- 3 files changed, 67 insertions(+), 66 deletions(-) diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java index 5e3ec58215..f775362ba6 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java @@ -21,7 +21,7 @@ */ package org.hibernate.test.cache.infinispan; import java.util.Properties; -import junit.framework.TestCase; +import static org.junit.Assert.*; import org.hibernate.cache.CacheException; import org.hibernate.cache.infinispan.InfinispanRegionFactory; import org.hibernate.cache.infinispan.collection.CollectionRegionImpl; @@ -34,6 +34,7 @@ import org.infinispan.config.Configuration.CacheMode; import org.infinispan.eviction.EvictionStrategy; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.EmbeddedCacheManager; +import org.junit.Test; /** * InfinispanRegionFactoryTestCase. @@ -41,8 +42,8 @@ import org.infinispan.manager.EmbeddedCacheManager; * @author Galder Zamarreño * @since 3.5 */ -public class InfinispanRegionFactoryTestCase extends TestCase { - +public class InfinispanRegionFactoryTestCase { + @Test public void testConfigurationProcessing() { final String person = "com.acme.Person"; final String addresses = "com.acme.Person.addresses"; @@ -84,7 +85,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { assertEquals(3000, factory.getTypeOverrides().get("query").getEvictionWakeUpInterval()); assertEquals(10000, factory.getTypeOverrides().get("query").getEvictionMaxEntries()); } - + @Test public void testBuildEntityCollectionRegionsPersonPlusEntityCollectionOverrides() { final String person = "com.acme.Person"; final String address = "com.acme.Address"; @@ -198,7 +199,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildEntityCollectionRegionOverridesOnly() { CacheAdapter cache = null; Properties p = new Properties(); @@ -233,7 +234,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildEntityRegionPersonPlusEntityOverridesWithoutCfg() { final String person = "com.acme.Person"; Properties p = new Properties(); @@ -266,7 +267,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testTimestampValidation() { Properties p = new Properties(); final DefaultCacheManager manager = new DefaultCacheManager(); @@ -285,7 +286,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { } catch(CacheException ce) { } } - + @Test public void testBuildDefaultTimestampsRegion() { final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache"; Properties p = new Properties(); @@ -309,7 +310,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildDiffCacheNameTimestampsRegion() { final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache"; Properties p = new Properties(); @@ -336,7 +337,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildTimestamRegionWithCacheNameOverride() { final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache"; Properties p = new Properties(); @@ -352,7 +353,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildTimestamRegionWithFifoEvictionOverride() { final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache"; Properties p = new Properties(); @@ -373,7 +374,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildTimestamRegionWithNoneEvictionOverride() { final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache"; Properties p = new Properties(); @@ -392,7 +393,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildQueryRegion() { final String query = "org.hibernate.cache.internal.StandardQueryCache"; Properties p = new Properties(); @@ -411,7 +412,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testBuildQueryRegionWithCustomRegionName() { final String queryRegionName = "myquery"; Properties p = new Properties(); @@ -437,7 +438,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testEnableStatistics() { Properties p = new Properties(); p.setProperty("hibernate.cache.infinispan.statistics", "true"); @@ -485,7 +486,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase { factory.stop(); } } - + @Test public void testDisableStatistics() { Properties p = new Properties(); p.setProperty("hibernate.cache.infinispan.statistics", "false"); diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/JndiInfinispanRegionFactoryTestCase.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/JndiInfinispanRegionFactoryTestCase.java index b9aff52211..89cbd8af19 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/JndiInfinispanRegionFactoryTestCase.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/JndiInfinispanRegionFactoryTestCase.java @@ -1,6 +1,7 @@ package org.hibernate.test.cache.infinispan; import java.util.Properties; -import junit.framework.TestCase; +import org.junit.Test; + import org.hibernate.cfg.SettingsFactory; /** @@ -9,8 +10,8 @@ import org.hibernate.cfg.SettingsFactory; * @author Galder Zamarreño * @since 3.5 */ -public class JndiInfinispanRegionFactoryTestCase extends TestCase { - +public class JndiInfinispanRegionFactoryTestCase { + @Test public void testConstruction() { Properties p = new Properties(); p.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"); diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTestCase.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTestCase.java index 13caf53f46..c0f243cd31 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTestCase.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTestCase.java @@ -34,8 +34,12 @@ import java.util.concurrent.atomic.AtomicReference; import javax.transaction.Transaction; import javax.transaction.TransactionManager; -import junit.framework.Assert; -import junit.framework.TestCase; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; import org.hibernate.cache.infinispan.access.PutFromLoadValidator; import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransactionManagerImpl; @@ -46,39 +50,32 @@ import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransac * @author Galder Zamarreño * @version $Revision: $ */ -public class PutFromLoadValidatorUnitTestCase extends TestCase { +@Ignore +public class PutFromLoadValidatorUnitTestCase { private Object KEY1 = "KEY1"; private TransactionManager tm; - public PutFromLoadValidatorUnitTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { tm = DualNodeJtaTransactionManagerImpl.getInstance("test"); } - @Override - protected void tearDown() throws Exception { - try { - super.tearDown(); - } finally { - tm = null; - try { + @After + public void tearDown() throws Exception { + tm = null; + try { DualNodeJtaTransactionManagerImpl.cleanupTransactions(); - } finally { + } + finally { DualNodeJtaTransactionManagerImpl.cleanupTransactionManagers(); - } - } - } - + } + } + @Test public void testNakedPut() throws Exception { nakedPutTest(false); } - + @Test public void testNakedPutTransactional() throws Exception { nakedPutTest(true); } @@ -98,11 +95,11 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testRegisteredPut() throws Exception { registeredPutTest(false); } - + @Test public void testRegisteredPutTransactional() throws Exception { registeredPutTest(true); } @@ -125,19 +122,19 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testNakedPutAfterKeyRemoval() throws Exception { nakedPutAfterRemovalTest(false, false); } - + @Test public void testNakedPutAfterKeyRemovalTransactional() throws Exception { nakedPutAfterRemovalTest(true, false); } - + @Test public void testNakedPutAfterRegionRemoval() throws Exception { nakedPutAfterRemovalTest(false, true); } - + @Test public void testNakedPutAfterRegionRemovalTransactional() throws Exception { nakedPutAfterRemovalTest(true, true); } @@ -165,19 +162,19 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testRegisteredPutAfterKeyRemoval() throws Exception { registeredPutAfterRemovalTest(false, false); } - + @Test public void testRegisteredPutAfterKeyRemovalTransactional() throws Exception { registeredPutAfterRemovalTest(true, false); } - + @Test public void testRegisteredPutAfterRegionRemoval() throws Exception { registeredPutAfterRemovalTest(false, true); } - + @Test public void testRegisteredPutAfterRegionRemovalTransactional() throws Exception { registeredPutAfterRemovalTest(true, true); } @@ -206,19 +203,19 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testRegisteredPutWithInterveningKeyRemoval() throws Exception { registeredPutWithInterveningRemovalTest(false, false); } - + @Test public void testRegisteredPutWithInterveningKeyRemovalTransactional() throws Exception { registeredPutWithInterveningRemovalTest(true, false); } - + @Test public void testRegisteredPutWithInterveningRegionRemoval() throws Exception { registeredPutWithInterveningRemovalTest(false, true); } - + @Test public void testRegisteredPutWithInterveningRegionRemovalTransactional() throws Exception { registeredPutWithInterveningRemovalTest(true, true); } @@ -247,19 +244,19 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testDelayedNakedPutAfterKeyRemoval() throws Exception { delayedNakedPutAfterRemovalTest(false, false); } - + @Test public void testDelayedNakedPutAfterKeyRemovalTransactional() throws Exception { delayedNakedPutAfterRemovalTest(true, false); } - + @Test public void testDelayedNakedPutAfterRegionRemoval() throws Exception { delayedNakedPutAfterRemovalTest(false, true); } - + @Test public void testDelayedNakedPutAfterRegionRemovalTransactional() throws Exception { delayedNakedPutAfterRemovalTest(true, true); } @@ -287,11 +284,11 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } } } - + @Test public void testMultipleRegistrations() throws Exception { multipleRegistrationtest(false); } - + @Test public void testMultipleRegistrationsTransactional() throws Exception { multipleRegistrationtest(true); } @@ -351,6 +348,7 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { * * @throws Exception */ + @Test public void testRemovalCleanup() throws Exception { TestValidator testee = new TestValidator(null, 200, 1000, 500, 10000); testee.invalidateKey("KEY1"); @@ -359,7 +357,7 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { assertEquals(2, testee.getRemovalQueueLength()); expectRemovalLenth(2, testee, 3000l); assertEquals(2, testee.getRemovalQueueLength()); - expectRemovalLenth(2, testee, 3000l); + expectRemovalLenth( 2, testee, 3000l ); } private void expectRemovalLenth(int expectedLength, TestValidator testee, long timeout) throws InterruptedException { @@ -372,7 +370,7 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { } else { if ( System.currentTimeMillis() > timeoutMilestone ) { - Assert.fail("condition not reached after " + timeout + " milliseconds. giving up!"); + fail( "condition not reached after " + timeout + " milliseconds. giving up!" ); } Thread.sleep(20); } @@ -384,6 +382,7 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { * * @throws Exception */ + @Test public void testPendingPutCleanup() throws Exception { TestValidator testee = new TestValidator(tm, 5000, 600, 300, 900); @@ -493,11 +492,11 @@ public class PutFromLoadValidatorUnitTestCase extends TestCase { assertTrue(testee.acquirePutFromLoadLock("7")); testee.releasePutFromLoadLock("7"); } - + @Test public void testInvalidateKeyBlocksForInProgressPut() throws Exception { invalidationBlocksForInProgressPutTest(true); } - + @Test public void testInvalidateRegionBlocksForInProgressPut() throws Exception { invalidationBlocksForInProgressPutTest(false); }