[infinispan-commits] Infinispan SVN: r1275 - in trunk: core/src/test/java/org/infinispan/expiry and 1 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Thu Dec 10 08:12:18 EST 2009
Author: manik.surtani at jboss.com
Date: 2009-12-10 08:12:18 -0500 (Thu, 10 Dec 2009)
New Revision: 1275
Modified:
trunk/core/src/main/java/org/infinispan/container/entries/InternalEntryFactory.java
trunk/core/src/test/java/org/infinispan/expiry/ReplicatedExpiryTest.java
trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java
Log:
Fixed regressions
Modified: trunk/core/src/main/java/org/infinispan/container/entries/InternalEntryFactory.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/container/entries/InternalEntryFactory.java 2009-12-10 12:42:56 UTC (rev 1274)
+++ trunk/core/src/main/java/org/infinispan/container/entries/InternalEntryFactory.java 2009-12-10 13:12:18 UTC (rev 1275)
@@ -61,7 +61,7 @@
if (lifespan > -1 && maxIdle < 0) {
if (recordLastUsed) {
- return new TransientMortalCacheEntry(key, value, lifespan, -1);
+ return new TransientMortalCacheEntry(key, value, -1, lifespan);
} else {
return new MortalCacheEntry(key, value, lifespan);
}
@@ -69,14 +69,14 @@
if (lifespan < 0 && maxIdle > -1) {
if (recordCreation) {
- return new TransientMortalCacheEntry(key, value, -1, maxIdle);
+ return new TransientMortalCacheEntry(key, value, maxIdle, -1);
} else {
return new TransientCacheEntry(key, value, maxIdle);
}
}
// else...
- return new TransientMortalCacheEntry(key, value, lifespan, maxIdle);
+ return new TransientMortalCacheEntry(key, value, maxIdle, lifespan);
}
/**
Modified: trunk/core/src/test/java/org/infinispan/expiry/ReplicatedExpiryTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/expiry/ReplicatedExpiryTest.java 2009-12-10 12:42:56 UTC (rev 1274)
+++ trunk/core/src/test/java/org/infinispan/expiry/ReplicatedExpiryTest.java 2009-12-10 13:12:18 UTC (rev 1275)
@@ -51,7 +51,7 @@
c1.put("k", "v", lifespan, MILLISECONDS, idle, MILLISECONDS);
InternalCacheEntry ice = c2.getAdvancedCache().getDataContainer().get("k");
assert ice instanceof TransientMortalCacheEntry;
- assert ice.getLifespan() == lifespan;
- assert ice.getMaxIdle() == idle;
+ assert ice.getLifespan() == lifespan : "Expected " + lifespan + " but was " + ice.getLifespan();
+ assert ice.getMaxIdle() == idle : "Expected " + idle + " but was " + ice.getMaxIdle();
}
}
Modified: trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java
===================================================================
--- trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java 2009-12-10 12:42:56 UTC (rev 1274)
+++ trunk/query/src/test/java/org/infinispan/query/backend/QueryHelperTest.java 2009-12-10 13:12:18 UTC (rev 1275)
@@ -2,11 +2,18 @@
import org.infinispan.Cache;
import org.infinispan.CacheException;
+import org.infinispan.config.Configuration;
+import org.infinispan.manager.CacheManager;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.query.test.Person;
+import org.infinispan.test.TestingUtil;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import java.util.LinkedList;
+import java.util.List;
+
/**
* Test class for the {@link org.infinispan.query.backend.QueryHelper}
*
@@ -14,44 +21,57 @@
* @since 4.0
*/
- at Test (groups = "functional")
+ at Test(groups = "unit")
public class QueryHelperTest {
+ Configuration cfg;
+ List<CacheManager> cacheManagers;
@BeforeMethod
- public void setUp(){
- System.setProperty("infinispan.query.enabled", "true");
- System.setProperty("infinispan.query.indexLocalOnly", "true");
+ public void setUp() {
+ cfg = new Configuration();
+ cfg.setIndexingEnabled(true);
+ cfg.setIndexLocalOnly(true);
+
+ cacheManagers = new LinkedList<CacheManager>();
}
- @Test (expectedExceptions = IllegalArgumentException.class)
- public void testConstructorWithNoClasses(){
- Cache c = new DefaultCacheManager().getCache();
+ @AfterMethod
+ public void tearDown() {
+ TestingUtil.killCacheManagers(cacheManagers);
+ }
+
+ private Cache<?, ?> createCache(Configuration c) {
+ CacheManager cm = new DefaultCacheManager(c);
+ cacheManagers.add(cm);
+ return cm.getCache();
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testConstructorWithNoClasses() {
+ Cache<?, ?> c = createCache(cfg);
Class[] classes = new Class[0];
QueryHelper qh = new QueryHelper(c, null, classes);
}
- @Test (expectedExceptions = CacheException.class)
- public void testCheckInterceptorChainWithIndexLocalTrue(){
- Cache c = new DefaultCacheManager().getCache();
+ @Test(expectedExceptions = CacheException.class)
+ public void testCheckInterceptorChainWithIndexLocalTrue() {
+ Cache<?, ?> c = createCache(cfg);
QueryHelper qh = new QueryHelper(c, null, Person.class);
QueryHelper qh2 = new QueryHelper(c, null, Person.class);
-
}
- @Test (expectedExceptions = CacheException.class)
- public void testCheckInterceptorChainWithIndexLocalFalse(){
- System.setProperty("infinispan.query.indexLocalOnly", "false");
-
- Cache c = new DefaultCacheManager().getCache();
+ @Test(expectedExceptions = CacheException.class)
+ public void testCheckInterceptorChainWithIndexLocalFalse() {
+ cfg.setIndexLocalOnly(false);
+ Cache<?, ?> c = createCache(cfg);
QueryHelper qh = new QueryHelper(c, null, Person.class);
QueryHelper qh2 = new QueryHelper(c, null, Person.class);
}
- public void testTwoQueryHelpersWithTwoCaches(){
+ public void testTwoQueryHelpersWithTwoCaches() {
+ Cache c1 = createCache(cfg);
+ Cache c2 = createCache(cfg);
- Cache c1 = new DefaultCacheManager().getCache();
- Cache c2 = new DefaultCacheManager().getCache();
-
QueryHelper qh1 = new QueryHelper(c1, null, Person.class);
QueryHelper qh2 = new QueryHelper(c2, null, Person.class);
}
More information about the infinispan-commits
mailing list