[jboss-cvs] JBossAS SVN: r109050 - in trunk: testsuite/imports and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 1 13:27:26 EDT 2010
Author: pferraro
Date: 2010-11-01 13:27:24 -0400 (Mon, 01 Nov 2010)
New Revision: 109050
Added:
trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperClient.java
trunk/testsuite/src/resources/web/sso/war/jboss-beans.xml
Removed:
trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperServletContextListener.java
trunk/testsuite/src/resources/cluster/cache/
trunk/testsuite/src/resources/cluster/cachemanager/
Modified:
trunk/cluster/src/resources/infinispan/infinispan-configs.xml
trunk/testsuite/imports/config/tests-clustering.xml
trunk/testsuite/imports/sections/web.xml
trunk/testsuite/imports/server-config.xml
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/AttributeBasedMaxUnreplicatedIntervalTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/BuddyReplicationFailoverUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ClusteredSessionNotificationPolicyTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ConcurrentFailoverRequestsTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/MultipleWarSingleRedeployTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SessionPassivationTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/web/test/ScopedTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java
trunk/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java
trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java
trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java
trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossCacheConfigTestSetupDelegate.java
trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossClusteredWebTestCase.java
trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
trunk/testsuite/src/resources/cluster/http/http-scoped/clearCache.jsp
trunk/testsuite/src/resources/cluster/http/version.jsp
trunk/testsuite/src/resources/cluster/web/cachehelper/jboss-beans.xml
trunk/testsuite/src/resources/web/sso/war/web-sso-expire.xml
Log:
Rename BR test configs to DIST.
Clean up CacheHelper logic.
Modified: trunk/cluster/src/resources/infinispan/infinispan-configs.xml
===================================================================
--- trunk/cluster/src/resources/infinispan/infinispan-configs.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/cluster/src/resources/infinispan/infinispan-configs.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -30,11 +30,11 @@
</infinispan-config>
<!-- web session replication cache definitions -->
- <infinispan-config name="web-session">
+ <infinispan-config name="web">
<alias>standard-session-cache</alias>
<infinispan xmlns="urn:infinispan:config:4.2">
<global>
- <transport clusterName="${jboss.partition.name:DefaultPartition}-SessionCache" distributedSyncTimeout="17500">
+ <transport clusterName="${jboss.partition.name:DefaultPartition}-WebSessionCache" distributedSyncTimeout="17500">
<properties>
<property name="stack" value="${jboss.default.jgroups.stack:udp}"/>
</properties>
@@ -53,7 +53,7 @@
<loaders passivation="true" shared="false">
<loader class="org.infinispan.loaders.file.FileCacheStore">
<properties>
- <property name="location" value="${jboss.server.data.dir}${/}web-session"/>
+ <property name="location" value="${jboss.server.data.dir}${/}web"/>
</properties>
</loader>
</loaders>
@@ -123,10 +123,10 @@
</infinispan-config>
<!-- Hibernate second-level cache -->
- <infinispan-config name="entity" jndi-name="java:CacheManager/entity">
+ <infinispan-config name="hibernate" jndi-name="java:CacheManager/entity">
<infinispan xmlns="urn:infinispan:config:4.2" xsi:schemaLocation="urn:infinispan:config:4.1 http://www.infinispan.org/schemas/infinispan-config-4.1.xsd">
<global>
- <transport clusterName="${jboss.partition.name:DefaultPartition}-entity" distributedSyncTimeout="17500">
+ <transport clusterName="${jboss.partition.name:DefaultPartition}-Hibernate2ndLevelCache" distributedSyncTimeout="17500">
<properties>
<property name="stack" value="${jboss.default.jgroups.stack:udp}"/>
</properties>
Modified: trunk/testsuite/imports/config/tests-clustering.xml
===================================================================
--- trunk/testsuite/imports/config/tests-clustering.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/imports/config/tests-clustering.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -74,7 +74,7 @@
<!-- Modify this patternset to get a custom set of tests to run via the
tests-cluster-custom target -->
<patternset id="cluster.custom.includes">
- <include name="org/jboss/test/cluster/ejb3/clusteredsession/**/unit/**TestCase.class"/>
+ <include name="org/jboss/test/cluster/**/BuddyReplication*UnitTestCase.class"/>
<!--exclude name="org/jboss/test/cluster/ejb3/clusteredsession/unit/ForeignPartitionLocalInterceptorUnitTestCase.class"/-->
</patternset>
@@ -149,7 +149,7 @@
<param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-1"/>
</antcall>
- <echo message="Going to call target tests-clustering-unit for HTTP tests (ASYNC, no BR)"/>
+ <echo message="Going to call target tests-clustering-unit for HTTP tests (REPL_ASYNC)"/>
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="${cluster.http.includes}"/>
@@ -173,7 +173,7 @@
<sleep seconds="4"/>
- <echo message="Going to call target tests-clustering-unit again with new configuration (SYNC, no BR)"/>
+ <echo message="Going to call target tests-clustering-unit again with new configuration (REPL_SYNC)"/>
<antcall target="tests-clustering-sync-configure" inheritRefs="true"/>
@@ -182,45 +182,42 @@
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="${cluster.http.jk.includes}"/>
- <param name="jboss-junit-configuration" value="SyncModeNUseJvm-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="sync-standard-session-cache"/>
+ <param name="jboss-junit-configuration" value="SYNC-${jboss-junit-configuration}"/>
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache/sync"/>
<param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-SYNC-0"/>
<param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-SYNC-1"/>
</antcall>
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="${cluster.http.includes}"/>
- <param name="jboss-junit-configuration" value="SyncModeNUseJvm-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="sync-standard-session-cache"/>
+ <param name="jboss-junit-configuration" value="SYNC-${jboss-junit-configuration}"/>
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache/sync"/>
<param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-SYNC-0"/>
<param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-SYNC-1"/>
</antcall>
- <server:stop name="cluster-${jboss-junit-configuration}-SYNC-0"/>
- <server:stop name="cluster-${jboss-junit-configuration}-SYNC-1"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-SYNC-0"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-SYNC-1"/>
- <sleep seconds="4"/>
+ <sleep seconds="4"/>
- <echo message="Going to call target tests-clustering-unit again with new configuration (SYNC, BR)"/>
+ <echo message="Going to call target tests-clustering-unit again with new configuration (DIST_SYNC)"/>
- <antcall target="tests-clustering-br-configure" inheritRefs="true"/>
+ <antcall target="tests-clustering-dist-configure" inheritRefs="true"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-1"/>
- <echo message="Going to call target tests-clustering-unit again with new configuration (SYNC, BR)"/>
-
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="${cluster.http.includes}"/>
- <param name="jboss-junit-configuration" value="BuddyReplEnabled-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="br-enabled-sync-standard-session-cache"/>
- <param name="jbosstest.cluster.web.cache.br" value="true"/>
- <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-BR-0"/>
- <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-BR-1"/>
+ <param name="jboss-junit-configuration" value="DIST-${jboss-junit-configuration}"/>
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache/dist"/>
+ <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-DIST-1"/>
</antcall>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-1"/>
</target>
@@ -238,13 +235,13 @@
<http-cluster-node-config-change conf="cluster-${jboss-junit-configuration}-SYNC-1"/>
</target>
- <target name="tests-clustering-br-configure" unless="${tests.clustering.skip.startup}">
- <create-cluster-node conf="cluster-${jboss-junit-configuration}-BR-0"/>
- <create-cluster-node conf="cluster-${jboss-junit-configuration}-BR-1"/>
+ <target name="tests-clustering-dist-configure" unless="${tests.clustering.skip.startup}">
+ <create-cluster-node conf="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <create-cluster-node conf="cluster-${jboss-junit-configuration}-DIST-1"/>
<echo message="Modifying the node0 and node1 Tomcat configuration for JK"/>
- <http-cluster-node-config-change conf="cluster-${jboss-junit-configuration}-BR-0"/>
- <http-cluster-node-config-change conf="cluster-${jboss-junit-configuration}-BR-1"/>
+ <http-cluster-node-config-change conf="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <http-cluster-node-config-change conf="cluster-${jboss-junit-configuration}-DIST-1"/>
</target>
<target name="tests-clustered-classloader-leak" depends="init">
@@ -440,7 +437,7 @@
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="one.test.includes"/>
<param name="jboss-junit-configuration" value="Default-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache"/>
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache"/>
<param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-0"/>
<param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-1"/>
</antcall>
@@ -470,28 +467,27 @@
<server:stop name="cluster-${jboss-junit-configuration}-1"/>
</target>
- <target name="one-cluster-test-br" if="test" depends="init">
+ <target name="one-cluster-test-dist" if="test" depends="init">
<property name="jboss-junit-configuration" value="udp"/>
- <antcall target="tests-clustering-br-configure" inheritRefs="true"/>
+ <antcall target="tests-clustering-dist-configure" inheritRefs="true"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-1"/>
<echo message="Going to call target tests-clustering-unit for ${test}"/>
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="one.test.includes"/>
- <param name="jboss-junit-configuration" value="BuddyReplEnabled-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="br-enabled-sync-standard-session-cache"/>
- <param name="jbosstest.cluster.web.cache.br" value="true"/>
- <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-BR-0"/>
- <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-BR-1"/>
+ <param name="jboss-junit-configuration" value="DIST-${jboss-junit-configuration}"/>
+ <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache/sync"/>
+ <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-DIST-1"/>
</antcall>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-1"/>
</target>
<!-- Runs the EJB3 tests -->
@@ -563,7 +559,7 @@
<server:stop name="cluster-${jboss-junit-configuration}-1"/>
</target>
- <!-- Runs only the basic http tests (ASYNC, no BR) -->
+ <!-- Runs only the basic http tests (REPL_ASYNC) -->
<target name="tests-clustering-http" depends="init">
<property name="jboss-junit-configuration" value="udp"/>
@@ -576,7 +572,7 @@
<antcall target="tests-clustering-unit" inheritRefs="true">
<param name="cluster.includes.refid" value="cluster.defaultcfg.http.includes"/>
<param name="jboss-junit-configuration" value="Default-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="standard-session-cache"/>
+ <param name="jboss.test.cluster.web.cache.config" value="standard-session-cache"/>
<param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-0"/>
<param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-1"/>
</antcall>
@@ -585,27 +581,26 @@
<server:stop name="cluster-${jboss-junit-configuration}-1"/>
</target>
- <!-- Runs only the basic http tests (ASYNC, with BR) -->
- <target name="tests-clustering-http-br" depends="init">
+ <!-- Runs only the basic http tests (DIST_SYNC) -->
+ <target name="tests-clustering-http-dist" depends="init">
- <property name="jboss-junit-configuration" value="udp"/>
+ <property name="jboss-junit-configuration" value="udp"/>
- <antcall target="tests-clustering-br-configure" inheritRefs="true"/>
+ <antcall target="tests-clustering-dist-configure" inheritRefs="true"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:start name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:start name="cluster-${jboss-junit-configuration}-DIST-1"/>
- <antcall target="tests-clustering-unit" inheritRefs="true">
- <param name="cluster.includes.refid" value="cluster.defaultcfg.http.includes"/>
- <param name="jboss-junit-configuration" value="BuddyReplEnabled-${jboss-junit-configuration}"/>
- <param name="jbosstest.cluster.web.cache.config" value="br-enabled-sync-standard-session-cache"/>
- <param name="jbosstest.cluster.web.cache.br" value="true"/>
- <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-BR-0"/>
- <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-BR-1"/>
- </antcall>
+ <antcall target="tests-clustering-unit" inheritRefs="true">
+ <param name="cluster.includes.refid" value="cluster.defaultcfg.http.includes"/>
+ <param name="jboss-junit-configuration" value="DIST-${jboss-junit-configuration}"/>
+ <param name="jboss.test.cluster.web.cache.config" value="standard-session-cache/dist"/>
+ <param name="jbosstest.cluster.node0.config" value="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <param name="jbosstest.cluster.node1.config" value="cluster-${jboss-junit-configuration}-DIST-1"/>
+ </antcall>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-0"/>
- <server:stop name="cluster-${jboss-junit-configuration}-BR-1"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-0"/>
+ <server:stop name="cluster-${jboss-junit-configuration}-DIST-1"/>
</target>
</project>
Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/imports/sections/web.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -420,11 +420,12 @@
webxml="${build.resources}/web/sso/war/web-sso-expire.xml">
<webinf dir="${build.resources}/web/sso/war">
<include name="jboss-web.xml"/>
+ <include name="jboss-beans.xml"/>
</webinf>
<classes dir="${build.classes}">
<include name="org/jboss/test/web/servlets/LogoutServlet.class"/>
<include name="org/jboss/test/web/util/Util*"/>
- <include name="org/jboss/test/cluster/web/CacheHelper*"/>
+ <include name="org/jboss/test/cluster/web/CacheHelper*"/>
</classes>
<fileset dir="${build.resources}/web/sso/war">
<include name="**/*.html"/>
Modified: trunk/testsuite/imports/server-config.xml
===================================================================
--- trunk/testsuite/imports/server-config.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/imports/server-config.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -409,7 +409,7 @@
<sysproperty key="jgroups.bind_addr" value="${node1.jgroups.bind_addr}" />
<sysproperty key="node0.bind.address" value="${node0}" />
</server>
- <server name="cluster-udp-BR-0" host="${node0}">
+ <server name="cluster-udp-DIST-0" host="${node0}">
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=512m" />
@@ -423,7 +423,7 @@
<sysproperty key="jgroups.bind_addr" value="${node0.jgroups.bind_addr}" />
<sysproperty key="node0.bind.address" value="${node0}" />
</server>
- <server name="cluster-udp-BR-1" host="${node1}">
+ <server name="cluster-udp-DIST-1" host="${node1}">
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=512m" />
@@ -519,7 +519,7 @@
<sysproperty key="jgroups.tcpping.initial_hosts" value="${node0}[7650],${node1}[7650]"/>
<sysproperty key="jgroups.bind_addr" value="${node1.jgroups.bind_addr}" />
</server>
- <server name="cluster-tcp-BR-0" host="${node0}">
+ <server name="cluster-tcp-DIST-0" host="${node0}">
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=512m" />
@@ -532,7 +532,7 @@
<sysproperty key="jgroups.tcpping.initial_hosts" value="${node0}[7650],${node1}[7650]"/>
<sysproperty key="jgroups.bind_addr" value="${node0.jgroups.bind_addr}" />
</server>
- <server name="cluster-tcp-BR-1" host="${node1}">
+ <server name="cluster-tcp-DIST-1" host="${node1}">
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=512m" />
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/EntityTestBean.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -61,9 +61,10 @@
private List<Cache<?, ?>> caches = new LinkedList<Cache<?, ?>>();
+ @Override
public void getCache(String regionPrefix)
{
- EmbeddedCacheManager container = DefaultCacheContainerRegistry.getInstance().getCacheContainer("entity");
+ EmbeddedCacheManager container = DefaultCacheContainerRegistry.getInstance().getCacheContainer("hibernate");
for (String cacheName: container.getCacheNames())
{
if (cacheName.startsWith(regionPrefix))
@@ -75,6 +76,7 @@
}
}
+ @Override
public Customer createCustomer()
{
System.out.println("CREATE CUSTOMER");
@@ -120,6 +122,7 @@
}
}
+ @Override
public Customer findByCustomerId(Integer id)
{
System.out.println("FIND CUSTOMER");
@@ -143,6 +146,7 @@
}
}
+ @Override
public String loadedFromCache()
{
System.out.println("CHECK CACHE");
@@ -166,6 +170,7 @@
}
+ @Override
@Remove
public void cleanup()
{
@@ -196,33 +201,29 @@
}
}
-// @Listener
-// public static class MyListener
-// {
- Set<String> visited = new ConcurrentSkipListSet<String>();
-
- public void clear()
+ private Set<String> visited = new ConcurrentSkipListSet<String>();
+
+ public void clear()
+ {
+ visited.clear();
+ }
+
+ @CacheEntryVisited
+ public void entryVisited(CacheEntryVisitedEvent event)
+ {
+ if (!event.isPre())
{
- visited.clear();
- }
-
- @CacheEntryVisited
- public void entryVisited(CacheEntryVisitedEvent event)
- {
- if (!event.isPre())
+ String key = event.getKey().toString();
+ System.out.println("MyListener - Visiting node " + key);
+ String token = ".clusteredentity.";
+ int index = key.indexOf(token);
+ if (index > -1)
{
- String key = event.getKey().toString();
- System.out.println("MyListener - Visiting node " + key);
- String token = ".clusteredentity.";
- int index = key.indexOf(token);
- if (index > -1)
- {
- index += token.length();
- String name = key.substring(index);
- System.out.println("MyListener - recording visit to " + name);
- visited.add(name);
- }
+ index += token.length();
+ String name = key.substring(index);
+ System.out.println("MyListener - recording visit to " + name);
+ visited.add(name);
}
}
-// }
+ }
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/clusteredentity/classloader/EntityQueryTestBean.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -72,11 +72,12 @@
{
}
+ @Override
public void getCache(String regionPrefix)
{
try
{
- EmbeddedCacheManager container = DefaultCacheContainerRegistry.getInstance().getCacheContainer("entity");
+ EmbeddedCacheManager container = DefaultCacheContainerRegistry.getInstance().getCacheContainer("hibernate");
for (String cacheName: container.getCacheNames())
{
if (cacheName.startsWith(regionPrefix))
@@ -94,18 +95,17 @@
}
}
+ @Override
public void updateAccountBranch(Integer id, String branch)
{
- Account account = (Account) manager.find(Account.class, id);
+ Account account = manager.find(Account.class, id);
account.setBranch(branch);
}
+ @Override
public int getCountForBranch(String branch, boolean useNamed, boolean useRegion)
{
- if (useNamed)
- return getCountForBranchViaNamedQuery(branch, useRegion);
- else
- return getCountForBranchViaLocalQuery(branch, useRegion);
+ return useNamed ? getCountForBranchViaNamedQuery(branch, useRegion) : getCountForBranchViaLocalQuery(branch, useRegion);
}
private int getCountForBranchViaLocalQuery(String branch, boolean useRegion)
@@ -133,6 +133,7 @@
/* (non-Javadoc)
* @see org.jboss.ejb3.test.clusteredentity.EntityQueryTest#createAccount(org.jboss.ejb3.test.clusteredentity.AccountHolderPK, Integer, Integer)
*/
+ @Override
public void createAccount(AccountHolderPK pk, Integer id, Integer openingBalance, String branch)
{
Account account = new Account();
@@ -143,18 +144,17 @@
manager.persist(account);
}
+ @Override
public void updateAccountBalance(Integer id, Integer newBalance)
{
- Account account = (Account) manager.find(Account.class, id);
+ Account account = manager.find(Account.class, id);
account.setBalance(newBalance);
}
+ @Override
public String getBranch(AccountHolderPK pk, boolean useNamed, boolean useRegion)
{
- if (useNamed)
- return getBranchViaNamedQuery(pk, useRegion);
- else
- return getBranchViaLocalQuery(pk, useRegion);
+ return useNamed ? getBranchViaNamedQuery(pk, useRegion) : getBranchViaLocalQuery(pk, useRegion);
}
private String getBranchViaLocalQuery(AccountHolderPK pk, boolean useRegion)
@@ -180,12 +180,11 @@
query.setParameter(1, pk);
return (String) query.getResultList().get(0);
}
+
+ @Override
public int getTotalBalance(AccountHolderPK pk, boolean useNamed, boolean useRegion)
{
- if (useNamed)
- return getTotalBalanceViaNamedQuery(pk, useRegion);
- else
- return getTotalBalanceViaLocalQuery(pk, useRegion);
+ return useNamed ? getTotalBalanceViaNamedQuery(pk, useRegion) : getTotalBalanceViaLocalQuery(pk, useRegion);
}
private int getTotalBalanceViaLocalQuery(AccountHolderPK pk, boolean useRegion)
@@ -217,16 +216,19 @@
return total;
}
+ @Override
public boolean getSawRegionModification(String regionName)
{
return this.modified.remove(regionName);
}
+ @Override
public boolean getSawRegionAccess(String regionName)
{
return this.accessed.remove(regionName);
}
+ @Override
public void cleanup()
{
internalCleanup();
@@ -250,6 +252,7 @@
}
}
+ @Override
@PreDestroy
@Remove
public void remove(boolean removeEntities)
@@ -274,7 +277,7 @@
cache.removeListener(this);
}
this.caches.clear();
- DefaultCacheContainerRegistry.getInstance().getCacheContainer("entity").removeListener(this);
+ DefaultCacheContainerRegistry.getInstance().getCacheContainer("hibernate").removeListener(this);
}
catch (Exception e)
{
@@ -282,64 +285,54 @@
}
}
-// @Listener
-// public static class MyListener
-// {
- Set<String> modified = new ConcurrentSkipListSet<String>();
- Set<String> accessed = new ConcurrentSkipListSet<String>();
-// private Collection<Cache<?, ?>> caches;
-
-// public MyListener(Collection<Cache<?, ?>> caches)
-// {
-// this.caches = caches;
-// }
-
- public void clear()
+ private Set<String> modified = new ConcurrentSkipListSet<String>();
+ private Set<String> accessed = new ConcurrentSkipListSet<String>();
+
+ public void clear()
+ {
+ modified.clear();
+ accessed.clear();
+ }
+
+ @CacheStarted
+ public void cacheStarted(CacheStartedEvent event)
+ {
+ Cache<?, ?> cache = event.getCacheManager().getCache(event.getCacheName());
+ System.out.println("Adding cache listener for " + event.getCacheName());
+ cache.addListener(this);
+ this.caches.add(cache);
+ }
+
+ @CacheEntryModified
+ public void entryModified(CacheEntryModifiedEvent event)
+ {
+ if (!event.isPre())
{
- modified.clear();
- accessed.clear();
+ String region = event.getCache().getName();
+ System.out.println("MyListener - Modified cache entry " + region);
+ modified.add(region);
}
-
- @CacheStarted
- public void cacheStarted(CacheStartedEvent event)
+ }
+
+ @CacheEntryCreated
+ public void entryCreated(CacheEntryCreatedEvent event)
+ {
+ if (!event.isPre())
{
- Cache<?, ?> cache = event.getCacheManager().getCache(event.getCacheName());
- System.out.println("Adding cache listener for " + event.getCacheName());
- cache.addListener(this);
- this.caches.add(cache);
+ String region = event.getCache().getName();
+ System.out.println("MyListener - Created cache entry " + region);
+ modified.add(region);
}
-
- @CacheEntryModified
- public void entryModified(CacheEntryModifiedEvent event)
+ }
+
+ @CacheEntryVisited
+ public void entryVisited(CacheEntryVisitedEvent event)
+ {
+ if (!event.isPre())
{
- if (!event.isPre())
- {
- String region = event.getCache().getName();
- System.out.println("MyListener - Modified cache entry " + region);
- modified.add(region);
- }
+ String region = event.getCache().getName();
+ System.out.println("MyListener - Visited cache entry " + region);
+ accessed.add(region);
}
-
- @CacheEntryCreated
- public void entryCreated(CacheEntryCreatedEvent event)
- {
- if (!event.isPre())
- {
- String region = event.getCache().getName();
- System.out.println("MyListener - Created cache entry " + region);
- modified.add(region);
- }
- }
-
- @CacheEntryVisited
- public void entryVisited(CacheEntryVisitedEvent event)
- {
- if (!event.isPre())
- {
- String region = event.getCache().getName();
- System.out.println("MyListener - Visited cache entry " + region);
- accessed.add(region);
- }
- }
-// }
+ }
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/AttributeBasedMaxUnreplicatedIntervalTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/AttributeBasedMaxUnreplicatedIntervalTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/AttributeBasedMaxUnreplicatedIntervalTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -47,7 +47,7 @@
public static Test suite() throws Exception
{
- return CacheConfigTestSetup.getTestSetup(AttributeBasedMaxUnreplicatedIntervalTestCase.class, cacheContainers, false, null, !useBuddyRepl);
+ return CacheConfigTestSetup.getTestSetup(AttributeBasedMaxUnreplicatedIntervalTestCase.class, cacheContainers, false, null, null);
}
protected ReplicationGranularity getReplicationGranularity()
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/BuddyReplicationFailoverUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/BuddyReplicationFailoverUnitTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/BuddyReplicationFailoverUnitTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -72,11 +72,19 @@
return CacheConfigTestSetup.getTestSetup(BuddyReplicationFailoverUnitTestCase.class, cacheContainers, false, root.getAbsolutePath(), false);
}
+ /**
+ * {@inheritDoc}
+ * @see junit.framework.TestCase#setUp()
+ */
@Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ @Override
protected void tearDown() throws Exception
{
- super.tearDown();
-
for (JBossCacheManager<?> manager : managers)
{
if (manager != null)
@@ -84,6 +92,8 @@
manager.stop();
}
}
+
+ super.tearDown();
}
protected ReplicationGranularity getReplicationGranularity()
@@ -98,37 +108,53 @@
public void testInvalidateOnFailoverToBackup() throws Exception
{
- log.info("++++ Starting testInvalidateOnFailoverToBackup ++++");
+ this.log.info("++++ Starting testInvalidateOnFailoverToBackup ++++");
String warname = String.valueOf(++testId);
+ this.log.info("Starting managers");
+
// A war with a maxInactive of 30 mins and a maxIdle of 1
this.startManagers(warname, 1800000, 1, -1);
+ this.log.info("Request(1) to manager[3]");
+
SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", getAttributeValue(0)), false);
invokeRequest(managers[3], setHandler, null);
+ this.log.info("Request(2) to manager[3]");
+
String id = setHandler.getSessionId();
setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", getAttributeValue(1)), false);
invokeRequest(managers[3], setHandler, id);
assertEquals(getAttributeValue(0), setHandler.getCheckedAttributes().get("count"));
+ this.log.info("Sleeping");
+
sleepThread(1100);
+ this.log.info("Run passivation");
+
managers[0].backgroundProcess();
managers[1].backgroundProcess();
managers[2].backgroundProcess();
managers[3].backgroundProcess();
+ this.log.info("Request(3) to manager[3]");
+
setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", getAttributeValue(2)), false);
invokeRequest(managers[3], setHandler, id);
assertEquals(getAttributeValue(1), setHandler.getCheckedAttributes().get("count"));
+ this.log.info("Request(4) to manager[3]");
+
setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", getAttributeValue(3)), false);
invokeRequest(managers[3], setHandler, id);
assertEquals(getAttributeValue(2), setHandler.getCheckedAttributes().get("count"));
+ this.log.info("Invalidate request to manager[0]");
+
// Invalidate on the failover request
InvalidateSessionRequestHandler invalidationHandler = new InvalidateSessionRequestHandler(Collections.singleton("count"), false);
invokeRequest(managers[0], invalidationHandler, id);
@@ -139,12 +165,13 @@
assertNull(setHandler.getCheckedAttributes().get("count"));
}
- public void testFailoverAndFailBack() throws Exception
+ public void testFailoverAndFailBack() throws Throwable
{
log.info("++++ Starting testFailoverAndFailBack ++++");
String warname = String.valueOf(++testId);
-
+ try
+ {
// A war with a maxInactive of 30 mins and no maxIdle
this.startManagers(warname, 1800000, -1, -1);
@@ -190,6 +217,12 @@
setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", getAttributeValue(0)), false);
invokeRequest(managers[0], invalidationHandler, id);
assertNull(setHandler.getCheckedAttributes().get("count"));
+ }
+ catch (Throwable e)
+ {
+ log.error(e.getMessage(), e);
+ throw e;
+ }
}
protected void startManagers(String warname, int maxInactive, int maxIdle, int maxUnreplicated) throws Exception
@@ -202,5 +235,4 @@
managers[i].start();
}
}
-
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ClusteredSessionNotificationPolicyTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ClusteredSessionNotificationPolicyTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ClusteredSessionNotificationPolicyTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -60,8 +60,6 @@
protected static long testId = System.currentTimeMillis();
- protected static boolean useBuddyRepl = Boolean.valueOf(System.getProperty("jbosstest.cluster.web.cache.br")).booleanValue();
-
protected Logger log = Logger.getLogger(getClass());
protected JBossCacheManager<?>[] managers = new JBossCacheManager[cacheContainers.length];
@@ -85,7 +83,7 @@
{
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File root = new File(tmpDir, ClusteredSessionNotificationPolicyTestCase.class.getSimpleName());
- return CacheConfigTestSetup.getTestSetup(ClusteredSessionNotificationPolicyTestCase.class, cacheContainers, false, root.getAbsolutePath(), !useBuddyRepl);
+ return CacheConfigTestSetup.getTestSetup(ClusteredSessionNotificationPolicyTestCase.class, cacheContainers, false, root.getAbsolutePath(), null);
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ConcurrentFailoverRequestsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ConcurrentFailoverRequestsTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/ConcurrentFailoverRequestsTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -81,6 +81,7 @@
super.setUp();
jgSupport.setUpProperties();
+
}
@Override
@@ -128,22 +129,44 @@
public void testConcurrentFailoverRequests() throws Exception
{
+ log.info("++++ Starting testConcurrentFailoverRequests ++++");
+
++testCount;
+ log.info("Starting cache containers");
+
String warName = "test" + testCount;
JBossWebMetaData webMetaData = SessionTestUtil.createWebMetaData(100);
for (int i = 0; i < cacheContainers.length; ++i)
{
cacheContainers[i] = SessionTestUtil.createCacheContainer(false, null, false, false);
cacheContainers[i].start();
-
+ }
+/*
+ log.info("Blocking until all views are received");
+
+ SessionTestUtil.blockUntilViewsReceived(cacheContainers, 10000);
+
+ log.info("All views received");
+*/
+ log.info("Starting managers");
+ EmbeddedCacheManager[] containers = new EmbeddedCacheManager[cacheContainers.length];
+
+ for (int i = 0; i < cacheContainers.length; ++i)
+ {
managers[i] = SessionTestUtil.createManager(warName, 30, cacheContainers[i], null);
managers[i].init(warName, webMetaData);
managers[i].start();
+
+ containers[i] = (EmbeddedCacheManager) cacheContainers[i].getCache(managers[i].getName()).getCacheManager();
}
- SessionTestUtil.blockUntilViewsReceived(cacheContainers, 10000);
+ log.info("Blocking until all views are received");
+ SessionTestUtil.blockUntilViewsReceived(containers, 10000);
+
+ log.info("All views received");
+
Object value = "0";
Map<String, Object> attrs = Collections.unmodifiableMap(Collections.singletonMap("count", value));
SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attrs, false);
@@ -261,8 +284,6 @@
concurrentHandler.unregisterHandler();
}
-
}
-
}
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/MultipleWarSingleRedeployTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/MultipleWarSingleRedeployTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/MultipleWarSingleRedeployTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -52,8 +52,6 @@
protected static long testId = System.currentTimeMillis();
- protected static boolean useBuddyRepl = Boolean.valueOf(System.getProperty("jbosstest.cluster.web.cache.br")).booleanValue();
-
protected Logger log = Logger.getLogger(getClass());
protected JBossCacheManager<?>[] managersA = new JBossCacheManager[cacheContainers.length];
@@ -68,7 +66,7 @@
public static Test suite() throws Exception
{
- return CacheConfigTestSetup.getTestSetup(MultipleWarSingleRedeployTestCase.class, cacheContainers, false, null, !useBuddyRepl);
+ return CacheConfigTestSetup.getTestSetup(MultipleWarSingleRedeployTestCase.class, cacheContainers, false, null, null);
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionBasedMaxUnreplicatedIntervalTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -53,8 +53,6 @@
protected static long testId = System.currentTimeMillis();
- protected static boolean useBuddyRepl = Boolean.valueOf(System.getProperty("jbosstest.cluster.web.cache.br")).booleanValue();
-
protected Logger log = Logger.getLogger(getClass());
protected JBossCacheManager<?>[] managers = new JBossCacheManager[cacheContainers.length];
@@ -70,9 +68,8 @@
public static Test suite() throws Exception
{
- return CacheConfigTestSetup.getTestSetup(SessionBasedMaxUnreplicatedIntervalTestCase.class, cacheContainers, false, null, !useBuddyRepl);
+ return CacheConfigTestSetup.getTestSetup(SessionBasedMaxUnreplicatedIntervalTestCase.class, cacheContainers, false, null, null);
}
-
@Override
protected void setUp() throws Exception
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SessionPassivationTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SessionPassivationTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SessionPassivationTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -35,6 +35,7 @@
import org.apache.commons.httpclient.methods.GetMethod;
import org.jboss.test.cluster.testutil.SessionTestUtil;
import org.jboss.test.cluster.testutil.WebTestBase;
+import org.jboss.test.cluster.web.CacheHelperClient;
import org.jboss.test.cluster.web.JBossClusteredWebTestCase;
/**
@@ -56,7 +57,6 @@
protected String setUrlBase_;
protected String getUrlBase_;
protected String invalidateUrlBase_;
- private boolean usingBuddyReplication_;
private Set<HttpClient> clients = new HashSet<HttpClient>();
@@ -89,6 +89,7 @@
"http-session-pass.war");
}
+ @Override
protected void setUp() throws Exception
{
super.setUp();
@@ -104,11 +105,9 @@
deploy(adaptors[1]);
deployed1 = true;
}
-
- String br = System.getProperty("jbosstest.cluster.web.cache.br");
- usingBuddyReplication_ = Boolean.parseBoolean(br);
}
+ @Override
protected void tearDown() throws Exception
{
super.tearDown();
@@ -130,9 +129,9 @@
clients.clear();
}
- protected boolean isCleanCacheOnRedeploy()
+ protected boolean isCleanCacheOnRedeploy() throws Exception
{
- return usingBuddyReplication_;
+ return new CacheHelperClient(this.getAdaptors()[0]).isDistributed();
}
/**
@@ -230,8 +229,8 @@
{
// Make sure the cache is not stopped during redeploy due to
// no services using it. Tell CacheHelper to hold a ref.
- String cacheConfigName = System.getProperty(SessionTestUtil.CACHE_CONFIG_PROP, "standard-session-cache");
- SessionTestUtil.setCacheConfigName(adaptors[0], cacheConfigName);
+// String cacheConfigName = System.getProperty(SessionTestUtil.CACHE_CONFIG_PROP, "standard-session-cache");
+// SessionTestUtil.setCacheConfigName(adaptors[0], cacheConfigName);
}
sleep(2000);
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/web/test/ScopedTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/web/test/ScopedTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/web/test/ScopedTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -228,8 +228,10 @@
* @throws Exception
*/
public void testNonPrimitiveRepeatedModify()
- throws Exception
+ throws Throwable
{
+ try
+ {
String attr = "";
getLog().info("Enter testNonPrimitiveRepeatedModify");
@@ -238,45 +240,61 @@
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
+ getLog().info("// Set the session attribute first");
// Set the session attribute first
makeGet(client, baseURL0_ +setUrl);
+ getLog().info("// Get the Attribute set");
// Get the Attribute set
String attrOld = makeGetWithState(client, baseURL0_ +getUrl);
+ getLog().info("// Modify a method instance");
// Modify a method instance.
makeGet(client, baseURL0_ +modifyUrl);
+ getLog().info("// Get the Attribute set");
// Get the Attribute set
attr = makeGetWithState(client, baseURL0_ +getUrl);
sleepThread(DEFAULT_SLEEP);
+ getLog().info("// Make connection to server 1 and get");
// Make connection to server 1 and get
SessionTestUtil.setCookieDomainToThisServer(client, servers_[1]);
String attr2 = makeGetWithState(client, baseURL1_ +getUrl);
+ getLog().info("// Check the result");
// Check the result
assertFalse("Old attribute should be different from new one.",
attrOld.equals(attr));
assertEquals("Attributes should be the same", attr, attr2);
+ getLog().info("// Modify a method instance.");
// Modify a method instance.
makeGet(client, baseURL1_ +modifyUrl);
+ getLog().info("// Get the Attribute set");
// Get the Attribute set
attr = makeGetWithState(client, baseURL1_ +getUrl);
sleepThread(DEFAULT_SLEEP);
+ getLog().info("// Make connection to server 1 and get");
// Make connection to server 1 and get
SessionTestUtil.setCookieDomainToThisServer(client, servers_[0]);
attr2 = makeGetWithState(client, baseURL0_ +getUrl);
+ getLog().info("// Check the result");
// Check the result
assertEquals("Attributes should be the same after second modify", attr, attr2);
getLog().debug("Exit testNonPrimitiveRepeatedModify");
+ }
+ catch (Throwable e)
+ {
+ getLog().error(e.getMessage(), e);
+ throw e;
+ }
}
/**
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/testutil/CacheConfigTestSetup.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -38,7 +38,7 @@
*/
public class CacheConfigTestSetup extends JBossTestSetup
{
- public static Test getTestSetup(Class<?> clazz, final CacheContainer[] cacheContainers, final boolean local, final String passivationDir, final boolean totalReplication) throws Exception
+ public static Test getTestSetup(Class<?> clazz, final CacheContainer[] cacheContainers, final boolean local, final String passivationDir, final Boolean totalReplication) throws Exception
{
final TestSuite suite = new TestSuite();
suite.addTest(new TestSuite(clazz));
@@ -48,7 +48,7 @@
private CacheContainer[] cacheContainers;
private String passivationDir;
private boolean local;
- private boolean totalReplication;
+ private Boolean totalReplication;
private final List<String> cleanupPaths = new ArrayList<String>();
/**
@@ -57,7 +57,7 @@
* @param test
* @throws Exception
*/
- public CacheConfigTestSetup(Test test, CacheContainer[] cacheContainers, boolean local, String passivationDir, boolean totalReplication) throws Exception
+ public CacheConfigTestSetup(Test test, CacheContainer[] cacheContainers, boolean local, String passivationDir, Boolean totalReplication) throws Exception
{
super(test);
this.cacheContainers = cacheContainers;
@@ -66,8 +66,10 @@
this.totalReplication = totalReplication;
}
+ @Override
protected void setUp() throws Exception
{
+ super.setUp();
if (cacheContainers == null) return;
JGroupsSystemPropertySupport jgSupport = new JGroupsSystemPropertySupport();
@@ -84,13 +86,12 @@
{
throw new RuntimeException("Cannot create base passivation dir " + passivationDir);
}
- else
- {
- cleanupPaths.add(base.getAbsolutePath());
- }
+
+ cleanupPaths.add(base.getAbsolutePath());
}
}
long now = System.currentTimeMillis();
+ boolean totalReplication = (this.totalReplication != null) ? this.totalReplication.booleanValue() : !System.getProperty(SessionTestUtil.CACHE_CONFIG_PROP, "standard-session-cache").endsWith("dist");
for (int i = 0; i < cacheContainers.length; i++)
{
String cacheStore = (passivationDir == null ? null : new File(passivationDir, String.valueOf( now + i)).getAbsolutePath());
@@ -114,6 +115,7 @@
}
}
+ @Override
protected void tearDown() throws Exception
{
for (CacheContainer cacheContainer: cacheContainers)
@@ -125,5 +127,6 @@
{
SessionTestUtil.cleanFilesystem(path);
}
+ super.tearDown();
}
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/testutil/SessionTestUtil.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -31,9 +31,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import javax.management.MBeanServerConnection;
import javax.servlet.ServletException;
import org.apache.catalina.Context;
@@ -58,6 +56,7 @@
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.remoting.transport.Address;
import org.infinispan.util.concurrent.IsolationLevel;
+import org.jboss.ha.ispn.DefaultCacheContainer;
import org.jboss.logging.Logger;
import org.jboss.metadata.javaee.spec.EmptyMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
@@ -66,7 +65,6 @@
import org.jboss.metadata.web.jboss.ReplicationGranularity;
import org.jboss.metadata.web.jboss.ReplicationTrigger;
import org.jboss.metadata.web.jboss.SnapshotMode;
-import org.jboss.test.cluster.web.CacheHelper;
import org.jboss.test.cluster.web.mocks.BasicRequestHandler;
import org.jboss.test.cluster.web.mocks.MockEngine;
import org.jboss.test.cluster.web.mocks.MockHost;
@@ -88,34 +86,11 @@
* @version $Revision$
*/
public class SessionTestUtil
-{
+{
public static final String CACHE_CONFIG_PROP = "jbosstest.cluster.web.cache.config";
- public static final String CACHE_TYPE_PROP = "jbosstest.cluster.web.cache.pojo";
private static final Logger log = Logger.getLogger(SessionTestUtil.class);
- private static final String[] STRING_ONLY_TYPES = { String.class.getName() };
- private static final String[] STRING_STRING_TYPES = { String.class.getName(), String.class.getName() };
- private static final String[] STRING_BOOLEAN_TYPES = { String.class.getName(), boolean.class.getName() };
-/*
- public static JBossCacheManager<?> createManager(String warName, int maxInactiveInterval,
- boolean local, String passivationDir,
- boolean totalReplication, boolean marshalling,
- String jvmRoute) throws Exception
- {
- return createManager(warName, maxInactiveInterval, local, passivationDir,
- totalReplication, marshalling, false, jvmRoute);
- }
-
- public static JBossCacheManager<?> createManager(String warName, int maxInactiveInterval,
- boolean local, String passivationDir,
- boolean totalReplication, boolean marshalling,
- boolean purgeCacheLoader,
- String jvmRoute) throws Exception
- {
- EmbeddedCacheManager cacheContainer = createCacheContainer(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
- return createManager(warName, maxInactiveInterval, cacheContainer, jvmRoute);
- }
-*/
+
public static JBossCacheManager<?> createManager(String warName,
int maxInactiveInterval,
final CacheContainer cacheContainer,
@@ -156,60 +131,25 @@
GlobalConfiguration globalConfig = local ? GlobalConfiguration.getNonClusteredDefault() : GlobalConfiguration.getClusteredDefault();
globalConfig.setClusterName("testing");
globalConfig.setStrictPeerToPeer(false);
-
+
Configuration config = new Configuration();
config.setInvocationBatchingEnabled(true);
config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
config.setSyncReplTimeout(20000);
config.setLockAcquisitionTimeout(15000);
config.setCacheMode(local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC));
- if (config.getCacheMode().isReplicated())
+
+ CacheMode mode = config.getCacheMode();
+ if (mode.isReplicated())
{
config.setFetchInMemoryState(true);
}
-
- // Block for commits -- no races between test driver and replication
- config.setSyncCommitPhase(true);
- config.setSyncRollbackPhase(true);
-
- if (passivationDir != null)
+ else if (mode.isDistributed())
{
- CacheLoaderManagerConfig managerConfig = new CacheLoaderManagerConfig();
- managerConfig.setPassivation(true);
- managerConfig.setShared(false);
-
- FileCacheStoreConfig fileConfig = new FileCacheStoreConfig();
- fileConfig.setLocation(passivationDir);
- fileConfig.setFetchPersistentState(true);
- fileConfig.setPurgeOnStartup(purgeCacheLoader);
- fileConfig.setIgnoreModifications(false);
-
- managerConfig.setCacheLoaderConfigs(Collections.<CacheLoaderConfig>singletonList(fileConfig));
-
- config.setCacheLoaderManagerConfig(managerConfig);
- }
-
- if (config.getCacheMode().isDistributed())
- {
config.setNumOwners(2);
+ config.setFetchInMemoryState(false);
}
- return new DefaultCacheManager(globalConfig, config);
- }
-/*
- public static DistributedCacheManagerFactory createDistributedCacheManagerFactory(boolean local, String passivationDir,
- boolean totalReplication, boolean marshalling, boolean purgeCacheLoader) throws Exception
- {
- GlobalConfiguration globalConfig = new GlobalConfiguration();
- globalConfig.setClusterName("Tomcat-TestCluster");
-
- Configuration config = new Configuration();
- config.setTransactionManagerLookupClass(BatchModeTransactionManager.class.getName());
- config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- config.setSyncReplTimeout(20000);
- config.setLockAcquisitionTimeout(15000);
- config.setCacheMode(local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC));
-
// Block for commits -- no races between test driver and replication
config.setSyncCommitPhase(true);
config.setSyncRollbackPhase(true);
@@ -218,7 +158,7 @@
{
CacheLoaderManagerConfig managerConfig = new CacheLoaderManagerConfig();
managerConfig.setPassivation(true);
- managerConfig.setShared(true);
+ managerConfig.setShared(false);
FileCacheStoreConfig fileConfig = new FileCacheStoreConfig();
fileConfig.setLocation(passivationDir);
@@ -231,29 +171,9 @@
config.setCacheLoaderManagerConfig(managerConfig);
}
- if (config.getCacheMode().isDistributed())
- {
- config.setNumOwners(2);
- }
-
- final CacheContainer container = new DefaultCacheManager(globalConfig, config);
-
- CacheSource source = new CacheSource()
- {
- @Override
- public <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager)
- {
- return container.getCache();
- }
- };
-
- org.jboss.web.tomcat.service.session.distributedcache.ispn.DistributedCacheManagerFactory factory = new org.jboss.web.tomcat.service.session.distributedcache.ispn.DistributedCacheManagerFactory();
-
- factory.setCacheSource(source);
-
- return factory;
+ return new DefaultCacheContainer(new DefaultCacheManager(globalConfig, config, false));
}
-*/
+
public static void setupContainer(String warName, String jvmRoute, Manager mgr)
{
MockEngine engine = new MockEngine();
@@ -387,74 +307,7 @@
}
}
}
-
- public static Object getSessionVersion(MBeanServerConnection adaptor, String webapp, String sessionId) throws Exception
- {
- return adaptor.invoke(CacheHelper.OBJECT_NAME,
- "getSessionVersion",
- new Object[] { webapp, sessionId },
- STRING_STRING_TYPES);
- }
- public static Object getBuddySessionVersion(MBeanServerConnection adaptor, String sessionFqn) throws Exception
- {
-
- return adaptor.invoke(CacheHelper.OBJECT_NAME,
- "getBuddySessionVersion",
- new Object[] { sessionFqn },
- STRING_ONLY_TYPES);
- }
-
- public static void setCacheConfigName(MBeanServerConnection adaptor, String cacheConfigName) throws Exception
- {
- adaptor.invoke(CacheHelper.OBJECT_NAME,
- "setCacheConfigName",
- new Object[] { cacheConfigName },
- new String[]{ String.class.getName() });
- }
-
- @SuppressWarnings("unchecked")
- public static Set<String> getSessionIds(MBeanServerConnection adaptor, String warFqn) throws Exception
- {
- return (Set<String>) adaptor.invoke(CacheHelper.OBJECT_NAME,
- "getSessionIds",
- new Object[] { warFqn },
- STRING_ONLY_TYPES);
- }
-
- @SuppressWarnings("unchecked")
- public static Set<String> getSessionIds(MBeanServerConnection adaptor, String warFqn, boolean includeBuddies) throws Exception
- {
- return (Set<String>) adaptor.invoke(CacheHelper.OBJECT_NAME,
- "getSessionIds",
- new Object[] { warFqn, Boolean.valueOf(includeBuddies) },
- STRING_BOOLEAN_TYPES);
- }
-
- @SuppressWarnings("unchecked")
- public static Set<String> releaseCache(MBeanServerConnection adaptor) throws Exception
- {
- return (Set<String>) adaptor.invoke(CacheHelper.OBJECT_NAME,
- "releaseCache",
- new Object[0],
- new String[0]);
- }
-
- public static boolean isBuddyReplication() throws Exception
- {
- return Boolean.parseBoolean(System.getProperty("jbosstest.cluster.web.cache.br", "false"));
- }
-
- public static String getSessionFqn(String contextPath, String sessionId)
- {
- return "/JSESSION/" + SessionTestUtil.getContextHostPath("localhost", contextPath) + "/" + sessionId;
- }
-
- public static String getContextHostPath(String hostname, String contextPath)
- {
- return contextPath + "_" + hostname;
- }
-
/**
* Loops, continually calling {@link #areCacheViewsComplete(TestDistributedCacheManagerFactory[])}
* until it either returns true or <code>timeout</code> ms have elapsed.
@@ -500,6 +353,7 @@
{
for (EmbeddedCacheManager cacheContainer: cacheContainers)
{
+ log.info("Cache container " + cacheContainer.getClusterName() + " members: " + cacheContainer.getMembers());
if (!isCacheViewComplete(cacheContainer, cacheContainers.length, barfIfTooManyMembers))
{
return false;
@@ -540,7 +394,8 @@
throw new IllegalStateException(sb.toString());
}
- else return false;
+
+ return false;
}
return true;
@@ -556,8 +411,10 @@
for(int c = 0; c < cookies.length; c ++)
{
Cookie k = cookies[c];
- if( k.getName().equalsIgnoreCase("JSESSIONID") )
+ if(k.getName().equalsIgnoreCase("JSESSIONID"))
+ {
sessionID = k;
+ }
}
return sessionID;
}
@@ -567,7 +424,9 @@
// Get the session cookie
Cookie sessionID = getSessionCookie(client);
if (sessionID == null)
+ {
throw new IllegalStateException("No session cookie found on " + client);
+ }
// Reset the domain so that the cookie will be sent to server1
sessionID.setDomain(server);
client.getState().addCookie(sessionID);
@@ -587,7 +446,6 @@
{
assertEquals(entry.getKey(), expected.get(entry.getKey()), entry.getValue());
}
-
}
public static void validateNewSession(BasicRequestHandler handler)
@@ -600,7 +458,9 @@
}
Map<String, Object> checked = handler.getCheckedAttributes();
for (Map.Entry<String, Object> entry : checked.entrySet())
+ {
assertNull(entry.getKey(), entry.getValue());
+ }
}
public static String getPassivationDir(String rootDir, long testCount, int cacheCount)
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -25,15 +25,17 @@
import java.util.Map;
import java.util.Set;
-import javax.management.ObjectName;
-
import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.context.Flag;
import org.infinispan.manager.CacheContainer;
-import org.jboss.ha.ispn.DefaultCacheContainerRegistry;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.jboss.ha.ispn.CacheContainerRegistry;
import org.jboss.ha.ispn.atomic.AtomicMapCache;
-import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionMapEntry;
+import org.jboss.web.tomcat.service.sso.ispn.CredentialKey;
+import org.jboss.web.tomcat.service.sso.ispn.SSOKey;
/**
* Helper class to locate and invoke methods on the cache mbeans used by JBossWeb.
@@ -53,29 +55,60 @@
{
public static final String CACHE_CONFIG_PROP = "jbosstest.cluster.web.cache.config";
- public static final ObjectName OBJECT_NAME =
- ObjectNameFactory.create("jboss.test:service=WebTestCacheHelper");
+ public static final String OBJECT_NAME = "jboss.test:service=WebTestCacheHelper";
- private CacheContainer container;
-// private boolean usePojoCache;
+ private final CacheContainer container;
+ private final String cacheName;
- public void setCacheConfigName(String cacheConfigName)
+ public CacheHelper(CacheContainerRegistry registry, String config)
{
- this.container = DefaultCacheContainerRegistry.getInstance().getCacheContainer(cacheConfigName);
+ String containerName = config;
+ String cacheName = null;
+
+ String[] parts = config.split("/");
+ if (parts.length == 2)
+ {
+ containerName = parts[0];
+ cacheName = parts[1];
+ }
+
+ this.container = registry.getCacheContainer(containerName);
+ this.cacheName = cacheName;
}
- public Object getSessionVersion(String webapp, String sessionId)
+ @Override
+ public boolean isDistributed()
{
+ EmbeddedCacheManager container = (EmbeddedCacheManager) this.container;
+ Configuration config = (this.cacheName != null) ? container.defineConfiguration(this.cacheName, new Configuration()) : container.getDefaultConfiguration();
+ return config.getCacheMode().isDistributed();
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#clear()
+ */
+ @Override
+ public void clear(String webapp)
+ {
+ this.container.getCache(webapp).getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear();
+ }
+
+ @Override
+ public Integer getSessionVersion(String webapp, String sessionId)
+ {
Cache<String, Map<Object, Object>> cache = this.container.getCache(webapp);
Map<Object, Object> map = new AtomicMapCache<String, Object, Object>(cache).get(sessionId);
- return (map != null) ? SessionMapEntry.VERSION.get(map) : null;
+ return (map != null) ? SessionMapEntry.VERSION.<Integer>get(map) : null;
}
- public Object getBuddySessionVersion(String webapp, String sessionId) throws Exception
+ @Override
+ public Integer getBuddySessionVersion(String webapp, String sessionId) throws Exception
{
return this.getSessionVersion(webapp, sessionId);
}
+ @Override
public Set<String> getSessionIds(String webapp) throws Exception
{
Cache<Object, Map<Object, Object>> cache = this.container.getCache(webapp);
@@ -90,91 +123,32 @@
return sessions;
}
- public Set getSessionIds(String webapp, boolean includeBuddies) throws Exception
+ @Override
+ public Set<String> getSessionIds(String webapp, boolean includeBuddies) throws Exception
{
return this.getSessionIds(webapp);
}
- /*
- public Set getSSOIds() throws Exception
+
+ @Override
+ public Set<String> getSSOIds() throws Exception
{
- Set result = new HashSet();
+ Cache<SSOKey, ?> cache = (this.cacheName != null) ? this.container.<SSOKey, Object>getCache(this.cacheName) : this.container.<SSOKey, Object>getCache();
+ Set<String> result = new HashSet<String>();
- Fqn fqn = Fqn.fromString("/SSO");
- Node main = getCache().getRoot().getChild(fqn);
- if (main != null)
+ for (SSOKey key: cache.keySet())
{
- result.addAll(main.getChildrenNames());
- }
-
- // Check in the buddy backup tree
-
- Set buddies = getBuddyBackupRoots();
- for (Iterator iter = buddies.iterator(); iter.hasNext();)
- {
- Node buddy = (Node) iter.next();
- Node ssoRoot = buddy.getChild(fqn);
- if (ssoRoot != null)
+ if (key instanceof CredentialKey)
{
- result.addAll(ssoRoot.getChildrenNames());
+ result.add(key.getId());
}
}
-
return result;
}
+ @Override
public boolean getCacheHasSSO(String ssoId) throws Exception
{
- Fqn fqn = Fqn.fromString("/SSO/" + ssoId);
- Node main = getCache().getRoot().getChild(fqn);
- if (main != null)
- return true;
-
- // Check in the buddy backup tree
-
- Set buddies = getBuddyBackupRoots();
- for (Iterator iter = buddies.iterator(); iter.hasNext();)
- {
- Node buddy = (Node) iter.next();
- Node ssoRoot = buddy.getChild(fqn);
- if (ssoRoot != null)
- {
- return true;
- }
- }
-
- return false;
+ Cache<SSOKey, ?> cache = (this.cacheName != null) ? this.container.<SSOKey, Object>getCache(this.cacheName) : this.container.<SSOKey, Object>getCache();
+ return cache.containsKey(ssoId);
}
- */
- public void startService() throws Exception
- {
- super.startService();
-
- String cacheConfigName = System.getProperty(CACHE_CONFIG_PROP);
-
- if (cacheConfigName != null)
- {
- this.setCacheConfigName(cacheConfigName);
- }
- }
-
- public void stopService() throws Exception
- {
- super.stopService();
- }
-/*
- private Set getBuddyBackupRoots()
- {
- Set buddies = null;
- Node buddyRoot = getCache().getRoot().getChild(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
- if (buddyRoot != null)
- {
- buddies = buddyRoot.getChildren();
- }
- else
- {
- buddies = Collections.EMPTY_SET;
- }
- return buddies;
- }
-*/
}
Added: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperClient.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperClient.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperClient.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.cluster.web;
+
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class CacheHelperClient implements CacheHelperMBean
+{
+ private final ObjectName name;
+ private final MBeanServerConnection server;
+
+ public CacheHelperClient(MBeanServerConnection server)
+ {
+ this.server = server;
+
+ try
+ {
+ this.name = ObjectName.getInstance(CacheHelper.OBJECT_NAME);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#isDistributed()
+ */
+ @Override
+ public boolean isDistributed()
+ {
+ return this.getAttribute("Distributed", Boolean.class).booleanValue();
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#clear(java.lang.String)
+ */
+ @Override
+ public void clear(String webapp)
+ {
+ this.invoke("clear", Void.class, webapp);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getSessionVersion(java.lang.String, java.lang.String)
+ */
+ @Override
+ public Integer getSessionVersion(String webapp, String sessionId)
+ {
+ return this.invoke("getSessionVersion", Integer.class, webapp, sessionId);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getBuddySessionVersion(java.lang.String, java.lang.String)
+ */
+ @Override
+ public Integer getBuddySessionVersion(String webapp, String sessionId) throws Exception
+ {
+ return this.invoke("getBuddySessionVersion", Integer.class, webapp, sessionId);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getSessionIds(java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<String> getSessionIds(String webapp) throws Exception
+ {
+ return this.invoke("getSessionIds", Set.class, webapp);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getSessionIds(java.lang.String, boolean)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<String> getSessionIds(String webapp, boolean includeBuddies) throws Exception
+ {
+ return this.invoke("getSessionIds", Set.class, webapp, includeBuddies);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getSSOIds()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<String> getSSOIds() throws Exception
+ {
+ return this.getAttribute("SSOIds", Set.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.test.cluster.web.CacheHelperMBean#getCacheHasSSO(java.lang.String)
+ */
+ @Override
+ public boolean getCacheHasSSO(String ssoId) throws Exception
+ {
+ return this.invoke("getCacheHasSSO", Boolean.class, ssoId).booleanValue();
+ }
+
+ private <T> T invoke(String method, Class<T> targetClass, Object... args)
+ {
+ String[] types = new String[args.length];
+ for (int i = 0; i < args.length; ++i)
+ {
+ types[i] = args[i].getClass().getName();
+ }
+ try
+ {
+ Object value = this.server.invoke(this.name, method, args, types);
+ return (value != null) ? targetClass.cast(value) : null;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private <T> T getAttribute(String attribute, Class<T> targetClass)
+ {
+ try
+ {
+ Object result = this.server.getAttribute(this.name, attribute);
+ return (result != null) ? targetClass.cast(result) : null;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -25,19 +25,19 @@
public interface CacheHelperMBean
{
- void setCacheConfigName(String cacheConfigName);
+ boolean isDistributed();
- Object getSessionVersion(String webapp, String sessionId);
+ void clear(String webapp);
+
+ Integer getSessionVersion(String webapp, String sessionId);
- Object getBuddySessionVersion(String webapp, String sessionId) throws Exception;
+ Integer getBuddySessionVersion(String webapp, String sessionId) throws Exception;
- Set getSessionIds(String webapp) throws Exception;
+ Set<String> getSessionIds(String webapp) throws Exception;
- Set getSessionIds(String webapp, boolean includeBuddies) throws Exception;
+ Set<String> getSessionIds(String webapp, boolean includeBuddies) throws Exception;
-// Set getSSOIds() throws Exception;
+ Set<String> getSSOIds() throws Exception;
-// boolean getCacheHasSSO(String ssoId) throws Exception;
-
-// void releaseCache();
+ boolean getCacheHasSSO(String ssoId) throws Exception;
}
\ No newline at end of file
Deleted: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperServletContextListener.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperServletContextListener.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperServletContextListener.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cluster.web;
-
-import javax.management.MBeanServer;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.jboss.mx.util.MBeanServerLocator;
-
-public class CacheHelperServletContextListener implements ServletContextListener
-{
- private MBeanServer server;
- private CacheHelper helper;
-
- public void contextInitialized(ServletContextEvent arg0)
- {
- server = MBeanServerLocator.locateJBoss();
- if (!server.isRegistered(CacheHelper.OBJECT_NAME))
- {
- helper = new CacheHelper();
- try
- {
- server.registerMBean(helper, CacheHelper.OBJECT_NAME);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- }
-
- public void contextDestroyed(ServletContextEvent arg0)
- {
- try
- {
- if (helper != null && server.isRegistered(CacheHelper.OBJECT_NAME))
- {
- server.unregisterMBean(CacheHelper.OBJECT_NAME);
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
-}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossCacheConfigTestSetupDelegate.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossCacheConfigTestSetupDelegate.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossCacheConfigTestSetupDelegate.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -38,7 +38,6 @@
*/
public void setUp() throws Exception
{
-
cacheConfigName = System.getProperty(SessionTestUtil.CACHE_CONFIG_PROP);
if (cacheConfigName != null)
{
@@ -51,8 +50,10 @@
*/
public void tearDown() throws Exception
{
- // TODO Auto-generated method stub
-
+ if (cacheConfigName != null)
+ {
+ this.clearServerSideCacheConfigProperties();
+ }
}
private void setServerSideCacheConfigProperties() throws Exception
@@ -76,12 +77,6 @@
adaptor.invoke(on, "remove",
new Object[]{SessionTestUtil.CACHE_CONFIG_PROP},
new String[] {String.class.getName()});
-
- adaptor.invoke(on, "remove",
- new Object[] {SessionTestUtil.CACHE_TYPE_PROP},
- new String[] {String.class.getName()});
}
}
-
-
}
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossClusteredWebTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossClusteredWebTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/JBossClusteredWebTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -51,11 +51,6 @@
{
super(name);
}
-
- public String getCacheConfigName()
- {
- return System.getProperty(SessionTestUtil.CACHE_CONFIG_PROP);
- }
public static Test getDeploySetup(Test test, String jarNames)
throws Exception
Modified: trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java 2010-11-01 17:27:24 UTC (rev 109050)
@@ -29,7 +29,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
import org.jboss.test.JBossClusteredTestCase;
-import org.jboss.test.cluster.web.CacheHelper;
+import org.jboss.test.cluster.web.CacheHelperClient;
/** Tests of web app single sign-on in a clustered environment
@@ -67,6 +67,7 @@
return JBossClusteredTestCase.getDeploySetup(suite, "web-sso-clustered.ear");
}
+ @Override
protected void setUp() throws Exception
{
super.setUp();
@@ -87,6 +88,7 @@
}
}
+ @Override
protected void tearDown() throws Exception
{
super.tearDown();
@@ -239,7 +241,7 @@
SSOBaseCase.checkAccessDenied(httpConn1, warA3 + "index.jsp");
SSOBaseCase.executeFormLogin(httpConn1, warA3);
HttpState state = httpConn1.getState();
- // String sessionID1 = SSOBaseCase.getSessionIdValueFromState(state);
+ String sessionID1 = SSOBaseCase.getSessionIdValueFromState(state);
// Now the standard SSO tests
HttpClient httpConn = new HttpClient();
@@ -279,25 +281,7 @@
SSOBaseCase.checkAccessDenied(httpConn, warB3 + "index.jsp");
// Confirm that the SSO we created at the start was removed from the cache
- // TODO: enable the following logic
- //assertFalse("node0 cache does not have SSO " + sessionID1,
- // getCacheHasSSO(adaptors[0], sessionID1));
- //assertFalse("node1 cache does not have SSO " + sessionID1,
- // getCacheHasSSO(adaptors[1], sessionID1));
+ assertFalse("node0 cache does not have SSO " + sessionID1, new CacheHelperClient(adaptors[0]).getCacheHasSSO(sessionID1));
+ assertFalse("node1 cache does not have SSO " + sessionID1, new CacheHelperClient(adaptors[1]).getCacheHasSSO(sessionID1));
}
-
- private boolean getCacheHasSSO(MBeanServerConnection adaptor ,String ssoId)
- throws Exception
- {
- adaptor.invoke(CacheHelper.OBJECT_NAME,
- "setCacheConfigName",
- new Object[] { "clustered-sso" },
- new String[] { String.class.getName() });
-
-
- Boolean b = (Boolean) adaptor.invoke(CacheHelper.OBJECT_NAME, "getCacheHasSSO",
- new Object[] { ssoId },
- new String[] { String.class.getName() });
- return b.booleanValue();
- }
}
Modified: trunk/testsuite/src/resources/cluster/http/http-scoped/clearCache.jsp
===================================================================
--- trunk/testsuite/src/resources/cluster/http/http-scoped/clearCache.jsp 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/resources/cluster/http/http-scoped/clearCache.jsp 2010-11-01 17:27:24 UTC (rev 109050)
@@ -1,15 +1,20 @@
<%@page contentType="text/html"
+ import="org.jboss.mx.util.*"
+ import="javax.management.*"
import="java.util.*"
- import="org.jboss.test.cluster.web.*"
+ import="org.jboss.test.cluster.web.CacheHelperMBean"
+ import="org.jboss.test.cluster.web.CacheHelperClient"
%>
<html>
<center>
<%
- String id=request.getSession().getId();
- CacheHelper.getCacheInstance().remove("/");
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ CacheHelperMBean helper = new CacheHelperClient(server);
+ String webapp = "//localhost" + request.getContextPath();
+ helper.clear(webapp);
%>
-<%=id%>
+<%=session.getId()%>
<h1><%=application.getServerInfo()%>:<%=request.getServerPort()%></h1>
</body>
Modified: trunk/testsuite/src/resources/cluster/http/version.jsp
===================================================================
--- trunk/testsuite/src/resources/cluster/http/version.jsp 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/resources/cluster/http/version.jsp 2010-11-01 17:27:24 UTC (rev 109050)
@@ -1,13 +1,13 @@
<%@page contentType="text/html"
import="org.jboss.mx.util.*"
import="javax.management.*"
- import="org.jboss.test.cluster.web.CacheHelper"
+ import="org.jboss.test.cluster.web.CacheHelperMBean"
+ import="org.jboss.test.cluster.web.CacheHelperClient"
%>
<%
MBeanServer server = MBeanServerLocator.locateJBoss();
+ CacheHelperMBean helper = new CacheHelperClient(server);
String webapp = "//localhost" + request.getContextPath();
- Object version = server.invoke(CacheHelper.OBJECT_NAME, "getSessionVersion",
- new Object[] { webapp, session.getId() },
- new String[] { "java.lang.String", "java.lang.String"});
+ Integer version = helper.getSessionVersion(webapp, session.getId());
%>
<%= version %>
Modified: trunk/testsuite/src/resources/cluster/web/cachehelper/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/web/cachehelper/jboss-beans.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/resources/cluster/web/cachehelper/jboss-beans.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -2,10 +2,12 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="ClusterTestCacheHelper" class="org.jboss.test.cluster.web.CacheHelper">
-
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=WebTestCacheHelper", exposedInterface=org.jboss.test.cluster.web.CacheHelperMBean.class, registerDirectly=true)</annotation>
-
- </bean>
+ <bean name="ClusterTestCacheHelper" class="org.jboss.test.cluster.web.CacheHelper">
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=WebTestCacheHelper", exposedInterface=org.jboss.test.cluster.web.CacheHelperMBean.class, registerDirectly=true)</annotation>
+ <constructor>
+ <parameter><inject bean="CacheContainerRegistry"/></parameter>
+ <parameter>${jbosstest.cluster.web.cache.config:standard-session-cache}</parameter>
+ </constructor>
+ </bean>
</deployment>
Added: trunk/testsuite/src/resources/web/sso/war/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/web/sso/war/jboss-beans.xml (rev 0)
+++ trunk/testsuite/src/resources/web/sso/war/jboss-beans.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="ClusteredSSOTestCacheHelper" class="org.jboss.test.cluster.web.CacheHelper">
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.test:service=WebTestCacheHelper", exposedInterface=org.jboss.test.cluster.web.CacheHelperMBean.class, registerDirectly=true)</annotation>
+ <constructor>
+ <parameter><inject bean="CacheContainerRegistry"/></parameter>
+ <parameter>clustered-sso</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Modified: trunk/testsuite/src/resources/web/sso/war/web-sso-expire.xml
===================================================================
--- trunk/testsuite/src/resources/web/sso/war/web-sso-expire.xml 2010-11-01 17:24:46 UTC (rev 109049)
+++ trunk/testsuite/src/resources/web/sso/war/web-sso-expire.xml 2010-11-01 17:27:24 UTC (rev 109050)
@@ -8,11 +8,7 @@
<!--distributable/-->
<!-- Registers an mbean the test driver can use to check the cache state -->
- <listener>
- <listener-class>org.jboss.test.cluster.web.CacheHelperServletContextListener</listener-class>
- </listener>
-
- <servlet>
+ <servlet>
<servlet-name>LogoutServlet</servlet-name>
<servlet-class>org.jboss.test.web.servlets.LogoutServlet</servlet-class>
</servlet>
More information about the jboss-cvs-commits
mailing list