[jboss-cvs] JBossAS SVN: r79412 - in branches/JBPAPP_4_2_0_GA_CP: server/src/resources/43specific/org/jboss/metadata and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 13 12:40:12 EDT 2008
Author: jiwils
Date: 2008-10-13 12:40:11 -0400 (Mon, 13 Oct 2008)
New Revision: 79412
Added:
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/test/ClusteredSessionNotificationPolicyTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/InvalidateSessionRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/RemoveAttributesRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java
Removed:
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/server/src/resources/42specific/org/jboss/metadata/WebMetaData.java
branches/JBPAPP_4_2_0_GA_CP/server/src/resources/43specific/org/jboss/metadata/WebMetaData.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheClusteredSession.java
branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
Log:
Fix for [JBPAPP-1225]. Configurable changes for HTTP session notification messages.
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/resources/42specific/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/resources/42specific/org/jboss/metadata/WebMetaData.java 2008-10-13 16:39:25 UTC (rev 79411)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/resources/42specific/org/jboss/metadata/WebMetaData.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -198,11 +198,17 @@
* for pojo replication or not.
*/
private boolean replicationFieldBatchMode = true;
-
+
/** By default replicate clustered session metadata at least every 60 seconds */
- public static final int DEFAULT_MAX_UNREPLICATED_INTERVAL = 60;
+ public static final int DEFAULT_MAX_UNREPLICATED_INTERVAL = 60;
private Integer maxUnreplicatedInterval = null;
+ /**
+ * Name of class the defines policy for issuing servlet spec
+ * notifications for clustered sessions.
+ */
+ private String clusteredSessionNotificationPolicy = null;
+
/** Should the context use session cookies or use default */
private int sessionCookies = SESSION_COOKIES_DEFAULT;
@@ -230,7 +236,7 @@
}
/**
- *
+ *
* @param environmentEntries - Collection<EnvEntryMetaData>
*/
public void setEnvironmentEntries(Collection environmentEntries)
@@ -248,7 +254,7 @@
}
/**
- *
+ *
* @param ejbReferences - Map<String, EjbRefMetaData>
*/
public void setEjbReferences(Map ejbReferences)
@@ -266,7 +272,7 @@
}
/**
- *
+ *
* @param ejbReferences - Map<String, EjbRefMetaData>
*/
public void setEjbLocalReferences(Map ejbReferences)
@@ -284,7 +290,7 @@
}
/**
- *
+ *
* @param resourceReferences - Map<String, ResourceRefMetaData>
*/
public void setResourceReferences(Map resourceReferences)
@@ -302,7 +308,7 @@
}
/**
- *
+ *
* @param resourceReferences - Map<String, ResourceEnvRefMetaData>
*/
public void setResourceEnvReferences(Map resourceReferences)
@@ -313,7 +319,7 @@
/**
* Return an iterator of message-destination-refs.
- *
+ *
* @return Iterator of MessageDestinationRefMetaData objects.
*/
public Iterator getMessageDestinationReferences()
@@ -322,7 +328,7 @@
}
/**
- *
+ *
* @param messageDestinationReferences - Map<String, MessageDestinationRefMetaData>
*/
public void setMessageDestinationReferences(Map messageDestinationReferences)
@@ -331,9 +337,9 @@
this.messageDestinationReferences.putAll(messageDestinationReferences);
}
- /**
+ /**
* Get a message destination metadata
- *
+ *
* @param name the name of the message destination
* @return the message destination metadata
*/
@@ -343,7 +349,7 @@
}
/**
- *
+ *
* @param messageDestinations - Map<String, MessageDestinationMetaData>
*/
public void setMessageDestination(Map messageDestinations)
@@ -403,7 +409,7 @@
}
/**
- *
+ *
* @param wsdlPublishLocationMap - Map<String, String>
*/
public void setWsdlPublishLocationMap(Map wsdlPublishLocationMap)
@@ -496,7 +502,7 @@
}
/**
- *
+ *
* @param securityContraints - Collection<WebSecurityMetaData>
*/
public void setSecurityConstraints(Collection securityContraints)
@@ -514,7 +520,7 @@
}
/**
- *
+ *
* @param servletName
* @return List<SecurityRoleRefMetaData> for the given servlet name
*/
@@ -525,7 +531,7 @@
}
/**
- *
+ *
* @param securityRoleReferences - <String servlet-name, ArrayList<SecurityRoleRefMetaData>>
*/
public void setSecurityRoleReferences(Map securityRoleReferences)
@@ -552,7 +558,7 @@
}
/**
- *
+ *
* @param securityRoles - Map<String, SecurityRoleMetaData>
*/
public void setSecurityRoles(Map securityRoles)
@@ -562,7 +568,7 @@
}
/**
- *
+ *
* @param userName
* @return Set<String>
*/
@@ -604,7 +610,7 @@
}
/**
- *
+ *
* @return servlet/run-as <String servlet-name, RunAsIdentity>
*/
public Map getRunAsIdentity()
@@ -650,8 +656,6 @@
}
/**
- <<<<<<< .working
- =======
* Get the init parameter map for a servlet or an empty map if there are none.
*/
public Map getServletParams(String servletName)
@@ -666,7 +670,6 @@
}
/**
- >>>>>>> .merge-right.r68814
* Get the servlet-name/servlet-class mapping from the web.xml descriptor
* @return Map<String, String> of the servlet-name/servlet-class mapping from web.xml
*/
@@ -709,7 +712,7 @@
}
/**
- *
+ *
* @param virtualHosts - Collection<String>
*/
public void setVirtualHosts(Collection virtualHosts)
@@ -847,7 +850,7 @@
{
return replicationFieldBatchMode;
}
-
+
public void setReplicationFieldBatchMode(boolean batchMode)
{
this.replicationFieldBatchMode = batchMode;
@@ -863,6 +866,16 @@
this.maxUnreplicatedInterval = maxUnreplicatedInterval;
}
+ public String getClusteredSessionNotificationPolicy()
+ {
+ return clusteredSessionNotificationPolicy;
+ }
+
+ public void setClusteredSessionNotificationPolicy(String expirationNotificationPolicy)
+ {
+ this.clusteredSessionNotificationPolicy = expirationNotificationPolicy;
+ }
+
public void importXml(Element element) throws DeploymentException
{
String rootTag = element.getOwnerDocument().getDocumentElement().getTagName();
@@ -1369,12 +1382,15 @@
Element batchModeElement = MetaData.getOptionalChild(sessionReplicationRootElement,
"replication-field-batch-mode");
+
if (batchModeElement != null)
{
Boolean flag = Boolean.valueOf(MetaData.getElementContent(batchModeElement));
replicationFieldBatchMode = flag.booleanValue();
}
+ // ... then manage "max-unreplicated-interval".
+ //
Element maxUnreplicatedIntervalElement = MetaData.getOptionalChild(sessionReplicationRootElement, "max-unreplicated-interval");
if (maxUnreplicatedIntervalElement != null)
{
@@ -1389,6 +1405,14 @@
+ " in jboss-web.xml");
}
}
+
+ // ... then manage "session-notification-policy".
+ //
+ Element expirationNotificationPolicyElement = MetaData.getOptionalChild(sessionReplicationRootElement, "session-notification-policy");
+ if (expirationNotificationPolicyElement != null)
+ {
+ clusteredSessionNotificationPolicy = MetaData.getElementContent(expirationNotificationPolicyElement);
+ }
}
// Check for a war level class loading config
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/resources/43specific/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/resources/43specific/org/jboss/metadata/WebMetaData.java 2008-10-13 16:39:25 UTC (rev 79411)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/resources/43specific/org/jboss/metadata/WebMetaData.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -198,11 +198,17 @@
* for pojo replication or not.
*/
private boolean replicationFieldBatchMode = true;
-
+
/** By default replicate clustered session metadata at least every 60 seconds */
- public static final int DEFAULT_MAX_UNREPLICATED_INTERVAL = 60;
+ public static final int DEFAULT_MAX_UNREPLICATED_INTERVAL = 60;
private Integer maxUnreplicatedInterval = null;
+ /**
+ * Name of class the defines policy for issuing servlet spec
+ * notifications for clustered sessions.
+ */
+ private String clusteredSessionNotificationPolicy = null;
+
/** Should the context use session cookies or use default */
private int sessionCookies = SESSION_COOKIES_DEFAULT;
@@ -230,7 +236,7 @@
}
/**
- *
+ *
* @param environmentEntries - Collection<EnvEntryMetaData>
*/
public void setEnvironmentEntries(Collection environmentEntries)
@@ -248,7 +254,7 @@
}
/**
- *
+ *
* @param ejbReferences - Map<String, EjbRefMetaData>
*/
public void setEjbReferences(Map ejbReferences)
@@ -266,7 +272,7 @@
}
/**
- *
+ *
* @param ejbReferences - Map<String, EjbRefMetaData>
*/
public void setEjbLocalReferences(Map ejbReferences)
@@ -284,7 +290,7 @@
}
/**
- *
+ *
* @param resourceReferences - Map<String, ResourceRefMetaData>
*/
public void setResourceReferences(Map resourceReferences)
@@ -302,7 +308,7 @@
}
/**
- *
+ *
* @param resourceReferences - Map<String, ResourceEnvRefMetaData>
*/
public void setResourceEnvReferences(Map resourceReferences)
@@ -313,7 +319,7 @@
/**
* Return an iterator of message-destination-refs.
- *
+ *
* @return Iterator of MessageDestinationRefMetaData objects.
*/
public Iterator getMessageDestinationReferences()
@@ -322,7 +328,7 @@
}
/**
- *
+ *
* @param messageDestinationReferences - Map<String, MessageDestinationRefMetaData>
*/
public void setMessageDestinationReferences(Map messageDestinationReferences)
@@ -331,9 +337,9 @@
this.messageDestinationReferences.putAll(messageDestinationReferences);
}
- /**
+ /**
* Get a message destination metadata
- *
+ *
* @param name the name of the message destination
* @return the message destination metadata
*/
@@ -343,7 +349,7 @@
}
/**
- *
+ *
* @param messageDestinations - Map<String, MessageDestinationMetaData>
*/
public void setMessageDestination(Map messageDestinations)
@@ -403,7 +409,7 @@
}
/**
- *
+ *
* @param wsdlPublishLocationMap - Map<String, String>
*/
public void setWsdlPublishLocationMap(Map wsdlPublishLocationMap)
@@ -496,7 +502,7 @@
}
/**
- *
+ *
* @param securityContraints - Collection<WebSecurityMetaData>
*/
public void setSecurityConstraints(Collection securityContraints)
@@ -514,7 +520,7 @@
}
/**
- *
+ *
* @param servletName
* @return List<SecurityRoleRefMetaData> for the given servlet name
*/
@@ -525,7 +531,7 @@
}
/**
- *
+ *
* @param securityRoleReferences - <String servlet-name, ArrayList<SecurityRoleRefMetaData>>
*/
public void setSecurityRoleReferences(Map securityRoleReferences)
@@ -552,7 +558,7 @@
}
/**
- *
+ *
* @param securityRoles - Map<String, SecurityRoleMetaData>
*/
public void setSecurityRoles(Map securityRoles)
@@ -562,7 +568,7 @@
}
/**
- *
+ *
* @param userName
* @return Set<String>
*/
@@ -604,7 +610,7 @@
}
/**
- *
+ *
* @return servlet/run-as <String servlet-name, RunAsIdentity>
*/
public Map getRunAsIdentity()
@@ -650,8 +656,6 @@
}
/**
- <<<<<<< .working
- =======
* Get the init parameter map for a servlet or an empty map if there are none.
*/
public Map getServletParams(String servletName)
@@ -666,7 +670,6 @@
}
/**
- >>>>>>> .merge-right.r68814
* Get the servlet-name/servlet-class mapping from the web.xml descriptor
* @return Map<String, String> of the servlet-name/servlet-class mapping from web.xml
*/
@@ -709,7 +712,7 @@
}
/**
- *
+ *
* @param virtualHosts - Collection<String>
*/
public void setVirtualHosts(Collection virtualHosts)
@@ -847,7 +850,7 @@
{
return replicationFieldBatchMode;
}
-
+
public void setReplicationFieldBatchMode(boolean batchMode)
{
this.replicationFieldBatchMode = batchMode;
@@ -863,6 +866,16 @@
this.maxUnreplicatedInterval = maxUnreplicatedInterval;
}
+ public String getClusteredSessionNotificationPolicy()
+ {
+ return clusteredSessionNotificationPolicy;
+ }
+
+ public void setClusteredSessionNotificationPolicy(String expirationNotificationPolicy)
+ {
+ this.clusteredSessionNotificationPolicy = expirationNotificationPolicy;
+ }
+
public void importXml(Element element) throws DeploymentException
{
String rootTag = element.getOwnerDocument().getDocumentElement().getTagName();
@@ -1369,12 +1382,15 @@
Element batchModeElement = MetaData.getOptionalChild(sessionReplicationRootElement,
"replication-field-batch-mode");
+
if (batchModeElement != null)
{
Boolean flag = Boolean.valueOf(MetaData.getElementContent(batchModeElement));
replicationFieldBatchMode = flag.booleanValue();
}
+ // ... then manage "max-unreplicated-interval".
+ //
Element maxUnreplicatedIntervalElement = MetaData.getOptionalChild(sessionReplicationRootElement, "max-unreplicated-interval");
if (maxUnreplicatedIntervalElement != null)
{
@@ -1389,6 +1405,14 @@
+ " in jboss-web.xml");
}
}
+
+ // ... then manage "session-notification-policy".
+ //
+ Element expirationNotificationPolicyElement = MetaData.getOptionalChild(sessionReplicationRootElement, "session-notification-policy");
+ if (expirationNotificationPolicyElement != null)
+ {
+ clusteredSessionNotificationPolicy = MetaData.getElementContent(expirationNotificationPolicyElement);
+ }
}
// Check for a war level class loading config
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/test/ClusteredSessionNotificationPolicyTestCase.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/ClusteredSessionNotificationPolicyTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/test/ClusteredSessionNotificationPolicyTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/test/ClusteredSessionNotificationPolicyTestCase.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,620 @@
+/*
+ * 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.test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.apache.catalina.Context;
+import org.jboss.cache.aop.PojoCache;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.cluster.web.notification.MockClusteredSessionNotificationPolicy;
+import org.jboss.test.cluster.web.notification.MockHttpSessionAttributeListener;
+import org.jboss.test.cluster.web.notification.MockHttpSessionBindingListener;
+import org.jboss.test.cluster.web.notification.MockHttpSessionListener;
+import org.jboss.test.cluster.web.util.BasicRequestHandler;
+import org.jboss.test.cluster.web.util.CacheConfigTestSetup;
+import org.jboss.test.cluster.web.util.InvalidateSessionRequestHandler;
+import org.jboss.test.cluster.web.util.RemoveAttributesRequestHandler;
+import org.jboss.test.cluster.web.util.SetAttributesRequestHandler;
+import org.jboss.test.cluster.web.util.WebSessionTestUtil;
+import org.jboss.web.tomcat.service.session.JBossCacheManager;
+
+/**
+ * Tests of handling of servlet spec notifications.
+ *
+ * @author Brian Stansberry
+ */
+public class ClusteredSessionNotificationPolicyTestCase extends JBossTestCase
+{
+ protected static PojoCache[] pojoCaches = new PojoCache[2];
+
+ 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 Set<JBossCacheManager> managers = new HashSet<JBossCacheManager>();
+
+ protected Map<String, Object> allAttributes;
+ protected Map<String, Object> immutables;
+ protected Map<String, Object> mutables;
+ protected Map<String, Object> attributes;
+ protected MockHttpSessionBindingListener attribute = new MockHttpSessionBindingListener();
+ protected Map<String, Object> newAttributes;
+ protected MockHttpSessionBindingListener newAttribute = new MockHttpSessionBindingListener();
+
+ public ClusteredSessionNotificationPolicyTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return CacheConfigTestSetup.getTestSetup(ClusteredSessionNotificationPolicyTestCase.class, pojoCaches, false, !useBuddyRepl, false);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ attributes = new HashMap<String, Object>();
+ attributes.put("KEY", attribute);
+ attributes = Collections.unmodifiableMap(attributes);
+
+ newAttributes = new HashMap<String, Object>();
+ newAttributes.put("KEY", newAttribute);
+ newAttributes = Collections.unmodifiableMap(newAttributes);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ for (JBossCacheManager manager : managers)
+ {
+ try
+ {
+ manager.stop();
+ }
+ catch (RuntimeException ignored)
+ {
+ log.debug("tearDown(): Caught exception cleaning up manager -- " + ignored.getLocalizedMessage());
+ }
+ }
+ managers.clear();
+
+ attribute.invocations.clear();
+ newAttribute.invocations.clear();
+ }
+
+ protected int getReplicationGranularity()
+ {
+ return WebMetaData.REPLICATION_GRANULARITY_SESSION;
+ }
+
+ protected int getReplicationTrigger()
+ {
+ return WebMetaData.SESSION_INVALIDATE_SET_AND_NON_PRIMITIVE_GET;
+ }
+
+ public void testSessionLifecycleWithNotifications() throws Exception
+ {
+ log.info("++++ Starting testSessionLifecycleWithNotifications ++++");
+ sessionLifecycleTest(true);
+ }
+
+ public void testSessionLifecycleWithoutNotifications() throws Exception
+ {
+ log.info("++++ Starting testSessionLifecycleWithoutNotifications ++++");
+ sessionLifecycleTest(false);
+ }
+
+ private void sessionLifecycleTest(boolean notify) throws Exception
+ {
+ String warname = String.valueOf(++testId);
+
+ // A war with a maxInactive of 30 mins maxUnreplicated of 0
+ JBossCacheManager[] mgrs = getCacheManagers(warname, 1800, 0);
+ JBossCacheManager jbcm0 = mgrs[0];
+ JBossCacheManager jbcm1 = mgrs[1];
+
+ assertTrue(jbcm0.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp0 = (MockClusteredSessionNotificationPolicy) jbcm0.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp0.getClusteredSessionExpriationNotificationCapability());
+ mcsnp0.setResponse(notify);
+
+ assertTrue(jbcm1.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp1 = (MockClusteredSessionNotificationPolicy) jbcm1.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp1.getClusteredSessionExpriationNotificationCapability());
+ mcsnp1.setResponse(notify);
+
+ MockHttpSessionListener hsl0 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal0 = new MockHttpSessionAttributeListener();
+ Context ctx = (Context) jbcm0.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl0 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal0 });
+
+ MockHttpSessionListener hsl1 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal1 = new MockHttpSessionAttributeListener();
+ ctx = (Context) jbcm1.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl1 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal1 });
+
+ // Initial request
+ SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm0, setHandler, null);
+
+ validateNewSession(setHandler);
+ String sessionId = setHandler.getSessionId();
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl0.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.CREATED, hsl0.invocations.get(0));
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.ADDED, hsal0.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute });
+ }
+
+ // Modify attribute request
+ setHandler = new SetAttributesRequestHandler(newAttributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm0, setHandler, sessionId);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REPLACED, hsal0.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.UNBOUND, attribute.invocations.get(0));
+ assertEquals(1, newAttribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, newAttribute.invocations.get(0));
+
+ validateNoNotifications(hsl0, null, hsl1, hsal1, null);
+ clearNotifications(null, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute, newAttribute });
+ }
+
+ // Remove attribute request
+ RemoveAttributesRequestHandler removeHandler = new RemoveAttributesRequestHandler(newAttributes.keySet(), false);
+ WebSessionTestUtil.invokeRequest(jbcm0, removeHandler, sessionId);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REMOVED, hsal0.invocations.get(0));
+ assertEquals(1, newAttribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.UNBOUND, newAttribute.invocations.get(0));
+
+ validateNoNotifications(hsl0, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ attribute });
+ clearNotifications(null, hsal0, null, null, new MockHttpSessionBindingListener[]{ newAttribute });
+ }
+
+ // Failover request
+ setHandler = new SetAttributesRequestHandler(attributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm1, setHandler, sessionId);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl1.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.CREATED, hsl1.invocations.get(0));
+ assertEquals(1, hsal1.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.ADDED, hsal1.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ attribute });
+ }
+
+ // Invalidate session request
+ InvalidateSessionRequestHandler invalidateHandler = new InvalidateSessionRequestHandler(attributes.keySet(), false);
+ WebSessionTestUtil.invokeRequest(jbcm1, invalidateHandler, sessionId);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl1.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.DESTROYED, hsl1.invocations.get(0));
+ assertEquals(1, hsal1.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REMOVED, hsal1.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.UNBOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ attribute });
+ }
+ }
+
+ public void testSessionExpirationWithNotifications() throws Exception
+ {
+ log.info("++++ Starting testSessionExpirationWithNotifications ++++");
+ sessionExpirationTest(true);
+ }
+
+ public void testSessionExpirationWithoutNotifications() throws Exception
+ {
+ log.info("++++ Starting testSessionExpirationWithoutNotifications ++++");
+ sessionExpirationTest(false);
+ }
+
+ private void sessionExpirationTest(boolean notify) throws Exception
+ {
+ String warname = String.valueOf(++testId);
+
+ // A war with a maxInactive of 3 secs and a maxUnreplicated of 0
+ JBossCacheManager[] mgrs = getCacheManagers(warname, 2, 0);
+ JBossCacheManager jbcm0 = mgrs[0];
+ JBossCacheManager jbcm1 = mgrs[1];
+
+ assertTrue(jbcm0.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp0 = (MockClusteredSessionNotificationPolicy) jbcm0.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp0.getClusteredSessionExpriationNotificationCapability());
+ mcsnp0.setResponse(notify);
+
+ assertTrue(jbcm1.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp1 = (MockClusteredSessionNotificationPolicy) jbcm1.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp1.getClusteredSessionExpriationNotificationCapability());
+ mcsnp1.setResponse(notify);
+
+ MockHttpSessionListener hsl0 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal0 = new MockHttpSessionAttributeListener();
+ Context ctx = (Context) jbcm0.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl0 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal0 });
+
+ MockHttpSessionListener hsl1 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal1 = new MockHttpSessionAttributeListener();
+ ctx = (Context) jbcm1.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl1 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal1 });
+
+ // Initial request
+ SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm0, setHandler, null);
+
+ validateNewSession(setHandler);
+
+ String sessionId = setHandler.getSessionId();
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl0.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.CREATED, hsl0.invocations.get(0));
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.ADDED, hsal0.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute });
+ }
+
+ // Failover request
+ setHandler = new SetAttributesRequestHandler(newAttributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm1, setHandler, sessionId);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl1.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.CREATED, hsl1.invocations.get(0));
+ assertEquals(1, hsal1.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REPLACED, hsal1.invocations.get(0));
+ assertEquals(1, newAttribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, newAttribute.invocations.get(0));
+
+ validateNoNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute });
+ clearNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ }
+
+ Thread.sleep(2100);
+
+ jbcm0.backgroundProcess();
+ jbcm1.backgroundProcess();
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl0.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.DESTROYED, hsl0.invocations.get(0));
+ assertEquals(1, hsl1.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.DESTROYED, hsl1.invocations.get(0));
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REMOVED, hsal0.invocations.get(0));
+ assertEquals(1, hsal1.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REMOVED, hsal1.invocations.get(0));
+ assertEquals(1, newAttribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.UNBOUND, newAttribute.invocations.get(0));
+
+ validateNoNotifications(null, null, null, null, new MockHttpSessionBindingListener[]{ attribute });
+ clearNotifications(hsl0, hsal0, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ }
+ }
+
+ public void testUndeployWithNotifications() throws Exception
+ {
+ log.info("++++ Starting testUndeployWithNotifications ++++");
+ undeployTest(true);
+ }
+
+ public void testUndeployWithoutNotifications() throws Exception
+ {
+ log.info("++++ Starting testUndeployWithoutNotifications ++++");
+ undeployTest(false);
+ }
+
+ private void undeployTest(boolean notify) throws Exception
+ {
+ String warname = String.valueOf(++testId);
+
+ // A war with a maxInactive of 3 secs and a maxUnreplicated of 0
+ JBossCacheManager[] mgrs = getCacheManagers(warname, 2, 0);
+ JBossCacheManager jbcm0 = mgrs[0];
+ JBossCacheManager jbcm1 = mgrs[1];
+
+ assertTrue(jbcm0.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp0 = (MockClusteredSessionNotificationPolicy) jbcm0.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp0.getClusteredSessionExpriationNotificationCapability());
+ mcsnp0.setResponse(notify);
+
+ assertTrue(jbcm1.getNotificationPolicy() instanceof MockClusteredSessionNotificationPolicy);
+ MockClusteredSessionNotificationPolicy mcsnp1 = (MockClusteredSessionNotificationPolicy) jbcm1.getNotificationPolicy();
+ assertNotNull("capability set", mcsnp1.getClusteredSessionExpriationNotificationCapability());
+ mcsnp1.setResponse(notify);
+
+ MockHttpSessionListener hsl0 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal0 = new MockHttpSessionAttributeListener();
+ Context ctx = (Context) jbcm0.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl0 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal0 });
+
+ MockHttpSessionListener hsl1 = new MockHttpSessionListener();
+ MockHttpSessionAttributeListener hsal1 = new MockHttpSessionAttributeListener();
+ ctx = (Context) jbcm1.getContainer();
+ ctx.setApplicationLifecycleListeners(new Object[]{ hsl1 });
+ ctx.setApplicationEventListeners(new Object[]{ hsal1 });
+
+ // Initial request
+ SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(attributes, false);
+ WebSessionTestUtil.invokeRequest(jbcm0, setHandler, null);
+
+ validateNewSession(setHandler);
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl0.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.CREATED, hsl0.invocations.get(0));
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.ADDED, hsal0.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.BOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute });
+
+ }
+
+ jbcm0.stop();
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ assertEquals(1, hsl0.invocations.size());
+ assertEquals(MockHttpSessionListener.Type.DESTROYED, hsl0.invocations.get(0));
+ assertEquals(1, hsal0.invocations.size());
+ assertEquals(MockHttpSessionAttributeListener.Type.REMOVED, hsal0.invocations.get(0));
+ assertEquals(1, attribute.invocations.size());
+ assertEquals(MockHttpSessionBindingListener.Type.UNBOUND, attribute.invocations.get(0));
+
+ validateNoNotifications(null, null, hsl1, hsal1, new MockHttpSessionBindingListener[]{ newAttribute });
+ clearNotifications(hsl0, hsal0, null, null, new MockHttpSessionBindingListener[]{ attribute });
+
+
+ }
+
+ jbcm1.stop();
+
+ if (!notify)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ else
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1);
+ }
+ }
+
+ private void validateNoNotifications(MockHttpSessionListener hsl0, MockHttpSessionAttributeListener hsal0,
+ MockHttpSessionListener hsl1, MockHttpSessionAttributeListener hsal1)
+ {
+ validateNoNotifications(hsl0, hsal0, hsl1, hsal1, new MockHttpSessionBindingListener[]{ attribute, newAttribute});
+ }
+
+ private void validateNoNotifications(MockHttpSessionListener hsl0, MockHttpSessionAttributeListener hsal0,
+ MockHttpSessionListener hsl1, MockHttpSessionAttributeListener hsal1, MockHttpSessionBindingListener[] hsbls)
+ {
+ if (hsl0 != null)
+ {
+ assertEquals(0, hsl0.invocations.size());
+ }
+ if (hsal0 != null)
+ {
+ assertEquals(0, hsal0.invocations.size());
+ }
+ if (hsl1 != null)
+ {
+ assertEquals(0, hsl1.invocations.size());
+ }
+ if (hsal1 != null)
+ {
+ assertEquals(0, hsal1.invocations.size());
+ }
+
+ if (hsbls != null)
+ {
+ for (int i = 0; i < hsbls.length; i++)
+ {
+ assertEquals("Binding listener " + i + " has no notifications", 0, hsbls[i].invocations.size());
+ }
+ }
+
+ clearNotifications(hsl0, hsal0, hsl1, hsal1, hsbls);
+ }
+
+ private void clearNotifications(MockHttpSessionListener hsl0, MockHttpSessionAttributeListener hsal0,
+ MockHttpSessionListener hsl1, MockHttpSessionAttributeListener hsal1)
+ {
+ clearNotifications(hsl0, hsal0, hsl1, hsal1, new MockHttpSessionBindingListener[]{ attribute, newAttribute});
+ }
+
+ private void clearNotifications(MockHttpSessionListener hsl0, MockHttpSessionAttributeListener hsal0,
+ MockHttpSessionListener hsl1, MockHttpSessionAttributeListener hsal1, MockHttpSessionBindingListener[] hsbls)
+ {
+
+ if (hsl0 != null)
+ {
+ hsl0.invocations.clear();
+ }
+ if (hsal0 != null)
+ {
+ hsal0.invocations.clear();
+ }
+ if (hsl1 != null)
+ {
+ hsl1.invocations.clear();
+ }
+ if (hsal1 != null)
+ {
+ hsal1.invocations.clear();
+ }
+
+ if (hsbls != null)
+ {
+ for (int i = 0; i < hsbls.length; i++)
+ {
+ hsbls[i].invocations.clear();
+ }
+ }
+ }
+
+ protected JBossCacheManager[] getCacheManagers(String warname, int maxInactive, int maxUnreplicated)
+ throws Exception
+ {
+ JBossCacheManager jbcm0 = WebSessionTestUtil.createManager(warname, maxInactive, pojoCaches[0], null);
+ WebMetaData metadata = WebSessionTestUtil.getWebMetaData(getReplicationGranularity(), getReplicationTrigger(), true, maxUnreplicated);
+ metadata.setClusteredSessionNotificationPolicy(MockClusteredSessionNotificationPolicy.class.getName());
+ jbcm0.init(warname, metadata, false, true);
+ this.managers.add(jbcm0);
+ jbcm0.start();
+
+ JBossCacheManager jbcm1 = WebSessionTestUtil.createManager(warname, maxInactive, pojoCaches[1], null);
+ metadata = WebSessionTestUtil.getWebMetaData(getReplicationGranularity(), getReplicationTrigger(), true, maxUnreplicated);
+ metadata.setClusteredSessionNotificationPolicy(MockClusteredSessionNotificationPolicy.class.getName());
+ jbcm1.init(warname, metadata, false, true);
+ this.managers.add(jbcm1);
+ jbcm1.start();
+
+ return new JBossCacheManager[]{jbcm0, jbcm1};
+ }
+
+ protected void validateExpectedAttributes(Map<String, Object> expected, BasicRequestHandler handler)
+ {
+ assertFalse(handler.isNewSession());
+
+ if (handler.isCheckAttributeNames())
+ {
+ assertEquals(expected.size(), handler.getAttributeNames().size());
+ }
+ Map<String, Object> checked = handler.getCheckedAttributes();
+ assertEquals(expected.size(), checked.size());
+ for (Map.Entry<String, Object> entry : checked.entrySet())
+ assertEquals(entry.getKey(), expected.get(entry.getKey()), entry.getValue());
+
+ }
+
+ protected void validateNewSession(BasicRequestHandler handler)
+ {
+ assertTrue(handler.isNewSession());
+ assertEquals(handler.getCreationTime(), handler.getLastAccessedTime());
+ if (handler.isCheckAttributeNames())
+ {
+ assertEquals(0, handler.getAttributeNames().size());
+ }
+ Map<String, Object> checked = handler.getCheckedAttributes();
+ for (Map.Entry<String, Object> entry : checked.entrySet())
+ assertNull(entry.getKey(), entry.getValue());
+ }
+
+
+}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks)
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,135 +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.mocks;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpSession;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class BasicRequestHandler implements RequestHandler
-{
- private Set<String> namesToCheck = new HashSet<String>();
- private boolean checkAttributeNames;
- private Map<String, Object> checkedAttributes = new HashMap<String, Object>();
- private Set<String> attributeNames = new HashSet<String>();
- private String sessionId;
- private long lastAccessedTime;
- private int maxInactiveInterval;
- private long creationTime;
- private boolean newSession;
- private HttpSession session;
-
- /**
- * Create a new AbstractRequestHandler.
- *
- */
- public BasicRequestHandler(Set<String> toCheck, boolean checkNames)
- {
- if (toCheck != null)
- this.namesToCheck.addAll(toCheck);
- this.checkAttributeNames = checkNames;
- }
-
- public void handleRequest(Request request, Response response)
- {
- this.session = request.getSession();
- this.sessionId = session.getId();
- this.lastAccessedTime = session.getLastAccessedTime();
- this.maxInactiveInterval = session.getMaxInactiveInterval();
- this.newSession = session.isNew();
- this.creationTime = session.getCreationTime();
-
- if (this.checkAttributeNames)
- {
- Enumeration<String> e = session.getAttributeNames();
- while (e.hasMoreElements())
- attributeNames.add(e.nextElement());
- }
-
- if (namesToCheck != null)
- {
- for (String name : namesToCheck)
- {
- checkedAttributes.put(name, session.getAttribute(name));
- }
- }
- }
-
- public String getSessionId()
- {
- return sessionId;
- }
-
- public long getLastAccessedTime()
- {
- return lastAccessedTime;
- }
-
- public int getMaxInactiveInterval()
- {
- return maxInactiveInterval;
- }
-
- public boolean isNewSession()
- {
- return newSession;
- }
-
- public long getCreationTime()
- {
- return creationTime;
- }
-
- public Map<String, Object> getCheckedAttributes()
- {
- return checkedAttributes;
- }
-
- public Set<String> getAttributeNames()
- {
- return attributeNames;
- }
-
- public HttpSession getSession()
- {
- return session;
- }
-
- public boolean isCheckAttributeNames()
- {
- return checkAttributeNames;
- }
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/BasicRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,135 @@
+/*
+ * 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.mocks;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class BasicRequestHandler implements RequestHandler
+{
+ private Set<String> namesToCheck = new HashSet<String>();
+ private boolean checkAttributeNames;
+ private Map<String, Object> checkedAttributes = new HashMap<String, Object>();
+ private Set<String> attributeNames = new HashSet<String>();
+ private String sessionId;
+ private long lastAccessedTime;
+ private int maxInactiveInterval;
+ private long creationTime;
+ private boolean newSession;
+ private HttpSession session;
+
+ /**
+ * Create a new AbstractRequestHandler.
+ *
+ */
+ public BasicRequestHandler(Set<String> toCheck, boolean checkNames)
+ {
+ if (toCheck != null)
+ this.namesToCheck.addAll(toCheck);
+ this.checkAttributeNames = checkNames;
+ }
+
+ public void handleRequest(Request request, Response response)
+ {
+ this.session = request.getSession();
+ this.sessionId = session.getId();
+ this.lastAccessedTime = session.getLastAccessedTime();
+ this.maxInactiveInterval = session.getMaxInactiveInterval();
+ this.newSession = session.isNew();
+ this.creationTime = session.getCreationTime();
+
+ if (this.checkAttributeNames)
+ {
+ Enumeration<String> e = session.getAttributeNames();
+ while (e.hasMoreElements())
+ attributeNames.add(e.nextElement());
+ }
+
+ if (namesToCheck != null)
+ {
+ for (String name : namesToCheck)
+ {
+ checkedAttributes.put(name, session.getAttribute(name));
+ }
+ }
+ }
+
+ public String getSessionId()
+ {
+ return sessionId;
+ }
+
+ public long getLastAccessedTime()
+ {
+ return lastAccessedTime;
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return maxInactiveInterval;
+ }
+
+ public boolean isNewSession()
+ {
+ return newSession;
+ }
+
+ public long getCreationTime()
+ {
+ return creationTime;
+ }
+
+ public Map<String, Object> getCheckedAttributes()
+ {
+ return checkedAttributes;
+ }
+
+ public Set<String> getAttributeNames()
+ {
+ return attributeNames;
+ }
+
+ public HttpSession getSession()
+ {
+ return session;
+ }
+
+ public boolean isCheckAttributeNames()
+ {
+ return checkAttributeNames;
+ }
+
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.mocks;
-
-import org.apache.catalina.Loader;
-import org.apache.catalina.Pipeline;
-import org.apache.catalina.core.ContainerBase;
-import org.apache.catalina.core.StandardPipeline;
-
-/**
- * Mock Container impl to wrap a JBossCacheManager in unit tests.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class MockContainer extends ContainerBase
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 1L;
-
- private Loader loader;
-
- private Pipeline pipeline;
-
- @Override
- public Loader getLoader()
- {
- if (loader == null)
- {
- loader = new MockLoader();
- loader.setContainer(this);
- }
- return loader;
- }
-
- public Pipeline getPipeline()
- {
- if (pipeline == null)
- {
- pipeline = new StandardPipeline(this);
- }
- return pipeline;
- }
-
- public void setLoader(Loader loader)
- {
- this.loader = loader;
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockContainer.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.mocks;
+
+import org.apache.catalina.Loader;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.core.ContainerBase;
+import org.apache.catalina.core.StandardPipeline;
+
+/**
+ * Mock Container impl to wrap a JBossCacheManager in unit tests.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class MockContainer extends ContainerBase
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private Loader loader;
+
+ private Pipeline pipeline;
+
+ @Override
+ public Loader getLoader()
+ {
+ if (loader == null)
+ {
+ loader = new MockLoader();
+ loader.setContainer(this);
+ }
+ return loader;
+ }
+
+ public Pipeline getPipeline()
+ {
+ if (pipeline == null)
+ {
+ pipeline = new StandardPipeline(this);
+ }
+ return pipeline;
+ }
+
+ public void setLoader(Loader loader)
+ {
+ this.loader = loader;
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.mocks;
-
-import org.apache.catalina.Engine;
-import org.apache.catalina.Service;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockEngine extends MockContainer implements Engine
-{
- private static final long serialVersionUID = 1L;
-
- private Service service;
- private String defaultHost = "localhost";
- private String jvmRoute;
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#getDefaultHost()
- */
- public String getDefaultHost()
- {
- return defaultHost;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#getJvmRoute()
- */
- public String getJvmRoute()
- {
- return jvmRoute;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#getService()
- */
- public Service getService()
- {
- return service;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#setDefaultHost(java.lang.String)
- */
- public void setDefaultHost(String arg0)
- {
- this.defaultHost = arg0;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#setJvmRoute(java.lang.String)
- */
- public void setJvmRoute(String arg0)
- {
- this.jvmRoute = arg0;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Engine#setService(org.apache.catalina.Service)
- */
- public void setService(Service arg0)
- {
- this.service = arg0;
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockEngine.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.mocks;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.Service;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockEngine extends MockContainer implements Engine
+{
+ private static final long serialVersionUID = 1L;
+
+ private Service service;
+ private String defaultHost = "localhost";
+ private String jvmRoute;
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#getDefaultHost()
+ */
+ public String getDefaultHost()
+ {
+ return defaultHost;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#getJvmRoute()
+ */
+ public String getJvmRoute()
+ {
+ return jvmRoute;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#getService()
+ */
+ public Service getService()
+ {
+ return service;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#setDefaultHost(java.lang.String)
+ */
+ public void setDefaultHost(String arg0)
+ {
+ this.defaultHost = arg0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#setJvmRoute(java.lang.String)
+ */
+ public void setJvmRoute(String arg0)
+ {
+ this.jvmRoute = arg0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Engine#setService(org.apache.catalina.Service)
+ */
+ public void setService(Service arg0)
+ {
+ this.service = arg0;
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.mocks;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.Host;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockHost extends MockContainer implements Host
-{
- private static final long serialVersionUID = 1L;
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#addAlias(java.lang.String)
- */
- public void addAlias(String arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#findAliases()
- */
- public String[] findAliases()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getAppBase()
- */
- public String getAppBase()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getAutoDeploy()
- */
- public boolean getAutoDeploy()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getConfigClass()
- */
- public String getConfigClass()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getDeployOnStartup()
- */
- public boolean getDeployOnStartup()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getXmlNamespaceAware()
- */
- public boolean getXmlNamespaceAware()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#getXmlValidation()
- */
- public boolean getXmlValidation()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#map(java.lang.String)
- */
- public Context map(String arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#removeAlias(java.lang.String)
- */
- public void removeAlias(String arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setAppBase(java.lang.String)
- */
- public void setAppBase(String arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setAutoDeploy(boolean)
- */
- public void setAutoDeploy(boolean arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setConfigClass(java.lang.String)
- */
- public void setConfigClass(String arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setDeployOnStartup(boolean)
- */
- public void setDeployOnStartup(boolean arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setXmlNamespaceAware(boolean)
- */
- public void setXmlNamespaceAware(boolean arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.catalina.Host#setXmlValidation(boolean)
- */
- public void setXmlValidation(boolean arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockHost.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.mocks;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Host;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockHost extends MockContainer implements Host
+{
+ private static final long serialVersionUID = 1L;
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#addAlias(java.lang.String)
+ */
+ public void addAlias(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#findAliases()
+ */
+ public String[] findAliases()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getAppBase()
+ */
+ public String getAppBase()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getAutoDeploy()
+ */
+ public boolean getAutoDeploy()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getConfigClass()
+ */
+ public String getConfigClass()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getDeployOnStartup()
+ */
+ public boolean getDeployOnStartup()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getXmlNamespaceAware()
+ */
+ public boolean getXmlNamespaceAware()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#getXmlValidation()
+ */
+ public boolean getXmlValidation()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#map(java.lang.String)
+ */
+ public Context map(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#removeAlias(java.lang.String)
+ */
+ public void removeAlias(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setAppBase(java.lang.String)
+ */
+ public void setAppBase(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setAutoDeploy(boolean)
+ */
+ public void setAutoDeploy(boolean arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setConfigClass(java.lang.String)
+ */
+ public void setConfigClass(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setDeployOnStartup(boolean)
+ */
+ public void setDeployOnStartup(boolean arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setXmlNamespaceAware(boolean)
+ */
+ public void setXmlNamespaceAware(boolean arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.catalina.Host#setXmlValidation(boolean)
+ */
+ public void setXmlValidation(boolean arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.mocks;
-
-import java.beans.PropertyChangeListener;
-
-import org.apache.catalina.Container;
-import org.apache.catalina.Loader;
-
-/**
- * Mock Loader impl for use in unit tests.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class MockLoader implements Loader
-{
- private Container container;
-
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- // TODO Auto-generated method stub
- }
-
- public void addRepository(String repository)
- {
- // TODO Auto-generated method stub
- }
-
- public void backgroundProcess()
- {
- // TODO Auto-generated method stub
- }
-
- public String[] findRepositories()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ClassLoader getClassLoader()
- {
- return container == null ? getClass().getClassLoader()
- : container.getClass().getClassLoader();
- }
-
- public Container getContainer()
- {
- return container;
- }
-
- public boolean getDelegate()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getInfo()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean getReloadable()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean modified()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void setContainer(Container container)
- {
- this.container = container;
- }
-
- public void setDelegate(boolean delegate)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void setReloadable(boolean reloadable)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.mocks;
+
+import java.beans.PropertyChangeListener;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Loader;
+
+/**
+ * Mock Loader impl for use in unit tests.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class MockLoader implements Loader
+{
+ private Container container;
+
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void addRepository(String repository)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void backgroundProcess()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public String[] findRepositories()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return container == null ? getClass().getClassLoader()
+ : container.getClass().getClassLoader();
+ }
+
+ public Container getContainer()
+ {
+ return container;
+ }
+
+ public boolean getDelegate()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String getInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean getReloadable()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean modified()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setContainer(Container container)
+ {
+ this.container = container;
+ }
+
+ public void setDelegate(boolean delegate)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setReloadable(boolean reloadable)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,121 +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.mocks;
-
-import java.io.IOException;
-
-import org.apache.catalina.Manager;
-import org.apache.catalina.Session;
-import org.apache.catalina.connector.Request;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockRequest extends Request
-{
- private Session session;
- private String requestedSessionId;
- private boolean requestedSessionIdFromURL;
-
- /**
- * Create a new MockRequest.
- *
- */
- public MockRequest()
- {
- }
-
- @Override
- public String getRequestedSessionId()
- {
- return requestedSessionId;
- }
-
- public void setRequestedSessionId(String requestedSessionId)
- {
- this.requestedSessionId = requestedSessionId;
- }
-
-
- @Override
- protected Session doGetSession(boolean create)
- {
- if (session == null)
- {
- Manager manager = getContext().getManager();
- if (requestedSessionId != null)
- {
- try {
- session = manager.findSession(requestedSessionId);
- } catch (IOException e) {
- session = null;
- }
- }
-
- if (session == null && create)
- {
- session = manager.createSession(requestedSessionId);
- }
-
- if (session != null)
- {
- session.access();
- }
-
- }
-
- if (session != null && !session.isValid())
- {
- session = null;
- doGetSession(create);
- }
-
- return session;
- }
-
- public void setSession(Session session)
- {
- this.session = session;
- }
-
- @Override
- public boolean isRequestedSessionIdFromURL()
- {
- return requestedSessionIdFromURL;
- }
-
- public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
- {
- this.requestedSessionIdFromURL = requestedSessionIdFromURL;
- }
-
- @Override
- public void recycle()
- {
- if (session != null)
- session.endAccess();
- }
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockRequest.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,121 @@
+/*
+ * 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.mocks;
+
+import java.io.IOException;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.connector.Request;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockRequest extends Request
+{
+ private Session session;
+ private String requestedSessionId;
+ private boolean requestedSessionIdFromURL;
+
+ /**
+ * Create a new MockRequest.
+ *
+ */
+ public MockRequest()
+ {
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ return requestedSessionId;
+ }
+
+ public void setRequestedSessionId(String requestedSessionId)
+ {
+ this.requestedSessionId = requestedSessionId;
+ }
+
+
+ @Override
+ protected Session doGetSession(boolean create)
+ {
+ if (session == null)
+ {
+ Manager manager = getContext().getManager();
+ if (requestedSessionId != null)
+ {
+ try {
+ session = manager.findSession(requestedSessionId);
+ } catch (IOException e) {
+ session = null;
+ }
+ }
+
+ if (session == null && create)
+ {
+ session = manager.createSession(requestedSessionId);
+ }
+
+ if (session != null)
+ {
+ session.access();
+ }
+
+ }
+
+ if (session != null && !session.isValid())
+ {
+ session = null;
+ doGetSession(create);
+ }
+
+ return session;
+ }
+
+ public void setSession(Session session)
+ {
+ this.session = session;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return requestedSessionIdFromURL;
+ }
+
+ public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
+ {
+ this.requestedSessionIdFromURL = requestedSessionIdFromURL;
+ }
+
+ @Override
+ public void recycle()
+ {
+ if (session != null)
+ session.endAccess();
+ }
+
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,93 +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.mocks;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
-import org.apache.catalina.CometEvent;
-import org.apache.catalina.Valve;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockValve implements Valve
-{
- private Request invokedRequest;
- private Response invokedResponse;
-
- /**
- * Create a new MockValve.
- *
- */
- public MockValve()
- {
- }
-
- public void backgroundProcess()
- {
- }
-
- public void event(Request request, Response response, CometEvent event) throws IOException, ServletException
- {
- }
-
- public String getInfo()
- {
- return "MockValve";
- }
-
- public Valve getNext()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void invoke(Request request, Response response) throws IOException, ServletException
- {
- this.invokedRequest = request;
- this.invokedResponse = response;
- }
-
- public void setNext(Valve valve)
- {
-
- }
-
- public Request getInvokedRequest()
- {
- return invokedRequest;
- }
-
- public Response getInvokedResponse()
- {
- return invokedResponse;
- }
-
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockValve.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,93 @@
+/*
+ * 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.mocks;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.CometEvent;
+import org.apache.catalina.Valve;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockValve implements Valve
+{
+ private Request invokedRequest;
+ private Response invokedResponse;
+
+ /**
+ * Create a new MockValve.
+ *
+ */
+ public MockValve()
+ {
+ }
+
+ public void backgroundProcess()
+ {
+ }
+
+ public void event(Request request, Response response, CometEvent event) throws IOException, ServletException
+ {
+ }
+
+ public String getInfo()
+ {
+ return "MockValve";
+ }
+
+ public Valve getNext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void invoke(Request request, Response response) throws IOException, ServletException
+ {
+ this.invokedRequest = request;
+ this.invokedResponse = response;
+ }
+
+ public void setNext(Valve valve)
+ {
+
+ }
+
+ public Request getInvokedRequest()
+ {
+ return invokedRequest;
+ }
+
+ public Response getInvokedResponse()
+ {
+ return invokedResponse;
+ }
+
+
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,85 +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.mocks;
-
-import java.io.Serializable;
-
-/**
- * Simple wrapper around a string that will trigger replication on a get if
- * SET_AND_NON_PRIMITIVE_GET is used.
- *
- * @author Brian Stansberry
- *
- */
-public class MutableObject implements Serializable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -8800180646736265624L;
-
- private String string;
-
- /**
- * Create a new MutableObject.
- *
- */
- public MutableObject(String string)
- {
- this.string = string;
- }
-
- public String getString()
- {
- return this.string;
- }
-
- public void setString(String string)
- {
- this.string = string;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof MutableObject)
- {
- return this.string.equals(((MutableObject) obj).string);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return this.string.hashCode();
- }
-
- @Override
- public String toString()
- {
- return this.string;
- }
-
-
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/MutableObject.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,85 @@
+/*
+ * 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.mocks;
+
+import java.io.Serializable;
+
+/**
+ * Simple wrapper around a string that will trigger replication on a get if
+ * SET_AND_NON_PRIMITIVE_GET is used.
+ *
+ * @author Brian Stansberry
+ *
+ */
+public class MutableObject implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8800180646736265624L;
+
+ private String string;
+
+ /**
+ * Create a new MutableObject.
+ *
+ */
+ public MutableObject(String string)
+ {
+ this.string = string;
+ }
+
+ public String getString()
+ {
+ return this.string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof MutableObject)
+ {
+ return this.string.equals(((MutableObject) obj).string);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return this.string.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.string;
+ }
+
+
+
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,35 +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.mocks;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * @author Brian Stansberry
- *
- */
-public interface RequestHandler
-{
- void handleRequest(Request request, Response response);
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,35 @@
+/*
+ * 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.mocks;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public interface RequestHandler
+{
+ void handleRequest(Request request, Response response);
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,69 +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.mocks;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class RequestHandlerValve extends MockValve
-{
- private RequestHandler requestHandler;
-
- public RequestHandlerValve(RequestHandler handler)
- {
- this.requestHandler = handler;
- }
-
- public String getInfo()
- {
- return "RequestHandlerValve";
- }
-
- public void invoke(Request request, Response response) throws IOException, ServletException
- {
- super.invoke(request, response);
- requestHandler.handleRequest(request, response);
- }
-
- public RequestHandler getRequestHandler()
- {
- return requestHandler;
- }
-
- public void setRequestHandler(RequestHandler requestHandler)
- {
- this.requestHandler = requestHandler;
- }
-
-
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/RequestHandlerValve.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,69 @@
+/*
+ * 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.mocks;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class RequestHandlerValve extends MockValve
+{
+ private RequestHandler requestHandler;
+
+ public RequestHandlerValve(RequestHandler handler)
+ {
+ this.requestHandler = handler;
+ }
+
+ public String getInfo()
+ {
+ return "RequestHandlerValve";
+ }
+
+ public void invoke(Request request, Response response) throws IOException, ServletException
+ {
+ super.invoke(request, response);
+ requestHandler.handleRequest(request, response);
+ }
+
+ public RequestHandler getRequestHandler()
+ {
+ return requestHandler;
+ }
+
+ public void setRequestHandler(RequestHandler requestHandler)
+ {
+ this.requestHandler = requestHandler;
+ }
+
+
+
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,64 +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.mocks;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpSession;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class SetAttributesRequestHandler extends BasicRequestHandler
-{
- private Map<String, Object> toStore;
-
- /**
- * Create a new EstablishSessionRequestHandler.
- *
- */
- public SetAttributesRequestHandler(Map<String, Object> toStore, boolean checkNames)
- {
- super(toStore.keySet(), checkNames);
- this.toStore = toStore;
- }
-
- public void handleRequest(Request request, Response response)
- {
- super.handleRequest(request, response);
-
- HttpSession session = getSession();
- for (Map.Entry<String,Object> entry : toStore.entrySet())
- {
- session.setAttribute(entry.getKey(), entry.getValue());
- }
- }
-
-
-
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/mocks/SetAttributesRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,64 @@
+/*
+ * 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.mocks;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class SetAttributesRequestHandler extends BasicRequestHandler
+{
+ private Map<String, Object> toStore;
+
+ /**
+ * Create a new EstablishSessionRequestHandler.
+ *
+ */
+ public SetAttributesRequestHandler(Map<String, Object> toStore, boolean checkNames)
+ {
+ super(toStore.keySet(), checkNames);
+ this.toStore = toStore;
+ }
+
+ public void handleRequest(Request request, Response response)
+ {
+ super.handleRequest(request, response);
+
+ HttpSession session = getSession();
+ for (Map.Entry<String,Object> entry : toStore.entrySet())
+ {
+ session.setAttribute(entry.getKey(), entry.getValue());
+ }
+ }
+
+
+
+
+}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification)
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.notification;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus;
-import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause;
-import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
-import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicyBase;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockClusteredSessionNotificationPolicy extends ClusteredSessionNotificationPolicyBase
- implements
- ClusteredSessionNotificationPolicy
-{
- private boolean response;
- public final List<PolicyInvocation> invocations = new ArrayList<PolicyInvocation>();
-
- public enum Type { ATTRIBUTE, BINDING, SESSION };
-
- /* (non-Javadoc)
- * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionAttributeListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, java.lang.String, boolean)
- */
- public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- invocations.add(new PolicyInvocation(Type.ATTRIBUTE, status, cause, attributeName, local));
- return response;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionBindingListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, java.lang.String, boolean)
- */
- public boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- invocations.add(new PolicyInvocation(Type.BINDING, status, cause, attributeName, local));
- return response;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, boolean)
- */
- public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, boolean local)
- {
- invocations.add(new PolicyInvocation(Type.SESSION, status, cause, null, local));
- return response;
- }
-
- public boolean getResponse()
- {
- return response;
- }
-
- public void setResponse(boolean response)
- {
- this.response = response;
- }
-
- public List<PolicyInvocation> getInvocations()
- {
- return invocations;
- }
-
- public void clear()
- {
- invocations.clear();
- }
-
- public static class PolicyInvocation
- {
- public final Type type;
- public final ClusteredSessionManagementStatus status;
- public final ClusteredSessionNotificationCause cause;
- public final String attributeName;
- public final boolean local;
-
- private PolicyInvocation(Type type, ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- this.type = type;
- this.status = status;
- this.cause = cause;
- this.attributeName = attributeName;
- this.local = local;
- }
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicyBase;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockClusteredSessionNotificationPolicy extends ClusteredSessionNotificationPolicyBase
+ implements
+ ClusteredSessionNotificationPolicy
+{
+ private boolean response;
+ public final List<PolicyInvocation> invocations = new ArrayList<PolicyInvocation>();
+
+ public enum Type { ATTRIBUTE, BINDING, SESSION };
+
+ /* (non-Javadoc)
+ * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionAttributeListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, java.lang.String, boolean)
+ */
+ public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ invocations.add(new PolicyInvocation(Type.ATTRIBUTE, status, cause, attributeName, local));
+ return response;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionBindingListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, java.lang.String, boolean)
+ */
+ public boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ invocations.add(new PolicyInvocation(Type.BINDING, status, cause, attributeName, local));
+ return response;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy#isHttpSessionListenerInvocationAllowed(org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus, org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause, boolean)
+ */
+ public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, boolean local)
+ {
+ invocations.add(new PolicyInvocation(Type.SESSION, status, cause, null, local));
+ return response;
+ }
+
+ public boolean getResponse()
+ {
+ return response;
+ }
+
+ public void setResponse(boolean response)
+ {
+ this.response = response;
+ }
+
+ public List<PolicyInvocation> getInvocations()
+ {
+ return invocations;
+ }
+
+ public void clear()
+ {
+ invocations.clear();
+ }
+
+ public static class PolicyInvocation
+ {
+ public final Type type;
+ public final ClusteredSessionManagementStatus status;
+ public final ClusteredSessionNotificationCause cause;
+ public final String attributeName;
+ public final boolean local;
+
+ private PolicyInvocation(Type type, ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ this.type = type;
+ this.status = status;
+ this.cause = cause;
+ this.attributeName = attributeName;
+ this.local = local;
+ }
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.notification;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpSessionAttributeListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-import org.jboss.test.cluster.web.notification.MockHttpSessionBindingListener.Type;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockHttpSessionAttributeListener implements HttpSessionAttributeListener
-{
- public enum Type { ADDED, REMOVED, REPLACED };
-
- public final List<Type> invocations = new ArrayList<Type>();
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionAttributeListener#attributeAdded(javax.servlet.http.HttpSessionBindingEvent)
- */
- public void attributeAdded(HttpSessionBindingEvent arg0)
- {
- invocations.add(Type.ADDED);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionAttributeListener#attributeRemoved(javax.servlet.http.HttpSessionBindingEvent)
- */
- public void attributeRemoved(HttpSessionBindingEvent arg0)
- {
- invocations.add(Type.REMOVED);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionAttributeListener#attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)
- */
- public void attributeReplaced(HttpSessionBindingEvent arg0)
- {
- invocations.add(Type.REPLACED);
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionAttributeListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+
+import org.jboss.test.cluster.web.notification.MockHttpSessionBindingListener.Type;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockHttpSessionAttributeListener implements HttpSessionAttributeListener
+{
+ public enum Type { ADDED, REMOVED, REPLACED };
+
+ public final List<Type> invocations = new ArrayList<Type>();
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionAttributeListener#attributeAdded(javax.servlet.http.HttpSessionBindingEvent)
+ */
+ public void attributeAdded(HttpSessionBindingEvent arg0)
+ {
+ invocations.add(Type.ADDED);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionAttributeListener#attributeRemoved(javax.servlet.http.HttpSessionBindingEvent)
+ */
+ public void attributeRemoved(HttpSessionBindingEvent arg0)
+ {
+ invocations.add(Type.REMOVED);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionAttributeListener#attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)
+ */
+ public void attributeReplaced(HttpSessionBindingEvent arg0)
+ {
+ invocations.add(Type.REPLACED);
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.notification;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionBindingListener;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockHttpSessionBindingListener implements HttpSessionBindingListener, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- public enum Type { BOUND, UNBOUND };
-
- public transient List<Type> invocations = new ArrayList<Type>();
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
- */
- public void valueBound(HttpSessionBindingEvent arg0)
- {
- getInvocations().add(Type.BOUND);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
- */
- public void valueUnbound(HttpSessionBindingEvent arg0)
- {
- getInvocations().add(Type.UNBOUND);
- }
-
- private List<Type> getInvocations()
- {
- if (invocations == null)
- {
- invocations = new ArrayList<Type>();
- }
- return invocations;
- }
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionBindingListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.notification;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockHttpSessionBindingListener implements HttpSessionBindingListener, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ public enum Type { BOUND, UNBOUND };
+
+ public transient List<Type> invocations = new ArrayList<Type>();
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
+ */
+ public void valueBound(HttpSessionBindingEvent arg0)
+ {
+ getInvocations().add(Type.BOUND);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
+ */
+ public void valueUnbound(HttpSessionBindingEvent arg0)
+ {
+ getInvocations().add(Type.UNBOUND);
+ }
+
+ private List<Type> getInvocations()
+ {
+ if (invocations == null)
+ {
+ invocations = new ArrayList<Type>();
+ }
+ return invocations;
+ }
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java 2008-09-29 13:23:25 UTC (rev 78928)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.notification;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class MockHttpSessionListener implements HttpSessionListener
-{
- public enum Type { CREATED, DESTROYED };
-
- public final List<Type> invocations = new ArrayList<Type>();
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
- */
- public void sessionCreated(HttpSessionEvent arg0)
- {
- invocations.add(Type.CREATED);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
- */
- public void sessionDestroyed(HttpSessionEvent arg0)
- {
- invocations.add(Type.DESTROYED);
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/notification/MockHttpSessionListener.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class MockHttpSessionListener implements HttpSessionListener
+{
+ public enum Type { CREATED, DESTROYED };
+
+ public final List<Type> invocations = new ArrayList<Type>();
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
+ */
+ public void sessionCreated(HttpSessionEvent arg0)
+ {
+ invocations.add(Type.CREATED);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
+ */
+ public void sessionDestroyed(HttpSessionEvent arg0)
+ {
+ invocations.add(Type.DESTROYED);
+ }
+
+}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/InvalidateSessionRequestHandler.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/util/InvalidateSessionRequestHandler.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/InvalidateSessionRequestHandler.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/InvalidateSessionRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,55 @@
+/*
+ * 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.util;
+
+import java.util.Set;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class InvalidateSessionRequestHandler extends BasicRequestHandler
+{
+ /**
+ * Create a new RemoveAttributesRequestHandler.
+ *
+ */
+ public InvalidateSessionRequestHandler(Set<String> toCheck, boolean checkNames)
+ {
+ super(toCheck, checkNames);
+ }
+
+ public void handleRequest(Request request, Response response)
+ {
+ super.handleRequest(request, response);
+
+ getSession().invalidate();
+ }
+
+
+
+
+}
Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/RemoveAttributesRequestHandler.java (from rev 78928, branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/util/RemoveAttributesRequestHandler.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/RemoveAttributesRequestHandler.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cluster/web/util/RemoveAttributesRequestHandler.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,64 @@
+/*
+ * 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.util;
+
+import java.util.Set;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class RemoveAttributesRequestHandler extends BasicRequestHandler
+{
+ private Set<String> toRemove;
+
+ /**
+ * Create a new RemoveAttributesRequestHandler.
+ *
+ */
+ public RemoveAttributesRequestHandler(Set<String> toRemove, boolean checkNames)
+ {
+ super(toRemove, checkNames);
+ this.toRemove = toRemove;
+ }
+
+ public void handleRequest(Request request, Response response)
+ {
+ super.handleRequest(request, response);
+
+ HttpSession session = getSession();
+ for (String key : toRemove)
+ {
+ session.removeAttribute(key);
+ }
+ }
+
+
+
+
+}
Modified: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2008-10-13 16:39:25 UTC (rev 79411)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/ClusteredSession.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -50,6 +50,10 @@
import org.apache.catalina.util.StringManager;
import org.jboss.logging.Logger;
import org.jboss.metadata.WebMetaData;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
+import org.jboss.web.tomcat.service.session.notification.LegacyClusteredSessionNotificationPolicy;
/**
* Abstract base class for session clustering based on StandardSession. Different session
@@ -175,6 +179,13 @@
* Has this session only been accessed once?
*/
protected transient boolean firstAccess;
+
+ /**
+ * Policy that drives whether we issue servlet spec notifications.
+ */
+ protected transient ClusteredSessionNotificationPolicy notificationPolicy;
+
+ protected transient ClusteredSessionManagementStatus clusterStatus;
/**
* The string manager for this package.
@@ -200,6 +211,7 @@
invalidationPolicy = manager.getInvalidateSessionPolicy();
this.useJK = useJK;
this.firstAccess = true;
+ this.notificationPolicy = new LegacyClusteredSessionNotificationPolicy();
checkAlwaysReplicateMetadata();
}
@@ -555,11 +567,14 @@
throw new IllegalArgumentException
(sm.getString("clusteredSession.setAttribute.iae"));
+ ClusteredSessionNotificationPolicy policy = getNotificationPolicy();
+
// Construct an event with the new value
HttpSessionBindingEvent event = null;
// Call the valueBound() method if necessary
- if (value instanceof HttpSessionBindingListener)
+ if (value instanceof HttpSessionBindingListener
+ && policy.isHttpSessionBindingListenerInvocationAllowed(this.clusterStatus, ClusteredSessionNotificationCause.MODIFY, name, true))
{
event = new HttpSessionBindingEvent(getSession(), name, value);
try
@@ -577,7 +592,8 @@
// Call the valueUnbound() method if necessary
if ((unbound != null) && (unbound != value) &&
- (unbound instanceof HttpSessionBindingListener))
+ (unbound instanceof HttpSessionBindingListener) &&
+ policy.isHttpSessionBindingListenerInvocationAllowed(this.clusterStatus, ClusteredSessionNotificationCause.MODIFY, name, true))
{
try
{
@@ -591,71 +607,74 @@
}
// Notify interested application event listeners
- Context context = (Context) manager.getContainer();
- Object listeners[] = context.getApplicationEventListeners();
- if (listeners == null)
- return;
- for (int i = 0; i < listeners.length; i++)
+ if (policy.isHttpSessionAttributeListenerInvocationAllowed(this.clusterStatus, ClusteredSessionNotificationCause.MODIFY, name, true))
{
- if (!(listeners[i] instanceof HttpSessionAttributeListener))
- continue;
- HttpSessionAttributeListener listener =
- (HttpSessionAttributeListener) listeners[i];
- try
+ Context context = (Context) manager.getContainer();
+ Object lifecycleListeners[] = context.getApplicationEventListeners();
+ if (lifecycleListeners == null)
+ return;
+ for (int i = 0; i < lifecycleListeners.length; i++)
{
- if (unbound != null)
- {
- fireContainerEvent(context,
- "beforeSessionAttributeReplaced",
- listener);
- if (event == null)
- {
- event = new HttpSessionBindingEvent
- (getSession(), name, unbound);
- }
- listener.attributeReplaced(event);
- fireContainerEvent(context,
- "afterSessionAttributeReplaced",
- listener);
- }
- else
- {
- fireContainerEvent(context,
- "beforeSessionAttributeAdded",
- listener);
- if (event == null)
- {
- event = new HttpSessionBindingEvent
- (getSession(), name, value);
- }
- listener.attributeAdded(event);
- fireContainerEvent(context,
- "afterSessionAttributeAdded",
- listener);
- }
- }
- catch (Throwable t)
- {
+ if (!(lifecycleListeners[i] instanceof HttpSessionAttributeListener))
+ continue;
+ HttpSessionAttributeListener listener =
+ (HttpSessionAttributeListener) lifecycleListeners[i];
try
{
if (unbound != null)
{
fireContainerEvent(context,
+ "beforeSessionAttributeReplaced",
+ listener);
+ if (event == null)
+ {
+ event = new HttpSessionBindingEvent
+ (getSession(), name, unbound);
+ }
+ listener.attributeReplaced(event);
+ fireContainerEvent(context,
"afterSessionAttributeReplaced",
listener);
}
else
{
fireContainerEvent(context,
+ "beforeSessionAttributeAdded",
+ listener);
+ if (event == null)
+ {
+ event = new HttpSessionBindingEvent
+ (getSession(), name, value);
+ }
+ listener.attributeAdded(event);
+ fireContainerEvent(context,
"afterSessionAttributeAdded",
listener);
}
}
- catch (Exception e)
+ catch (Throwable t)
{
- ;
+ try
+ {
+ if (unbound != null)
+ {
+ fireContainerEvent(context,
+ "afterSessionAttributeReplaced",
+ listener);
+ }
+ else
+ {
+ fireContainerEvent(context,
+ "afterSessionAttributeAdded",
+ listener);
+ }
+ }
+ catch (Exception e)
+ {
+ ;
+ }
+ manager.getContainer().getLogger().error(sm.getString("standardSession.attributeEvent"), t);
}
- manager.getContainer().getLogger().error(sm.getString("standardSession.attributeEvent"), t);
}
}
}
@@ -692,7 +711,7 @@
boolean notify = true;
boolean localCall = true;
boolean localOnly = false;
- expire(notify, localCall, localOnly);
+ expire(notify, localCall, localOnly, ClusteredSessionNotificationCause.INVALIDATE);
}
@@ -757,7 +776,7 @@
{
boolean localCall = true;
boolean localOnly = true;
- expire(notify, localCall, localOnly);
+ expire(notify, localCall, localOnly, ClusteredSessionNotificationCause.TIMEOUT);
}
/**
@@ -782,8 +801,9 @@
* cluster nodes should be made aware of the expiration.
* Only meaningful if <code>localCall</code> is
* <code>true</code>.
+ * @param cause the cause of the expiration
*/
- public void expire(boolean notify, boolean localCall, boolean localOnly)
+ public void expire(boolean notify, boolean localCall, boolean localOnly, ClusteredSessionNotificationCause cause)
{
if (log.isDebugEnabled())
{
@@ -810,18 +830,20 @@
// Notify interested application event listeners
// FIXME - Assumes we call listeners in reverse order
Context context = (Context) manager.getContainer();
- Object listeners[] = context.getApplicationLifecycleListeners();
- if (notify && (listeners != null))
+ Object lifecycleListeners[] = context.getApplicationLifecycleListeners();
+ if (notify
+ && (lifecycleListeners != null)
+ && getNotificationPolicy().isHttpSessionListenerInvocationAllowed(this.clusterStatus, cause, localCall))
{
HttpSessionEvent event =
new HttpSessionEvent(getSession());
- for (int i = 0; i < listeners.length; i++)
+ for (int i = 0; i < lifecycleListeners.length; i++)
{
- int j = (listeners.length - 1) - i;
- if (!(listeners[j] instanceof HttpSessionListener))
+ int j = (lifecycleListeners.length - 1) - i;
+ if (!(lifecycleListeners[j] instanceof HttpSessionListener))
continue;
HttpSessionListener listener =
- (HttpSessionListener) listeners[j];
+ (HttpSessionListener) lifecycleListeners[j];
try
{
fireContainerEvent(context,
@@ -848,6 +870,7 @@
}
}
}
+
if (ACTIVITY_CHECK) {
accessCount.set(0);
}
@@ -861,7 +884,7 @@
// JBAS-1360 -- Unbind any objects associated with this session
String keys[] = keys();
for (int i = 0; i < keys.length; i++)
- removeAttributeInternal(keys[i], localCall, localOnly, notify);
+ removeAttributeInternal(keys[i], localCall, localOnly, notify, cause);
// Remove this session from our manager's active sessions
removeFromManager(localCall, localOnly);
@@ -1034,6 +1057,8 @@
lastReplicated = 0;
maxUnreplicatedInterval = 0;
this.alwaysReplicateMetadata = true;
+ this.notificationPolicy = null;
+ this.clusterStatus = null;
}
/**
@@ -1057,7 +1082,20 @@
// Parse the real id first, as super.setId() calls add(),
// which depends on having the real id
parseRealId(id);
- super.setId(id);
+
+ // TODO -- should we bypass this if realId hasn't changed? We're removing
+ // and readding every time we fail over, when all we want is a
+ // jvmRoute change to the session id
+
+ if ((this.id != null) && (manager != null))
+ manager.remove(this);
+
+ this.id = id;
+
+ this.clusterStatus = new ClusteredSessionManagementStatus(this.realId, true, null, null);
+
+ if (manager != null)
+ manager.add(this);
}
/**
@@ -1099,6 +1137,53 @@
sessionMetadataDirty();
}
+ @Override
+ public void tellNew()
+ {
+ tellNew(ClusteredSessionNotificationCause.CREATE);
+ }
+
+ public void tellNew(ClusteredSessionNotificationCause cause)
+ {
+ // Notify interested session event listeners
+ fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
+
+ // Notify interested application event listeners
+ if (getNotificationPolicy().isHttpSessionListenerInvocationAllowed(this.clusterStatus, cause, true))
+ {
+ Context context = (Context) manager.getContainer();
+ Object lifecycleListeners[] = context.getApplicationLifecycleListeners();
+ if (lifecycleListeners != null)
+ {
+ HttpSessionEvent event = new HttpSessionEvent(getSession());
+ for (int i = 0; i < lifecycleListeners.length; i++)
+ {
+ if (!(lifecycleListeners[i] instanceof HttpSessionListener))
+ continue;
+ HttpSessionListener listener = (HttpSessionListener) lifecycleListeners[i];
+ try
+ {
+ fireContainerEvent(context, "beforeSessionCreated", listener);
+ listener.sessionCreated(event);
+ fireContainerEvent(context, "afterSessionCreated", listener);
+ }
+ catch (Throwable t)
+ {
+ try
+ {
+ fireContainerEvent(context, "afterSessionCreated", listener);
+ }
+ catch (Exception e)
+ {
+ ;
+ }
+ manager.getContainer().getLogger().error(sm.getString("standardSession.sessionEvent"), t);
+ }
+ }
+ }
+ }
+ }
+
public String toString()
{
StringBuffer buf = new StringBuffer();
@@ -1156,6 +1241,10 @@
// as a proxy for when replication occurred
this.lastReplicated = this.thisAccessedTime;
+ this.notificationPolicy = new LegacyClusteredSessionNotificationPolicy();
+
+ this.clusterStatus = new ClusteredSessionManagementStatus(this.realId, true, null, null);
+
checkAlwaysReplicateMetadata();
// TODO uncomment when work on JBAS-1900 is completed
@@ -1257,9 +1346,20 @@
return excluded;
}
+
+ protected ClusteredSessionNotificationPolicy getNotificationPolicy()
+ {
+ return notificationPolicy;
+ }
+
+ protected void setNotificationPolicy(ClusteredSessionNotificationPolicy notificationPolicy)
+ {
+ this.notificationPolicy = notificationPolicy;
+ }
+
// -------------------------------------- Internal protected method override
-
+
/**
* Method inherited from Tomcat. Return zero-length based string if not found.
*/
@@ -1278,7 +1378,7 @@
{
boolean localCall = true;
boolean localOnly = false;
- removeAttributeInternal(name, localCall, localOnly, notify);
+ removeAttributeInternal(name, localCall, localOnly, notify, ClusteredSessionNotificationCause.MODIFY);
}
/**
@@ -1294,11 +1394,13 @@
* @param localOnly <code>true</code> if the removal should not be
* replicated around the cluster
* @param notify <code>true</code> if listeners should be notified
+ * @param cause the cause of the removal
*/
protected void removeAttributeInternal(String name,
boolean localCall,
boolean localOnly,
- boolean notify)
+ boolean notify,
+ ClusteredSessionNotificationCause cause)
{
// Remove this attribute from our collection
@@ -1310,53 +1412,59 @@
return;
}
+ ClusteredSessionNotificationPolicy policy = getNotificationPolicy();
+
// Call the valueUnbound() method if necessary
HttpSessionBindingEvent event = null;
- if (value instanceof HttpSessionBindingListener)
+ if (value instanceof HttpSessionBindingListener
+ && policy.isHttpSessionBindingListenerInvocationAllowed(this.clusterStatus, cause, name, localCall))
{
event = new HttpSessionBindingEvent(getSession(), name, value);
((HttpSessionBindingListener) value).valueUnbound(event);
}
// Notify interested application event listeners
- Context context = (Context) manager.getContainer();
- Object listeners[] = context.getApplicationEventListeners();
- if (listeners == null)
- return;
- for (int i = 0; i < listeners.length; i++)
+ if (policy.isHttpSessionAttributeListenerInvocationAllowed(this.clusterStatus, cause, name, localCall))
{
- if (!(listeners[i] instanceof HttpSessionAttributeListener))
- continue;
- HttpSessionAttributeListener listener =
- (HttpSessionAttributeListener) listeners[i];
- try
+ Context context = (Context) manager.getContainer();
+ Object lifecycleListeners[] = context.getApplicationEventListeners();
+ if (lifecycleListeners == null)
+ return;
+ for (int i = 0; i < lifecycleListeners.length; i++)
{
- fireContainerEvent(context,
- "beforeSessionAttributeRemoved",
- listener);
- if (event == null)
- {
- event = new HttpSessionBindingEvent
- (getSession(), name, value);
- }
- listener.attributeRemoved(event);
- fireContainerEvent(context,
- "afterSessionAttributeRemoved",
- listener);
- }
- catch (Throwable t)
- {
+ if (!(lifecycleListeners[i] instanceof HttpSessionAttributeListener))
+ continue;
+ HttpSessionAttributeListener listener =
+ (HttpSessionAttributeListener) lifecycleListeners[i];
try
{
fireContainerEvent(context,
+ "beforeSessionAttributeRemoved",
+ listener);
+ if (event == null)
+ {
+ event = new HttpSessionBindingEvent
+ (getSession(), name, value);
+ }
+ listener.attributeRemoved(event);
+ fireContainerEvent(context,
"afterSessionAttributeRemoved",
listener);
}
- catch (Exception e)
+ catch (Throwable t)
{
- ;
+ try
+ {
+ fireContainerEvent(context,
+ "afterSessionAttributeRemoved",
+ listener);
+ }
+ catch (Exception e)
+ {
+ ;
+ }
+ manager.getContainer().getLogger().error(sm.getString("standardSession.attributeEvent"), t);
}
- manager.getContainer().getLogger().error(sm.getString("standardSession.attributeEvent"), t);
}
}
Modified: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheClusteredSession.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheClusteredSession.java 2008-10-13 16:39:25 UTC (rev 79411)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheClusteredSession.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -47,6 +47,7 @@
super(manager, manager.getUseJK());
int maxUnrep = manager.getMaxUnreplicatedInterval() * 1000;
setMaxUnreplicatedInterval(maxUnrep);
+ establishNotificationPolicy();
establishProxy();
}
@@ -58,9 +59,10 @@
*/
public void initAfterLoad(AbstractJBossManager manager)
{
- // Our manager and proxy may have been lost if we were recycled,
+ // Our manager, notification policy and proxy may have been lost if we were replicated,
// so reestablish them
setManager(manager);
+ establishNotificationPolicy();
establishProxy();
// Since attribute map may be transient, we may need to populate it
@@ -158,4 +160,8 @@
boolean localCall,
boolean localOnly);
+ protected void establishNotificationPolicy()
+ {
+ setNotificationPolicy(((JBossCacheManager)manager).getNotificationPolicy());
+ }
}
Modified: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2008-10-13 16:39:25 UTC (rev 79411)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -49,6 +49,10 @@
import org.jboss.metadata.WebMetaData;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.web.tomcat.service.JBossWeb;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCapability;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause;
+import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationPolicy;
+import org.jboss.web.tomcat.service.session.notification.LegacyClusteredSessionNotificationPolicy;
/**
* Implementation of a clustered session manager for
@@ -62,7 +66,7 @@
public class JBossCacheManager
extends JBossManager
implements JBossCacheManagerMBean
-{
+{
/**
* Informational name for this Catalina component
*/
@@ -132,6 +136,9 @@
private boolean trace;
private int maxUnreplicatedInterval_ = WebMetaData.DEFAULT_MAX_UNREPLICATED_INTERVAL;
+
+ private String notificationPolicyClass_;
+ private ClusteredSessionNotificationPolicy notificationPolicy_;
// ---------------------------------------------------------- Constructors
@@ -173,6 +180,8 @@
this.maxUnreplicatedInterval_ = maxUnrep.intValue();
}
+ this.notificationPolicyClass_ = webMetaData.getClusteredSessionNotificationPolicy();
+
if (proxy_ == null)
proxy_ = new JBossCacheService(cacheObjectNameString_);
@@ -408,8 +417,18 @@
this.maxUnreplicatedInterval_ = maxUnreplicatedInterval;
}
+ public ClusteredSessionNotificationPolicy getNotificationPolicy()
+ {
+ return notificationPolicy_;
+ }
+
// JBossCacheManagerMBean-methods -------------------------------------
+ public void setNotificationPolicy_(ClusteredSessionNotificationPolicy notificationPolicy_)
+ {
+ this.notificationPolicy_ = notificationPolicy_;
+ }
+
public void expireSession(String sessionId)
{
Session session = findSession(sessionId);
@@ -550,7 +569,7 @@
boolean localOnly = true;
try
{
- ses.expire(notify, localCall, localOnly);
+ ses.expire(notify, localCall, localOnly, ClusteredSessionNotificationCause.UNDEPLOY);
}
catch (Throwable t)
{
@@ -637,6 +656,7 @@
}
session.setId(sessionId); // Setting the id leads to a call to add()
+ session.tellNew(ClusteredSessionNotificationCause.CREATE);
if (log_.isDebugEnabled())
{
@@ -810,12 +830,15 @@
log_.trace("Checking for session " + realId + " in the distributed cache");
session = loadSession(realId);
- if (session != null)
- {
- add(session);
- // TODO should we advise of a new session?
- //tellNew();
- }
+// if (session != null)
+// {
+// add(session);
+// // We now notify, since we've added a policy to allow listeners
+// // to discriminate. But the default policy will not allow the
+// // notification to be emitted for FAILOVER, so the standard
+// // behavior is unchanged.
+// session.tellNew(ClusteredSessionNotificationCause.FAILOVER);
+// }
}
else if (session != null && session.isOutdated())
{
@@ -1075,7 +1098,10 @@
// Need to initialize.
session.initAfterLoad(this);
if (mustAdd)
+ {
add(session, false); // don't replicate
+ session.tellNew(ClusteredSessionNotificationCause.FAILOVER);
+ }
long elapsed = System.currentTimeMillis() - begin;
stats_.updateLoadStats(realId, elapsed);
@@ -1331,7 +1357,7 @@
Thread.currentThread().setContextClassLoader(tcl_);
synchronized (session)
{
- session.removeAttributeInternal(attrKey, localCall, localOnly, notify);
+ session.removeAttributeInternal(attrKey, localCall, localOnly, notify, ClusteredSessionNotificationCause.MODIFY);
}
if (trace)
log_.trace("processRemoteAttributeRemoval: removed attribute " +
@@ -1378,7 +1404,7 @@
try
{
Thread.currentThread().setContextClassLoader(tcl_);
- session.expire(notify, localCall, localOnly);
+ session.expire(notify, localCall, localOnly, ClusteredSessionNotificationCause.TIMEOUT);
}
finally
{
@@ -1395,7 +1421,9 @@
public void processLocalPojoModification(String realId)
{
+ // Try to use the thread local and avoid concurrent map
ClusteredSession session = findLocalSession(realId);
+
if (session != null)
{
if (trace)
@@ -1454,6 +1482,8 @@
{
super.start();
+ initClusteredSessionNotificationPolicy();
+
// Start the JBossCacheService
// Will need to pass the classloader that is associated with this
//web app so de-serialization will work correctly.
@@ -1521,8 +1551,10 @@
log_.error(msg, e);
throw new LifecycleException(msg, e);
}
- }
+ }
+ initClusteredSessionNotificationPolicy();
+
// Validate attributes
if ("SET_AND_GET".equalsIgnoreCase(replTriggerString_))
@@ -1683,6 +1715,32 @@
}
return (mserver_);
}
+
+ private void initClusteredSessionNotificationPolicy()
+ {
+ if (this.notificationPolicyClass_ == null || this.notificationPolicyClass_.length() == 0)
+ {
+ this.notificationPolicyClass_ = System.getProperty("jboss.web.clustered.session.notification.policy",
+ LegacyClusteredSessionNotificationPolicy.class.getName());
+ }
+
+ try
+ {
+ this.notificationPolicy_ = (ClusteredSessionNotificationPolicy) Thread.currentThread().getContextClassLoader().loadClass(this.notificationPolicyClass_).newInstance();
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to instantiate " +
+ ClusteredSessionNotificationPolicy.class.getName() +
+ " " + this.notificationPolicyClass_, e);
+ }
+
+ this.notificationPolicy_.setClusteredSessionNotificationCapability(new ClusteredSessionNotificationCapability());
+ }
/**
* Gets the ids of all sessions in the distributed cache and adds
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification)
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,103 +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.web.tomcat.service.session.notification;
-
-/**
- * Encapsulates the status of how the local container is managing the
- * given session.
- *
- * @author Brian Stansberry
- */
-public class ClusteredSessionManagementStatus
-{
- private final String realId;
- private final boolean locallyUsed;
- private final Boolean locallyActive;
- private final Boolean locallyOwned;
-
- public ClusteredSessionManagementStatus(String realId,
- boolean locallyUsed,
- Boolean locallyActive,
- Boolean locallyOwned)
- {
- if (this.realId == null)
- throw new IllegalArgumentException("realId is null");
-
- this.realId = realId;
- this.locallyUsed = locallyUsed;
- // If we haven't been locallyUsed, we can't be locallyActive
- this.locallyActive = (locallyUsed ? locallyActive : Boolean.FALSE);
- // If we are locallyActive, we are locally owned
- this.locallyOwned = (Boolean.TRUE.equals(locallyActive) ? Boolean.TRUE : locallyOwned);
- }
-
- /**
- * Gets whether an HttpSession object for the given session has been
- * returned from the container to the application on this node.
- *
- * @return <code>true</code> if the session has been used locally,
- * <code>false</code> if not.
- */
- public boolean isLocallyUsed()
- {
- return locallyUsed;
- }
-
- /**
- * Gets whether an HttpSession object for the given session has been
- * returned from the container to the application on this node AND
- * this node is the last one to handle a request for the session.
- *
- * @return <code>true</code> if the above conditions are true and the
- * container is sure of this, <code>false</code> if they are not
- * true and the container knows this, or <code>null</code> if the
- * container is unsure if this node is the last one to handle a
- * request for the session.
- *
- * @see ClusteredSessionNotificationCapability#isLocallyActiveAware()
- */
- public Boolean getLocallyActive()
- {
- return locallyActive;
- }
-
- /**
- * Gets whether this node considers itself to be the "owner" of the session;
- * i.e. the one primarily responsible for managing its lifecycle. Note that
- * a node that is undeploying a war will always give up ownership of its
- * sessions if it is aware of other nodes in the cluster that still have
- * the war deployed.
- *
- * @return <code>true</code> if the container knows it is the owner,
- * <code>false</code> if it knows it is not the owner, or
- * <code>null</code> if the container is unsure about ownership
- * or does not recognize the concept of ownership.
- *
- * @see ClusteredSessionNotificationCapability#isLocallyOwnedAware()
- */
- public Boolean getLocallyOwned()
- {
- return locallyOwned;
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionManagementStatus.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,127 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+/**
+ * Encapsulates the status of how the local container is managing the
+ * given session.
+ *
+ * @author Brian Stansberry
+ */
+public class ClusteredSessionManagementStatus
+{
+ private final String realId;
+ private final boolean locallyUsed;
+ private final Boolean locallyActive;
+ private final Boolean locallyOwned;
+
+ /**
+ * Create a new ClusteredSessionManagementStatus.
+ *
+ * @param realId the id of the session, excluding any jvmRoute.
+ * @param locallyUsed whether the session has been provided to the
+ * application on this node.
+ * @param locallyActive whether this node is the most recent one to
+ * handle a request for the session; <code>null</code>
+ * if unknown
+ * @param locallyOwned whether this node is the "owner" of the session,
+ * <code>null</code> if unknown or the concept of
+ * ownership is unsupported.
+ */
+ public ClusteredSessionManagementStatus(String realId,
+ boolean locallyUsed,
+ Boolean locallyActive,
+ Boolean locallyOwned)
+ {
+ if (realId == null)
+ throw new IllegalArgumentException("realId is null");
+
+ this.realId = realId;
+ this.locallyUsed = locallyUsed;
+ // If we haven't been locallyUsed, we can't be locallyActive
+ this.locallyActive = (locallyUsed ? locallyActive : Boolean.FALSE);
+ // If we are locallyActive, we are locally owned
+ this.locallyOwned = (Boolean.TRUE.equals(locallyActive) ? Boolean.TRUE : locallyOwned);
+ }
+
+ /**
+ * Gets the id of the session, excluding any jvmRoute that may have
+ * been appended if JK is used.
+ *
+ * @return the id. Will not return <code>null</code>.
+ */
+ public String getRealId()
+ {
+ return realId;
+ }
+
+ /**
+ * Gets whether an HttpSession object for the given session has been
+ * returned from the container to the application on this node.
+ *
+ * @return <code>true</code> if the session has been used locally,
+ * <code>false</code> if not.
+ */
+ public boolean isLocallyUsed()
+ {
+ return locallyUsed;
+ }
+
+ /**
+ * Gets whether an HttpSession object for the given session has been
+ * returned from the container to the application on this node AND
+ * this node is the last one to handle a request for the session.
+ *
+ * @return <code>true</code> if the above conditions are true and the
+ * container is sure of this, <code>false</code> if they are not
+ * true and the container knows this, or <code>null</code> if the
+ * container is unsure if this node is the last one to handle a
+ * request for the session.
+ *
+ * @see ClusteredSessionNotificationCapability#isLocallyActiveAware()
+ */
+ public Boolean getLocallyActive()
+ {
+ return locallyActive;
+ }
+
+ /**
+ * Gets whether this node considers itself to be the "owner" of the session;
+ * i.e. the one primarily responsible for managing its lifecycle. Note that
+ * a node that is undeploying a war will always give up ownership of its
+ * sessions if it is aware of other nodes in the cluster that still have
+ * the war deployed.
+ *
+ * @return <code>true</code> if the container knows it is the owner,
+ * <code>false</code> if it knows it is not the owner, or
+ * <code>null</code> if the container is unsure about ownership
+ * or does not recognize the concept of ownership.
+ *
+ * @see ClusteredSessionNotificationCapability#isLocallyOwnedAware()
+ */
+ public Boolean getLocallyOwned()
+ {
+ return locallyOwned;
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,133 +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.web.tomcat.service.session.notification;
-
-
-/**
- * Encapsulates information about the container's capability to issue
- * servlet spec notifications under different condititions. Implementations of
- * {@link ClusteredSessionNotificationPolicy} can use this
- * information to get a sense of the capabilities of the container.
- *
- * @author Brian Stansberry
- */
-public class ClusteredSessionNotificationCapability
-{
-
- /**
- * Does the container support invoking <code>HttpSessionListener</code>
- * callbacks under the given conditions?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is supported,
- * <code>false</code> if not
- */
- public boolean isHttpSessionListenerInvocationSupported(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- boolean local)
- {
- return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
- }
-
- /**
- * Under the given conditions, does the container support invoking
- * <code>HttpSessionAttributeListener</code> callbacks?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is supported,
- * <code>false</code> if not
- */
- public boolean isHttpSessionAttributeListenerInvocationSupported(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- boolean local)
- {
- return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
- }
-
- /**
- * Under the given conditions, does the container support invoking
- * <code>HttpSessionBindingListener</code> callbacks?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is supported,
- * <code>false</code> if not
- */
- public boolean isHttpSessionBindingListenerInvocationSupported(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- boolean local)
- {
- return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
- }
-
- /**
- * Is the container able to distinguish whether a session that has been
- * {@link ClusteredSessionManagementStatus#isLocallyUsed() locally used}
- * is also {@link ClusteredSessionManagementStatus#getLocallyActive() locally active}?
- *
- * @return <code>true</code> if the container is able to make this distinction;
- * <code>false</code> if not
- */
- public boolean isLocallyActiveAware()
- {
- return false;
- }
-
- /**
- * Is the container able to distinguish whether a session is
- * {@link ClusteredSessionManagementStatus#getLocallyOwned() locally owned}?
- *
- * @return <code>true</code> if the container is able to make this distinction;
- * <code>false</code> if not
- */
- public boolean isLocallyOwnedAware()
- {
- return false;
- }
-
- /**
- * Returns whether the local container is aware of events on remote nodes
- * that could give rise to notifications.
- *
- * @param cause the cause
- * @return <code>true</code> if the local container is aware of the
- * remote event, <code>false</code> if not.
- */
- public boolean isRemoteCauseAware(ClusteredSessionNotificationCause cause)
- {
- return ClusteredSessionNotificationCause.CREATE.equals(cause)
- || ClusteredSessionNotificationCause.MODIFY.equals(cause)
- || ClusteredSessionNotificationCause.INVALIDATE.equals(cause);
- }
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCapability.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,133 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+
+/**
+ * Encapsulates information about the container's capability to issue
+ * servlet spec notifications under different condititions. Implementations of
+ * {@link ClusteredSessionNotificationPolicy} can use this
+ * information to get a sense of the capabilities of the container.
+ *
+ * @author Brian Stansberry
+ */
+public class ClusteredSessionNotificationCapability
+{
+
+ /**
+ * Does the container support invoking <code>HttpSessionListener</code>
+ * callbacks under the given conditions?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is supported,
+ * <code>false</code> if not
+ */
+ public boolean isHttpSessionListenerInvocationSupported(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ boolean local)
+ {
+ return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
+ }
+
+ /**
+ * Under the given conditions, does the container support invoking
+ * <code>HttpSessionAttributeListener</code> callbacks?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is supported,
+ * <code>false</code> if not
+ */
+ public boolean isHttpSessionAttributeListenerInvocationSupported(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ boolean local)
+ {
+ return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
+ }
+
+ /**
+ * Under the given conditions, does the container support invoking
+ * <code>HttpSessionBindingListener</code> callbacks?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is supported,
+ * <code>false</code> if not
+ */
+ public boolean isHttpSessionBindingListenerInvocationSupported(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ boolean local)
+ {
+ return local && status.isLocallyUsed() && !ClusteredSessionNotificationCause.STATE_TRANSFER.equals(cause);
+ }
+
+ /**
+ * Is the container able to distinguish whether a session that has been
+ * {@link ClusteredSessionManagementStatus#isLocallyUsed() locally used}
+ * is also {@link ClusteredSessionManagementStatus#getLocallyActive() locally active}?
+ *
+ * @return <code>true</code> if the container is able to make this distinction;
+ * <code>false</code> if not
+ */
+ public boolean isLocallyActiveAware()
+ {
+ return false;
+ }
+
+ /**
+ * Is the container able to distinguish whether a session is
+ * {@link ClusteredSessionManagementStatus#getLocallyOwned() locally owned}?
+ *
+ * @return <code>true</code> if the container is able to make this distinction;
+ * <code>false</code> if not
+ */
+ public boolean isLocallyOwnedAware()
+ {
+ return false;
+ }
+
+ /**
+ * Returns whether the local container is aware of events on remote nodes
+ * that could give rise to notifications.
+ *
+ * @param cause the cause
+ * @return <code>true</code> if the local container is aware of the
+ * remote event, <code>false</code> if not.
+ */
+ public boolean isRemoteCauseAware(ClusteredSessionNotificationCause cause)
+ {
+ return ClusteredSessionNotificationCause.CREATE.equals(cause)
+ || ClusteredSessionNotificationCause.MODIFY.equals(cause)
+ || ClusteredSessionNotificationCause.INVALIDATE.equals(cause);
+ }
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,100 +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.web.tomcat.service.session.notification;
-
-/**
- * Reasons why a servlet spec notification for a clustered session is being
- * generated.
- *
- * @author Brian Stansberry
- */
-public enum ClusteredSessionNotificationCause
-{
- /**
- * Session has been newly created.
- */
- CREATE,
-
- /**
- * Session has been modified by the application.
- */
- MODIFY,
-
- /**
- * Session has failed over and is now in use on the local node.
- */
- FAILOVER,
-
- /**
- * Session has failed over and is no longer active on the local node.
- */
- FAILAWAY,
-
- /**
- * Session is being invalidated by the application.
- */
- INVALIDATE,
-
- /**
- * Session is being expired by the container due to timeout.
- */
- TIMEOUT,
-
- /**
- * Session is being expired by the container due to undeploy of the
- * web application.
- */
- UNDEPLOY,
-
- /**
- * Local node became aware of a session active on another node as
- * a result of the local node receiving a bulk state transfer due to
- * its being elected to provide backup for that other node's sessions.
- */
- STATE_TRANSFER//,
-
-// /**
-// * Local node has taken "ownership" of a session for a reason other than
-// * failover; i.e. the session hasn't become active on the local node. In this
-// * case the local node would have become aware of the session earlier (i.e.
-// * via {@link #CREATE} or {@link #STATE_TRANSFER}) and these notifications
-// * would signal the local node taking greater responsibility for the session.
-// * Typically a policy implementation would not allow notifications for a
-// * remotely originated CREATE or for a STATE_TRANSFER if it allows
-// * notifications for TAKE_OWNERSHIP, and vice versa. Otherwise, multiple
-// * notifications would be received for the same session.
-// */
-// TAKE_OWNERSHIP,
-//
-// /**
-// * Local node has relinquised "ownership" of a session for a reason other than
-// * {@link #FAILAWAY} {@link #INVALIDATE}, {@link #TIMEOUT} or {@link #UNDEPLOY};
-// * i.e. some other node is taking over as the owner of session.
-// * Typically a policy implementation would not allow notifications for a
-// * remotely originated CREATE or for a STATE_TRANSFER if it allows
-// * notifications for TAKE_OWNERSHIP, and vice versa. Otherwise, multiple
-// * notifications would be received for the same session.
-// */
-// RELINQUISH_OWNERSHIP
-
-}
\ No newline at end of file
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationCause.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,100 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+/**
+ * Reasons why a servlet spec notification for a clustered session is being
+ * generated.
+ *
+ * @author Brian Stansberry
+ */
+public enum ClusteredSessionNotificationCause
+{
+ /**
+ * Session has been newly created.
+ */
+ CREATE,
+
+ /**
+ * Session has been modified by the application.
+ */
+ MODIFY,
+
+ /**
+ * Session has failed over and is now in use on the local node.
+ */
+ FAILOVER,
+
+ /**
+ * Session has failed over and is no longer active on the local node.
+ */
+ FAILAWAY,
+
+ /**
+ * Session is being invalidated by the application.
+ */
+ INVALIDATE,
+
+ /**
+ * Session is being expired by the container due to timeout.
+ */
+ TIMEOUT,
+
+ /**
+ * Session is being expired by the container due to undeploy of the
+ * web application.
+ */
+ UNDEPLOY,
+
+ /**
+ * Local node became aware of a session active on another node as
+ * a result of the local node receiving a bulk state transfer due to
+ * its being elected to provide backup for that other node's sessions.
+ */
+ STATE_TRANSFER//,
+
+// /**
+// * Local node has taken "ownership" of a session for a reason other than
+// * failover; i.e. the session hasn't become active on the local node. In this
+// * case the local node would have become aware of the session earlier (i.e.
+// * via {@link #CREATE} or {@link #STATE_TRANSFER}) and these notifications
+// * would signal the local node taking greater responsibility for the session.
+// * Typically a policy implementation would not allow notifications for a
+// * remotely originated CREATE or for a STATE_TRANSFER if it allows
+// * notifications for TAKE_OWNERSHIP, and vice versa. Otherwise, multiple
+// * notifications would be received for the same session.
+// */
+// TAKE_OWNERSHIP,
+//
+// /**
+// * Local node has relinquised "ownership" of a session for a reason other than
+// * {@link #FAILAWAY} {@link #INVALIDATE}, {@link #TIMEOUT} or {@link #UNDEPLOY};
+// * i.e. some other node is taking over as the owner of session.
+// * Typically a policy implementation would not allow notifications for a
+// * remotely originated CREATE or for a STATE_TRANSFER if it allows
+// * notifications for TAKE_OWNERSHIP, and vice versa. Otherwise, multiple
+// * notifications would be received for the same session.
+// */
+// RELINQUISH_OWNERSHIP
+
+}
\ No newline at end of file
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,115 +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.web.tomcat.service.session.notification;
-
-/**
- * Policy for determining whether the servlet spec notifications related
- * to session events are allowed to be emitted on the local cluster node.
- * <p>
- * <strong>Note:</strong> The use of the word <strong>allowed</strong> above
- * is intentional; if a given policy implementation returns <code>true</code>
- * from one of the methods in this interface, that does not mean the listener
- * will be invoked by the container, nor does the presence of a method in this
- * interface imply that it will be invoked by the container in all cases. The
- * only contract this interface creates is that before invoking a listener
- * method, the container will invoke an implementation of this policy to
- * get permission and will not invoke the listeners if this policy returns
- * <code>false</code>. If the container does not support emitting notifications
- * in certain cases, it may not bother checking if the notification is allowed,
- * and even if it checks, it still will not emit the notification.
- * </p>
- * <p>
- * An example of a case where the container may not support emitting a
- * notification is for a session that has never been used locally.
- * </p>
- *
- * @author Brian Stansberry
- */
-public interface ClusteredSessionNotificationPolicy
-{
- /**
- * Are invocations of <code>HttpSessionListener</code> callbacks
- * allowed under the given conditions?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is allowed,
- * <code>false</code> if not
- */
- boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- boolean local);
-
-
- /**
- * Under the given conditions, are invocations of
- * <code>HttpSessionAttributeListener</code> callbacks allowed?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param attributeName value that would be passed to the <code>name</code>
- * param of the <code>HttpSessionBindingEvent</code> if
- * the listener were invoked
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is allowed,
- * <code>false</code> if not
- */
- boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- String attributeName,
- boolean local);
-
- /**
- * Under the given conditions, are invocations of
- * <code>HttpSessionBindingListener</code> callbacks allowed?
- *
- * @param status the status of the session
- * @param cause the cause of the session notification
- * @param attributeName value that would be passed to the <code>name</code>
- * param of the <code>HttpSessionBindingEvent</code> if
- * the listener were invoked
- * @param local <code>true</code> if the event driving the notification
- * originated on this node; <code>false</code> otherwise
- *
- * @return <code>true</code> if the notification is allowed,
- * <code>false</code> if not
- */
- boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause,
- String attributeName,
- boolean local);
-
- /**
- * Provides the policy information about the container's capabilities with
- * respect to issuing notifications. Will be invoked by the container before
- * the first invocation of any of the other methods in this interface.
- *
- * @param capability the capability, Will not be <code>null</code>.
- */
- void setClusteredSessionExpriationNotificationCapability(ClusteredSessionNotificationCapability capability);
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,115 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+/**
+ * Policy for determining whether the servlet spec notifications related
+ * to session events are allowed to be emitted on the local cluster node.
+ * <p>
+ * <strong>Note:</strong> The use of the word <strong>allowed</strong> above
+ * is intentional; if a given policy implementation returns <code>true</code>
+ * from one of the methods in this interface, that does not mean the listener
+ * will be invoked by the container, nor does the presence of a method in this
+ * interface imply that it will be invoked by the container in all cases. The
+ * only contract this interface creates is that before invoking a listener
+ * method, the container will invoke an implementation of this policy to
+ * get permission and will not invoke the listeners if this policy returns
+ * <code>false</code>. If the container does not support emitting notifications
+ * in certain cases, it may not bother checking if the notification is allowed,
+ * and even if it checks, it still will not emit the notification.
+ * </p>
+ * <p>
+ * An example of a case where the container may not support emitting a
+ * notification is for a session that has never been used locally.
+ * </p>
+ *
+ * @author Brian Stansberry
+ */
+public interface ClusteredSessionNotificationPolicy
+{
+ /**
+ * Are invocations of <code>HttpSessionListener</code> callbacks
+ * allowed under the given conditions?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is allowed,
+ * <code>false</code> if not
+ */
+ boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ boolean local);
+
+
+ /**
+ * Under the given conditions, are invocations of
+ * <code>HttpSessionAttributeListener</code> callbacks allowed?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param attributeName value that would be passed to the <code>name</code>
+ * param of the <code>HttpSessionBindingEvent</code> if
+ * the listener were invoked
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is allowed,
+ * <code>false</code> if not
+ */
+ boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ String attributeName,
+ boolean local);
+
+ /**
+ * Under the given conditions, are invocations of
+ * <code>HttpSessionBindingListener</code> callbacks allowed?
+ *
+ * @param status the status of the session
+ * @param cause the cause of the session notification
+ * @param attributeName value that would be passed to the <code>name</code>
+ * param of the <code>HttpSessionBindingEvent</code> if
+ * the listener were invoked
+ * @param local <code>true</code> if the event driving the notification
+ * originated on this node; <code>false</code> otherwise
+ *
+ * @return <code>true</code> if the notification is allowed,
+ * <code>false</code> if not
+ */
+ boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause,
+ String attributeName,
+ boolean local);
+
+ /**
+ * Provides the policy information about the container's capabilities with
+ * respect to issuing notifications. Will be invoked by the container before
+ * the first invocation of any of the other methods in this interface.
+ *
+ * @param capability the capability, Will not be <code>null</code>.
+ */
+ void setClusteredSessionNotificationCapability(ClusteredSessionNotificationCapability capability);
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,29 +0,0 @@
-package org.jboss.web.tomcat.service.session.notification;
-
-/**
- * Base superclass for a {@link ClusteredSessionNotificationPolicy} implementation.
- *
- * @author Brian Stansberry
- *
- */
-public class ClusteredSessionNotificationPolicyBase
-{
-
- private ClusteredSessionNotificationCapability capability;
-
- public ClusteredSessionNotificationPolicyBase()
- {
- super();
- }
-
- public void setClusteredSessionExpriationNotificationCapability(ClusteredSessionNotificationCapability capability)
- {
- this.capability = capability;
- }
-
- public ClusteredSessionNotificationCapability getClusteredSessionExpriationNotificationCapability()
- {
- return this.capability;
- }
-
-}
\ No newline at end of file
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/ClusteredSessionNotificationPolicyBase.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,29 @@
+package org.jboss.web.tomcat.service.session.notification;
+
+/**
+ * Base superclass for a {@link ClusteredSessionNotificationPolicy} implementation.
+ *
+ * @author Brian Stansberry
+ *
+ */
+public class ClusteredSessionNotificationPolicyBase
+{
+
+ private ClusteredSessionNotificationCapability capability;
+
+ public ClusteredSessionNotificationPolicyBase()
+ {
+ super();
+ }
+
+ public void setClusteredSessionNotificationCapability(ClusteredSessionNotificationCapability capability)
+ {
+ this.capability = capability;
+ }
+
+ public ClusteredSessionNotificationCapability getClusteredSessionExpriationNotificationCapability()
+ {
+ return this.capability;
+ }
+
+}
\ No newline at end of file
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,64 +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.web.tomcat.service.session.notification;
-
-/**
- * Does not allow invocation of HttpSessionListener or HttpSessionAttributeListener
- * during session expiration due to undeploy.
- *
- * @author Brian Stansberry
- */
-public class IgnoreUndeployLegacyClusteredSessionNotificationPolicy
- extends LegacyClusteredSessionNotificationPolicy
-{
- /**
- * Overrides superclass to return <code>false</code> if the cause of the
- * notification is {@link ClusteredSessionNotificationCause.UNDEPLOY}.
- *
- * @return <code>true</code> if <code>status.isLocallyUsed()</code>
- * is <code>true</code> and the cause of the notification is not
- * {@link ClusteredSessionNotificationCause.UNDEPLOY}.
- */
- public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- return !ClusteredSessionNotificationCause.UNDEPLOY.equals(cause)
- && super.isHttpSessionAttributeListenerInvocationAllowed(status, cause, attributeName, local);
- }
-
- /**
- * Overrides superclass to return <code>false</code> if the cause of the
- * notification is {@link ClusteredSessionNotificationCause.UNDEPLOY}.
- *
- * @return <code>true</code> if <code>status.isLocallyUsed()</code>
- * is <code>true</code> and the cause of the notification is not
- * {@link ClusteredSessionNotificationCause.UNDEPLOY}.
- */
- public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, boolean local)
- {
- return !ClusteredSessionNotificationCause.UNDEPLOY.equals(cause)
- && isHttpSessionListenerInvocationAllowed(status, cause, local);
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/IgnoreUndeployLegacyClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,64 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+/**
+ * Does not allow invocation of HttpSessionListener or HttpSessionAttributeListener
+ * during session expiration due to undeploy.
+ *
+ * @author Brian Stansberry
+ */
+public class IgnoreUndeployLegacyClusteredSessionNotificationPolicy
+ extends LegacyClusteredSessionNotificationPolicy
+{
+ /**
+ * Overrides superclass to return <code>false</code> if the cause of the
+ * notification is {@link ClusteredSessionNotificationCause.UNDEPLOY}.
+ *
+ * @return <code>true</code> if <code>status.isLocallyUsed()</code>
+ * is <code>true</code> and the cause of the notification is not
+ * {@link ClusteredSessionNotificationCause.UNDEPLOY}.
+ */
+ public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ return !ClusteredSessionNotificationCause.UNDEPLOY.equals(cause)
+ && super.isHttpSessionAttributeListenerInvocationAllowed(status, cause, attributeName, local);
+ }
+
+ /**
+ * Overrides superclass to return <code>false</code> if the cause of the
+ * notification is {@link ClusteredSessionNotificationCause.UNDEPLOY}.
+ *
+ * @return <code>true</code> if <code>status.isLocallyUsed()</code>
+ * is <code>true</code> and the cause of the notification is not
+ * {@link ClusteredSessionNotificationCause.UNDEPLOY}.
+ */
+ public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, boolean local)
+ {
+ return !ClusteredSessionNotificationCause.UNDEPLOY.equals(cause)
+ && isHttpSessionListenerInvocationAllowed(status, cause, local);
+ }
+
+}
Deleted: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java 2008-09-15 20:51:43 UTC (rev 78553)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -1,73 +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.web.tomcat.service.session.notification;
-
-/**
- * {@link ClusteredSessionNotificationPolicy} implementation that
- * describes the behavior of JBoss AS releases prior to 4.2.4.
- *
- * @author Brian Stansberry
- */
-public class LegacyClusteredSessionNotificationPolicy
- extends ClusteredSessionNotificationPolicyBase
- implements ClusteredSessionNotificationPolicy
-{
- // -------------------------------------- ClusteredSessionNotificationPolicy
-
- /**
- * {@inheritDoc}
- *
- * @return <code>true</code> if <code>status.isLocallyUsed()</code>
- * is <code>true</code>.
- */
- public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- return status.isLocallyUsed();
- }
-
- /**
- * {@inheritDoc}
- *
- * @return <code>true</code> if <code>status.isLocallyUsed()</code>
- * is <code>true</code>.
- */
- public boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, String attributeName, boolean local)
- {
- return status.isLocallyUsed();
- }
-
- /**
- * {@inheritDoc}
- *
- * @return <code>true</code> if <code>status.isLocallyUsed()</code>
- * is <code>true</code>.
- */
- public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
- ClusteredSessionNotificationCause cause, boolean local)
- {
- return status.isLocallyUsed();
- }
-
-}
Copied: branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java (from rev 78553, branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/tomcat/src/main/org/jboss/web/tomcat/service/session/notification/LegacyClusteredSessionNotificationPolicy.java 2008-10-13 16:40:11 UTC (rev 79412)
@@ -0,0 +1,73 @@
+/*
+ * 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.web.tomcat.service.session.notification;
+
+/**
+ * {@link ClusteredSessionNotificationPolicy} implementation that
+ * describes the behavior of JBoss AS releases prior to 4.2.4.
+ *
+ * @author Brian Stansberry
+ */
+public class LegacyClusteredSessionNotificationPolicy
+ extends ClusteredSessionNotificationPolicyBase
+ implements ClusteredSessionNotificationPolicy
+{
+ // -------------------------------------- ClusteredSessionNotificationPolicy
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return <code>true</code> if <code>status.isLocallyUsed()</code>
+ * is <code>true</code>.
+ */
+ public boolean isHttpSessionAttributeListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ return status.isLocallyUsed();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return <code>true</code> if <code>status.isLocallyUsed()</code>
+ * is <code>true</code>.
+ */
+ public boolean isHttpSessionBindingListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, String attributeName, boolean local)
+ {
+ return status.isLocallyUsed();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return <code>true</code> if <code>status.isLocallyUsed()</code>
+ * is <code>true</code>.
+ */
+ public boolean isHttpSessionListenerInvocationAllowed(ClusteredSessionManagementStatus status,
+ ClusteredSessionNotificationCause cause, boolean local)
+ {
+ return status.isLocallyUsed() && !ClusteredSessionNotificationCause.FAILOVER.equals(cause);
+ }
+
+}
More information about the jboss-cvs-commits
mailing list