Author: julien(a)jboss.com
Date: 2006-11-28 19:44:02 -0500 (Tue, 28 Nov 2006)
New Revision: 5741
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/build.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java
Log:
- separate the session clustering tests as they conflict when they are executed in the
same test case (xfiles, needs to be figured out)
Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-29 00:44:02 UTC (rev 5741)
@@ -593,7 +593,9 @@
<sysproperty key="test.uri"
value="/test/redirect/"/>
</x-sysproperty>
<x-test>
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.ha.session.SessionTestSuite"/>-->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.portlet.ha.session.ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase"/>
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.info.InfoTestSuite"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.session.SessionSynchronizationTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
@@ -606,10 +608,13 @@
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.deployment.UnmarshallerTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.state.StatefulPortletInvokerTestCase"/>-->
+
+<!--
<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.ext.nocache.NoCacheTestSuite"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.ext.expiringcache.ExpiringCacheTestSuite"/>
+-->
</x-test>
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -162,7 +162,7 @@
}
else
{
- log.debug("Found action for jointpoint " + actionJoinpoint + "
: " + action);
+ log.info("Found action for jointpoint " + actionJoinpoint + "
: " + action);
//
Result result = ((PortletActionTestAction)action).execute(this, req, resp);
@@ -209,7 +209,7 @@
//
if (action != null && action instanceof PortletRenderTestAction)
{
- log.debug("Found action for jointpoint " + renderJoinpoint + " :
" + action);
+ log.info("Found action for jointpoint " + renderJoinpoint + " :
" + action);
// Get the result
Result sr = ((PortletRenderTestAction)action).execute(this, req, resp);
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new
NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate"));
+ return suite;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.portlet.ha.session;
import java.io.Serializable;
+import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -61,4 +62,16 @@
}
return false;
}
+
+ private void writeObject(java.io.ObjectOutputStream out) throws IOException
+ {
+ out.writeUTF(string);
+ System.out.print("Serializing " + string);
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException,
ClassNotFoundException
+ {
+ string = in.readUTF();
+ System.out.print("Unserializing " + string);
+ }
}
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ReplicateImmutableValueTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new
NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestReplicateImmutableValue"));
+ return suite;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ReplicateMutableValueTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new
NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestReplicateMutableValue"));
+ return suite;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -32,6 +32,7 @@
import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
import org.jboss.portal.test.framework.portlet.universal.UTP1;
import org.jboss.portal.test.framework.server.NodeId;
+import org.jboss.portal.common.util.Tools;
import javax.portlet.Portlet;
import javax.portlet.PortletException;
@@ -41,6 +42,7 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import java.io.IOException;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -51,7 +53,7 @@
public void createTestReplicateImmutableValue(SequenceRegistry registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+ registry.addSequence("TestReplicateImmutableValue", seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new
PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws PortletException, PortletSecurityException, IOException
@@ -80,7 +82,7 @@
public void createTestReplicateMutableValue(SequenceRegistry registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+ registry.addSequence("TestReplicateMutableValue", seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new
PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException
@@ -111,7 +113,7 @@
public void
createTestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate(SequenceRegistry
registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+
registry.addSequence("TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate",
seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new
PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException
@@ -119,6 +121,7 @@
assertNull(request.getPortletSession(false));
PortletSession session = request.getPortletSession();
assertNotNull(session);
+ assertEquals(Collections.EMPTY_LIST,
Tools.toList(session.getAttributeNames()));
MutableValue value = new MutableValue("abcdef");
session.setAttribute("mutable", value);
PortletURL portletURL = response.createRenderURL();
@@ -131,6 +134,7 @@
protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response) throws IOException
{
PortletSession session = request.getPortletSession();
+ assertEquals(Collections.singletonList("mutable"),
Tools.toList(session.getAttributeNames()));
Object o = session.getAttribute("mutable");
assertNotNull(o);
assertEquals(MutableValue.class, o.getClass());
@@ -147,6 +151,7 @@
{
PortletSession session = request.getPortletSession();
assertNotNull(session);
+ assertEquals(Collections.singletonList("mutable"),
Tools.toList(session.getAttributeNames()));
assertEquals(new MutableValue("abcdef"),
session.getAttribute("mutable"));
return new EndTestResult();
}
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -36,7 +36,9 @@
public static Test suite()
{
TestSuite suite = new TestSuite("test-ha-session.war", new
NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
- suite.addTest(new TestCase(NodeId.PORTS_01, "ABC"));
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestReplicateMutableValue"));
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestReplicateImmutableValue"));
+ suite.addTest(new TestCase(NodeId.PORTS_01,
"TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate"));
return suite;
}
}
Added:
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.framework.container.client;
+
+import org.apache.commons.httpclient.SimpleHttpConnectionManager;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExtendedSimpleHttpConnectionManager extends SimpleHttpConnectionManager
+{
+ public void closeConnection()
+ {
+ httpConnection.close();
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java 2006-11-28
23:04:49 UTC (rev 5740)
+++
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java 2006-11-29
00:44:02 UTC (rev 5741)
@@ -29,7 +29,6 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
@@ -89,6 +88,9 @@
/** . */
private Node currentNode;
+ /** . */
+ private ExtendedSimpleHttpConnectionManager connManager;
+
public TestCase(String testCaseId)
{
this(testCaseId, "/test/");
@@ -124,7 +126,8 @@
this.uri = uri;
this.testCaseId = testCaseId;
this.requestCount = 0;
- this.client = new HttpClient(new SimpleHttpConnectionManager());
+ this.connManager = new ExtendedSimpleHttpConnectionManager();
+ this.client = new HttpClient(connManager);
// Configure client
client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, null);
@@ -216,6 +219,9 @@
if (post != null)
{
post.releaseConnection();
+
+ //
+ connManager.closeConnection();
}
}
}
@@ -243,6 +249,9 @@
if (get != null)
{
get.releaseConnection();
+
+ //
+ connManager.closeConnection();
}
}
}
@@ -334,6 +343,7 @@
//
log.info("# Invoking test case over http " + cfg + " " +
method.getURI());
+ //
return client.executeMethod(cfg, method);
}