You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2010/02/10 03:39:38 UTC
svn commit: r908327 - in
/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache:
TestCacheExclusions.java TestPartitionedDataCache.java
Author: ppoddar
Date: Wed Feb 10 02:39:38 2010
New Revision: 908327
URL: http://svn.apache.org/viewvc?rev=908327&view=rev
Log:
OPENJPA-1334: Separate distribution policy from DataCacheManager.
Modified:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestCacheExclusions.java
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestPartitionedDataCache.java
Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestCacheExclusions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestCacheExclusions.java?rev=908327&r1=908326&r2=908327&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestCacheExclusions.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestCacheExclusions.java Wed Feb 10 02:39:38 2010
@@ -194,17 +194,20 @@
}
StringBuilder dataCacheSettings = new StringBuilder();
dataCacheSettings.append("default");
+
+ StringBuilder policySettings = new StringBuilder();
if (includes.length() > 0 || excludes.length() > 0) {
- dataCacheSettings.append("(");
- dataCacheSettings.append(includes);
+ policySettings.append("type-based(");
+ policySettings.append(includes);
if (includes.length() > 0 && excludes.length() > 0) {
- dataCacheSettings.append(",");
+ policySettings.append(",");
}
- dataCacheSettings.append(excludes);
- dataCacheSettings.append(")");
+ policySettings.append(excludes);
+ policySettings.append(")");
}
Map<String, String> props = new HashMap<String, String>();
props.put("openjpa.DataCacheManager", dataCacheSettings.toString());
+ props.put("openjpa.CacheDistributionPolicy", policySettings.toString());
props.put("openjpa.DataCache", "true");
props.put("openjpa.RemoteCommitProvider", "sjvm");
props.put("openjpa.MetaDataFactory", "jpa(Types="
Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestPartitionedDataCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestPartitionedDataCache.java?rev=908327&r1=908326&r2=908327&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestPartitionedDataCache.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestPartitionedDataCache.java Wed Feb 10 02:39:38 2010
@@ -23,6 +23,7 @@
import org.apache.openjpa.datacache.DataCache;
import org.apache.openjpa.datacache.PartitionedDataCache;
import org.apache.openjpa.kernel.OpenJPAStateManager;
+import org.apache.openjpa.lib.conf.Configuration;
import org.apache.openjpa.persistence.StoreCacheImpl;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
import org.apache.openjpa.util.UserException;
@@ -32,8 +33,8 @@
super.setUp("openjpa.DataCache", "partitioned(PartitionType=concurrent,partitions="+
"'(name=a,cacheSize=100),(name=b,cacheSize=200)')",
"openjpa.RemoteCommitProvider", "sjvm",
- "openjpa.DataCacheManager",
- "DistributionPolicy=org.apache.openjpa.persistence.datacache.TestPartitionedDataCache$TestPolicy");
+ "openjpa.CacheDistributionPolicy",
+ "org.apache.openjpa.persistence.datacache.TestPartitionedDataCache$TestPolicy");
}
public void testPropertyParsing() {
@@ -76,7 +77,10 @@
}
- public void testPolicy() {
+ public void testPolicyConfiguration() {
+ Object v = emf.getConfiguration().toProperties(true).get("openjpa.CacheDistributionPolicy");
+ String policyPlugin = emf.getConfiguration().getCacheDistributionPolicy();
+ CacheDistributionPolicy policyInstance = emf.getConfiguration().getCacheDistributionPolicyInstance();
CacheDistributionPolicy policy = emf.getConfiguration().getDataCacheManagerInstance().getDistributionPolicy();
assertNotNull(policy);
assertTrue(policy.getClass() + " not TestPolicy", policy instanceof TestPolicy);
@@ -105,6 +109,15 @@
public String selectCache(OpenJPAStateManager sm, Object context) {
return "a";
}
+
+ public void endConfiguration() {
+ }
+
+ public void setConfiguration(Configuration conf) {
+ }
+
+ public void startConfiguration() {
+ }
}
}