Author: mircea.markus
Date: 2009-03-05 13:10:25 -0500 (Thu, 05 Mar 2009)
New Revision: 7867
Removed:
core/branches/flat/src/main/resources/cache-jdbc.properties
Modified:
core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java
core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java
core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderConfig.java
core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManagerImpl.java
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStoreConfig.java
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
core/branches/flat/src/main/resources/config-samples/all.xml
core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java
core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreConfigTest.java
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreTest.java
core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java
core/branches/flat/src/test/java/org/horizon/loader/dummy/DummyInMemoryCacheStore.java
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest.java
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest2.java
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/DefaultKey2StringMapperTest.java
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest.java
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest2.java
core/branches/flat/src/test/resources/configs/named-cache-test.xml
Log:
ongoing jdbc cache store work
Modified:
core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/config/PluggableConfigurationComponent.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -37,11 +37,11 @@
protected String className;
protected Properties properties = EMPTY_PROPERTIES;
- public String getClassName() {
+ public String getCacheLoaderClassName() {
return className;
}
- public void setClassName(String className) {
+ public void setCacheLoaderClassName(String className) {
if (className == null || className.length() == 0) return;
testImmutability("className");
this.className = className;
Modified:
core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/config/parsing/element/LoadersElementParser.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -33,6 +33,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import java.util.Properties;
+
/**
* Utility class for parsing the 'loaders' element in the .xml configuration
file.
* <pre>
@@ -82,8 +84,11 @@
String purgeOnStartup = getAttributeValue(indivElement,
"purgeOnStartup");
if (existsAttribute(purgeOnStartup))
clc.setPurgeOnStartup(getBoolean(purgeOnStartup));
- clc.setClassName(clClass);
- XmlConfigHelper.setValues(clc,
XmlConfigHelper.readPropertiesContents(indivElement), false, true);
+ clc.setCacheLoaderClassName(clClass);
+ Element propertiesElement = getSingleElementInCoreNS("properties",
indivElement);
+ Properties props = XmlConfigHelper.extractProperties(propertiesElement);
+ if (props != null) XmlConfigHelper.setValues(clc, props, false, true);
+
clc.setSingletonStoreConfig(parseSingletonStoreConfig(getSingleElementInCoreNS("singletonStore",
indivElement)));
clc.setAsyncStoreConfig(parseAsyncStoreConfig(getSingleElementInCoreNS("async",
indivElement)));
return clc;
Modified: core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderConfig.java 2009-03-05
17:51:03 UTC (rev 7866)
+++ core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderConfig.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -32,7 +32,7 @@
CacheLoaderConfig clone();
- String getClassName();
+ String getCacheLoaderClassName();
- void setClassName(String s);
+ void setCacheLoaderClassName(String s);
}
Modified: core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManagerImpl.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManagerImpl.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/loader/CacheLoaderManagerImpl.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -178,7 +178,7 @@
}
CacheLoader createCacheLoader(CacheLoaderConfig cfg, Cache cache) throws Exception {
- CacheLoader tmpLoader = (CacheLoader) Util.getInstance(cfg.getClassName());
+ CacheLoader tmpLoader = (CacheLoader)
Util.getInstance(cfg.getCacheLoaderClassName());
if (tmpLoader != null) {
if (tmpLoader instanceof CacheStore) {
Modified:
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfig.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -33,7 +33,7 @@
private String catalogDbName;
public BdbjeCacheStoreConfig() {
- setClassName(BdbjeCacheStore.class.getName());
+ setCacheLoaderClassName(BdbjeCacheStore.class.getName());
}
public int getMaxTxRetries() {
Modified:
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStoreConfig.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/loader/file/FileCacheStoreConfig.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -25,7 +25,7 @@
private int streamBufferSize = 8192;
public FileCacheStoreConfig() {
- setClassName(FileCacheStore.class.getName());
+ setCacheLoaderClassName(FileCacheStore.class.getName());
}
public String getLocation() {
Modified:
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
===================================================================
---
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/main/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -158,7 +158,7 @@
* org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore}, but will be
injected through {@link
*
org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore#doConnectionFactoryInitialization(org.horizon.loader.jdbc.connectionfactory.ConnectionFactory)}
*/
- public boolean isManageConnectionFactory() {
+ boolean isManageConnectionFactory() {
return manageConnectionFactory;
}
Deleted: core/branches/flat/src/main/resources/cache-jdbc.properties
===================================================================
--- core/branches/flat/src/main/resources/cache-jdbc.properties 2009-03-05 17:51:03 UTC
(rev 7866)
+++ core/branches/flat/src/main/resources/cache-jdbc.properties 2009-03-05 18:10:25 UTC
(rev 7867)
@@ -1,66 +0,0 @@
-##
-# Standard JBC table properties
-# The table name can also be prepended with schema name for the given table.
-# Even though there is an Sql92 standard syntax for this: <schema_name>.<table
name>
-#schema has different meanings accross various DBMS: Oracle - user name; PointBase -
database name
-# Microsoft SQL Server & DB2 - schema name corresponds to the catalog owner
-
-horizon.jdbc.table.name=horizon
-horizon.jdbc.table.create=true
-horizon.jdbc.table.drop=false
-horizon.jdbc.table.primarykey=CACHE_KEY
-horizon.jdbc.key.column=CACHE_KEY
-horizon.jdbc.key.type=VARCHAR(255)
-horizon.jdbc.value.column=CACHE_VALUE
-
-##
-# DataSource
-# horizon.jdbc.datasource=DefaultDS
-
-##
-# JDBC driver specific properties
-
-# Hypersonic
-horizon.jdbc.value.type=BINARY
-horizon.jdbc.driver = org.hsqldb.jdbcDriver
-horizon.jdbc.url=jdbc:hsqldb:mem:horizondb
-horizon.jdbc.user=sa
-horizon.jdbc.password=
-
-
-## MySql
-#horizon.jdbc.driver=com.mysql.jdbc.Driver
-#horizon.jdbc.url=jdbc:mysql://localhost:3306/horizondb
-#horizon.jdbc.user=root
-#horizon.jdbc.password=admin
-
-## Oracle
-#horizon.jdbc.driver=oracle.jdbc.OracleDriver
-#horizon.jdbc.url=jdbc:oracle:thin:@192.168.0.100:1521:HORIZONDB
-#horizon.jdbc.user=scott
-#horizon.jdbc.password=tiger
-
-## MS Sql Server
-#horizon.jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
-#horizon.jdbc.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=horizondb;SelectMethod=cursor
-#horizon.jdbc.user=sa
-#horizon.jdbc.password=
-#horizon.jdbc.value.type=image
-
-## Pointbase
-#horizon.jdbc.driver=com.pointbase.jdbc.jdbcUniversalDriver
-#horizon.jdbc.url=jdbc:pointbase:server://localhost:9092/horizon,new
-#horizon.jdbc.user=PBPUBLIC
-#horizon.jdbc.password=PBPUBLIC
-
-## PostgreSQL
-#horizon.jdbc.driver = org.postgresql.Driver
-#horizon.jdbc.url=jdbc:postgresql://192.168.0.100:5432/horizondb
-#horizon.jdbc.user=postgres
-#horizon.jdbc.password=admin
-
-## Derby
-#horizon.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
-#horizon.jdbc.url=jdbc:derby:horizondb;create=true
-#horizon.jdbc.user=user1
-#horizon.jdbc.password=user1
\ No newline at end of file
Modified: core/branches/flat/src/main/resources/config-samples/all.xml
===================================================================
--- core/branches/flat/src/main/resources/config-samples/all.xml 2009-03-05 17:51:03 UTC
(rev 7866)
+++ core/branches/flat/src/main/resources/config-samples/all.xml 2009-03-05 18:10:25 UTC
(rev 7867)
@@ -146,17 +146,20 @@
<!--
We can have multiple cache loaders, which get chained
-->
- <loader class="org.horizon.loader.JDBCCacheLoader"
fetchPersistentState="true"
+ <loader
class="org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore"
fetchPersistentState="true"
ignoreModifications="true"
purgeOnStartup="true">
<!-- See the documentation for more configuration examples and options.
-->
<properties>
- horizon.jdbc.datasource=HorizonDS
- horizon.jdbc.table.name=horizon
- horizon.jdbc.table.create=true
- horizon.jdbc.table.drop=false
+ <property name="connectionFactoryClass"
value="org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory"/>
+ <property name="connectionUrl"
value="org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory"/>
+ <property name="userName" value="root"/>
+ <property name="driverClass"
value="org.dbms.Driver"/>
+ <property name="idColumnType"
value="VARCHAR2(256)"/>
+ <property name="dataColumnType" value="BLOB"/>
+ <property name="dropTableOnExit"
value="false"/>
+ <property name="createTableOnStart"
value="true"/>
</properties>
-
<singletonStore enabled="true"
pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
<async enabled="true" batchSize="1000"
threadPoolSize="5"/>
</loader>
Modified: core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd
===================================================================
--- core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd 2009-03-05
17:51:03 UTC (rev 7866)
+++ core/branches/flat/src/main/resources/schema/horizon-config-1.0.xsd 2009-03-05
18:10:25 UTC (rev 7867)
@@ -170,7 +170,7 @@
<xs:element name="loader" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
- <xs:element name="properties"/>
+ <xs:element name="properties"
type="tns:propertiesType"/>
<xs:element name="singletonStore" minOccurs="0"
maxOccurs="1">
<xs:complexType>
<xs:attribute name="enabled"
type="tns:booleanType"/>
@@ -200,6 +200,12 @@
<xs:attribute name="shared" type="tns:booleanType"/>
</xs:complexType>
+ <xs:complexType name="propertiesType">
+ <xs:sequence>
+ <xs:element name="property" minOccurs="0"
maxOccurs="unbounded" type="tns:propertyType"/>
+ </xs:sequence>
+ </xs:complexType>
+
<xs:complexType name="customInterceptorsType">
<xs:sequence>
<xs:element name="interceptor" maxOccurs="unbounded">
Modified:
core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/config/parsing/ConfigurationParserTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -8,7 +8,11 @@
import org.horizon.eviction.algorithms.fifo.FIFOAlgorithmConfig;
import org.horizon.loader.CacheLoaderConfig;
import org.horizon.loader.decorators.SingletonStoreConfig;
-import org.horizon.loader.jdbc.binary.JdbcBinaryCacheStoreConfig;
+import org.horizon.loader.jdbc.TableManipulation;
+import org.horizon.loader.jdbc.connectionfactory.ConnectionFactoryConfig;
+import org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory;
+import org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore;
+import org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStoreConfig;
import org.horizon.lock.IsolationLevel;
import org.horizon.transaction.GenericTransactionManagerLookup;
import org.testng.annotations.Test;
@@ -152,22 +156,26 @@
assert !c.isUseReplQueue();
}
- @Test (enabled = false)
public void testCacheLoaders() throws Exception {
XmlConfigurationParserImpl parser = new XmlConfigurationParserImpl();
- String xml = "<loaders passivation=\"true\"
shared=\"true\" preload=\"true\">\n" +
- " <loader
class=\"org.horizon.loader.jdbc.JdbcBucketCacheStore\"
fetchPersistentState=\"true\"\n" +
- " ignoreModifications=\"false\"
purgeOnStartup=\"false\">\n" +
+ String xml =
+ " <loaders passivation=\"true\"
shared=\"true\" preload=\"true\">\n" +
+ " <loader
class=\"org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore\"
fetchPersistentState=\"true\"\n" +
+ " ignoreModifications=\"true\"
purgeOnStartup=\"true\">\n" +
" <properties>\n" +
- " dataSource=HorizonDS\n" +
- " tableNamePrefix=horizon\n" +
- " createTable=true\n" +
- " dropTableOnExit=false\n" +
+ " <property name=\"connectionFactoryClass\"
value=\"org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory\"/>\n"
+
+ " <property name=\"connectionUrl\"
value=\"jdbc://some-url\"/>\n" +
+ " <property name=\"userName\"
value=\"root\"/>\n" +
+ " <property name=\"driverClass\"
value=\"org.dbms.Driver\"/>\n" +
+ " <property name=\"idColumnType\"
value=\"VARCHAR2(256)\"/>\n" +
+ " <property name=\"dataColumnType\"
value=\"BLOB\"/>\n" +
+ " <property name=\"dropTableOnExit\"
value=\"true\"/>\n" +
+ " <property name=\"createTableOnStart\"
value=\"false\"/>\n" +
" </properties>\n" +
- " <singletonStore enabled=\"true\"
pushStateWhenCoordinator=\"true\" pushStateTimeout=\"20000\"
/>\n" +
- " <async enabled=\"true\"
batchSize=\"15\" />\n" +
+ " <singletonStore enabled=\"true\"
pushStateWhenCoordinator=\"true\"
pushStateTimeout=\"20000\"/>\n" +
+ " <async enabled=\"true\"
batchSize=\"15\"/>\n" +
" </loader>\n" +
- " </loaders>";
+ " </loaders> ";
Element e = XmlConfigHelper.stringToElement(xml);
Configuration c = new Configuration();
@@ -181,23 +189,34 @@
assert clc.isPreload();
CacheLoaderConfig iclc = clc.getFirstCacheLoaderConfig();
- assert
iclc.getClassName().equals("org.horizon.loader.jdbc.JdbcBucketCacheStore");
+ assert
iclc.getCacheLoaderClassName().equals(JdbcStringBasedCacheStore.class.getName());
assert iclc.getAsyncStoreConfig().isEnabled();
assert iclc.getAsyncStoreConfig().getBatchSize() == 15;
assert iclc.getAsyncStoreConfig().getPollWait() == 100;
assert iclc.getAsyncStoreConfig().getQueueSize() == 10000;
assert iclc.getAsyncStoreConfig().getThreadPoolSize() == 1;
assert iclc.isFetchPersistentState();
- assert !iclc.isIgnoreModifications();
- assert !iclc.isPurgeOnStartup();
+ assert iclc.isIgnoreModifications();
+ assert iclc.isPurgeOnStartup();
- JdbcBinaryCacheStoreConfig jdbcclc = (JdbcBinaryCacheStoreConfig) iclc;
-// assert jdbcclc.getDataSource().equals("HorizonDS");
-// assert jdbcclc.getTableNamePrefix().equals("horizon");
- assert false : "todo update test according to config";
-// assert jdbcclc.isCreateTableOnStart();
-// assert !jdbcclc.isDropTableOnExit();
+ assert clc.getCacheLoaderConfigs().size() == 1;
+ JdbcStringBasedCacheStoreConfig csConf = (JdbcStringBasedCacheStoreConfig)
clc.getFirstCacheLoaderConfig();
+ assert
csConf.getCacheLoaderClassName().equals("org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore");
+ assert csConf.isFetchPersistentState();
+ assert csConf.isIgnoreModifications();
+ assert csConf.isPurgeOnStartup();
+ TableManipulation tableManipulation = csConf.getTableManipulation();
+ ConnectionFactoryConfig cfc = csConf.getConnectionFactoryConfig();
+ assert
cfc.getConnectionFactoryClass().equals(PooledConnectionFactory.class.getName());
+ assert cfc.getConnectionUrl().equals("jdbc://some-url");
+ assert cfc.getUserName().equals("root");
+ assert cfc.getDriverClass().equals("org.dbms.Driver");
+ assert tableManipulation.getIdColumnType().equals("VARCHAR2(256)");
+ assert tableManipulation.getDataColumnType().equals("BLOB");
+ assert tableManipulation.isDropTableOnExit();
+ assert !tableManipulation.isCreateTableOnStart();
+
SingletonStoreConfig ssc = iclc.getSingletonStoreConfig();
assert ssc.isSingletonStoreEnabled();
assert ssc.isPushStateWhenCoordinator();
@@ -224,7 +243,7 @@
assert !clc.isPreload();
CacheLoaderConfig iclc = clc.getFirstCacheLoaderConfig();
- assert
iclc.getClassName().equals("org.horizon.loader.jdbc.binary.JdbcBinaryCacheStore");
+ assert
iclc.getCacheLoaderClassName().equals("org.horizon.loader.jdbc.binary.JdbcBinaryCacheStore");
assert !iclc.getAsyncStoreConfig().isEnabled();
assert !iclc.isFetchPersistentState();
assert !iclc.isIgnoreModifications();
Modified:
core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/config/parsing/XmlFileParsingTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -1,7 +1,12 @@
package org.horizon.config.parsing;
+import org.horizon.config.CacheLoaderManagerConfig;
import org.horizon.config.Configuration;
import org.horizon.config.GlobalConfiguration;
+import org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStoreConfig;
+import org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory;
+import org.horizon.loader.jdbc.connectionfactory.ConnectionFactoryConfig;
+import org.horizon.loader.jdbc.TableManipulation;
import org.horizon.lock.IsolationLevel;
import org.testng.annotations.Test;
@@ -87,6 +92,25 @@
c = namedCaches.get("lazyDeserialization");
assert c.isUseLazyDeserialization();
+
+ c = namedCaches.get("withLoader");
+ CacheLoaderManagerConfig loaderManagerConfig = c.getCacheLoaderManagerConfig();
+ assert loaderManagerConfig.getCacheLoaderConfigs().size() == 1;
+ JdbcStringBasedCacheStoreConfig csConf = (JdbcStringBasedCacheStoreConfig)
loaderManagerConfig.getFirstCacheLoaderConfig();
+ assert
csConf.getCacheLoaderClassName().equals("org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore");
+ assert csConf.isFetchPersistentState();
+ assert csConf.isIgnoreModifications();
+ assert csConf.isPurgeOnStartup();
+ TableManipulation tableManipulation = csConf.getTableManipulation();
+ ConnectionFactoryConfig cfc = csConf.getConnectionFactoryConfig();
+ assert
cfc.getConnectionFactoryClass().equals(PooledConnectionFactory.class.getName());
+ assert cfc.getConnectionUrl().equals("jdbc://some-url");
+ assert cfc.getUserName().equals("root");
+ assert cfc.getDriverClass().equals("org.dbms.Driver");
+ assert tableManipulation.getIdColumnType().equals("VARCHAR2(256)");
+ assert tableManipulation.getDataColumnType().equals("BLOB");
+ assert tableManipulation.isDropTableOnExit();
+ assert !tableManipulation.isCreateTableOnStart();
}
public void testConfigurationMerging() throws IOException {
Modified:
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreConfigTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreConfigTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreConfigTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -11,7 +11,7 @@
* @version $Id: $
* @since 1.0
*/
-@Test(groups = "unit", enabled = true, testName =
"loader.bdbje.AbstractCacheStoreConfig")
+@Test(groups = "unit", testName =
"loader.AbstractCacheStoreConfigTest")
public class AbstractCacheStoreConfigTest {
private AbstractCacheStoreConfig config;
Modified: core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/AbstractCacheStoreTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -16,7 +16,7 @@
* @version $Id: $
* @since 1.0
*/
-@Test(groups = "unit", enabled = true, testName =
"loader.bdbje.AbstractCacheStoreTest")
+@Test(groups = "unit", testName = "loader.AbstractCacheStoreTest")
public class AbstractCacheStoreTest {
private AbstractCacheStore cs;
private AbstractCacheStoreConfig cfg;
Modified: core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++ core/branches/flat/src/test/java/org/horizon/loader/BaseCacheStoreTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -430,7 +430,7 @@
public void testConfigFile() throws Exception {
Class<? extends CacheLoaderConfig> cfgClass = cs.getConfigurationClass();
CacheLoaderConfig clc = Util.getInstance(cfgClass);
- assert clc.getClassName().equals(cs.getClass().getName()) : "Cache loader
doesn't provide a proper configuration type that is capable of creating the
loader!";
+ assert clc.getCacheLoaderClassName().equals(cs.getClass().getName()) : "Cache
loader doesn't provide a proper configuration type that is capable of creating the
loader!";
}
public void testConcurrency() throws Exception {
Modified:
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/bdbje/BdbjeCacheStoreConfigTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -30,7 +30,7 @@
@Test
public void testGetClassNameDefault() {
- assert config.getClassName().equals(BdbjeCacheStore.class.getName());
+ assert config.getCacheLoaderClassName().equals(BdbjeCacheStore.class.getName());
}
@Test
Modified:
core/branches/flat/src/test/java/org/horizon/loader/dummy/DummyInMemoryCacheStore.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/dummy/DummyInMemoryCacheStore.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/dummy/DummyInMemoryCacheStore.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -127,7 +127,7 @@
String store = "__DEFAULT_STORE__";
public Cfg() {
- setClassName(DummyInMemoryCacheStore.class.getName());
+ setCacheLoaderClassName(DummyInMemoryCacheStore.class.getName());
}
public Cfg(String name) {
Modified:
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -26,7 +26,7 @@
*
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional", testName =
"loader.jdbc.JdbcMixedCacheStoreTest")
+@Test(groups = "functional", testName =
"loader.jdbc.mixed.JdbcMixedCacheStoreTest")
public class JdbcMixedCacheStoreTest {
private CacheStore cacheStore;
Modified:
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest2.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest2.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/jdbc/mixed/JdbcMixedCacheStoreTest2.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -12,7 +12,7 @@
*
* @author
*/
-@Test(groups = "functional", testName =
"loader.jdbc.JdbcMixedCacheStoreTest2")
+@Test(groups = "functional", testName =
"loader.jdbc.mixed.JdbcMixedCacheStoreTest2")
public class JdbcMixedCacheStoreTest2 extends BaseCacheStoreTest {
protected CacheStore createCacheStore() throws Exception {
Modified:
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/DefaultKey2StringMapperTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/DefaultKey2StringMapperTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/DefaultKey2StringMapperTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -7,7 +7,7 @@
*
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "unit", testName =
"loader.jdbc.DefaultKey2StringMapperTest")
+@Test(groups = "unit", testName =
"loader.jdbc.stringbased.DefaultKey2StringMapperTest")
public class DefaultKey2StringMapperTest {
DefaultKey2StringMapper mapper = new DefaultKey2StringMapper();
Modified:
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -15,7 +15,7 @@
*
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional", testName =
"loader.jdbc.JdbcStringBasedCacheStoreTest")
+@Test(groups = "functional", testName =
"loader.jdbc.stringbased.JdbcStringBasedCacheStoreTest")
public class JdbcStringBasedCacheStoreTest extends BaseCacheStoreTest {
protected CacheStore createCacheStore() throws Exception {
Modified:
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest2.java
===================================================================
---
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest2.java 2009-03-05
17:51:03 UTC (rev 7866)
+++
core/branches/flat/src/test/java/org/horizon/loader/jdbc/stringbased/JdbcStringBasedCacheStoreTest2.java 2009-03-05
18:10:25 UTC (rev 7867)
@@ -22,7 +22,7 @@
*
* @author Mircea.Markus(a)jboss.com
*/
-@Test(groups = "functional", testName =
"jdbc.stringbased.JdbcStringBasedCacheStoreTest2")
+@Test(groups = "functional", testName =
"loader.jdbc.stringbased.JdbcStringBasedCacheStoreTest2")
public class JdbcStringBasedCacheStoreTest2 {
CacheStore cacheStore;
Modified: core/branches/flat/src/test/resources/configs/named-cache-test.xml
===================================================================
--- core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-03-05 17:51:03
UTC (rev 7866)
+++ core/branches/flat/src/test/resources/configs/named-cache-test.xml 2009-03-05 18:10:25
UTC (rev 7867)
@@ -74,4 +74,30 @@
<lazyDeserialization enabled="true"/>
</namedCache>
+ <namedCache name="withLoader">
+ <loaders passivation="false" shared="false"
preload="true">
+
+ <!--
+ We can have multiple cache loaders, which get chained
+ -->
+ <loader
class="org.horizon.loader.jdbc.stringbased.JdbcStringBasedCacheStore"
fetchPersistentState="true"
+ ignoreModifications="true"
purgeOnStartup="true">
+
+ <!-- See the documentation for more configuration examples and options.
-->
+ <properties>
+ <property name="connectionFactoryClass"
value="org.horizon.loader.jdbc.connectionfactory.PooledConnectionFactory"/>
+ <property name="connectionUrl"
value="jdbc://some-url"/>
+ <property name="userName" value="root"/>
+ <property name="driverClass"
value="org.dbms.Driver"/>
+ <property name="idColumnType"
value="VARCHAR2(256)"/>
+ <property name="dataColumnType" value="BLOB"/>
+ <property name="dropTableOnExit" value="true"/>
+ <property name="createTableOnStart"
value="false"/>
+ </properties>
+ <singletonStore enabled="true"
pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
+ <async enabled="true" batchSize="1000"
threadPoolSize="5"/>
+ </loader>
+ </loaders>
+ </namedCache>
+
</horizon>