Skip to content
Browse files

MODE-1763 Changed from using deprecated methods (compatible with 5.1.…

…x) to the newer 5.2.x style configuration builders.
  • Loading branch information...
1 parent 339d91a commit 66408a0d72faa775cd3e6f0bee40b1da87f9bdc9 @rhauch rhauch committed Mar 5, 2013
View
70 modeshape-jcr/src/main/java/org/modeshape/jcr/LocalEnvironment.java
@@ -207,29 +207,87 @@ protected CacheContainer createContainer( String configFile ) throws IOException
if (container == null) {
// The default Infinispan configuration is in-memory, local and non-clustered.
// But we need a transaction manager, so use the generic TM which is a good default ...
- Configuration config = createDefaultConfiguration();
- GlobalConfiguration global = createGlobalConfiguration();
+ ConfigurationBuilder config = createDefaultConfigurationBuilder();
+ GlobalConfigurationBuilder global = createGlobalConfigurationBuilder();
container = createContainer(global, config);
}
return container;
}
- protected Configuration createDefaultConfiguration() {
+ /**
+ * Create the default configuration.
+ *
+ * @return the default cache configuration.
+ */
+ protected ConfigurationBuilder createDefaultConfigurationBuilder() {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
configurationBuilder.transaction().transactionManagerLookup(transactionManagerLookupInstance());
configurationBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC);
- return configurationBuilder.build();
+ return configurationBuilder;
}
- protected GlobalConfiguration createGlobalConfiguration() {
+ /**
+ * Create the global configuration.
+ *
+ * @return the global configuration.
+ */
+ protected GlobalConfigurationBuilder createGlobalConfigurationBuilder() {
GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
global.globalJmxStatistics().allowDuplicateDomains(true);
// TODO author=Horia Chiorean date=7/26/12 description=MODE-1524 - Currently we don't use advanced externalizers
// global = global.fluent().serialization().addAdvancedExternalizer(Schematic.externalizers()).build();
- return global.build();
+ return global;
+ }
+
+ /**
+ * Create a cache container using the supplied configurations.
+ *
+ * @param globalConfigurationBuilder the global configuration builder
+ * @param configurationBuilder the default cache configuration builder
+ * @return the cache container
+ */
+ protected CacheContainer createContainer( GlobalConfigurationBuilder globalConfigurationBuilder,
+ ConfigurationBuilder configurationBuilder ) {
+ GlobalConfiguration globalConfiguration = globalConfigurationBuilder.build();
+ Configuration configuration = configurationBuilder.build();
+ logger.debug("Starting cache manager with global configuration \n{0}\nand default configuration:\n{1}",
+ globalConfiguration,
+ configuration);
+ return new DefaultCacheManager(globalConfiguration, configuration);
}
+ /**
+ * Create the default configuration.
+ *
+ * @return the default cache configuration.
+ * @deprecated see {@link #createDefaultConfigurationBuilder()}
+ */
+ @Deprecated
+ protected Configuration createDefaultConfiguration() {
+ return createDefaultConfigurationBuilder().build();
+ }
+
+ /**
+ * Create the global configuration.
+ *
+ * @return the global configuration.
+ * @deprecated see {@link #createGlobalConfigurationBuilder()}
+ */
+ @Deprecated
+ protected GlobalConfiguration createGlobalConfiguration() {
+ return createGlobalConfigurationBuilder().build();
+ }
+
+ /**
+ * Create a cache container using the supplied configurations.
+ *
+ * @param globalConfiguration the global configuration
+ * @param configuration the default cache configuration
+ * @return the cache container
+ * @deprecated use {@link #createContainer(GlobalConfigurationBuilder, ConfigurationBuilder)} instead
+ */
+ @Deprecated
protected CacheContainer createContainer( GlobalConfiguration globalConfiguration,
Configuration configuration ) {
logger.debug("Starting cache manager with global configuration \n{0}\nand default configuration:\n{1}",
View
35 modeshape-jcr/src/test/java/org/modeshape/jcr/InfinispanUtilTest.java
@@ -23,24 +23,21 @@
*/
package org.modeshape.jcr;
+import static junit.framework.Assert.fail;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.infinispan.Cache;
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.file.FileCacheStore;
import org.infinispan.manager.DefaultCacheManager;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.modeshape.common.util.FileUtil;
import org.modeshape.jcr.value.binary.infinispan.InfinispanTestUtil;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-
public class InfinispanUtilTest {
private static DefaultCacheManager cacheManager;
@@ -62,10 +59,11 @@ public static void beforeClass() throws Exception {
DIST = configurationBuilder.build();
// store config
+ File dir = new File(System.getProperty("java.io.tmpdir"), "InfinispanLocalBinaryStoreWithPersistenceTest");
+ if (dir.exists()) FileUtil.delete(dir);
+ dir.mkdirs();
configurationBuilder.loaders().shared(true);
- LoaderConfigurationBuilder loaderBuilder = configurationBuilder.loaders().addCacheLoader().cacheLoader(new FileCacheStore());
- loaderBuilder.addProperty("location", new File(System.getProperty("java.io.tmpdir"), "InfinispanTestUtil").getAbsolutePath());
- loaderBuilder.purgeOnStartup(true);
+ configurationBuilder.loaders().addFileCacheStore().purgeOnStartup(true).location(dir.getAbsolutePath());
configurationBuilder.clustering().cacheMode(CacheMode.LOCAL);
LOCAL_STORE = configurationBuilder.build();
@@ -89,7 +87,8 @@ public static void afterClass() {
org.infinispan.test.TestingUtil.recursiveFileRemove(new File(System.getProperty("java.io.tmpdir"), "InfinispanTestUtil"));
}
- private void checkSequence(InfinispanUtil.Sequence<String> sequence, String... expected) throws Exception {
+ private void checkSequence( InfinispanUtil.Sequence<String> sequence,
+ String... expected ) throws Exception {
int index = 0;
List<String> keys = new ArrayList<String>(expected.length);
while (true) {
@@ -100,17 +99,17 @@ private void checkSequence(InfinispanUtil.Sequence<String> sequence, String... e
keys.add(key);
}
- if(keys.size() != expected.length){
- fail("Sequence contains wrong elements. Expected: "+expected.length+" Contained: "+index);
+ if (keys.size() != expected.length) {
+ fail("Sequence contains wrong elements. Expected: " + expected.length + " Contained: " + index);
}
- for(String key : expected){
- if(!keys.contains(key)){
- fail("Missing key in sequence: "+key);
+ for (String key : expected) {
+ if (!keys.contains(key)) {
+ fail("Missing key in sequence: " + key);
}
}
}
- private void standardTest(String cacheName) throws Exception {
+ private void standardTest( String cacheName ) throws Exception {
Cache<String, String> cache = cacheManager.getCache(cacheName);
cache.put("Foo", "Bar");
View
2 modeshape-jcr/src/test/java/org/modeshape/jcr/JcrQueryManagerTest.java
@@ -994,7 +994,7 @@ public void shouldBeAbleToExecuteQueryForAllColumns() throws RepositoryException
@FixFor ( "MODE-1833" )
@Test
- public void shouldBeAbleToQueryAllColumnsOnSimpleType() throws RepositoryException, IOException {
+ public void shouldBeAbleToQueryAllColumnsOnSimpleType() throws RepositoryException {
QueryManager queryManager = session.getWorkspace().getQueryManager();
QueryObjectModelFactory factory = queryManager.getQOMFactory();
Query query = factory.createQuery(factory.selector("modetest:simpleType", "type1"),
View
18 modeshape-jcr/src/test/java/org/modeshape/jcr/TestingEnvironment.java
@@ -25,9 +25,7 @@
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LegacyConfigurationAdaptor;
-import org.infinispan.configuration.global.GlobalConfiguration;
-import org.infinispan.configuration.global.LegacyGlobalConfigurationAdaptor;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
import org.infinispan.manager.CacheContainer;
import org.infinispan.test.TestingUtil;
import org.infinispan.test.fwk.TestCacheManagerFactory;
@@ -46,11 +44,12 @@ public TestingEnvironment() {
this(null, DummyTransactionManagerLookup.class);
}
- public TestingEnvironment(CustomLoaderTest customLoaderTest ) {
+ public TestingEnvironment( CustomLoaderTest customLoaderTest ) {
this(customLoaderTest, DummyTransactionManagerLookup.class);
}
- public TestingEnvironment(CustomLoaderTest customLoaderTest, Class<? extends TransactionManagerLookup> transactionManagerLookup) {
+ public TestingEnvironment( CustomLoaderTest customLoaderTest,
+ Class<? extends TransactionManagerLookup> transactionManagerLookup ) {
super(transactionManagerLookup);
this.customLoaderTest = customLoaderTest;
}
@@ -65,16 +64,15 @@ protected Configuration createDefaultConfiguration() {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
configurationBuilder.transaction().transactionManagerLookup(transactionManagerLookupInstance());
- if(customLoaderTest != null) {
+ if (customLoaderTest != null) {
customLoaderTest.applyLoaderConfiguration(configurationBuilder);
}
return configurationBuilder.build();
}
@Override
- protected CacheContainer createContainer( GlobalConfiguration globalConfiguration,
- Configuration configuration ) {
- return TestCacheManagerFactory.createCacheManager(LegacyGlobalConfigurationAdaptor.adapt(globalConfiguration),
- LegacyConfigurationAdaptor.adapt(configuration));
+ protected CacheContainer createContainer( GlobalConfigurationBuilder globalConfigurationBuilder,
+ ConfigurationBuilder configurationBuilder ) {
+ return TestCacheManagerFactory.createCacheManager(globalConfigurationBuilder, configurationBuilder);
}
}
View
12 modeshape-jcr/src/test/java/org/modeshape/jcr/store/BerkleyDbCacheStoreTest.java
@@ -24,10 +24,8 @@
package org.modeshape.jcr.store;
import java.io.File;
-
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.bdbje.BdbjeCacheStore;
+import org.infinispan.loaders.bdbje.configuration.BdbjeCacheStoreConfigurationBuilder;
import org.modeshape.common.util.FileUtil;
public class BerkleyDbCacheStoreTest extends InMemoryTest {
@@ -40,9 +38,11 @@ protected void cleanUpFileSystem() {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new BdbjeCacheStore());
- lb.addProperty("location", dbDir.getAbsolutePath());
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ configurationBuilder.loaders()
+ .addStore(BdbjeCacheStoreConfigurationBuilder.class)
+ .location(dbDir.getAbsolutePath())
+ .purgeOnStartup(true);
}
}
View
45 modeshape-jcr/src/test/java/org/modeshape/jcr/store/JdbcBinaryCacheStoreTest.java
@@ -24,18 +24,14 @@
package org.modeshape.jcr.store;
import java.io.File;
-
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore;
+import org.infinispan.loaders.jdbc.configuration.JdbcBinaryCacheStoreConfigurationBuilder;
import org.junit.Ignore;
import org.modeshape.common.util.FileUtil;
-
/**
- * Currently ignored because of the time required to run it.
- *
- * //TODO author=Horia Chiorean date=9/12/12 description=If they are ever enabled, c3p0 needs to be added as a test dependency
+ * Currently ignored because of the time required to run it. //TODO author=Horia Chiorean date=9/12/12 description=If they are
+ * ever enabled, c3p0 needs to be added as a test dependency
*/
@Ignore
public class JdbcBinaryCacheStoreTest extends InMemoryTest {
@@ -51,22 +47,23 @@ protected void cleanUpFileSystem() throws Exception {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
- lb.addProperty("dropTableOnExit", "false")
- .addProperty("createTableOnStart", "true")
- .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
- .addProperty("connectionUrl", dataSourceConfig.getUrl() + "/string_based_db;DB_CLOSE_DELAY=1")
- .addProperty("driverClass", dataSourceConfig.getDriverClassName())
- .addProperty("userName", dataSourceConfig.getUsername())
- .addProperty("idColumnName", "ID_COLUMN")
- .addProperty("idColumnType", "VARCHAR(255)")
- .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
- .addProperty("timestampColumnType", "BIGINT")
- .addProperty("dataColumnName", "DATA_COLUMN")
- .addProperty("dataColumnType", "BINARY")
- .addProperty("bucketTableNamePrefix", "MODE")
- .addProperty("cacheName", "default");
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbcBinaryCacheStoreConfigurationBuilder builder = new JdbcBinaryCacheStoreConfigurationBuilder(
+ configurationBuilder.loaders());
+ builder.purgeOnStartup(true);
+ builder.table()
+ .createOnStart(true)
+ .dropOnExit(false)
+ .idColumnName("ID_COLUMN")
+ .idColumnType("VARCHAR(255)")
+ .timestampColumnName("TIMESTAMP_COLUMN")
+ .timestampColumnType("BIGINT")
+ .dataColumnName("DATA_COLUMN")
+ .dataColumnType("BINARY")
+ .connectionPool()
+ .connectionUrl(dataSourceConfig.getUrl() + "/string_based_db;DB_CLOSE_DELAY=1")
+ .driverClass(dataSourceConfig.getDriverClassName())
+ .username(dataSourceConfig.getUsername());
+ configurationBuilder.loaders().addStore(builder);
}
-
}
View
41 modeshape-jcr/src/test/java/org/modeshape/jcr/store/JdbcStringCacheStoreTest.java
@@ -24,13 +24,12 @@
package org.modeshape.jcr.store;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore;
+import org.infinispan.loaders.jdbc.configuration.JdbcBinaryCacheStoreConfigurationBuilder;
import org.junit.Ignore;
/**
- * Currently ignored because of the time required to run it.
- * //TODO author=Horia Chiorean date=9/12/12 description=If they are ever enabled, c3p0 needs to be added as a test dependency
+ * Currently ignored because of the time required to run it. //TODO author=Horia Chiorean date=9/12/12 description=If they are
+ * ever enabled, c3p0 needs to be added as a test dependency
*/
@Ignore
public class JdbcStringCacheStoreTest extends InMemoryTest {
@@ -44,22 +43,24 @@ protected void cleanUpFileSystem() throws Exception {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcStringBasedCacheStore());
- lb.addProperty("dropTableOnExit", "true")
- .addProperty("createTableOnStart", "true")
- .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
- .addProperty("connectionUrl", dataSourceConfig.getUrl() + "/string_based_db;DB_CLOSE_DELAY=1")
- .addProperty("driverClass", dataSourceConfig.getDriverClassName())
- .addProperty("userName", dataSourceConfig.getUsername())
- //.addProperty("databaseType", databaseType)
- .addProperty("stringsTableNamePrefix", "ISPN_STRING_TABLE")
- .addProperty("idColumnName", "ID_COLUMN")
- .addProperty("idColumnType", "VARCHAR(255)")
- .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
- .addProperty("timestampColumnType", "BIGINT")
- .addProperty("dataColumnName", "DATA_COLUMN")
- .addProperty("dataColumnType", "BINARY");
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbcBinaryCacheStoreConfigurationBuilder builder = new JdbcBinaryCacheStoreConfigurationBuilder(
+ configurationBuilder.loaders());
+ builder.purgeOnStartup(true);
+ builder.table()
+ .createOnStart(true)
+ .dropOnExit(true)
+ .idColumnName("ID_COLUMN")
+ .idColumnType("VARCHAR(255)")
+ .timestampColumnName("TIMESTAMP_COLUMN")
+ .timestampColumnType("BIGINT")
+ .dataColumnName("DATA_COLUMN")
+ .dataColumnType("BINARY")
+ .connectionPool()
+ .connectionUrl(dataSourceConfig.getUrl() + "/string_based_db;DB_CLOSE_DELAY=1")
+ .driverClass(dataSourceConfig.getDriverClassName())
+ .username(dataSourceConfig.getUsername());
+ configurationBuilder.loaders().addStore(builder);
}
}
View
12 modeshape-jcr/src/test/java/org/modeshape/jcr/store/JdbmCacheStoreTest.java
@@ -24,10 +24,8 @@
package org.modeshape.jcr.store;
import java.io.File;
-
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbm.JdbmCacheStore;
+import org.infinispan.loaders.jdbm.configuration.JdbmCacheStoreConfigurationBuilder;
import org.junit.Ignore;
import org.modeshape.common.util.FileUtil;
@@ -45,9 +43,11 @@ protected void cleanUpFileSystem() {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbmCacheStore());
- lb.addProperty("location", dbDir.getAbsolutePath());
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbmCacheStoreConfigurationBuilder builder = new JdbmCacheStoreConfigurationBuilder(configurationBuilder.loaders());
+ builder.location(dbDir.getAbsolutePath());
+ builder.purgeOnStartup(true);
+ configurationBuilder.loaders().addStore(builder);
}
}
View
13 .../modeshape/jcr/value/binary/infinispan/InfinispanLocalBinaryStoreWithPersistenceTest.java
@@ -27,9 +27,8 @@
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.file.FileCacheStore;
import org.junit.BeforeClass;
+import org.modeshape.common.util.FileUtil;
public class InfinispanLocalBinaryStoreWithPersistenceTest extends AbstractInfinispanStoreTest {
@@ -40,13 +39,11 @@ public static void beforeClass() throws Exception {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.clustering().cacheMode(CacheMode.LOCAL);
// Set up the file persistence ...
+ File dir = new File(System.getProperty("java.io.tmpdir"), "InfinispanLocalBinaryStoreWithPersistenceTest");
+ if (dir.exists()) FileUtil.delete(dir);
+ dir.mkdirs();
configurationBuilder.loaders().shared(false);
- LoaderConfigurationBuilder loaderBuilder = configurationBuilder.loaders()
- .addCacheLoader()
- .cacheLoader(new FileCacheStore());
- loaderBuilder.addProperty("location", new File(System.getProperty("java.io.tmpdir"),
- "InfinispanLocalBinaryStoreWithPersistenceTest").getAbsolutePath());
- loaderBuilder.purgeOnStartup(true);
+ configurationBuilder.loaders().addFileCacheStore().purgeOnStartup(true).location(dir.getAbsolutePath());
// Create the configurations for the two different caches ...
Configuration blobConfiguration = configurationBuilder.build();
View
11 ...ests/src/test/java/org/modeshape/test/performance/BerkleyDbCacheStorePerformanceTest.java
@@ -23,15 +23,14 @@
*/
package org.modeshape.test.performance;
+import java.io.File;
import javax.jcr.Node;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.bdbje.BdbjeCacheStore;
+import org.infinispan.loaders.bdbje.configuration.BdbjeCacheStoreConfigurationBuilder;
import org.junit.Test;
import org.modeshape.common.annotation.Performance;
import org.modeshape.common.statistic.Stopwatch;
import org.modeshape.common.util.FileUtil;
-import java.io.File;
public class BerkleyDbCacheStorePerformanceTest extends InMemoryPerformanceTest {
@@ -44,8 +43,10 @@ protected void cleanUpFileSystem() {
@Override
public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new BdbjeCacheStore());
- lb.addProperty("location", dbDir.getAbsolutePath());
+ BdbjeCacheStoreConfigurationBuilder builder = new BdbjeCacheStoreConfigurationBuilder(configurationBuilder.loaders());
+ builder.location(dbDir.getAbsolutePath());
+ builder.purgeOnStartup(true);
+ configurationBuilder.loaders().addStore(builder);
}
@Performance
View
40 ...sts/src/test/java/org/modeshape/test/performance/JdbcBinaryCacheStorePerformanceTest.java
@@ -23,11 +23,10 @@
*/
package org.modeshape.test.performance;
+import java.io.File;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore;
+import org.infinispan.loaders.jdbc.configuration.JdbcBinaryCacheStoreConfigurationBuilder;
import org.modeshape.common.util.FileUtil;
-import java.io.File;
public class JdbcBinaryCacheStorePerformanceTest extends InMemoryPerformanceTest {
@@ -40,23 +39,24 @@ protected void cleanUpFileSystem() throws Exception {
FileUtil.delete(dbDir);
}
-
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
- lb.addProperty("dropTableOnExit", "false")
- .addProperty("createTableOnStart", "true")
- .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
- .addProperty("connectionUrl", "jdbc:h2:file:" + dbDir.getAbsolutePath() + "/string_based_db;DB_CLOSE_DELAY=1")
- .addProperty("driverClass", "org.h2.Driver")
- .addProperty("userName", "sa")
- .addProperty("idColumnName", "ID_COLUMN")
- .addProperty("idColumnType", "VARCHAR(255)")
- .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
- .addProperty("timestampColumnType", "BIGINT")
- .addProperty("dataColumnName", "DATA_COLUMN")
- .addProperty("dataColumnType", "BINARY")
- .addProperty("bucketTableNamePrefix", "MODE")
- .addProperty("cacheName", "default");
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbcBinaryCacheStoreConfigurationBuilder builder = new JdbcBinaryCacheStoreConfigurationBuilder(
+ configurationBuilder.loaders());
+ builder.purgeOnStartup(true);
+ builder.table()
+ .createOnStart(true)
+ .dropOnExit(false)
+ .idColumnName("ID_COLUMN")
+ .idColumnType("VARCHAR(255)")
+ .timestampColumnName("TIMESTAMP_COLUMN")
+ .timestampColumnType("BIGINT")
+ .dataColumnName("DATA_COLUMN")
+ .dataColumnType("BINARY")
+ .connectionPool()
+ .connectionUrl("jdbc:h2:file:" + dbDir.getAbsolutePath() + "/string_based_db;DB_CLOSE_DELAY=1")
+ .driverClass("org.h2.Driver")
+ .username("sa");
+ configurationBuilder.loaders().addStore(builder);
}
}
View
40 ...sts/src/test/java/org/modeshape/test/performance/JdbcStringCacheStorePerformanceTest.java
@@ -23,10 +23,9 @@
*/
package org.modeshape.test.performance;
-import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore;
import java.io.File;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.loaders.jdbc.configuration.JdbcStringBasedCacheStoreConfigurationBuilder;
public class JdbcStringCacheStorePerformanceTest extends InMemoryPerformanceTest {
@@ -39,22 +38,23 @@ protected void cleanUpFileSystem() throws Exception {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(
- new JdbcStringBasedCacheStore());
- lb.addProperty("dropTableOnExit", "true")
- .addProperty("createTableOnStart", "true")
- .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
- .addProperty("connectionUrl", "jdbc:h2:file:" + dbDir.getAbsolutePath() + "/string_based_db;DB_CLOSE_DELAY=1")
-// .addProperty("connectionUrl", "jdbc:h2:mem:string_based_db;DB_CLOSE_DELAY=-1")
- .addProperty("driverClass", "org.h2.Driver")
- .addProperty("userName", "sa")
- .addProperty("stringsTableNamePrefix", "ISPN_STRING_TABLE")
- .addProperty("idColumnName", "ID_COLUMN")
- .addProperty("idColumnType", "VARCHAR(255)")
- .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
- .addProperty("timestampColumnType", "BIGINT")
- .addProperty("dataColumnName", "DATA_COLUMN")
- .addProperty("dataColumnType", "BINARY");
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbcStringBasedCacheStoreConfigurationBuilder builder = new JdbcStringBasedCacheStoreConfigurationBuilder(
+ configurationBuilder.loaders());
+ builder.purgeOnStartup(true);
+ builder.table()
+ .createOnStart(true)
+ .dropOnExit(false)
+ .idColumnName("ID_COLUMN")
+ .idColumnType("VARCHAR(255)")
+ .timestampColumnName("TIMESTAMP_COLUMN")
+ .timestampColumnType("BIGINT")
+ .dataColumnName("DATA_COLUMN")
+ .dataColumnType("BINARY")
+ .connectionPool()
+ .connectionUrl("jdbc:h2:file:" + dbDir.getAbsolutePath() + "/string_based_db;DB_CLOSE_DELAY=1")
+ .driverClass("org.h2.Driver")
+ .username("sa");
+ configurationBuilder.loaders().addStore(builder);
}
}
View
13 ...nce-tests/src/test/java/org/modeshape/test/performance/JdbmCacheStorePerformanceTest.java
@@ -23,11 +23,10 @@
*/
package org.modeshape.test.performance;
+import java.io.File;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.LoaderConfigurationBuilder;
-import org.infinispan.loaders.jdbm.JdbmCacheStore;
+import org.infinispan.loaders.jdbm.configuration.JdbmCacheStoreConfigurationBuilder;
import org.modeshape.common.util.FileUtil;
-import java.io.File;
public class JdbmCacheStorePerformanceTest extends InMemoryPerformanceTest {
@@ -39,8 +38,10 @@ protected void cleanUpFileSystem() {
}
@Override
- public void applyLoaderConfiguration(ConfigurationBuilder configurationBuilder) {
- LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbmCacheStore());
- lb.addProperty("location", dbDir.getAbsolutePath());
+ public void applyLoaderConfiguration( ConfigurationBuilder configurationBuilder ) {
+ JdbmCacheStoreConfigurationBuilder builder = new JdbmCacheStoreConfigurationBuilder(configurationBuilder.loaders());
+ builder.location(dbDir.getAbsolutePath());
+ builder.purgeOnStartup(true);
+ configurationBuilder.loaders().addStore(builder);
}
}
View
8 ...shape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/ModeShapeWebdavStore.java
@@ -531,6 +531,10 @@ protected final RequestResolver requestResolver() {
return requestResolver;
}
+ protected final Logger logger() {
+ return logger;
+ }
+
/**
* Implementation of the {@link ITransaction} interface that uses a {@link Session JCR session} to load and store webdav
* content. The session also provides support for transactional access to the underlying store.
@@ -564,7 +568,7 @@ Session session( ResolvedRequest request ) throws RepositoryException {
try {
result = RepositoryManager.getSession(request.getRequest(), repositoryName, workspaceName);
} catch (RepositoryException e) {
- logger.error(e, WebdavI18n.cannotGetRepositorySession, repositoryName);
+ logger().error(e, WebdavI18n.cannotGetRepositorySession, repositoryName);
throw e;
}
sessions.put(key, result);
@@ -633,7 +637,7 @@ boolean repositoryAndWorkspaceExist( ResolvedRequest request ) throws Repository
session = RepositoryManager.getSession(request.getRequest(), repositoryName, null);
return session.getWorkspace().getAccessibleWorkspaceNames();
} catch (RepositoryException e) {
- logger.error(e, WebdavI18n.cannotGetRepositorySession, repositoryName);
+ logger().error(e, WebdavI18n.cannotGetRepositorySession, repositoryName);
throw e;
} finally {
if (session != null) {

0 comments on commit 66408a0

Please sign in to comment.
Something went wrong with that request. Please try again.