Author: galder.zamarreno(a)jboss.com
Date: 2007-09-24 16:54:20 -0400 (Mon, 24 Sep 2007)
New Revision: 4500
Removed:
cacheloader-migration/trunk/assembly.xml
Modified:
cacheloader-migration/trunk/pom.xml
cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java
cacheloader-migration/trunk/src/examples/misc/build.xml
cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml
cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml
cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml
cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
Log:
Fixed cache loader migration examples and added more verbose logging when reading nodes
from cache loader.
Deleted: cacheloader-migration/trunk/assembly.xml
===================================================================
--- cacheloader-migration/trunk/assembly.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/assembly.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -1,67 +0,0 @@
-<assembly>
- <id>all</id>
-
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>true</includeBaseDirectory>
-
- <fileSets>
-
- <!-- code -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory/>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
-
- <!-- examples -->
- <fileSet>
- <directory>src/examples/java</directory>
- <outputDirectory>examples/src</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/resources</directory>
- <outputDirectory>examples/resources</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/data</directory>
- <outputDirectory>examples/data</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/misc</directory>
- <outputDirectory>examples</outputDirectory>
- </fileSet>
-
- <!-- srcs -->
- <fileSet>
- <directory>src/main/java</directory>
- <outputDirectory>src</outputDirectory>
- </fileSet>
-
- <!-- tests -->
- <fileSet>
- <directory>src/test/java</directory>
- <outputDirectory>test</outputDirectory>
- </fileSet>
-
- <!-- test resources -->
- <fileSet>
- <directory>src/test/resources</directory>
- <outputDirectory>test</outputDirectory>
- </fileSet>
-
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
-
<outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
Modified: cacheloader-migration/trunk/pom.xml
===================================================================
--- cacheloader-migration/trunk/pom.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/pom.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -4,12 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>2.0.0</jbosscache-core-version>
+ <jbosscache-core-version>2.1.0-SNAPSHOT</jbosscache-core-version>
</properties>
<parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-common-parent</artifactId>
- <version>1.0</version>
+ <version>1.1-SNAPSHOT</version>
</parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-cacheloader-migration</artifactId>
@@ -33,6 +33,13 @@
<version>4.0.3.SP1</version>
</dependency>
+ <!-- overriding derby dependency so that is included in the assembly; derby is a
runtime dependency so that cache loader migration examples can run -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ </dependency>
+
</dependencies>
<build>
<plugins>
Modified: cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java
===================================================================
--- cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java 2007-09-24
17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java 2007-09-24
20:54:20 UTC (rev 4500)
@@ -19,22 +19,25 @@
*/
public class TransformStore
{
- /* Type of cache loader, either use "jdbccl" for JDBCCacheLoader or
"fcl" for FileCacheLoader */
+ /* Type of cache loader, either use "jdbccl" for JDBCCacheLoader or
"fcl" for FileCacheLoader */
public static final String CL_TYPE = System.getProperty("cacheloader.type",
"jdbccl");
+ /* Path of config file */
+ public static final String CL_CONFIG_PATH =
System.getProperty("cacheloader.config.path", "resources/");
+
private static Log log = LogFactory.getLog(TransformStore.class);
public static void main(String[] args) throws Exception
{
TransformStore ts = new TransformStore();
- String transformConfigName = "transform-" + CL_TYPE +
"-service.xml";
+ String transformConfigName = CL_CONFIG_PATH + "transform-" + CL_TYPE +
"-service.xml";
log.info("Transforming configuration file: " + transformConfigName);
Cache transformingCache = ts.createAndStartCache(transformConfigName);
ts.transformCacheStore(transformingCache);
ts.stopAndDestroyCache(transformingCache);
- String originalConfigName = "original-" + CL_TYPE +
"-service.xml";
+ String originalConfigName = CL_CONFIG_PATH + "original-" + CL_TYPE +
"-service.xml";
log.info("Original configuration file: " + originalConfigName);
Cache checkingCache = ts.createAndStartCache(originalConfigName);
ts.checkCacheStore(checkingCache);
@@ -77,11 +80,25 @@
public void checkNode(Cache cache, Node<Object, Object> node)
{
- log.info("Node: " + node.getFqn() + " | Data: " +
node.getData());
+ log.info(printNode(node));
for (Node child : node.getChildren())
{
checkNode(cache, child);
}
}
+
+ public String printNode(Node<Object, Object> node)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Node: ").append(node.getFqn())
+ .append(" | Data: ")
+ .append("[")
+
.append("capital=").append(node.get("capital")).append(",")
+
.append("currency=").append(node.get("currency")).append(",")
+ .append("population=").append(node.get("population"))
+ .append("]");
+
+ return sb.toString();
+ }
}
Modified: cacheloader-migration/trunk/src/examples/misc/build.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/misc/build.xml 2007-09-24 17:15:43 UTC (rev
4499)
+++ cacheloader-migration/trunk/src/examples/misc/build.xml 2007-09-24 20:54:20 UTC (rev
4500)
@@ -18,7 +18,7 @@
<property name="filestore.zip"
value="filecacheloader-1x.zip"/>
<path id="lib.classpath">
- <fileset dir="${cache.lib}">
+ <fileset dir="${cache.home}">
<include name="**/*.jar"/>
</fileset>
</path>
@@ -69,7 +69,7 @@
<java classname="examples.TransformStore" fork="yes">
<jvmarg value="-Dcacheloader.type=jdbccl"/>
- <jvmarg
value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+ <jvmarg
value="-Dlog4j.configuration=file:${basedir}/resources/log4j-cache.xml"/>
<classpath refid="lib.classpath"/>
<classpath path="${build}"/>
</java>
@@ -82,7 +82,7 @@
<java classname="examples.TransformStore" fork="yes">
<jvmarg value="-Dcacheloader.type=fcl"/>
- <jvmarg
value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+ <jvmarg
value="-Dlog4j.configuration=file:${basedir}/resources/log4j-cache.xml"/>
<classpath refid="lib.classpath"/>
<classpath path="${build}"/>
</java>
Modified: cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml 2007-09-24
17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml 2007-09-24
20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml
===================================================================
---
cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml 2007-09-24
17:15:43 UTC (rev 4499)
+++
cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml 2007-09-24
20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml
===================================================================
---
cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml 2007-09-24
17:15:43 UTC (rev 4499)
+++
cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml 2007-09-24
20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml
===================================================================
---
cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml 2007-09-24
17:15:43 UTC (rev 4499)
+++
cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml 2007-09-24
20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest
are ignored -->
<passivation>false</passivation>
Modified:
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
===================================================================
---
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-09-24
17:15:43 UTC (rev 4499)
+++
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-09-24
20:54:20 UTC (rev 4500)
@@ -22,7 +22,7 @@
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder
Zamarreno</a>
*/
-@Test
+@Test(groups = {"functional"})
public class TransformingFileCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
@@ -51,7 +51,6 @@
TestingUtil.recursiveFileRemove(targetLoc);
}
- @Test
public void testPutGetData() throws Exception
{
cache.start();
Modified:
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
===================================================================
---
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-09-24
17:15:43 UTC (rev 4499)
+++
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-09-24
20:54:20 UTC (rev 4500)
@@ -22,7 +22,7 @@
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder
Zamarreno</a>
*/
-@Test
+@Test(groups = {"functional"})
public class TransformingJDBCCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
@@ -54,7 +54,6 @@
cache.destroy();
}
- @Test
public void testPutGetData() throws Exception
{
cache.start();