[jboss-cvs] JBossAS SVN: r79741 - in trunk: testsuite/imports and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 20 08:06:20 EDT 2008
Author: alesj
Date: 2008-10-20 08:06:19 -0400 (Mon, 20 Oct 2008)
New Revision: 79741
Added:
trunk/testsuite/src/main/org/jboss/test/spring/cluster/
trunk/testsuite/src/main/org/jboss/test/spring/cluster/AnnotatedPojo.java
trunk/testsuite/src/main/org/jboss/test/spring/cluster/SimplePojo.java
trunk/testsuite/src/main/org/jboss/test/spring/test/AbstractSpringTest.java
trunk/testsuite/src/main/org/jboss/test/spring/test/SpringClusterTestCase.java
trunk/testsuite/src/resources/spring/cluster/
trunk/testsuite/src/resources/spring/cluster/META-INF/
trunk/testsuite/src/resources/spring/cluster/META-INF/cluster-spring.xml
Modified:
trunk/spring-int/build.xml
trunk/testsuite/imports/sections/spring.xml
trunk/testsuite/imports/server-config.xml
trunk/testsuite/src/main/org/jboss/test/spring/test/SpringStandaloneTestCase.java
Log:
[JBAS-6008]; add test for simple Spring cluster integration.
Modified: trunk/spring-int/build.xml
===================================================================
--- trunk/spring-int/build.xml 2008-10-20 10:06:26 UTC (rev 79740)
+++ trunk/spring-int/build.xml 2008-10-20 12:06:19 UTC (rev 79741)
@@ -102,6 +102,7 @@
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jboss.vfs.classpath"/>
<path refid="jboss.jboss.javaee.classpath"/>
+ <path refid="jboss.cache.jbosscache.core.classpath"/>
<path refid="jboss.cache.jbosscache.pojo.classpath"/>
</path>
@@ -174,6 +175,7 @@
<include name="org/jboss/spring/interceptor/**"/>
<include name="org/jboss/spring/support/**"/>
<include name="org/jboss/spring/io/**"/>
+ <include name="org/jboss/spring/cluster/**"/>
</fileset>
</jar>
@@ -241,6 +243,7 @@
<include name="org/jboss/spring/factory/**"/>
<include name="org/jboss/spring/support/**"/>
<include name="org/jboss/spring/io/**"/>
+ <include name="org/jboss/spring/cluster/**"/>
</javac>
</target>
@@ -395,6 +398,7 @@
<exclude name="org/jboss/spring/factory/**"/>
<exclude name="org/jboss/spring/interceptor/**"/>
<exclude name="org/jboss/spring/io/**"/>
+ <exclude name="org/jboss/spring/cluster/**"/>
</javac>
<copy todir="${module.output}/example/classes">
<fileset dir="${source.resources}/test/dd">
Modified: trunk/testsuite/imports/sections/spring.xml
===================================================================
--- trunk/testsuite/imports/sections/spring.xml 2008-10-20 10:06:26 UTC (rev 79740)
+++ trunk/testsuite/imports/sections/spring.xml 2008-10-20 12:06:19 UTC (rev 79741)
@@ -39,6 +39,16 @@
<!-- SERVICE -->
<copy tofile="${build.lib}/standalone-spring.xml" file="${build.resources}/spring/standalone-spring.xml"/>
+ <!-- Cluster -->
+ <jar destfile="${build.lib}/spring-cluster-pojos.jar">
+ <fileset dir="${build.resources}/spring/cluster">
+ <include name="**/*.xml"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/spring/cluster/**"/>
+ </fileset>
+ </jar>
+
</target>
</project>
Modified: trunk/testsuite/imports/server-config.xml
===================================================================
--- trunk/testsuite/imports/server-config.xml 2008-10-20 10:06:26 UTC (rev 79740)
+++ trunk/testsuite/imports/server-config.xml 2008-10-20 12:06:19 UTC (rev 79741)
@@ -917,9 +917,10 @@
<delete dir="${jboss.dist}/server/@{conf}" failonerror="false"/>
<echo message="creating @{conf} config, jboss.dist=${jboss.dist}"/>
<copy todir="${jboss.dist}/server/@{conf}">
- <fileset dir="${jboss.dist}/server/@{baseconf}">
+ <fileset dir="${jboss.dist}/server/@{baseconf}">
<include name="conf/**"/>
<include name="lib/**"/>
+ <include name="lib-opt/**"/>
<include name="deploy/**"/>
<include name="deployers/**"/>
</fileset>
@@ -933,6 +934,18 @@
<copy todir="${jboss.dist}/server/@{conf}" overwrite="true" failonerror="false">
<fileset dir="${build.resources}/test-configs/@{conf}" />
</copy>
+ <echo message="Adding JBoss Pojo Cache" />
+ <copy todir="${jboss.dist}/server/@{conf}/lib" overwrite="true" failonerror="false">
+ <fileset dir="${jgroups.jgroups.lib}">
+ <include name="jgroups.jar"/>
+ </fileset>
+ <fileset dir="${jboss.cache.jbosscache.core.lib}">
+ <include name="jbosscache-core.jar"/>
+ </fileset>
+ <fileset dir="${jboss.cache.jbosscache.pojo.lib}">
+ <include name="jbosscache-pojo.jar"/>
+ </fileset>
+ </copy>
</sequential>
</macrodef>
Added: trunk/testsuite/src/main/org/jboss/test/spring/cluster/AnnotatedPojo.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/spring/cluster/AnnotatedPojo.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/spring/cluster/AnnotatedPojo.java 2008-10-20 12:06:19 UTC (rev 79741)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.spring.cluster;
+
+import java.io.Serializable;
+
+import org.jboss.cache.pojo.annotation.Replicable;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Replicable
+public class AnnotatedPojo implements Serializable
+{
+ private static final long serialVersionUID = 6101030433115572240L;
+
+ private String host;
+ private int port;
+ private Object value;
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public void setHost(String host)
+ {
+ this.host = host;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+}
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/spring/cluster/SimplePojo.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/spring/cluster/SimplePojo.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/spring/cluster/SimplePojo.java 2008-10-20 12:06:19 UTC (rev 79741)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.spring.cluster;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimplePojo implements Serializable
+{
+ private static final long serialVersionUID = -4975473374662867962L;
+
+ private String host;
+ private int port;
+ private Object value;
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public void setHost(String host)
+ {
+ this.host = host;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/spring/test/AbstractSpringTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/spring/test/AbstractSpringTest.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/spring/test/AbstractSpringTest.java 2008-10-20 12:06:19 UTC (rev 79741)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.spring.test;
+
+import java.net.URL;
+import javax.management.MBeanServerConnection;
+
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractSpringTest extends JBossTestCase
+{
+ protected AbstractSpringTest(String s)
+ {
+ super(s);
+ }
+
+ protected <T> T invokeMainDeployer(String methodName, Object[] args, String[] sig, Class<T> clazz) throws Exception
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null class.");
+
+ MBeanServerConnection server = getServer();
+ Object result = server.invoke(MainDeployerMBean.OBJECT_NAME, methodName, args, sig);
+ return clazz.cast(result);
+ }
+
+ protected boolean isDeployed(String deployment) throws Exception
+ {
+ URL deployURL = getDeployURL(deployment);
+ String[] sig = {URL.class.getName()};
+ Object[] args = {deployURL};
+ return invokeMainDeployer("isDeployed", args, sig, Boolean.class);
+ }
+}
\ No newline at end of file
Copied: trunk/testsuite/src/main/org/jboss/test/spring/test/SpringClusterTestCase.java (from rev 79732, trunk/testsuite/src/main/org/jboss/test/spring/test/SpringStandaloneTestCase.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/spring/test/SpringClusterTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/spring/test/SpringClusterTestCase.java 2008-10-20 12:06:19 UTC (rev 79741)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.spring.test;
+
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SpringClusterTestCase extends AbstractSpringTest
+{
+ public SpringClusterTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(SpringClusterTestCase.class, "spring-cluster-pojos.jar");
+ }
+
+ public void testStandalone() throws Exception
+ {
+ assertTrue(isDeployed("spring-cluster-pojos.jar"));
+ }
+}
\ No newline at end of file
Modified: trunk/testsuite/src/main/org/jboss/test/spring/test/SpringStandaloneTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/spring/test/SpringStandaloneTestCase.java 2008-10-20 10:06:26 UTC (rev 79740)
+++ trunk/testsuite/src/main/org/jboss/test/spring/test/SpringStandaloneTestCase.java 2008-10-20 12:06:19 UTC (rev 79741)
@@ -21,17 +21,12 @@
*/
package org.jboss.test.spring.test;
-import java.net.URL;
-import javax.management.MBeanServerConnection;
-
import junit.framework.Test;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.test.JBossTestCase;
/**
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class SpringStandaloneTestCase extends JBossTestCase
+public class SpringStandaloneTestCase extends AbstractSpringTest
{
public SpringStandaloneTestCase(String name)
{
@@ -43,24 +38,6 @@
return getDeploySetup(SpringStandaloneTestCase.class, "standalone-spring.xml");
}
- protected <T> T invokeMainDeployer(String methodName, Object[] args, String[] sig, Class<T> clazz) throws Exception
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null class.");
-
- MBeanServerConnection server = getServer();
- Object result = server.invoke(MainDeployerMBean.OBJECT_NAME, methodName, args, sig);
- return clazz.cast(result);
- }
-
- protected boolean isDeployed(String deployment) throws Exception
- {
- URL deployURL = getDeployURL(deployment);
- String[] sig = {URL.class.getName()};
- Object[] args = {deployURL};
- return invokeMainDeployer("isDeployed", args, sig, Boolean.class);
- }
-
public void testStandalone() throws Exception
{
assertTrue(isDeployed("standalone-spring.xml"));
Copied: trunk/testsuite/src/resources/spring/cluster/META-INF/cluster-spring.xml (from rev 79732, trunk/testsuite/src/resources/spring/standalone-spring.xml)
===================================================================
--- trunk/testsuite/src/resources/spring/cluster/META-INF/cluster-spring.xml (rev 0)
+++ trunk/testsuite/src/resources/spring/cluster/META-INF/cluster-spring.xml 2008-10-20 12:06:19 UTC (rev 79741)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
+<beans>
+
+ <!-- JBoss Pojo Cache Config + Spring-Cache integration -->
+
+ <bean id="CacheConfig" class="org.jboss.cache.config.Configuration">
+ <property name="transactionManagerLookupClass"><value>org.jboss.cache.transaction.GenericTransactionManagerLookup</value></property>
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <property name="isolationLevel"><value>READ_COMMITTED</value></property>
+ <!-- Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <property name="cacheMode"><value>LOCAL</value></property>
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <property name="lockAcquisitionTimeout"><value>15000</value></property>
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <property name="evictionConfig">
+ <bean id="ExampleEvictionConfig" class="org.jboss.cache.config.EvictionConfig">
+ <property name="defaultEvictionPolicyClass"><value>org.jboss.cache.eviction.LRUPolicy</value></property>
+ <property name="wakeupIntervalSeconds"><value>5</value></property>
+ <property name="evictionRegionConfigs">
+ <list>
+ <bean name="ExampleDefaultEvictionRegionConfig" class="org.jboss.cache.config.EvictionRegionConfig">
+ <property name="regionName"><value>/_default_</value></property>
+ <property name="evictionPolicyConfig">
+ <bean id="ExampleDefaultLRUConfig" class="org.jboss.cache.eviction.LRUConfiguration">
+ <property name="maxNodes"><value>5000</value></property>
+ <property name="timeToLiveSeconds"><value>1000</value></property>
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="pojoCache" class="org.jboss.cache.pojo.PojoCacheFactory" factory-method="createCache">
+ <constructor-arg><ref local="CacheConfig"/></constructor-arg>
+ <constructor-arg><value>true</value></constructor-arg>
+ </bean>
+
+ <bean id="cachePostProcessor" class="org.jboss.spring.cluster.CachePostProcessor">
+ <constructor-arg><ref local="pojoCache"/></constructor-arg>
+ </bean>
+
+ <!-- app specific stuff -->
+
+ <bean id="plainPojo" class="org.jboss.test.spring.cluster.SimplePojo" scope="cache">
+ <property name="port">
+ <value>123</value>
+ </property>
+ <property name="host">
+ <value>PojoCache1</value>
+ </property>
+ <property name="value">
+ <value type="java.util.Locale">sl</value>
+ </property>
+ </bean>
+
+ <bean id="annotatedPojo" class="org.jboss.test.spring.cluster.AnnotatedPojo">
+ <property name="port">
+ <value>321</value>
+ </property>
+ <property name="host">
+ <value>PojoCache2</value>
+ </property>
+ <property name="value">
+ <value type="java.util.Locale">en</value>
+ </property>
+ </bean>
+
+</beans>
More information about the jboss-cvs-commits
mailing list