Author: mwringe
Date: 2010-06-15 14:36:05 -0400 (Tue, 15 Jun 2010)
New Revision: 3339
Added:
components/wsrp/trunk/test/.settings/
components/wsrp/trunk/wsrp-producer-war/src/test/
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/java/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/
components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml
Removed:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
components/wsrp/trunk/wsrp-producer-war/pom.xml
Log:
Initial commit of WSRP V1 producer tests, needs a lot of work and cleanup right now :(
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -23,6 +23,11 @@
package org.gatein.wsrp.producer;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
+
import junit.framework.TestCase;
import org.gatein.common.NotYetImplemented;
@@ -32,6 +37,8 @@
*/
public abstract class WSRPProducerBaseTest extends TestCase
{
+ protected WSRPProducerImpl producer = WSRPProducerImpl.getInstance();
+
protected WSRPProducerBaseTest(String name) throws Exception
{
super(name);
@@ -39,11 +46,85 @@
public void deploy(String warFileName) throws Exception
{
- throw new NotYetImplemented("deploy");
+ File archiveDirectory = getDirectory("test.deployables.dir");
+ File deployDirectory = getDirectory("jboss.server.home.dir",
"deploy");
+ File archiveFile = getArchive(warFileName, archiveDirectory, true);
+ File deployArchive = getArchive(warFileName, deployDirectory, false);
+
+ FileChannel inputChannel = new FileInputStream(archiveFile).getChannel();
+ FileChannel outputChannel = new FileOutputStream(deployArchive).getChannel();
+
+ inputChannel.transferTo(0, inputChannel.size(), outputChannel);
+
+ Thread.currentThread().sleep(10000);
}
public void undeploy(String warFileName) throws Exception
{
- throw new NotYetImplemented("undeploy");
+ File deployDirectory = getDirectory("jboss.server.home.dir",
"deploy");
+ File archive = getArchive(warFileName, deployDirectory, true);
+
+ archive.delete();
+
+ Thread.currentThread().sleep(10000);
}
+
+ private File getDirectory (String property) throws Exception
+ {
+ return getDirectory(property, null);
+ }
+
+ private File getDirectory (String property, String subDirectory) throws Exception
+ {
+ String deployableProperty = System.getProperty(property);
+ if (deployableProperty != null)
+ {
+ if (subDirectory != null)
+ {
+ deployableProperty += File.separator + subDirectory;
+ }
+
+ File deployableDir = new File(deployableProperty);
+ if (deployableDir.exists() && deployableDir.isDirectory())
+ {
+ return deployableDir;
+ }
+ else
+ {
+ throw new Error("Found a system property for \'" + property
+ "\' [" + deployableProperty + "] but value does not correspond to a
directory.");
+ }
+ }
+ else
+ {
+ throw new Error ("Could not find the system property \'" +
property + "\' cannot deploy test archives.");
+ }
}
+
+
+ private File getArchive(String fileName, File deployDirectory, boolean shouldExist)
throws Exception
+ {
+ if (fileName != null && deployDirectory != null &&
deployDirectory.exists() && deployDirectory.isDirectory())
+ {
+ File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator
+ fileName);
+ return archiveFile;
+// if (archiveFile.exists() && shouldExist)
+// {
+// return archiveFile;
+// }
+// else if (!archiveFile.exists() && !shouldExist)
+// {
+// return archiveFile;
+// }
+// else
+// {
+// //since its not what we are expecting we need to throw the opposite error
message
+// String existsString = shouldExist ? "does not exist" :
"exists";
+// throw new Exception("Archive " + fileName + " in directory
" + deployDirectory + " " + existsString + " which is not
expected.");
+// }
+ }
+ else
+ {
+ throw new Exception("Cannot find archive to deploy. Archive name ["
+ fileName + "] is null or the deploy directory + [" + deployDirectory + "]
is not a directory");
+ }
+ }
+}
Deleted:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -1,778 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.protocol.v1;
-
-import org.gatein.wsrp.WSRPActionURL;
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPPortletURL;
-import org.gatein.wsrp.WSRPRenderURL;
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
-import org.oasis.wsrp.v1.V1CacheControl;
-import org.oasis.wsrp.v1.V1GetMarkup;
-import org.oasis.wsrp.v1.V1InitCookie;
-import org.oasis.wsrp.v1.V1InteractionParams;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1MarkupContext;
-import org.oasis.wsrp.v1.V1MarkupResponse;
-import org.oasis.wsrp.v1.V1NamedString;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1RuntimeContext;
-import org.oasis.wsrp.v1.V1SessionContext;
-import org.oasis.wsrp.v1.V1StateChange;
-import org.oasis.wsrp.v1.V1UnsupportedMode;
-import org.oasis.wsrp.v1.V1UpdateResponse;
-
-import java.rmi.RemoteException;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 13149 $
- * @since 2.4
- */
-public class MarkupTestCase extends NeedPortletHandleTest
-{
- private static final String DEFAULT_VIEW_MARKUP = "<p>symbol unset stock
value: value unset</p>";
- private static final String DEFAULT_MARKUP_PORTLET_WAR =
"test-markup-portlet.war";
-
- public MarkupTestCase()
- throws Exception
- {
- super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
- }
-
- public void testGetMarkupViewNoSession() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponse(response, DEFAULT_VIEW_MARKUP);
- }
-
- public void testInvalidGetMarkup() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setMode("invalid mode");
-
- try
- {
- producer.getMarkup(getMarkup);
- ExtendedAssert.fail();
- }
- catch (V1UnsupportedMode unsupportedMode)
- {
- // expected
- }
- }
-
- public void testGetMarkupWithSessionID() throws Exception
- {
- // The consumer should never have access to or be able to set a sessionID. Sessions
are handled by the Producer using cookies.
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getRuntimeContext().setSessionID("Hello World");
-
- try
- {
- producer.getMarkup(getMarkup);
- ExtendedAssert.fail("A sessionID should not be allowed to be passed in
GetMarkup()");
- }
- catch (V1OperationFailed operationFailed)
- {
- // expected
- }
- }
-
- public void testGetMarkupEditNoSession() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setMode(WSRPConstants.EDIT_MODE);
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponse(response, "<form method='post'
action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite'
id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock
symbol</t" +
- "d><td><input
name='symbol'/></td></tr><tr><td><input
type='submit'
value='Submit'></td></tr></table></form>");
- }
-
- public void testGetMarkupRenderParameters() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archiveName = "test-renderparam-portlet.war";
- deploy(archiveName);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
-
- String markupString = res.getMarkupContext().getMarkupString();
-
- String julienLink = extractLink(markupString, 0);
- WSRPPortletURL julienURL = WSRPPortletURL.create(julienLink);
-
- ExtendedAssert.assertString1ContainsString2(markupString, "Hello,
Anonymous!");
- ExtendedAssert.assertString1ContainsString2(markupString, "Counter:
0");
-
- ExtendedAssert.assertTrue(julienURL instanceof WSRPRenderURL);
- WSRPRenderURL julienRender = (WSRPRenderURL)julienURL;
-
- // We're now trying to get a hello for Julien ;)
-
gm.getMarkupParams().setNavigationalState(julienRender.getNavigationalState().getStringValue());
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "Hello,
Julien!");
-
- // julien.length() * 2 to bypass second link
- WSRPPortletURL incrementURL = WSRPPortletURL.create(extractLink(markupString,
julienLink.length() * 2));
- ExtendedAssert.assertTrue(incrementURL instanceof WSRPActionURL);
- WSRPActionURL incrementAction = (WSRPActionURL)incrementURL;
-
- // let's see now if we can increment the counter
- V1PerformBlockingInteraction performBlockingInteraction =
-
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
-
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
- producer.performBlockingInteraction(performBlockingInteraction);
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "Counter:
1");
- }
- finally
- {
- undeploy(archiveName);
- }
- }
-
- private String extractLink(String markupString, int fromIndex)
- {
- int urlStartIndex = markupString.indexOf("='", fromIndex);
- int urlEndIndex = markupString.indexOf("'>", urlStartIndex);
- return markupString.substring(urlStartIndex + 2, urlEndIndex);
- }
-
- // fix-me: add more tests
-
- public void testGetMarkupSession() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- // deploy session-manipulating portlet
- String sessionPortletArchive = "test-session-portlet.war";
- deploy(sessionPortletArchive);
-
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponseWithSession(response, 0);
-
- response = producer.getMarkup(getMarkup);
- checkMarkupResponseWithSession(response, 1);
-
- // fix-me: try to reuse the old session id: what should happen?
-// runtimeContext.setSessionID(sessionID);
-// getMarkup.setRuntimeContext(runtimeContext);
-// try
-// {
-// producer.getMarkup(getMarkup);
-// fail("The session should be invalid...");
-// }
-// catch (InvalidSessionFault expected)
-// {
-// }
- }
- finally
- {
- // reset state
- undeploy(sessionPortletArchive);
- }
- }
-
- public void testPerformBlockingInteractionNoRedirect() throws Exception
- {
- checkPBIAndGetNavigationalState("RHAT");
- }
-
- public void testPerformBlockingInteractionRedirect() throws Exception
- {
- V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
- V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
-
- // crappy way but this is a test! ;)
- V1NamedString namedString = new V1NamedString();
- namedString.setName("symbol");
- namedString.setValue("HELP");
- interactionParams.getFormParameters().add(namedString);
-
- V1BlockingInteractionResponse response =
producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.assertNotNull(response);
-
- // this is a redirect...
- String redirectURL = response.getRedirectURL();
- ExtendedAssert.assertNotNull(redirectURL);
- ExtendedAssert.assertEquals("/WEB-INF/jsp/help.jsp", redirectURL); //
fix-me: handle URL re-writing
-
- // no update response
- V1UpdateResponse updateResponse = response.getUpdateResponse();
- ExtendedAssert.assertNull(updateResponse);
- }
-
- public void testGMAndPBIInteraction() throws Exception
- {
- testGetMarkupViewNoSession();
- String symbol = "AAPL";
- String navigationalState = checkPBIAndGetNavigationalState(symbol);
-
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setNavigationalState(navigationalState);
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "<p>" + symbol + " stock value:
123.45</p>");
- }
-
-
- public void testPBIWithSessionID() throws Exception
- {
- String portletHandle = getDefaultHandle();
- V1PerformBlockingInteraction performBlockingInteraction =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
-
- V1RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
- //the sessionID should never be set by the consumer. Sessions are handled by
cookies instead
- runtimeContext.setSessionID("Hello World");
-
- try
- {
- producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.fail("Should not be able to pass a sessionID in a
PerformBlockingInteraction()");
- }
- catch (V1OperationFailed expected)
- {
- // expected
- }
- }
-
- public void testMarkupCaching() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- V1CacheControl cacheControl = response.getMarkupContext().getCacheControl();
- ExtendedAssert.assertNotNull(cacheControl);
- ExtendedAssert.assertEquals(WSRPConstants.CACHE_PER_USER,
cacheControl.getUserScope());
- ExtendedAssert.assertEquals(15, cacheControl.getExpires());
-
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String sessionPortletArchive = "test-session-portlet.war";
- deploy(sessionPortletArchive);
-
- response = producer.getMarkup(createMarkupRequestForCurrentlyDeployedPortlet());
-
- cacheControl = response.getMarkupContext().getCacheControl();
- ExtendedAssert.assertNull(cacheControl);
-
- undeploy(sessionPortletArchive);
- }
-
- public void testGetMarkupWithDispatcherPortlet() throws Exception
- {
-
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String dispatcherPortletArchive = "test-dispatcher-portlet.war";
- deploy(dispatcherPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "test");
- }
- finally
- {
- undeploy(dispatcherPortletArchive);
- }
- }
-
- public void testGetMarkupWithNoContent() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String basicPortletArchive = "test-basic-portlet.war";
- deploy(basicPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "");
- }
- finally
- {
- undeploy(basicPortletArchive);
- }
- }
-
- public void testGetMarkupWithNonStandardLocalesStrictMode() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
- getMarkup.getMarkupParams().getLocales().add("en_US");
-
- try
- {
- producer.getMarkup(getMarkup);
- //fail("Should have trown an UnsupportetLocaleFault"); // ideally cf
http://jira.jboss.com/jira/browse/JBPORTAL-857
- ExtendedAssert.fail("Should have trown an exception"); // right now
- }
- catch (Exception expected)
- {
- // expected
- }
- finally
- {
- // checkMarkupResponse(response, "GetLocalesPortlet"); // should we
return try to generate markup regardless?
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupWithNonStandardLocalesLenientMode() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
- getMarkup.getMarkupParams().getLocales().add("en_US");
-
- // Use the lenient mode
- producer.usingStrictModeChangedTo(false);
-
- // markup should be properly generated
- checkMarkupResponse(producer.getMarkup(getMarkup), "English (United
States)");
- undeploy(getLocalesPortletArchive);
- }
-
- public void testGetMarkupWithoutDeclaredLocale() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("No
Declared"));
-
- try
- {
- checkMarkupResponse(producer.getMarkup(getMarkup),
Locale.getDefault().getDisplayName());
- }
- finally
- {
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupLocales() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup =
createMarkupRequest(getPortletHandleFrom("Simple"));
-
- try
- {
- List<String> locales = getMarkup.getMarkupParams().getLocales();
- locales.add("en");
- locales.add("fr");
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
-
- locales.clear();
- locales.add("fr");
- locales.add("en");
- response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.FRENCH.getDisplayName());
-
- locales.clear();
- locales.add("de");
- locales.add("en");
- response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
- }
- finally
- {
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupWithEncodedURLs() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String encodeURLPortletArchive = "test-encodeurl-portlet.war";
- deploy(encodeURLPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response,
"wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n"
+
-
"wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
- }
- finally
- {
- undeploy(encodeURLPortletArchive);
- }
- }
-
- public void testGetMarkupWithUserContext() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String userContextPortletArchive = "test-usercontext-portlet.war";
- deploy(userContextPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
getMarkup.setUserContext(WSRP1TypeFactory.createUserContext("johndoe"));
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "user: johndoe");
- }
- finally
- {
- undeploy(userContextPortletArchive);
- }
- }
-
- public void testGetMarkupMultiValuedFormParams() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String multiValuedPortletArchive = "test-multivalued-portlet.war";
- deploy(multiValuedPortletArchive);
-
- V1NamedString namedString = createNamedString("multi",
"value1");
- try
- {
- V1PerformBlockingInteraction action =
-
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- List<V1NamedString> formParameters =
action.getInteractionParams().getFormParameters();
- formParameters.add(namedString);
- V1BlockingInteractionResponse actionResponse =
producer.performBlockingInteraction(action);
- V1GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
-
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- V1MarkupResponse response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: value1");
-
- formParameters.clear();
- formParameters.add(namedString);
- formParameters.add(createNamedString("multi", "value2"));
- actionResponse = producer.performBlockingInteraction(action);
- markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
-
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: value1, value2");
-
- formParameters.clear();
- formParameters.add(new V1NamedString());
- actionResponse = producer.performBlockingInteraction(action);
- markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
-
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: ");
- }
- finally
- {
- undeploy(multiValuedPortletArchive);
- }
- }
-
- public void testImplicitCloning() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archiveName = "test-implicitcloning-portlet.war";
- deploy(archiveName);
-
- try
- {
- // check the initial value
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("initial", markupString);
-
- // modify the preference value
- V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
-
pbi.getInteractionParams().setPortletStateChange(V1StateChange.CLONE_BEFORE_WRITE); //
request cloning if needed
- String value = "new value";
-
pbi.getInteractionParams().getFormParameters().add(createNamedString("value",
value));
- V1BlockingInteractionResponse response =
producer.performBlockingInteraction(pbi);
- ExtendedAssert.assertNotNull(response);
-
- // check that we got a new portlet context
- V1PortletContext pc = response.getUpdateResponse().getPortletContext();
- ExtendedAssert.assertNotNull(pc);
-
- // get the markup again and check that we still get the initial value with the
initial portlet context
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("initial", markupString);
-
- // retrieving the markup with the new portlet context should return the new
value
- gm.setPortletContext(pc);
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals(value, markupString);
- }
- finally
- {
- undeploy(archiveName);
- }
- }
-
- private V1NamedString createNamedString(String name, String value)
- {
- V1NamedString namedString = new V1NamedString();
- namedString.setName(name);
- namedString.setValue(value);
- return namedString;
- }
-
- public void testGetMarkupWithResource() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-resource-portlet.war";
- deploy(archive);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
-
- // accept either localhost or 127.0.0.1 for the host part of the generated
markup
- String markupStart = "<img
src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
- String markupEnd =
"%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- String localhostMarkup = markupStart + "localhost" + markupEnd;
- String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
- boolean result = localhostMarkup.equals(markupString) ||
homeIPMarkup.equals(markupString);
- ExtendedAssert.assertTrue(result);
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testGetMarkupWithNonURLEncodedResource() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-resourcenoencodeurl-portlet.war";
- deploy(archive);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
-
- // accept either localhost or 127.0.0.1 for the host part of the generated
markup
- String markupStart = "<img src='http://";
- String markupEnd =
":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
- String localhostMarkup = markupStart + "localhost" + markupEnd;
- String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
- boolean result = localhostMarkup.equals(markupString) ||
homeIPMarkup.equals(markupString);
- ExtendedAssert.assertTrue(result);
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testApplicationScopeVariableHandling() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-applicationscope-portlet.war";
- deploy(archive);
-
- try
- {
- // set appVar to value in the application scope by the first portlet
- V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
-
pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar",
"value"));
- producer.performBlockingInteraction(pbi);
-
- // the second portlet reads the appVar value and outputs it
- V1GetMarkup gm = createMarkupRequest(getPortletHandleFrom("Get"));
- V1MarkupResponse res = producer.getMarkup(gm);
- checkMarkupResponse(res, "appVar=value");
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1GetMarkup gm = createMarkupRequest();
- try
- {
- producer.getMarkup(gm);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired()
throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- try
- {
- producer.performBlockingInteraction(pbi);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testInitCookieNoRegistrationWhenRegistrationRequired() throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1InitCookie initCookie = WSRP1TypeFactory.createInitCookie(null);
- try
- {
- producer.initCookie(initCookie);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- private String checkPBIAndGetNavigationalState(String symbol) throws Exception
- {
- V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
- V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
- interactionParams.getFormParameters().add(createNamedString("symbol",
symbol));
-
- V1BlockingInteractionResponse response =
producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.assertNotNull(response);
-
- // this is not a redirect...
- ExtendedAssert.assertNull(response.getRedirectURL());
-
- // check update response
- V1UpdateResponse updateResponse = response.getUpdateResponse();
- ExtendedAssert.assertNotNull(updateResponse);
- // request was readOnly so no updated portlet context
- ExtendedAssert.assertNull(updateResponse.getPortletContext());
- // check that no sessionId is getting passed.
- ExtendedAssert.assertNull(updateResponse.getSessionContext());
-
- String navigationalState = updateResponse.getNavigationalState();
- ExtendedAssert.assertNotNull(navigationalState);
- ExtendedAssert.assertEquals(updateResponse.getNewMode(), WSRPConstants.VIEW_MODE);
- V1MarkupContext markupContext = updateResponse.getMarkupContext();
- ExtendedAssert.assertNull(markupContext); // we don't return markup for now
-
- return navigationalState;
- }
-
- private void checkMarkupResponseWithSession(V1MarkupResponse response, int count)
throws RemoteException, V1InvalidRegistration, V1OperationFailed
- {
- ExtendedAssert.assertNotNull(response);
-
- // Markup context
- V1MarkupContext markupContext = response.getMarkupContext();
- ExtendedAssert.assertNotNull(markupContext);
- String markupString = markupContext.getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "count = " +
count);
- ExtendedAssert.assertString1ContainsString2(markupString, "<a
href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>");
-
- // checking session
- checkSessionForCurrentlyDeployedPortlet(response);
- }
-
- private V1MarkupContext checkMarkupResponse(V1MarkupResponse response, String
markupString)
- {
- ExtendedAssert.assertNotNull(response);
-
- // Markup context
- V1MarkupContext markupContext = response.getMarkupContext();
- ExtendedAssert.assertNotNull(markupContext);
- ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
- ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
- ExtendedAssert.assertTrue(markupContext.isRequiresUrlRewriting());
- ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());
-
- // Session context
- V1SessionContext sessionContext = response.getSessionContext();
- // The session information is should never be sent to the consumer, Cookies are
used instead.
- ExtendedAssert.assertNull(sessionContext);
-
- return markupContext;
- }
-
- protected String getMostUsedPortletWARFileName()
- {
- return DEFAULT_MARKUP_PORTLET_WAR;
- }
-}
Deleted:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -1,411 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.protocol.v1;
-
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1ClonePortlet;
-import org.oasis.wsrp.v1.V1DestroyFailed;
-import org.oasis.wsrp.v1.V1DestroyPortlets;
-import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
-import org.oasis.wsrp.v1.V1GetPortletDescription;
-import org.oasis.wsrp.v1.V1GetPortletProperties;
-import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
-import org.oasis.wsrp.v1.V1GetServiceDescription;
-import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1MissingParameters;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
-import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
-import org.oasis.wsrp.v1.V1Property;
-import org.oasis.wsrp.v1.V1PropertyDescription;
-import org.oasis.wsrp.v1.V1PropertyList;
-import org.oasis.wsrp.v1.V1SetPortletProperties;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 11547 $
- * @since 2.4
- */
-public class PortletManagementTestCase extends NeedPortletHandleTest
-{
- private static final String TEST_BASIC_PORTLET_WAR =
"test-basic-portlet.war";
-
- public PortletManagementTestCase() throws Exception
- {
- super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
- }
-
- public void testClonePortlet() throws Exception
- {
- String handle = getDefaultHandle();
- V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
-
- // first check that we get a new PortletContext
- V1PortletContext cloneContext = clonePortlet(handle);
- ExtendedAssert.assertNotNull(cloneContext);
- ExtendedAssert.assertFalse(initialContext.equals(cloneContext));
-
- // then check that the initial state is identical
- V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, cloneContext);
- List<V1Property> result =
producer.getPortletProperties(getPortletProperties).getProperties();
- getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null,
initialContext);
- checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties),
result);
-
- // check that new clone is not listed in service description
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
- checkServiceDescriptionWithOnlyBasicPortlet(gs);
- }
-
- public void testClonePortletNoRegistrationWhenRequired()
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
-
- try
- {
- producer.clonePortlet(clonePortlet);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testDestroyPortlets() throws Exception
- {
- // first try to destroy POP, should fail
- String handle = getDefaultHandle();
- V1DestroyPortlets destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(handle));
- V1DestroyPortletsResponse response = producer.destroyPortlets(destroyPortlets);
- ExtendedAssert.assertNotNull(response);
- List<V1DestroyFailed> failures = response.getDestroyFailed();
- ExtendedAssert.assertNotNull(failures);
- ExtendedAssert.assertEquals(1, failures.size());
- V1DestroyFailed failure = failures.get(0);
- ExtendedAssert.assertNotNull(failure);
- ExtendedAssert.assertEquals(handle, failure.getPortletHandle());
- ExtendedAssert.assertNotNull(failure.getReason());
-
- // clone portlet and try to destroy it
- V1PortletContext portletContext = clonePortlet(handle);
- destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(portletContext.getPortletHandle()));
- response = producer.destroyPortlets(destroyPortlets);
- ExtendedAssert.assertNotNull(response);
- failures = response.getDestroyFailed();
- ExtendedAssert.assertNull(failures);
- }
-
- public void testDestroyPortletsNoRegistrationWhenRequired()
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1DestroyPortlets dp = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(handle));
-
- try
- {
- producer.destroyPortlets(dp);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testGetPortletDescription() throws Exception
- {
- String handle = getDefaultHandle();
- V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null,
handle);
-
- V1PortletDescriptionResponse response = producer.getPortletDescription(gpd);
- ExtendedAssert.assertNotNull(response);
-
- checkBasicPortletDescription(response.getPortletDescription(), handle);
- }
-
- public void testGetPortletDescriptionNoRegistrationWhenRequired()
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null,
handle);
-
- try
- {
- producer.getPortletDescription(gpd);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testGetPortletPropertiesNoRegistration() throws Exception
- {
- String handle = getDefaultHandle();
- V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
- V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
-
- List<String> names = getPortletProperties.getNames();
- Collections.addAll(names, "prefName1", "prefName2");
-
- V1PropertyList response = producer.getPortletProperties(getPortletProperties);
- List<V1Property> expected = new ArrayList<V1Property>(2);
- Collections.addAll(expected, WSRP1TypeFactory.createProperty("prefName1",
"en", "prefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en",
"prefValue2"));
- checkGetPropertiesResponse(response, expected);
-
- names.clear();
- response = producer.getPortletProperties(getPortletProperties);
- checkGetPropertiesResponse(response, expected);
-
- names.add("prefName2");
- response = producer.getPortletProperties(getPortletProperties);
- checkGetPropertiesResponse(response,
Collections.<V1Property>singletonList(WSRP1TypeFactory.createProperty("prefName2",
"en", "prefValue2")));
- }
-
- public void testGetPortletPropertyDescription() throws Exception
- {
- String handle = getDefaultHandle();
- V1GetPortletPropertyDescription getPortletPropertyDescription =
WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
-
- V1PortletPropertyDescriptionResponse response =
producer.getPortletPropertyDescription(getPortletPropertyDescription);
-
- V1ModelDescription desc = response.getModelDescription();
- ExtendedAssert.assertNotNull(desc);
- List<V1PropertyDescription> propertyDescriptions =
desc.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
-
- List<V1PropertyDescription> expected = new
ArrayList<V1PropertyDescription>(2);
- V1PropertyDescription description =
WSRP1TypeFactory.createPropertyDescription("prefName1",
WSRPConstants.XSD_STRING);
-
description.setHint(WSRP1TypeFactory.createLocalizedString("prefName1"));
-
description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName1"));
- expected.add(description);
- description = WSRP1TypeFactory.createPropertyDescription("prefName2",
WSRPConstants.XSD_STRING);
-
description.setHint(WSRP1TypeFactory.createLocalizedString("prefName2"));
-
description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName2"));
- expected.add(description);
-
- checkPropertyDescriptions(expected, propertyDescriptions);
- }
-
- public void testGetPortletPropertiesNoRegistrationWhenRequired()
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1GetPortletPropertyDescription getPortletPropertyDescription =
WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
-
- try
- {
- producer.getPortletPropertyDescription(getPortletPropertyDescription);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testSetPortletProperties() throws Exception
- {
- String handle = getDefaultHandle();
-
- V1PortletContext portletContext = clonePortlet(handle);
- V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
- List<V1Property> properties = propertyList.getProperties();
- Collections.addAll(properties,
WSRP1TypeFactory.createProperty("prefName1", "en",
"newPrefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en",
"newPrefValue2"));
- V1SetPortletProperties setPortletProperties =
WSRP1TypeFactory.createSetPortletProperties(null, portletContext, propertyList);
-
- V1PortletContext response = producer.setPortletProperties(setPortletProperties);
- V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, response);
- checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties),
properties);
-
- portletContext = WSRP1TypeFactory.createPortletContext(handle);
- setPortletProperties.setPortletContext(portletContext);
- try
- {
- response = producer.setPortletProperties(setPortletProperties);
- ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should
fail...");
- }
- catch (V1InconsistentParameters expected)
- {
- // expected
- }
- }
-
- public void testSetPortletPropertiesNoRegistrationWhenRequired()
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
- List<V1Property> properties = propertyList.getProperties();
- Collections.addAll(properties,
WSRP1TypeFactory.createProperty("prefName1", "en",
"newPrefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en",
"newPrefValue2"));
- V1SetPortletProperties setPortletProperties =
WSRP1TypeFactory.createSetPortletProperties(null,
- WSRP1TypeFactory.createPortletContext(getDefaultHandle()), propertyList);
-
- try
- {
- producer.setPortletProperties(setPortletProperties);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- private V1PortletContext clonePortlet(String handle) throws V1InvalidUserCategory,
V1InconsistentParameters,
- V1InvalidRegistration, V1MissingParameters, V1OperationFailed, V1AccessDenied,
V1InvalidHandle
- {
- V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
- return producer.clonePortlet(clonePortlet);
- }
-
- private List<V1Property> checkGetPropertiesResponse(V1PropertyList response,
List<V1Property> expected)
- {
- ExtendedAssert.assertNotNull(response);
- List<V1Property> properties = response.getProperties();
- ExtendedAssert.assertEquals(expected.toArray(), properties.toArray(), false,
"Didn't receive expected properties!", new PropertyDecorator());
- return properties;
- }
-
- private void checkPropertyDescriptions(List<V1PropertyDescription> expected,
List<V1PropertyDescription> propertyDescriptions)
- {
- ExtendedAssert.assertEquals(expected.size(), propertyDescriptions.size());
- V1PropertyDescription propDesc = propertyDescriptions.get(0);
- ExtendedAssert.assertNotNull(propDesc);
- String name = propDesc.getName();
- if ("prefName1".equals(name))
- {
- assertEquals(expected.get(0), propDesc);
- assertEquals(expected.get(1), propertyDescriptions.get(1));
- }
- else if ("prefName2".equals(name))
- {
- assertEquals(expected.get(1), propDesc);
- assertEquals(expected.get(0), propertyDescriptions.get(1));
- }
- else
- {
- ExtendedAssert.fail("Unexpected PropertyDescription named '" +
name + "'");
- }
- }
-
- protected String getMostUsedPortletWARFileName()
- {
- return TEST_BASIC_PORTLET_WAR;
- }
-
- private static class PropertyDecorator implements ExtendedAssert.Decorator
- {
- private V1Property prop;
-
- public void decorate(Object decorated)
- {
- prop = (V1Property)decorated;
- }
-
- public boolean equals(Object o)
- {
- if (o instanceof ExtendedAssert.DecoratedObject)
- {
- ExtendedAssert.DecoratedObject decoratedObject =
(ExtendedAssert.DecoratedObject)o;
- V1Property that = (V1Property)decoratedObject.getDecorated();
-
- String name = prop.getName();
- if (name != null ? !name.equals(that.getName()) : that.getName() != null)
- {
- return false;
- }
-
- String value = prop.getStringValue();
- if (value != null ? !value.equals(that.getStringValue()) :
that.getStringValue() != null)
- {
- return false;
- }
-
- String lang = prop.getLang();
- if (lang != null ? !lang.equals(that.getLang()) : that.getLang() != null)
- {
- return false;
- }
-
- List<Object> any = prop.getAny();
- return !(any != null ? !any.equals(that.getAny()) : that.getAny() != null);
-
- }
- else
- {
- return false;
- }
- }
-
-
- public String toString()
- {
- return new StringBuffer().append("Property:
").append(prop.getName()).append("=")
- .append(prop.getStringValue()).append("
(").append(prop.getLang()).append(")").toString();
- }
- }
-}
\ No newline at end of file
Deleted:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -1,154 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.protocol.v1;
-
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.jboss.logging.Logger;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1ReleaseSessions;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Tests the behavior of the ReleaseSession method.
- *
- * @author Matt Wringe
- */
-public class ReleaseSessionTestCase extends NeedPortletHandleTest
-{
-
- // default portlet war used in this test
- private static final String DEFAULT_SESSION_PORTLET_WAR =
"test-session-portlet.war";
-
- private static final Logger log = Logger.getLogger(ReleaseSessionTestCase.class);
-
-
- protected String getMostUsedPortletWARFileName()
- {
- return DEFAULT_SESSION_PORTLET_WAR;
- }
-
- public ReleaseSessionTestCase() throws Exception
- {
- super("SessionWar", DEFAULT_SESSION_PORTLET_WAR);
- log.debug("Instantiating ReleaseSessionTestCase");
- }
-
-
- public void testReleaseSession() throws Exception
- {
- // possible registration contexts are: actual RegistrationContext, null, and a made
up value
- V1RegistrationContext fakeRegContext =
WSRP1TypeFactory.createRegistrationContext("Fake Registration Handle");
- V1RegistrationContext[] regContexts = new V1RegistrationContext[]{null, null,
fakeRegContext};
-
- // possible types of sessionIDs include null and a made up value.
- // Note: a valid session id cannot be used since the sessionID should never be sent
to the consumer
- String nullSessionID = null;
- String fakeSessionID = "Fake Session ID";
-
- String[][] sessionIDs = new String[][]{{nullSessionID},
- {nullSessionID, nullSessionID},
- {fakeSessionID},
- {fakeSessionID, fakeSessionID},
- {fakeSessionID, nullSessionID},
- {nullSessionID, fakeSessionID}};
-
- for (int i = 0; i < regContexts.length; i++)
- {
- for (String[] sessionID : sessionIDs)
- {
- V1ReleaseSessions releaseSession =
WSRP1TypeFactory.createReleaseSessions(regContexts[i], Arrays.asList(sessionID));
- releaseSessions(releaseSession, false, i);
- releaseSessions(releaseSession, true, i);
- }
- }
- }
-
- private void releaseSessions(V1ReleaseSessions releaseSessions, boolean
useRegistration, int index) throws Exception
- {
- setUp();
- try
- {
- if (useRegistration)
- {
- configureRegistrationSettings(true, false);
-
- // faking correct registration context when we're supposed to have one...
previous impl registered consumer
- // all the time but this cannot be done anymore since we prevent registering
if no registration is required
- // so we need to wait for the proper case to init the registration context...
Hackish! :(
- if (index == 0)
- {
- releaseSessions.setRegistrationContext(registerConsumer());
- }
- }
- log.info(getSetupString(releaseSessions));
- producer.releaseSessions(releaseSessions);
- ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed
Fault." + getSetupString(releaseSessions));
- }
- catch (V1OperationFailed operationFailedFault)
- {
- // expected fault.
- }
- finally
- {
- tearDown();
- }
- }
-
- private String getSetupString(V1ReleaseSessions releaseSessions)
- {
- StringBuffer message = new StringBuffer("ReleaseSessions Setup:\n");
-
- if (releaseSessions == null)
- {
- message.append(" ReleaseSessions : null");
- }
- else
- {
- V1RegistrationContext regContext = releaseSessions.getRegistrationContext();
- List<String> sessionIDs = releaseSessions.getSessionIDs();
- message.append(" RegistrationContext : ").append(regContext != null ?
regContext.getRegistrationHandle() : null);
- message.append(" | SessionIDs : ");
- if (sessionIDs != null)
- {
- for (int i = 0; i < sessionIDs.size(); i++)
- {
- message.append(sessionIDs.get(i)).append(i == sessionIDs.size() - 1 ?
"" : ", ");
- }
- }
-
- }
-
- if
(producer.getConfigurationService().getConfiguration().getRegistrationRequirements().isRegistrationRequired())
- {
- message.append(" | with registration required.");
- }
-
- return message.toString();
- }
-
-}
\ No newline at end of file
Deleted:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -1,153 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.
- */
-
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at
gnu.org.
- */
-package org.gatein.wsrp.protocol.v1;
-
-import org.gatein.wsrp.WSRPUtils;
-import org.gatein.wsrp.registration.RegistrationPropertyDescription;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1GetServiceDescription;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1PropertyDescription;
-import org.oasis.wsrp.v1.V1ServiceDescription;
-
-import java.util.List;
-
-/**
- * Tests WSRP Service Description
- *
- * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil
Saldhana</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 11547 $
- * @since 2.4 (Feb 20, 2006)
- */
-public class ServiceDescriptionTestCase extends V1ProducerBaseTest
-{
- public ServiceDescriptionTestCase() throws Exception
- {
- super("ServiceDescriptionTestCase");
- }
-
- public void testNotRequiringRegistration() throws Throwable
- {
-
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(false);
-
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
-
- // registration is not required
- ExtendedAssert.assertFalse(sd.isRequiresRegistration());
-
- // No registration properties
- ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
- }
-
- public void testRequiringRegistrationNotProvidingPortlets() throws Throwable
- {
- RegistrationPropertyDescription regProp = configureRegistrationSettings(true,
false);
-
- // service description request without registration info
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- //Invoke the Web Service
- V1ServiceDescription sd = producer.getServiceDescription(gs);
- ExtendedAssert.assertNotNull(sd);
- ExtendedAssert.assertTrue(sd.isRequiresRegistration());
-
- // Check registration properties
- checkRequiredRegistrationProperties(sd, regProp);
-
- // No offered portlets without registration!
- ExtendedAssert.assertNull(sd.getOfferedPortlets());
- }
-
- public void testRequiringRegistrationProvidingPortlets() throws Throwable
- {
- RegistrationPropertyDescription regProp = configureRegistrationSettings(true,
true);
-
- // service description request without registration info
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- //Invoke the Web Service, we should have the complete description
- V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
- ExtendedAssert.assertNotNull(sd);
- ExtendedAssert.assertTrue(sd.isRequiresRegistration());
-
- // Check registration properties
- checkRequiredRegistrationProperties(sd, regProp);
- }
-
- public void testLiveDeployment() throws Throwable
- {
- try
- {
- V1GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest();
-
- deploy("test-basic-portlet.war");
- V1ServiceDescription sd = producer.getServiceDescription(gsd);
- ExtendedAssert.assertEquals(1, sd.getOfferedPortlets().size());
-
- deploy("test-markup-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have 2 offered portlets
- ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
-
- deploy("test-session-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have 3 offered portlets
- ExtendedAssert.assertEquals(3, sd.getOfferedPortlets().size());
-
- undeploy("test-markup-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have only 2 offered portlets again
- ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
-
- undeploy("test-session-portlet.war");
- // only basic portlet should still be offered
- checkServiceDescriptionWithOnlyBasicPortlet(gsd);
- }
- finally
- {
- undeploy("test-basic-portlet.war");
- undeploy("test-markup-portlet.war");
- undeploy("test-session-portlet.war");
- }
- }
-
- private void checkRequiredRegistrationProperties(V1ServiceDescription sd,
RegistrationPropertyDescription regProp)
- {
- V1ModelDescription registrationPropertyDescription =
sd.getRegistrationPropertyDescription();
- ExtendedAssert.assertNotNull(registrationPropertyDescription);
- List<V1PropertyDescription> propertyDescriptions =
registrationPropertyDescription.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
- ExtendedAssert.assertEquals(1, propertyDescriptions.size());
- assertEquals(WSRPUtils.convertToPropertyDescription(regProp),
propertyDescriptions.get(0));
- }
-}
\ No newline at end of file
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -29,7 +29,9 @@
import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.WSRPProducerBaseTest;
+import org.gatein.wsrp.producer.WSRPProducerImpl;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.v1.WSRP1Producer;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -59,7 +61,7 @@
public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest
{
private static final String CONSUMER = "test-consumer";
- protected WSRP1Producer producer = ProducerHolder.getV1Producer();
+ protected WSRP1Producer producer = WSRP1Producer.getInstance();
public V1ProducerBaseTest() throws Exception
Modified:
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
===================================================================
---
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2010-06-15
17:58:11 UTC (rev 3338)
+++
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -23,12 +23,14 @@
package org.gatein.wsrp.test.support;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -125,6 +127,55 @@
{
return serverPort;
}
+ if ("getHeaderNames".equals(methodName))
+ {
+ return new Enumeration<String>()
+ {
+
+ public boolean hasMoreElements()
+ {
+ return false;
+ }
+
+ public String nextElement()
+ {
+ return null;
+ }
+ };
+ }
+ if ("getCookies".equals(methodName))
+ {
+ return new Cookie[0];
+ }
+ if ("getMethod".equals(methodName))
+ {
+ return "GET";
+ }
+ if ("getContextPath".equals(methodName))
+ {
+ return "/";
+ }
+ if ("getPathInfo".equals(methodName))
+ {
+ return "/";
+ }
+ if ("getQueryString".equals(methodName))
+ {
+ return "";
+ }
+ if ("getQueryURI".equals(methodName))
+ {
+ return "";
+ }
+ if ("getRequestURI".equals(methodName))
+ {
+ return "";
+ }
+ if ("getServletPath".equals(methodName))
+ {
+ return "/";
+ }
+
throw new UnsupportedOperationException("MockHttpServletRequest does not
support: " + method);
}
}
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -57,6 +57,127 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-federation</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>test-framework</artifactId>
+ <scope>test</scope>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Producer Sar Test Dependencies -->
+ <!-- TODO: move versioning to the main pom.xml -->
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-tomcat</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.wci}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ <scope>test</scope>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-controller</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-mc</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-api</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-51</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>1.0.3.GA</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -73,7 +194,160 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>test</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <!-- we don't want to add these archives into the repo -->
+ <attach>false</attach>
+
<outputDirectory>${project.build.directory}/test-archives</outputDirectory>
+ <descriptors>
+ <descriptor>src/test/assembly/test-producer.xml</descriptor>
+
<descriptor>src/test/assembly/test-markup-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-renderparam-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-basic-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-dispatcher-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-getlocales-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-encodeurl-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-usercontext-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-multivalued-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-implicitcloning-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-resource-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-resourcenoencodeurl-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-applicationscope-portlet.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <!-- note that package phase happens after the test phase and before the
integration test phase -->
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+ </dependencies>
+
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ <excludes>
+ <exclude>org/gatein/wsrp/protocol/v1/*</exclude>
+ <exclude>org/gatein/wsrp/protocol/v1a/*</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <!--<skip>false</skip>-->
+ <includes>
+
<include>org/gatein/wsrp/protocol/v1/MarkupTestCase.class</include>
+
<include>org/gatein/wsrp/protocol/v1/PortletManagementTestCase.class</include>
+ <!--
<include>org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.class</include>
-->
+
<include>org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.class</include>
+ </includes>
+ <excludes>
+ <exclude>org/gatein/wsrp/producer/**</exclude>
+ <exclude>org/gatein/wsrp/registration/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0.1</version>
+ <configuration>
+ <container>
+ <containerId>jboss51x</containerId>
+ <home>${JBOSS_HOME}</home>
+ <log>${basedir}/target/jboss51x/container.log</log>
+ <systemProperties>
+ <!-- Since the tests run on the server, we need to pass system
properties to the
+ server so that the tests can use them. -->
+ <!-- The tests need to deploy and undeploy artifacts during the test
so we need to pass
+ properties to enable this behaviour. -->
+
<jboss.deploy.dir>${jboss.server.home.dir}/conf</jboss.deploy.dir>
+
<test.deployables.dir>${basedir}/target/test-archives</test.deployables.dir>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+
<cargo.jvmargs>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</cargo.jvmargs>
+ </properties>
+ <deployables>
+ <deployable>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer</artifactId>
+ <type>war</type>
+ <properties>
+ <context>wsrp-producer</context>
+ </properties>
+
<pingURL>http://localhost:8080/wsrp-producer/MarkupService?WSDL</pingURL>
+ </deployable>
+ <deployable>
+
<location>${basedir}/target/test-archives/test-producer.sar</location>
+ <type>sar</type>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>pre-integration-start-server</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-integration-stop-server</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+ <testResources>
+ <testResource>
+ <directory>src/test/jboss-resources</directory>
+ </testResource>
+ </testResources>
</build>
-</project>
\ No newline at end of file
+</project>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>applicationscope-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-applicationscope-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>basic-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-basic-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>dispatcher-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-dispatcher-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>encodeurl-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-encodeurl-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>getlocales-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-getlocales-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>implicitcloning-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-implicitcloning-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>markup-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-markup-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>multivalued-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-multivalued-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
(rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,72 @@
+<assembly>
+ <id>producer</id>
+ <formats>
+ <format>sar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/producer-sar</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <moduleSets>
+ <moduleSet>
+<!-- <includes>
+ <include>org.gatein.wsrp:wsrp-producer-lib</include>
+ </includes> -->
+ <binaries/>
+ </moduleSet>
+ </moduleSets>
+
+ <dependencySets>
+ <dependencySet>
+ <scope>test</scope>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.gatein.wsrp:test-framework</include>
+
+ <include>org.gatein.wci:wci-tomcat</include>
+ <include>org.gatein.wci:wci-wci</include>
+
+ <include>org.gatein.pc:pc-portlet</include>
+ <include>org.gatein.pc:pc-api</include>
+ <include>javax.portlet:portlet-api</include>
+
+ <include>org.gatein.pc:pc-controller</include>
+ <include>org.gatein.pc:pc-mc</include>
+
+ <include>org.gatein.common:common-common</include>
+ <include>org.gatein.common:common-logging</include>
+
+ <include>javax.ccpp:ccpp</include>
+
+ <include>org.gatein.wsrp:wsrp-common</include>
+ <include>org.gatein.wsrp:wsrp-integration-api</include>
+ <include>org.gatein.wsrp:wsrp-producer-lib</include>
+ <include>org.gatein.wsrp:wsrp-wsrp1-ws</include>
+ <include>org.gatein.wsrp:wsrp-wsrp2-ws</include>
+
+ <include>junit:junit</include>
+ <include>commons-fileupload:commons-fileupload</include>
+
+ <include>com.google.collections:google-collections</include>
+
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>renderparam-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-renderparam-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>resource-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-resource-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>resourcenoencodeurl-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-resourcenoencodeurl-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>session-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-session-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>usercontext-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+
<directory>src/test/test-portlets/test-usercontext-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,431 @@
+/******************************************************************************
+ * 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.common.util.MapBuilder;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9218 $
+ * @since 2.6
+ */
+public abstract class AbstractRegistrationPersistenceManagerTestCase extends TestCase
+{
+
+ /** . */
+ private Map<QName, Object> registrationProperties;
+
+ public abstract RegistrationPersistenceManager getManager();
+
+ public void startInteraction()
+ {
+ }
+
+ public void stopInteraction()
+ {
+ }
+
+ public void setUp() throws Exception
+ {
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ registrationProperties = null;
+ }
+
+ public void testGetGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().getConsumerGroup(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroup() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ group = getManager().getConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection groups = getManager().getConsumerGroups();
+ assertNotNull(groups);
+ assertEquals(1, groups.size());
+ group = (ConsumerGroup)groups.iterator().next();
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testAddDuplicateGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ try
+ {
+ getManager().createConsumerGroup("Foo");
+ fail();
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().createConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ getManager().removeConsumerGroup("Foo");
+ assertNull(getManager().getConsumerGroup("Foo"));
+ assertEquals(Collections.EMPTY_SET, new
HashSet(getManager().getConsumerGroups()));
+ stopInteraction();
+ }
+
+ public void testRemoveGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveNonExistingGroup() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup("Foo");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testGetConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ group.getConsumer(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ consumer = group.getConsumer("Bar");
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection consumers = group.getConsumers();
+ assertNotNull(consumers);
+ assertEquals(1, consumers.size());
+ consumer = (Consumer)consumers.iterator().next();
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+ }
+
+ public void testAddDuplicateConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ try
+ {
+ group.addConsumer(consumer);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.addConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ group.removeConsumer(consumer);
+ assertNull(group.getConsumer("Bar"));
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testRemoveConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.removeConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg1 = getManager().addRegistrationFor("Bar",
registrationProperties);
+ assertNotNull(reg1);
+ String regId = reg1.getPersistentKey();
+ assertNotNull(regId);
+ assertEquals(consumer, reg1.getConsumer());
+ Map expectedProps = new HashMap();
+ expectedProps.put(new QName("prop1"), "value1");
+ expectedProps.put(new QName("prop2"), "value2");
+ assertEquals(expectedProps, reg1.getProperties());
+ stopInteraction();
+
+ // Retrieve it from the list of consumer registrations
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(1, registrations.size());
+ Registration reg3 = (Registration)registrations.iterator().next();
+ assertEquals(regId, reg3.getPersistentKey());
+ assertEquals(consumer, reg3.getConsumer());
+ assertEquals(expectedProps, reg3.getProperties());
+ stopInteraction();
+
+ // Retrieve the same registration from the registry
+ startInteraction();
+ Registration reg2 = getManager().getRegistration(regId);
+ consumer = getManager().getConsumerById("Bar");
+ assertNotNull(reg2);
+ assertEquals(regId, reg2.getPersistentKey());
+ assertEquals(consumer, reg2.getConsumer());
+ assertEquals(expectedProps, reg2.getProperties());
+ stopInteraction();
+ }
+
+ public void testAddRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+
+ try
+ {
+ getManager().addRegistrationFor(consumer.getId(), null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeRegistration(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ Registration reg = getManager().addRegistrationFor("Bar",
registrationProperties);
+ String regId = reg.getPersistentKey();
+ getManager().removeRegistration(regId);
+ stopInteraction();
+
+ // remove registration is the only method on RegistrationPersistenceManager that
needs to "cascade"
+ // this is needed because there is no remove method on Consumer, hence the manager
needs to remove the
+ // registration from its consumer since it's the only class that has access to
the specific consumer impl
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(0, registrations.size());
+ stopInteraction();
+
+ //
+ startInteraction();
+ assertEquals(null, getManager().getRegistration(regId));
+ stopInteraction();
+ }
+
+ public void testBulkUpdateRegistrationProperties() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ getManager().addRegistrationFor("Bar", registrationProperties);
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg = (Registration)consumer.getRegistrations().iterator().next();
+ registrationProperties.remove(new QName("prop1"));
+ reg.updateProperties(registrationProperties);
+ assertEquals(Collections.singletonMap(new QName("prop2"),
"value2"), reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(Collections.singletonMap(new QName("prop2"),
"value2"), reg.getProperties());
+ registrationProperties.put(new QName("prop3"), "value3");
+ reg.updateProperties(registrationProperties);
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"),
"value2").put(new QName("prop3"), "value3").get(),
reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"),
"value2").put(new QName("prop3"), "value3").get(),
reg.getProperties());
+ stopInteraction();
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ConsumerGroupTestCase extends TestCase
+{
+ private RegistrationManager manager;
+ private ConsumerGroup group;
+ private static final String NAME = "name";
+
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ group = manager.createConsumerGroup(NAME);
+ }
+
+ public void testGetName()
+ {
+ assertEquals(NAME, group.getName());
+ }
+
+ public void testConsumersManagement() throws RegistrationException
+ {
+ assertTrue(group.isEmpty());
+ assertEquals(0, group.getConsumers().size());
+
+ Consumer c1 = manager.createConsumer("c1");
+ group.addConsumer(c1);
+ assertTrue(!group.isEmpty());
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(group.contains(c1));
+ assertEquals(group, c1.getGroup());
+ assertEquals(c1, group.getConsumer(c1.getId()));
+
+ Consumer c2 = manager.createConsumer("c2");
+ group.addConsumer(c2);
+ assertEquals(2, group.getConsumers().size());
+ assertTrue(group.contains(c2));
+ assertEquals(group, c2.getGroup());
+
+ group.removeConsumer(c1);
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(!group.contains(c1));
+ assertTrue(group.contains(c2));
+ assertEquals(null, c1.getGroup());
+ }
+
+ public void testAddNullConsumer() throws RegistrationException
+ {
+ try
+ {
+ group.addConsumer(null);
+ fail("Shouldn't be possible to add null consumer");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testStatus()
+ {
+ assertEquals(RegistrationStatus.PENDING, group.getStatus());
+ group.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, group.getStatus());
+ }
+
+ public void testIllegalStatus()
+ {
+ try
+ {
+ group.setStatus(null);
+ fail("Shouldn't be possible to set the status to null");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ConsumerTestCase extends TestCase
+{
+ private Consumer consumer;
+ private RegistrationManager manager;
+ private static final Map<QName, RegistrationPropertyDescription>
EMPTY_EXPECTATIONS = Collections.emptyMap();
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ consumer = manager.createConsumer("name");
+ }
+
+ public void testGetName()
+ {
+ assertEquals("name", consumer.getName());
+ }
+
+ public void testStatus() throws RegistrationException
+ {
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ String name = consumer.getName();
+
+ // adding a registration that isn't validated doesn't change the status
+ Registration registration = manager.addRegistrationTo(name, Collections.<QName,
Object>emptyMap(), EMPTY_EXPECTATIONS, false);
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // but the consumer's status should become valid if the registration becomes so
as well
+ registration.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, consumer.getStatus());
+
+ // adding a new registration makes the consumer's status pending
+ // need to change the registration props to register this consumer again
+ Map<QName, Object> props = new HashMap<QName, Object>(1);
+ QName propName = new QName("prop");
+ props.put(propName, "value");
+ // need to change the expectations to allow the new registration property
+ Map<QName, RegistrationPropertyDescription> expectations = new
HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(propName, new RegistrationPropertyDescription(propName,
WSRPConstants.XSD_STRING));
+ registration = manager.addRegistrationTo(name, props, expectations, false);
+ assertEquals(2, consumer.getRegistrations().size());
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // and if the new registration is marked as invalid, so does the consumer's
status
+ registration.setStatus(RegistrationStatus.INVALID);
+ assertEquals(RegistrationStatus.INVALID, consumer.getStatus());
+
+ // if the registration is returned to pending, then so is the consumer
+ registration.setStatus(RegistrationStatus.PENDING);
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // if all the registrations are valid, then so is the consumer
+ registration.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, consumer.getStatus());
+ }
+
+ public void testSetGroup() throws Exception
+ {
+ ConsumerGroup group = manager.createConsumerGroup("group");
+ assertTrue(!group.getConsumers().contains(consumer));
+
+ consumer.setGroup(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+
+ consumer.setGroup(null);
+ assertNull(consumer.getGroup());
+ assertTrue(!group.getConsumers().contains(consumer));
+ }
+
+ public void testGetIdentity() throws Exception
+ {
+ assertNotNull(consumer.getId());
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.registration.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9180 $
+ * @since 2.6.3
+ */
+public class DefaultRegistrationPolicyTestCase extends TestCase
+{
+ DefaultRegistrationPolicy policy;
+ Map<QName, Object> registrationProperties;
+ Map<QName, PropertyDescription> expectations;
+ private static final String CONSUMER = "consumer";
+ private static final QName PROP1 = new QName("prop1");
+ private static final QName PROP2 = new QName("prop2");
+ private static final QName PROP3 = new QName("prop3");
+ private RegistrationManager manager;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ policy = new DefaultRegistrationPolicy();
+
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+
+ manager = new RegistrationManagerImpl();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ manager.createConsumer(CONSUMER);
+
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(PROP1, "value1");
+ registrationProperties.put(PROP2, "value2");
+
+ expectations = new HashMap<QName, PropertyDescription>();
+ }
+
+ public void testValidateRegistrationDataForNull() throws RegistrationException
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(null, "foo", expectations,
manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
null, expectations, manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testValidateRegistrationDataForInexistentConsumer()
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
"foo", expectations, manager);
+ }
+ catch (RegistrationException e)
+ {
+ fail("Should be possible to validate information for inexistent consumer
(otherwise, how would we register!)");
+ }
+ }
+
+ public void testValidateRegistrationDataMissingProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+ expectations.put(PROP2, new TestPropertyDescription(PROP2));
+ expectations.put(PROP3, new TestPropertyDescription(PROP3));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Missing prop3 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop3"));
+ }
+ }
+
+ public void testValidateRegistrationDataExtraProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Extra prop2 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop2"));
+ }
+ }
+
+ public void testValidateRegistrationDataInvalidValue()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ registrationProperties.remove(PROP2);
+ registrationProperties.put(PROP1, null);
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Should have detected null value for prop1");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop1"));
+ }
+ }
+
+ static class TestPropertyDescription implements PropertyDescription
+ {
+ private QName name;
+ private static final QName TYPE = new QName("type");
+
+ TestPropertyDescription(QName name)
+ {
+ this.name = name;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public QName getType()
+ {
+ return TYPE;
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,432 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class RegistrationManagerTestCase extends TestCase
+{
+
+ private RegistrationManager manager;
+ private Map<QName, Object> registrationProperties;
+ private Map<QName, RegistrationPropertyDescription> expectations;
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+
+ //todo: registration properties setup will need to be updated when property
validation is implemented
+ QName prop1Name = new QName("prop1");
+ QName prop2Name = new QName("prop2");
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(prop1Name, "value1");
+ registrationProperties.put(prop2Name, "value2");
+
+ expectations = new HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(prop1Name, new RegistrationPropertyDescription(prop1Name,
WSRPConstants.XSD_STRING));
+ expectations.put(prop2Name, new RegistrationPropertyDescription(prop2Name,
WSRPConstants.XSD_STRING));
+ }
+
+ public void testPolicy()
+ {
+ RegistrationPolicy policy = manager.getPolicy();
+ assertNotNull(policy);
+ }
+
+ public void testAddRegistrationTo() throws Exception
+ {
+ Registration registration = manager.addRegistrationTo("consumerName",
registrationProperties, expectations, true);
+ assertNotNull(registration);
+ assertNotNull(registration.getPersistentKey());
+
+ Consumer consumer = manager.getConsumerByIdentity("consumerName");
+ assertNotNull(consumer); // default policy: name == identity
+ assertEquals(consumer, registration.getConsumer());
+
+ String registrationHandle = registration.getRegistrationHandle();
+ assertNotNull(registrationHandle);
+ assertEquals(consumer, manager.getConsumerFor(registrationHandle));
+ }
+
+ public void testAddRegistrationToInexistentConsumer() throws RegistrationException
+ {
+ try
+ {
+ manager.addRegistrationTo("consumerName", registrationProperties,
expectations, false);
+ fail("Should have failed: consumer does not exist");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("consumerName")); // default
policy: name == identity
+ }
+
+ public void testGetConsumerForNullRegistrationHandle() throws Exception
+ {
+ try
+ {
+ manager.getConsumerFor(null);
+ fail("Should have failed: cannot find a consumer for a null registration
handle");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testCreateConsumer() throws Exception
+ {
+ String name = "consumerName";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+ assertEquals(name, consumer.getName());
+ assertNotNull(consumer.getId());
+ assertNull(consumer.getGroup());
+
+ Collection consumers = manager.getConsumers();
+ assertEquals(1, consumers.size());
+ assertTrue(consumers.contains(consumer));
+ assertEquals(consumer, manager.getConsumerByIdentity(name)); // default policy:
name == identity
+
+ try
+ {
+ consumers.add(consumer);
+ fail("Shouldn't be possible to directly modify consumer
collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testCreateConsumerWithGroupFromPolicy() throws RegistrationException
+ {
+ // use a different policy: now specifies that when creating a consumer, it should
be added to a group with the same name
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public String getAutomaticGroupNameFor(String consumerName)
+ {
+ return "group_" + consumerName;
+ }
+ };
+ manager.setPolicy(policy);
+
+ String name = "name";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+
+ ConsumerGroup group = manager.getConsumerGroup("group_" + name);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+ }
+
+ public void testCreateDuplicateConsumer() throws RegistrationException
+ {
+ String name = "name";
+ assertNotNull(manager.createConsumer(name));
+
+ try
+ {
+ manager.createConsumer(name);
+ fail("Should have failed when trying to create a consumer with an existing
name");
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ }
+
+ public void testAddAutomaticallyCreatedConsumerToInexistentGroup() throws
RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false, true);
+ fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToAutomaticallyCreatedGroup() throws
RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", true, false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToGroup() throws RegistrationException
+ {
+ manager.createConsumerGroup("bar");
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false,
false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNotNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToInexistentGroup() throws RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false,
false);
+ fail("Shouldn't be possible to add a consumer to an inexistent group
without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddConsumerToGroup() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
+
+ Consumer consumer1 = manager.getConsumerByIdentity(consumerName);
+ assertNotNull(consumer1);
+ assertEquals(consumer1, consumer); // default policy: identity == name
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ }
+
+ public void testCreateConsumerGroup() throws Exception
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(groupName, group.getName());
+
+ Collection groups = manager.getConsumerGroups();
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(group));
+ assertEquals(group, manager.getConsumerGroup(groupName));
+
+ try
+ {
+ groups.add(group);
+ fail("Shouldn't be possible to directly modify group
collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testRemoveConsumerGroup() throws RegistrationException
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerGroup(groupName));
+
+ manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(groupName);
+ assertNull(manager.getConsumerGroup(groupName));
+ }
+
+ public void testCascadeRemovalOnConsumerGroupRemoval() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testCascadeRemovalOnConsumerRemoval() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ manager.removeConsumer(consumer);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testRemoveSingleRegistration() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ assertTrue(consumer.getRegistrations().contains(reg));
+
+ manager.removeRegistration(handle);
+ assertTrue(!consumer.getRegistrations().contains(reg));
+ assertNull(manager.getRegistration(handle));
+
+ // since the consumer doesn't have any registration anymore, its status should
become pending
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // shouldn't be possible anymore to retrieve the consumer from the registration
handle
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testRemoveRegistrationOnConsumerWithOtherRegistrations() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ RegistrationStatus status = consumer.getStatus();
+ manager.removeRegistration(handle);
+
+ // consumer status shouldn't have changed
+ assertEquals(status, consumer.getStatus());
+
+ // Shouldn't be possible to retrieve consumer from handle anymore
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testAddRegistrationWithInvalidRegistrationProperties() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ try
+ {
+ manager.addRegistrationTo(consumerName, registrationProperties, expectations,
false);
+ fail("Expectations does not contain prop3, so trying to register with a
value for it should fail");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getMessage().contains("prop3"));
+ assertEquals(0, consumer.getRegistrations().size());
+ }
+ }
+
+ public void testRemoveInexistentRegistration() throws RegistrationException
+ {
+ try
+ {
+ manager.removeRegistration((Registration)null);
+ fail("Should be possible to remove a null registration");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration((String)null);
+ fail("Should be possible to remove a registration with a null
handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("");
+ fail("Should be possible to remove a registration with an empty
handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("doesn't exist");
+ fail("Should be possible to remove a registration with an invalid
handle");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ }
+
+ public void testClear() throws Exception
+ {
+ manager.createConsumer("c1");
+ manager.createConsumer("c2");
+ manager.addConsumerToGroupNamed("c1g1", "g1", true, true);
+ manager.createConsumerGroup("g2");
+ Registration r1 = manager.addRegistrationTo("c1", registrationProperties,
expectations, false);
+ Registration r2 = manager.addRegistrationTo("c3", registrationProperties,
expectations, true);
+
+ manager.clear();
+ assertTrue(manager.getConsumerGroups().isEmpty());
+ assertTrue(manager.getConsumers().isEmpty());
+ assertNull(manager.getRegistration(r1.getRegistrationHandle()));
+ assertNull(manager.getRegistration(r2.getRegistrationHandle()));
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.gatein.registration;
+
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerTestCase extends
AbstractRegistrationPersistenceManagerTestCase
+{
+
+ /** . */
+ private RegistrationPersistenceManager manager;
+
+ public void setUp() throws Exception
+ {
+ manager = new RegistrationPersistenceManagerImpl();
+
+ //
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //
+ this.manager = null;
+ }
+
+ public RegistrationPersistenceManager getManager()
+ {
+ return manager;
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.PropertyDescription;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11406 $
+ * @since 2.6
+ */
+public class RegistrationTestCase extends TestCase
+{
+ private Registration registration;
+ private Map<QName, Object> registrationProperties;
+
+ protected void setUp() throws Exception
+ {
+ RegistrationManager manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public void validateRegistrationDataFor(Map<QName, Object>
registrationProperties, String consumerIdentity, final Map<QName, ? extends
PropertyDescription> expectations, final RegistrationManager manager) throws
IllegalArgumentException, RegistrationException, DuplicateRegistrationException
+ {
+ // accept any registration data here
+ }
+ };
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+
+ registrationProperties = new HashMap<QName, Object>();
+ QName prop1Name = new QName("prop1");
+ registrationProperties.put(prop1Name, "value1");
+ QName prop2Name = new QName("prop2");
+ registrationProperties.put(prop2Name, "value2");
+
+ Map<QName, RegistrationPropertyDescription> expectations = new
HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(prop1Name, new RegistrationPropertyDescription(prop1Name,
WSRPConstants.XSD_STRING));
+ expectations.put(prop2Name, new RegistrationPropertyDescription(prop2Name,
WSRPConstants.XSD_STRING));
+
+ registration = manager.addRegistrationTo("name", registrationProperties,
expectations, true);
+ }
+
+ public void testGetPropertiesIsUnmodifiable()
+ {
+ Map properties = registration.getProperties();
+
+ try
+ {
+ properties.remove("foo");
+ fail("Properties shouldn't be directly modifiable");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testPropertiesAreClonedNotLive()
+ {
+ QName prop = new QName("prop3");
+ registrationProperties.put(prop, "value3");
+
+ assertNull(registration.getProperties().get(prop));
+ }
+
+ public void testSetNullPropertyValueThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor("foo", null);
+ fail("Shouldn't accept null values for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testSetNullPropertyNameThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor((QName)null, null);
+ fail("Shouldn't accept null names for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testProperties()
+ {
+ QName name = new QName("prop1");
+ assertEquals("value1", registration.getProperties().get(name));
+ assertEquals("value2", registration.getProperties().get(new
QName("prop2")));
+
+ String newValue = "new value";
+ registration.setPropertyValueFor("prop1", newValue);
+ assertEquals(newValue, registration.getProperties().get(name));
+
+ registration.removeProperty(name);
+ assertNull(registration.getPropertyValueFor(name));
+ }
+
+ public void testUpdateProperties()
+ {
+ registrationProperties.remove(new QName("prop1"));
+
+ registration.updateProperties(registrationProperties);
+ assertNull(registration.getPropertyValueFor("prop1"));
+
+ QName name = new QName("prop3");
+ String value = "value3";
+ registrationProperties.put(name, value);
+ registration.updateProperties(registrationProperties);
+ assertEquals(value, registration.getPropertyValueFor(name));
+ }
+
+ public void testHasEqualProperties()
+ {
+ assertTrue(registration.hasEqualProperties(registration));
+
+ assertTrue(registration.hasEqualProperties(registrationProperties));
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ assertTrue(!registration.hasEqualProperties(registrationProperties));
+ }
+
+ public void testClearAssociatedState()
+ {
+ //todo: implement
+ }
+
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.config;
+
+import java.io.FileInputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.gatein.common.net.URLTools;
+import
org.gatein.wsrp.producer.config.impl.xml.FileSystemXMLProducerConfigurationService;
+import org.gatein.wsrp.producer.config.impl.xml.SimpleXMLProducerConfigurationService;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class FileSystemXmlProducerConfigWithReload extends
SimpleXMLProducerConfigurationService
+{
+
+ // Hack to force the producer to reload when the configuration property is set.
+ // If unused then we will have issues with the producer not being loaded when we try
+ // and get an instance.
+ public void setConfigFile(String configLocation) throws Exception
+ {
+// this.inputStream = new FileInputStream(configLocation);
+// this.reloadConfiguration();
+ Enumeration<URL> resources =
Thread.currentThread().getContextClassLoader().getResources(configLocation);
+
+ URL configURL = null;
+ while (resources.hasMoreElements())
+ {
+ configURL = (URL)resources.nextElement();
+ }
+
+ if (configURL == null)
+ {
+ throw new Exception("The config " + configLocation + " does not
exist");
+ }
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not
exist");
+ }
+
+ this.inputStream = configURL.openStream();
+ this.reloadConfiguration();
+ }
+
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ApplicationScopeGetPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, PortletSecurityException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+ writer.write("appVar=" +
renderRequest.getPortletSession().getAttribute("appVar",
PortletSession.APPLICATION_SCOPE));
+ }
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ApplicationScopeSetPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, PortletSecurityException, IOException
+ {
+ PortletSession session = actionRequest.getPortletSession();
+ session.setAttribute("appVar",
actionRequest.getParameter("appVar"), PortletSession.APPLICATION_SCOPE);
+ }
+}
+
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class BasicPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("do view");
+ }
+
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
+ * @version $Revision$
+ */
+public class DispatcherPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("## before dispatch");
+ response.setContentType("text/html");
+ PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/index.jsp");
+ rd.include(request, response);
+ System.out.println("## after dispatch");
+ }
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class EncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write(response.encodeURL(response.createActionURL().toString()));
+ writer.write("\n");
+ writer.write(response.encodeURL(response.createRenderURL().toString()));
+ }
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
+ * @version $Revision$
+ */
+public class GetLocalesPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("#GetLocalesPortlet doView()");
+ Locale locale = request.getLocale();
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print(locale.getDisplayName());
+ writer.close();
+ }
+
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ImplicitCloningPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ String value = request.getParameter("value");
+ if (value == null)
+ {
+ value = "default";
+ }
+
+ PortletPreferences pp = request.getPreferences();
+ pp.setValue("name", value);
+ pp.store();
+ }
+
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PortletPreferences pp = request.getPreferences();
+ String value = pp.getValue("name", "default");
+ response.getWriter().write(value);
+ }
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class MarkupPortlet extends GenericPortlet
+{
+ private final String SYMBOL = "symbol";
+ private final String VALUE = "value";
+ private final String RHAT = "RHAT";
+ private final String AAPL = "AAPL";
+ private final String HELP = "HELP";
+ private final String RHAT_VALUE = "50.50";
+ private final String AAPL_VALUE = "123.45";
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletModeException, IOException
+ {
+ String symbol = req.getParameter(SYMBOL);
+ if (HELP.equalsIgnoreCase(symbol)) // fix-me: should use help mode but will do for
now
+ {
+ resp.sendRedirect("/WEB-INF/jsp/help.jsp");
+ return;
+ }
+
+ resp.setRenderParameter(SYMBOL, symbol.toUpperCase());
+ if (RHAT.equalsIgnoreCase(symbol))
+ {
+ resp.setRenderParameter(VALUE, RHAT_VALUE);
+ }
+ else if (AAPL.equalsIgnoreCase(symbol))
+ {
+ resp.setRenderParameter(VALUE, AAPL_VALUE);
+ }
+ else
+ {
+ resp.setRenderParameter(VALUE, "5.55");
+ }
+ resp.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<p>");
+ writer.write(getSymbol(request));
+ writer.write(" stock value: ");
+ writer.write(getValue(request));
+ writer.write("</p>");
+ }
+
+ private String getValue(RenderRequest request)
+ {
+ String value = request.getParameter(VALUE);
+ return value == null ? "value unset" : value;
+ }
+
+ private String getSymbol(RenderRequest request)
+ {
+ String symbol = request.getParameter(SYMBOL);
+ return symbol == null ? "symbol unset" : symbol;
+ }
+
+ protected void doEdit(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ StringBuffer sb = new StringBuffer(256);
+ sb.append("<form method='post' action='")
+ .append(response.createActionURL())
+ .append("' id='").append(response.getNamespace())
+ .append("portfolioManager'><table><tr><td>Stock
symbol</td><td><input name='").append(SYMBOL)
+ .append("'/></td></tr><tr><td><input
type='submit'
value='Submit'></td></tr></table></form>");
+
+ writer.write(sb.toString());
+ }
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.test.wsrp.portlet.MultiValuedPortlet">Chris
+ * Laprun</a>
+ * @version $Revision$
+ */
+public class MultiValuedPortlet extends GenericPortlet
+{
+ private static final String MULTI = "multi";
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletModeException, IOException
+ {
+ String[] multi = req.getParameterValues(MULTI);
+
+ if (multi != null)
+ {
+ resp.setRenderParameter(MULTI, multi);
+ }
+ resp.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("multi: ");
+ String[] values = request.getParameterValues(MULTI);
+ if (values != null)
+ {
+ StringBuffer sb = new StringBuffer(32);
+ for (int i = 0; i < values.length; i++)
+ {
+ sb.append(values[i]);
+ if (i != values.length - 1)
+ {
+ sb.append(", ");
+ }
+ }
+ writer.write(sb.toString());
+ }
+ }
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class RenderParamPortlet extends GenericPortlet
+{
+ private static final String NAME = "name";
+ private int count = 0;
+ private static final String OP = "op";
+ private static final String INC = "++";
+ private static final String DEC = "--";
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ String op = request.getParameter(OP);
+ if (INC.equals(op))
+ {
+ count++;
+ }
+ else if (DEC.equals(op))
+ {
+ count--;
+ }
+ else
+ {
+ throw new PortletException("Unrecognized operation!");
+ }
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+
+ String name = request.getParameter(NAME);
+ if (name == null)
+ {
+ name = "Anonymous";
+ }
+
+ writer.println("Hello, " + name + "!");
+ writer.println("Counter: " + count);
+ PortletURL url = response.createRenderURL();
+ url.setParameter(NAME, "Julien");
+ writer.println("<a href='" + url + "'>My name is
Julien</a>");
+ url.setParameter(NAME, "Roy");
+ writer.println("<a href='" + url + "'>My name is
Roy</a>");
+ url = response.createActionURL();
+ url.setParameter(OP, INC);
+ writer.println("<a href='" + url +
"'>counter++</a>");
+ url.setParameter(OP, DEC);
+ writer.println("<a href='" + url +
"'>counter--</a>");
+ }
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceNoEncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" + request.getContextPath() +
"/gif/logo.gif'/>");
+ }
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class ResourcePortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" +
response.encodeURL(request.getContextPath() + "/gif/logo.gif") +
"'/>");
+ }
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,64 @@
+package org.gatein.wsrp.portlet;
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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. *
+ ******************************************************************************/
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * A simple portlet to test session handling in WSRP.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class SessionPortlet extends GenericPortlet
+{
+ private static final String COUNT = "count";
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletSession session = req.getPortletSession();
+ int count = 0;
+ if (session.getAttribute(COUNT) != null)
+ {
+ count = ((Integer)session.getAttribute(COUNT)).intValue() + 1;
+ }
+ session.setAttribute(COUNT, new Integer(count));
+ writer.write("<p>Session id: " + session.getId() +
"</p>");
+ writer.write("<p>count = " + count + "</p>");
+ writer.write("<a href='" + resp.createRenderURL() +
"'>render</a>");
+
+ //
+ writer.close();
+ }
+}
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class UserContextPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("user: " + request.getRemoteUser());
+ }
+
+}
+
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.producer;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
+
+import junit.framework.TestCase;
+import org.gatein.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 8808 $
+ */
+public abstract class WSRPProducerBaseTest extends TestCase
+{
+ protected WSRPProducerImpl producer = WSRPProducerImpl.getInstance();
+
+ protected WSRPProducerBaseTest(String name) throws Exception
+ {
+ super(name);
+ }
+
+ public void deploy(String warFileName) throws Exception
+ {
+ File archiveDirectory = getDirectory("test.deployables.dir");
+ File deployDirectory = getDirectory("jboss.server.home.dir",
"deploy");
+ File archiveFile = getArchive(warFileName, archiveDirectory, true);
+ File deployArchive = getArchive(warFileName, deployDirectory, false);
+
+ FileChannel inputChannel = new FileInputStream(archiveFile).getChannel();
+ FileChannel outputChannel = new FileOutputStream(deployArchive).getChannel();
+
+ inputChannel.transferTo(0, inputChannel.size(), outputChannel);
+
+ Thread.currentThread().sleep(10000);
+ }
+
+ public void undeploy(String warFileName) throws Exception
+ {
+ File deployDirectory = getDirectory("jboss.server.home.dir",
"deploy");
+ File archive = getArchive(warFileName, deployDirectory, true);
+
+ archive.delete();
+
+ Thread.currentThread().sleep(10000);
+ }
+
+ private File getDirectory (String property) throws Exception
+ {
+ return getDirectory(property, null);
+ }
+
+ private File getDirectory (String property, String subDirectory) throws Exception
+ {
+ String deployableProperty = System.getProperty(property);
+ if (deployableProperty != null)
+ {
+ if (subDirectory != null)
+ {
+ deployableProperty += File.separator + subDirectory;
+ }
+
+ File deployableDir = new File(deployableProperty);
+ if (deployableDir.exists() && deployableDir.isDirectory())
+ {
+ return deployableDir;
+ }
+ else
+ {
+ throw new Error("Found a system property for \'" + property
+ "\' [" + deployableProperty + "] but value does not correspond to a
directory.");
+ }
+ }
+ else
+ {
+ throw new Error ("Could not find the system property \'" +
property + "\' cannot deploy test archives.");
+ }
+ }
+
+
+ private File getArchive(String fileName, File deployDirectory, boolean shouldExist)
throws Exception
+ {
+ if (fileName != null && deployDirectory != null &&
deployDirectory.exists() && deployDirectory.isDirectory())
+ {
+ File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator
+ fileName);
+ return archiveFile;
+// if (archiveFile.exists() && shouldExist)
+// {
+// return archiveFile;
+// }
+// else if (!archiveFile.exists() && !shouldExist)
+// {
+// return archiveFile;
+// }
+// else
+// {
+// //since its not what we are expecting we need to throw the opposite error
message
+// String existsString = shouldExist ? "does not exist" :
"exists";
+// throw new Exception("Archive " + fileName + " in directory
" + deployDirectory + " " + existsString + " which is not
expected.");
+// }
+ }
+ else
+ {
+ throw new Exception("Cannot find archive to deploy. Archive name ["
+ fileName + "] is null or the deploy directory + [" + deployDirectory + "]
is not a directory");
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,360 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.producer.config;
+
+import junit.framework.TestCase;
+import org.gatein.registration.RegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.registration.policies.RegistrationPolicyWrapper;
+import org.gatein.registration.policies.RegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.producer.config.impl.ProducerConfigurationImpl;
+import org.gatein.wsrp.producer.config.impl.xml.ProducerConfigurationFactory;
+import org.gatein.wsrp.producer.config.impl.xml.ProducerConfigurationProvider;
+import org.gatein.wsrp.registration.LocalizedString;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.ObjectModelProvider;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 10408 $
+ * @since 2.6
+ */
+public class ProducerConfigurationTestCase extends TestCase
+{
+ private Unmarshaller unmarshaller;
+ private ObjectModelFactory factory;
+
+ private static DefaultSchemaResolver RESOLVER;
+
+ static
+ {
+ RESOLVER = new DefaultSchemaResolver();
+ RESOLVER.setCacheResolvedSchemas(true);
+
RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace",
"xsd/xml.xsd");
+ RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_7",
"xsd/jboss-wsrp-producer_2_7.xsd");
+ }
+
+ protected void setUp() throws Exception
+ {
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ factory = new ProducerConfigurationFactory();
+ unmarshaller.setEntityResolver(new
org.gatein.wsrp.producer.config.TestEntityResolver());
+ }
+
+ public void testCustomPolicyUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("custom-policy.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements =
producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ RegistrationPolicy policy = requirements.getPolicy();
+
+ // check that the policy is properly wrapped
+ assertTrue(policy instanceof RegistrationPolicyWrapper);
+
+ // and that the delegate is indeed the expected policy
+ RegistrationPolicyWrapper wrapper = (RegistrationPolicyWrapper)policy;
+ assertTrue(wrapper.getDelegate() instanceof TestRegistrationPolicy);
+ }
+
+ public void testExtendedUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("extended.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements =
producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ RegistrationPolicy policy = requirements.getPolicy();
+ assertTrue(policy instanceof DefaultRegistrationPolicy);
+ RegistrationPropertyValidator propertyValidator =
((DefaultRegistrationPolicy)policy).getValidator();
+ assertNotNull(propertyValidator);
+ assertTrue(propertyValidator instanceof DefaultRegistrationPropertyValidator);
+ assertTrue(requirements.isRegistrationRequired());
+ assertTrue(requirements.isRegistrationRequiredForFullDescription());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertEquals(2, properties.size());
+
+ checkRegistrationProperty(requirements, 1);
+ checkRegistrationProperty(requirements, 2);
+ }
+
+ public void testMinimalRegistrationUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("minimal-registration.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements =
producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ assertTrue(requirements.isRegistrationRequired());
+ assertTrue(!requirements.isRegistrationRequiredForFullDescription());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ assertNotNull(requirements.getPolicy());
+ }
+
+ public void testMinimalUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements =
producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ assertFalse(requirements.isRegistrationRequired());
+ assertFalse(requirements.isRegistrationRequiredForFullDescription());
+ assertTrue(requirements.getRegistrationProperties().isEmpty());
+ assertNull(requirements.getPolicy());
+ }
+
+ public void testInvalidMultipleRegistrationConfiguration() throws Exception
+ {
+ try
+ {
+ getProducerConfiguration("invalid2.xml");
+ fail("Only one registration-configuration element allowed!");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidTypeValue() throws Exception
+ {
+ try
+ {
+ getProducerConfiguration("invalid-type.xml");
+ fail("Invalid type for property description should fail.");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidPropertyValidator()
+ {
+ try
+ {
+ getProducerConfiguration("invalid3.xml");
+ fail("Doesn't make sense to define a property validator if a
registration policy other than DefaultRegistrationPolicy");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidFullServiceDescriptionValue()
+ {
+ try
+ {
+ getProducerConfiguration("invalid1.xml");
+ fail("Invalid value for fullServiceDescriptionRequiresRegistration should
have caused failure");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testUseStrictMode() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("strict-mode.xml");
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ }
+
+ public void testChangeListeners() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration =
getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ TestProducerConfigurationChangeListener listener = new
TestProducerConfigurationChangeListener();
+ producerConfiguration.addChangeListener(listener);
+ assertFalse(listener.called);
+
+ // we're not changing the value, the listeners shouldn't be called
+ producerConfiguration.setUsingStrictMode(true);
+ assertFalse(listener.called);
+
+ producerConfiguration.setUsingStrictMode(false);
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ assertTrue(listener.called);
+ }
+
+ public void testSaveAndReload() throws IOException, ParserConfigurationException,
SAXException, JBossXBException
+ {
+ ProducerConfiguration configuration = new ProducerConfigurationImpl();
+ configuration.setUsingStrictMode(false);
+ ProducerRegistrationRequirements registrationRequirements =
configuration.getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequiredForFullDescription(true);
+ registrationRequirements.setRegistrationRequired(true);
+ String prop1 = "prop1";
+ registrationRequirements.addEmptyRegistrationProperty(prop1);
+
registrationRequirements.getRegistrationPropertyWith(prop1).setDefaultLabel("label1");
+ String prop2 = "prop2";
+ registrationRequirements.addEmptyRegistrationProperty(prop2);
+
registrationRequirements.getRegistrationPropertyWith(prop2).setDefaultHint("hint2");
+ String prop3 = "prop3";
+ registrationRequirements.addEmptyRegistrationProperty(prop3);
+
registrationRequirements.getRegistrationPropertyWith(prop3).setDefaultDescription("description3");
+ String prop4 = "prop4";
+ registrationRequirements.addEmptyRegistrationProperty(prop4);
+ RegistrationPropertyDescription propDesc4 =
registrationRequirements.getRegistrationPropertyWith(prop4);
+ propDesc4.setDefaultLabel("label4");
+ propDesc4.setDefaultHint("hint4");
+ propDesc4.setDefaultDescription("description4");
+
+ File tmp = File.createTempFile("producer-configuration-test-case",
"xml");
+ tmp.deleteOnExit();
+
+ writeConfigToFile(configuration, tmp);
+
+ configuration = getProducerConfiguration(tmp.toURL());
+
+ assertFalse(configuration.isUsingStrictMode());
+
+ registrationRequirements = configuration.getRegistrationRequirements();
+ assertTrue(registrationRequirements.isRegistrationRequired());
+ assertTrue(registrationRequirements.isRegistrationRequiredForFullDescription());
+
+ assertEquals(4, registrationRequirements.getRegistrationProperties().size());
+ assertEquals("label1",
registrationRequirements.getRegistrationPropertyWith(prop1).getLabel().getValue());
+ assertEquals("hint2",
registrationRequirements.getRegistrationPropertyWith(prop2).getHint().getValue());
+ assertEquals("description3",
registrationRequirements.getRegistrationPropertyWith(prop3).getDescription().getValue());
+ propDesc4 = registrationRequirements.getRegistrationPropertyWith(prop4);
+ assertEquals("label4", propDesc4.getLabel().getValue());
+ assertEquals("hint4", propDesc4.getHint().getValue());
+ assertEquals("description4", propDesc4.getDescription().getValue());
+ }
+
+ private void writeConfigToFile(ProducerConfiguration configuration, File file)
+ throws IOException, ParserConfigurationException, SAXException
+ {
+ StringWriter xmlOutput = new StringWriter();
+
+ // get the XML Schema source
+ InputStream is =
Thread.currentThread().getContextClassLoader().getResourceAsStream("xsd/jboss-wsrp-producer_2_7.xsd");
+
+ Reader xsReader = new InputStreamReader(is);
+
+ // create an instance of XML Schema marshaller
+ XercesXsMarshaller marshaller = new XercesXsMarshaller();
+
+ marshaller.setSchemaResolver(RESOLVER);
+
+ // we need to specify what elements are top most (roots) providing namespace URI,
prefix and local name
+ marshaller.addRootElement("urn:jboss:portal:wsrp:producer:v2_7",
"", "producer-configuration");
+
+ // declare default namespace
+ marshaller.declareNamespace("wpc",
"urn:jboss:portal:wsrp:producer:v2_7");
+
+ // add schema location by declaring xsi namespace and adding xsi:schemaLocation
attribute
+ marshaller.declareNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
+ marshaller.addAttribute("xsi", "schemaLocation",
"string",
+ "urn:jboss:portal:wsrp:producer:v2_7
http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd");
+
+ // create an instance of Object Model Provider
+ ObjectModelProvider provider = new ProducerConfigurationProvider();
+
+ marshaller.setProperty("org.jboss.xml.binding.marshalling.indent",
"true");
+ marshaller.marshal(xsReader, provider, configuration, xmlOutput);
+
+ // close XML Schema reader
+ xsReader.close();
+
+ file.createNewFile();
+ Writer configFile = new BufferedWriter(new FileWriter(file));
+ configFile.write(xmlOutput.toString());
+ configFile.flush();
+ configFile.close();
+ }
+
+ private ProducerConfiguration getProducerConfiguration(String fileName) throws
JBossXBException, IOException
+ {
+ URL location =
Thread.currentThread().getContextClassLoader().getResource(fileName);
+ assertNotNull(location);
+ System.out.println("location = " + location);
+
+ return getProducerConfiguration(location);
+ }
+
+ private ProducerConfiguration getProducerConfiguration(URL location) throws
JBossXBException, IOException
+ {
+ Object o = unmarshaller.unmarshal(location.openStream(), factory, null);
+ assertNotNull(o);
+ assertTrue(o instanceof ProducerConfiguration);
+ return (ProducerConfiguration)o;
+ }
+
+ private void checkRegistrationProperty(ProducerRegistrationRequirements requirements,
int index)
+ {
+ RegistrationPropertyDescription desc =
requirements.getRegistrationPropertyWith("name" + index);
+ assertNotNull(desc);
+ assertEquals(new QName("name" + index), desc.getName());
+ assertEquals(WSRPConstants.XSD_STRING, desc.getType());
+
+ LocalizedString localizedString = new LocalizedString("hint" + index,
Locale.ENGLISH);
+ localizedString.setResourceName("resource.hint" + index);
+ localizedString.setValue("hint" + index);
+ assertEquals(localizedString, desc.getHint());
+
+ localizedString = new LocalizedString("label" + index, Locale.ENGLISH);
+ localizedString.setResourceName("resource.label" + index);
+ localizedString.setValue("label" + index);
+ assertEquals(localizedString, desc.getLabel());
+ }
+
+ private static class TestProducerConfigurationChangeListener implements
ProducerConfigurationChangeListener
+ {
+ boolean called = false;
+
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+ called = true;
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,66 @@
+/*
+* 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.gatein.wsrp.producer.config;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class TestEntityResolver implements EntityResolver
+{
+ private static final String CONSUMER = "-//JBoss Portal//DTD WSRP Remote Producer
Configuration 2.6//EN";
+ private static final String PRODUCER = "-//JBoss Portal//DTD WSRP Local Producer
Configuration 2.6//EN";
+
+ public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException
+ {
+ String dtd;
+ if (PRODUCER.equals(publicId))
+ {
+ dtd = "jboss-wsrp-producer_2_6.dtd";
+ }
+ else if (CONSUMER.equals(publicId))
+ {
+ dtd = "jboss-wsrp-consumer_2_6.dtd";
+ }
+ else
+ {
+ return null;
+ }
+
+ InputStream dtdStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(dtd);
+ if (dtdStream != null)
+ {
+ return new InputSource(dtdStream);
+ }
+
+ return null;
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.producer.config;
+
+import org.gatein.registration.InvalidConsumerDataException;
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.RegistrationPolicy;
+import org.gatein.wsrp.registration.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11406 $
+ * @since 2.6
+ */
+public class TestRegistrationPolicy implements RegistrationPolicy
+{
+ public void validateRegistrationDataFor(Map<QName, Object>
registrationProperties, String consumerIdentity, final Map<QName, ? extends
PropertyDescription> expectations, final RegistrationManager manager) throws
IllegalArgumentException, RegistrationException
+ {
+ }
+
+ public String createRegistrationHandleFor(String registrationId) throws
IllegalArgumentException
+ {
+ return null;
+ }
+
+ public String getAutomaticGroupNameFor(String consumerName) throws
IllegalArgumentException
+ {
+ return null;
+ }
+
+ public String getConsumerIdFrom(String consumerName, Map<QName, Object>
registrationProperties) throws IllegalArgumentException, InvalidConsumerDataException
+ {
+ return null;
+ }
+
+ public void validateConsumerName(String consumerName, final RegistrationManager
manager) throws IllegalArgumentException, RegistrationException
+ {
+ }
+
+ public void validateConsumerGroupName(String groupName, RegistrationManager manager)
throws IllegalArgumentException, RegistrationException
+ {
+ }
+
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,844 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.WSRPActionURL;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPPortletURL;
+import org.gatein.wsrp.WSRPRenderURL;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
+import org.oasis.wsrp.v1.V1CacheControl;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1InitCookie;
+import org.oasis.wsrp.v1.V1InteractionParams;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1MarkupContext;
+import org.oasis.wsrp.v1.V1MarkupResponse;
+import org.oasis.wsrp.v1.V1NamedString;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1RuntimeContext;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1StateChange;
+import org.oasis.wsrp.v1.V1UnsupportedMode;
+import org.oasis.wsrp.v1.V1UpdateResponse;
+
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 13149 $
+ * @since 2.4
+ */
+
+(a)RunWith(Arquillian.class)
+public class MarkupTestCase extends NeedPortletHandleTest
+{
+ private static final String DEFAULT_VIEW_MARKUP = "<p>symbol unset stock
value: value unset</p>";
+ private static final String DEFAULT_MARKUP_PORTLET_WAR =
"test-markup-portlet.war";
+
+ public MarkupTestCase()
+ throws Exception
+ {
+ super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the producer
services
+ //I don't know why its really needed, seems to be a dependency where wsrp connects
with the pc module
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null),
MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testGetMarkupViewNoSession() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponse(response, DEFAULT_VIEW_MARKUP);
+ }
+
+ @Test
+ public void testInvalidGetMarkup() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setMode("invalid mode");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail();
+ }
+ catch (V1UnsupportedMode unsupportedMode)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithSessionID() throws Exception
+ {
+ // The consumer should never have access to or be able to set a sessionID. Sessions
are handled by the Producer using cookies.
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getRuntimeContext().setSessionID("Hello World");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("A sessionID should not be allowed to be passed in
GetMarkup()");
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testGetMarkupEditNoSession() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setMode(WSRPConstants.EDIT_MODE);
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponse(response, "<form method='post'
action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
+ "-interactionState=JBPNS_/wsrp_rewrite'
id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock
symbol</t" +
+ "d><td><input
name='symbol'/></td></tr><tr><td><input
type='submit'
value='Submit'></td></tr></table></form>");
+ }
+
+ @Test
+ public void testGetMarkupRenderParameters() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archiveName = "test-renderparam-portlet.war";
+ deploy(archiveName);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ String julienLink = extractLink(markupString, 0);
+ WSRPPortletURL julienURL = WSRPPortletURL.create(julienLink);
+
+ ExtendedAssert.assertString1ContainsString2(markupString, "Hello,
Anonymous!");
+ ExtendedAssert.assertString1ContainsString2(markupString, "Counter:
0");
+
+ ExtendedAssert.assertTrue(julienURL instanceof WSRPRenderURL);
+ WSRPRenderURL julienRender = (WSRPRenderURL)julienURL;
+
+ // We're now trying to get a hello for Julien ;)
+
gm.getMarkupParams().setNavigationalState(julienRender.getNavigationalState().getStringValue());
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "Hello,
Julien!");
+
+ // julien.length() * 2 to bypass second link
+ WSRPPortletURL incrementURL = WSRPPortletURL.create(extractLink(markupString,
julienLink.length() * 2));
+ ExtendedAssert.assertTrue(incrementURL instanceof WSRPActionURL);
+ WSRPActionURL incrementAction = (WSRPActionURL)incrementURL;
+
+ // let's see now if we can increment the counter
+ V1PerformBlockingInteraction performBlockingInteraction =
+
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
+
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
+ producer.performBlockingInteraction(performBlockingInteraction);
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "Counter:
1");
+ }
+ finally
+ {
+ undeploy(archiveName);
+ }
+ }
+
+ private String extractLink(String markupString, int fromIndex)
+ {
+ int urlStartIndex = markupString.indexOf("='", fromIndex);
+ int urlEndIndex = markupString.indexOf("'>", urlStartIndex);
+ return markupString.substring(urlStartIndex + 2, urlEndIndex);
+ }
+
+ // fix-me: add more tests
+ @Test
+ public void testGetMarkupSession() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ // deploy session-manipulating portlet
+ String sessionPortletArchive = "test-session-portlet.war";
+ deploy(sessionPortletArchive);
+
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponseWithSession(response, 0);
+
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponseWithSession(response, 1);
+
+ // fix-me: try to reuse the old session id: what should happen?
+// runtimeContext.setSessionID(sessionID);
+// getMarkup.setRuntimeContext(runtimeContext);
+// try
+// {
+// producer.getMarkup(getMarkup);
+// fail("The session should be invalid...");
+// }
+// catch (InvalidSessionFault expected)
+// {
+// }
+ }
+ finally
+ {
+ // reset state
+ undeploy(sessionPortletArchive);
+ }
+ }
+
+ @Test
+ public void testPerformBlockingInteractionNoRedirect() throws Exception
+ {
+ checkPBIAndGetNavigationalState("RHAT");
+ }
+
+ @Test
+ public void testPerformBlockingInteractionRedirect() throws Exception
+ {
+ V1PerformBlockingInteraction performBlockingInteraction =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
+
+ // crappy way but this is a test! ;)
+ V1NamedString namedString = new V1NamedString();
+ namedString.setName("symbol");
+ namedString.setValue("HELP");
+ interactionParams.getFormParameters().add(namedString);
+
+ V1BlockingInteractionResponse response =
producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.assertNotNull(response);
+
+ // this is a redirect...
+ String redirectURL = response.getRedirectURL();
+ ExtendedAssert.assertNotNull(redirectURL);
+ ExtendedAssert.assertEquals("/WEB-INF/jsp/help.jsp", redirectURL); //
fix-me: handle URL re-writing
+
+ // no update response
+ V1UpdateResponse updateResponse = response.getUpdateResponse();
+ ExtendedAssert.assertNull(updateResponse);
+ }
+
+ @Test
+ public void testGMAndPBIInteraction() throws Exception
+ {
+ testGetMarkupViewNoSession();
+ String symbol = "AAPL";
+ String navigationalState = checkPBIAndGetNavigationalState(symbol);
+
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setNavigationalState(navigationalState);
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "<p>" + symbol + " stock value:
123.45</p>");
+ }
+
+ @Test
+ public void testPBIWithSessionID() throws Exception
+ {
+ String portletHandle = getDefaultHandle();
+ V1PerformBlockingInteraction performBlockingInteraction =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
+
+ V1RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
+ //the sessionID should never be set by the consumer. Sessions are handled by
cookies instead
+ runtimeContext.setSessionID("Hello World");
+
+ try
+ {
+ producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.fail("Should not be able to pass a sessionID in a
PerformBlockingInteraction()");
+ }
+ catch (V1OperationFailed expected)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testMarkupCaching() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ V1CacheControl cacheControl = response.getMarkupContext().getCacheControl();
+ ExtendedAssert.assertNotNull(cacheControl);
+ ExtendedAssert.assertEquals(WSRPConstants.CACHE_PER_USER,
cacheControl.getUserScope());
+ ExtendedAssert.assertEquals(15, cacheControl.getExpires());
+
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String sessionPortletArchive = "test-session-portlet.war";
+ deploy(sessionPortletArchive);
+
+ response = producer.getMarkup(createMarkupRequestForCurrentlyDeployedPortlet());
+
+ cacheControl = response.getMarkupContext().getCacheControl();
+ ExtendedAssert.assertNull(cacheControl);
+
+ undeploy(sessionPortletArchive);
+ }
+
+ @Test
+ public void testGetMarkupWithDispatcherPortlet() throws Exception
+ {
+
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String dispatcherPortletArchive = "test-dispatcher-portlet.war";
+ deploy(dispatcherPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "test");
+ }
+ finally
+ {
+ undeploy(dispatcherPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNoContent() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String basicPortletArchive = "test-basic-portlet.war";
+ deploy(basicPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "");
+ }
+ finally
+ {
+ undeploy(basicPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonStandardLocalesStrictMode() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+ getMarkup.getMarkupParams().getLocales().add("en_US");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ //fail("Should have trown an UnsupportetLocaleFault"); // ideally cf
http://jira.jboss.com/jira/browse/JBPORTAL-857
+ ExtendedAssert.fail("Should have trown an exception"); // right now
+ }
+ catch (Exception expected)
+ {
+ // expected
+ }
+ finally
+ {
+ // checkMarkupResponse(response, "GetLocalesPortlet"); // should we
return try to generate markup regardless?
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonStandardLocalesLenientMode() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+ getMarkup.getMarkupParams().getLocales().add("en_US");
+
+ // Use the lenient mode
+ producer.usingStrictModeChangedTo(false);
+
+ // markup should be properly generated
+ checkMarkupResponse(producer.getMarkup(getMarkup), "English (United
States)");
+ undeploy(getLocalesPortletArchive);
+ }
+
+ @Test
+ public void testGetMarkupWithoutDeclaredLocale() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("No
Declared"));
+
+ try
+ {
+ checkMarkupResponse(producer.getMarkup(getMarkup),
Locale.getDefault().getDisplayName());
+ }
+ finally
+ {
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupLocales() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup =
createMarkupRequest(getPortletHandleFrom("Simple"));
+
+ try
+ {
+ List<String> locales = getMarkup.getMarkupParams().getLocales();
+ locales.add("en");
+ locales.add("fr");
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
+
+ locales.clear();
+ locales.add("fr");
+ locales.add("en");
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.FRENCH.getDisplayName());
+
+ locales.clear();
+ locales.add("de");
+ locales.add("en");
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
+ }
+ finally
+ {
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithEncodedURLs() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String encodeURLPortletArchive = "test-encodeurl-portlet.war";
+ deploy(encodeURLPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response,
"wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n"
+
+
"wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
+ }
+ finally
+ {
+ undeploy(encodeURLPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithUserContext() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String userContextPortletArchive = "test-usercontext-portlet.war";
+ deploy(userContextPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
getMarkup.setUserContext(WSRP1TypeFactory.createUserContext("johndoe"));
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "user: johndoe");
+ }
+ finally
+ {
+ undeploy(userContextPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupMultiValuedFormParams() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String multiValuedPortletArchive = "test-multivalued-portlet.war";
+ deploy(multiValuedPortletArchive);
+
+ V1NamedString namedString = createNamedString("multi",
"value1");
+ try
+ {
+ V1PerformBlockingInteraction action =
+
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ List<V1NamedString> formParameters =
action.getInteractionParams().getFormParameters();
+ formParameters.add(namedString);
+ V1BlockingInteractionResponse actionResponse =
producer.performBlockingInteraction(action);
+ V1GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ V1MarkupResponse response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: value1");
+
+ formParameters.clear();
+ formParameters.add(namedString);
+ formParameters.add(createNamedString("multi", "value2"));
+ actionResponse = producer.performBlockingInteraction(action);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: value1, value2");
+
+ formParameters.clear();
+ formParameters.add(new V1NamedString());
+ actionResponse = producer.performBlockingInteraction(action);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: ");
+ }
+ finally
+ {
+ undeploy(multiValuedPortletArchive);
+ }
+ }
+
+ @Test
+ public void testImplicitCloning() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archiveName = "test-implicitcloning-portlet.war";
+ deploy(archiveName);
+
+ try
+ {
+ // check the initial value
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals("initial", markupString);
+
+ // modify the preference value
+ V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+
pbi.getInteractionParams().setPortletStateChange(V1StateChange.CLONE_BEFORE_WRITE); //
request cloning if needed
+ String value = "new value";
+
pbi.getInteractionParams().getFormParameters().add(createNamedString("value",
value));
+ V1BlockingInteractionResponse response =
producer.performBlockingInteraction(pbi);
+ ExtendedAssert.assertNotNull(response);
+
+ // check that we got a new portlet context
+ V1PortletContext pc = response.getUpdateResponse().getPortletContext();
+ ExtendedAssert.assertNotNull(pc);
+
+ // get the markup again and check that we still get the initial value with the
initial portlet context
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals("initial", markupString);
+
+ // retrieving the markup with the new portlet context should return the new
value
+ gm.setPortletContext(pc);
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals(value, markupString);
+ }
+ finally
+ {
+ undeploy(archiveName);
+ }
+ }
+
+ private V1NamedString createNamedString(String name, String value)
+ {
+ V1NamedString namedString = new V1NamedString();
+ namedString.setName(name);
+ namedString.setValue(value);
+ return namedString;
+ }
+
+ @Test
+ public void testGetMarkupWithResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resource-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated
markup
+ String markupStart = "<img
src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
+ String markupEnd =
"%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) ||
homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonURLEncodedResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resourcenoencodeurl-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated
markup
+ String markupStart = "<img src='http://";
+ String markupEnd =
":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) ||
homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testApplicationScopeVariableHandling() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-applicationscope-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ // set appVar to value in the application scope by the first portlet
+ V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
+
pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar",
"value"));
+ producer.performBlockingInteraction(pbi);
+
+ // the second portlet reads the appVar value and outputs it
+ V1GetMarkup gm = createMarkupRequest(getPortletHandleFrom("Get"));
+ V1MarkupResponse res = producer.getMarkup(gm);
+ checkMarkupResponse(res, "appVar=value");
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1GetMarkup gm = createMarkupRequest();
+ try
+ {
+ producer.getMarkup(gm);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired()
throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1PerformBlockingInteraction pbi =
WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ try
+ {
+ producer.performBlockingInteraction(pbi);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testInitCookieNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1InitCookie initCookie = WSRP1TypeFactory.createInitCookie(null);
+ try
+ {
+ producer.initCookie(initCookie);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ private String checkPBIAndGetNavigationalState(String symbol) throws Exception
+ {
+ V1PerformBlockingInteraction performBlockingInteraction =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ V1InteractionParams interactionParams =
performBlockingInteraction.getInteractionParams();
+ interactionParams.getFormParameters().add(createNamedString("symbol",
symbol));
+
+ V1BlockingInteractionResponse response =
producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.assertNotNull(response);
+
+ // this is not a redirect...
+ ExtendedAssert.assertNull(response.getRedirectURL());
+
+ // check update response
+ V1UpdateResponse updateResponse = response.getUpdateResponse();
+ ExtendedAssert.assertNotNull(updateResponse);
+ // request was readOnly so no updated portlet context
+ ExtendedAssert.assertNull(updateResponse.getPortletContext());
+ // check that no sessionId is getting passed.
+ ExtendedAssert.assertNull(updateResponse.getSessionContext());
+
+ String navigationalState = updateResponse.getNavigationalState();
+ ExtendedAssert.assertNotNull(navigationalState);
+ ExtendedAssert.assertEquals(updateResponse.getNewMode(), WSRPConstants.VIEW_MODE);
+ V1MarkupContext markupContext = updateResponse.getMarkupContext();
+ ExtendedAssert.assertNull(markupContext); // we don't return markup for now
+
+ return navigationalState;
+ }
+
+ private void checkMarkupResponseWithSession(V1MarkupResponse response, int count)
throws RemoteException, V1InvalidRegistration, V1OperationFailed
+ {
+ ExtendedAssert.assertNotNull(response);
+
+ // Markup context
+ V1MarkupContext markupContext = response.getMarkupContext();
+ ExtendedAssert.assertNotNull(markupContext);
+ String markupString = markupContext.getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "count = " +
count);
+ ExtendedAssert.assertString1ContainsString2(markupString, "<a
href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>");
+
+ // checking session
+ checkSessionForCurrentlyDeployedPortlet(response);
+ }
+
+ private V1MarkupContext checkMarkupResponse(V1MarkupResponse response, String
markupString)
+ {
+ ExtendedAssert.assertNotNull(response);
+
+ // Markup context
+ V1MarkupContext markupContext = response.getMarkupContext();
+ ExtendedAssert.assertNotNull(markupContext);
+ ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
+ ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
+ ExtendedAssert.assertTrue(markupContext.isRequiresUrlRewriting());
+ ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());
+
+ // Session context
+ V1SessionContext sessionContext = response.getSessionContext();
+ // The session information is should never be sent to the consumer, Cookies are
used instead.
+ ExtendedAssert.assertNull(sessionContext);
+
+ return markupContext;
+ }
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return DEFAULT_MARKUP_PORTLET_WAR;
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidRegistrationFault;
+import org.oasis.wsrp.v1.V1MarkupResponse;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4
+ */
+public abstract class NeedPortletHandleTest extends V1ProducerBaseTest
+{
+ private String mostUsedPortletWARFileName;
+ private String currentlyDeployedArchiveName;
+ private Map<String, List<String>> war2Handles = new HashMap<String,
List<String>>(7);
+
+
+ public NeedPortletHandleTest(String portletWARFileName)
+ throws Exception
+ {
+ this("NeedPortletHandleTest", portletWARFileName);
+ this.mostUsedPortletWARFileName = portletWARFileName;
+ }
+
+ protected NeedPortletHandleTest(String name, String portletWARFileName)
+ throws Exception
+ {
+ super(name);
+ this.mostUsedPortletWARFileName = portletWARFileName;
+ }
+
+ protected String getDefaultHandle()
+ {
+ return getFirstHandleFor(mostUsedPortletWARFileName);
+ }
+
+ /**
+ * @param archiveName
+ * @return
+ * @since 2.6.3
+ */
+ private String getFirstHandleFor(String archiveName)
+ {
+ return war2Handles.get(archiveName).get(0);
+ }
+
+ protected String getHandleForCurrentlyDeployedArchive()
+ {
+ return getFirstHandleFor(currentlyDeployedArchiveName);
+ }
+
+ /**
+ * @return
+ * @since 2.6.3
+ */
+ protected List<String> getHandlesForCurrentlyDeployedArchive()
+ {
+ return war2Handles.get(currentlyDeployedArchiveName);
+ }
+
+ /**
+ * Each time we deploy a new archive, check to see if the service description has
changed and add any new portlet
+ * handles found.
+ *
+ * @param archiveName
+ * @throws Exception
+ */
+ public void deploy(String archiveName) throws Exception
+ {
+ super.deploy(archiveName);
+ currentlyDeployedArchiveName = archiveName;
+
+ if (!war2Handles.containsKey(archiveName))
+ {
+ V1GetServiceDescription getServiceDescription =
WSRP1TypeFactory.createGetServiceDescription();
+ V1ServiceDescription serviceDescription =
producer.getServiceDescription(getServiceDescription);
+ List<V1PortletDescription> offered =
serviceDescription.getOfferedPortlets();
+ if (offered != null)
+ {
+ for (V1PortletDescription portletDescription : offered)
+ {
+ String handle = portletDescription.getPortletHandle();
+ String warName = handle.substring(1, handle.indexOf('.')) +
".war";
+ if (warName.equals(archiveName))
+ {
+ List<String> handles = war2Handles.get(warName);
+ if (handles == null)
+ {
+ handles = new ArrayList<String>(3);
+ war2Handles.put(warName, handles);
+ }
+
+ handles.add(handle);
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException(archiveName + " didn't contain
any portlets...");
+ }
+ }
+ }
+
+ public void undeploy(String archiveName) throws Exception
+ {
+ try
+ {
+ super.undeploy(archiveName);
+ }
+ catch (Exception e)
+ {
+ // if an exception occurred the portlet is still probably deployed, so just
exit
+ e.printStackTrace();
+ return;
+ }
+
+ currentlyDeployedArchiveName = null;
+
+ // only remove the mapping if we're not undeploying the most used portlet
(optimization, as it avoids parsing the SD)
+ if (!mostUsedPortletWARFileName.equals(archiveName))
+ {
+ war2Handles.remove(archiveName);
+ }
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.mostUsedPortletWARFileName = getMostUsedPortletWARFileName();
+ deploy(mostUsedPortletWARFileName);
+
+ // reset strict mode
+ producer.usingStrictModeChangedTo(true);
+ }
+
+ /**
+ * Sub-classes need to implement this method to return the local WAR file name of the
portlet being deployed most of
+ * the time in the context of the test case. This is required since we cannot rely on
the name to be properly set at
+ * all time via the constructor.
+ *
+ * @return
+ */
+ protected abstract String getMostUsedPortletWARFileName();
+
+ public void tearDown() throws Exception
+ {
+ undeploy(mostUsedPortletWARFileName);
+ super.tearDown();
+ }
+
+ /**
+ * Creates a valid Markup request.
+ *
+ * @return a basic, valid GetMarkup object representing the markup request
+ */
+ protected V1GetMarkup createMarkupRequestForCurrentlyDeployedPortlet() throws
Exception
+ {
+ return createMarkupRequest(getHandleForCurrentlyDeployedArchive());
+ }
+
+ /**
+ * @param handle
+ * @return
+ * @throws RemoteException
+ * @throws V1InvalidRegistrationFault
+ * @throws V1OperationFailedFault
+ * @since 2.6.3
+ */
+ protected V1GetMarkup createMarkupRequest(String handle) throws RemoteException,
V1InvalidRegistration, V1OperationFailed
+ {
+ V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest(handle);
+
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+
+ return getMarkup;
+ }
+
+ protected String getPortletHandleFrom(String partialHandle)
+ {
+ List<String> handles = getHandlesForCurrentlyDeployedArchive();
+ for (String handle : handles)
+ {
+ if (handle.contains(partialHandle))
+ {
+ return handle;
+ }
+ }
+
+ throw new IllegalArgumentException("Couldn't find a portlet handle
matching '" + partialHandle + "' in " +
currentlyDeployedArchiveName);
+ }
+
+ protected V1GetMarkup createMarkupRequest() throws Exception
+ {
+ return createMarkupRequestForCurrentlyDeployedPortlet();
+ }
+
+ protected void checkSessionForCurrentlyDeployedPortlet(V1MarkupResponse response)
+ throws RemoteException, V1InvalidRegistration, V1OperationFailed
+ {
+ // We don't send any portlet session information, just user cookies... The
producer takes care of the details
+ // What this means, though is that we don't have access to individual portlet
session ids... so we can only
+ // check that we get a cookie... Not very test-friendly...
+ /*ProducerSessionInformation sessionInfo =
RequestHeaderClientHandler.getCurrentProducerSessionInformation();
+ ExtendedAssert.assertNotNull(sessionInfo);
+
ExtendedAssert.assertTrue(sessionInfo.getUserCookie().lastIndexOf("JSESSIONID")
!= -1);
+
+ // Check that we are not sending sessionID's
+ SessionContext sessionContext = response.getSessionContext();
+ ExtendedAssert.assertNull(sessionContext);*/
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,461 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1ClonePortlet;
+import org.oasis.wsrp.v1.V1DestroyFailed;
+import org.oasis.wsrp.v1.V1DestroyPortlets;
+import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
+import org.oasis.wsrp.v1.V1GetPortletDescription;
+import org.oasis.wsrp.v1.V1GetPortletProperties;
+import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
+import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v1.V1Property;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1PropertyList;
+import org.oasis.wsrp.v1.V1SetPortletProperties;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4
+ */
+(a)RunWith(Arquillian.class)
+public class PortletManagementTestCase extends NeedPortletHandleTest
+{
+ private static final String TEST_BASIC_PORTLET_WAR =
"test-basic-portlet.war";
+
+ public PortletManagementTestCase() throws Exception
+ {
+ super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the
producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp
connects with the pc module
+
ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null),
MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testClonePortlet() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
+
+ // first check that we get a new PortletContext
+ V1PortletContext cloneContext = clonePortlet(handle);
+ ExtendedAssert.assertNotNull(cloneContext);
+ ExtendedAssert.assertFalse(initialContext.equals(cloneContext));
+
+ // then check that the initial state is identical
+ V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, cloneContext);
+ List<V1Property> result =
producer.getPortletProperties(getPortletProperties).getProperties();
+ getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null,
initialContext);
+ checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties),
result);
+
+ // check that new clone is not listed in service description
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ @Test
+ public void testClonePortletNoRegistrationWhenRequired()
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
+
+ try
+ {
+ producer.clonePortlet(clonePortlet);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDestroyPortlets() throws Exception
+ {
+ // first try to destroy POP, should fail
+ String handle = getDefaultHandle();
+ V1DestroyPortlets destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(handle));
+ V1DestroyPortletsResponse response = producer.destroyPortlets(destroyPortlets);
+ ExtendedAssert.assertNotNull(response);
+ List<V1DestroyFailed> failures = response.getDestroyFailed();
+ ExtendedAssert.assertNotNull(failures);
+ ExtendedAssert.assertEquals(1, failures.size());
+ V1DestroyFailed failure = failures.get(0);
+ ExtendedAssert.assertNotNull(failure);
+ ExtendedAssert.assertEquals(handle, failure.getPortletHandle());
+ ExtendedAssert.assertNotNull(failure.getReason());
+
+ // clone portlet and try to destroy it
+ V1PortletContext portletContext = clonePortlet(handle);
+ destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(portletContext.getPortletHandle()));
+ response = producer.destroyPortlets(destroyPortlets);
+ ExtendedAssert.assertNotNull(response);
+ failures = response.getDestroyFailed();
+ ExtendedAssert.assertNull(failures);
+ }
+
+ @Test
+ public void testDestroyPortletsNoRegistrationWhenRequired()
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1DestroyPortlets dp = WSRP1TypeFactory.createDestroyPortlets(null,
Collections.<String>singletonList(handle));
+
+ try
+ {
+ producer.destroyPortlets(dp);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testGetPortletDescription() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null,
handle);
+
+ V1PortletDescriptionResponse response = producer.getPortletDescription(gpd);
+ ExtendedAssert.assertNotNull(response);
+
+ checkBasicPortletDescription(response.getPortletDescription(), handle);
+ }
+
+ @Test
+ public void testGetPortletDescriptionNoRegistrationWhenRequired()
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null,
handle);
+
+ try
+ {
+ producer.getPortletDescription(gpd);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testGetPortletPropertiesNoRegistration() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
+ V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
+
+ List<String> names = getPortletProperties.getNames();
+ Collections.addAll(names, "prefName1", "prefName2");
+
+ V1PropertyList response = producer.getPortletProperties(getPortletProperties);
+ List<V1Property> expected = new ArrayList<V1Property>(2);
+ Collections.addAll(expected, WSRP1TypeFactory.createProperty("prefName1",
"en", "prefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en",
"prefValue2"));
+ checkGetPropertiesResponse(response, expected);
+
+ names.clear();
+ response = producer.getPortletProperties(getPortletProperties);
+ checkGetPropertiesResponse(response, expected);
+
+ names.add("prefName2");
+ response = producer.getPortletProperties(getPortletProperties);
+ checkGetPropertiesResponse(response,
Collections.<V1Property>singletonList(WSRP1TypeFactory.createProperty("prefName2",
"en", "prefValue2")));
+ }
+
+ public void testGetPortletPropertyDescription() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1GetPortletPropertyDescription getPortletPropertyDescription =
WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
+
+ V1PortletPropertyDescriptionResponse response =
producer.getPortletPropertyDescription(getPortletPropertyDescription);
+
+ V1ModelDescription desc = response.getModelDescription();
+ ExtendedAssert.assertNotNull(desc);
+ List<V1PropertyDescription> propertyDescriptions =
desc.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+
+ List<V1PropertyDescription> expected = new
ArrayList<V1PropertyDescription>(2);
+ V1PropertyDescription description =
WSRP1TypeFactory.createPropertyDescription("prefName1",
WSRPConstants.XSD_STRING);
+
description.setHint(WSRP1TypeFactory.createLocalizedString("prefName1"));
+
description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName1"));
+ expected.add(description);
+ description = WSRP1TypeFactory.createPropertyDescription("prefName2",
WSRPConstants.XSD_STRING);
+
description.setHint(WSRP1TypeFactory.createLocalizedString("prefName2"));
+
description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName2"));
+ expected.add(description);
+
+ checkPropertyDescriptions(expected, propertyDescriptions);
+ }
+
+ @Test
+ public void testGetPortletPropertiesNoRegistrationWhenRequired()
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1GetPortletPropertyDescription getPortletPropertyDescription =
WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
+
+ try
+ {
+ producer.getPortletPropertyDescription(getPortletPropertyDescription);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetPortletProperties() throws Exception
+ {
+ String handle = getDefaultHandle();
+
+ V1PortletContext portletContext = clonePortlet(handle);
+ V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
+ List<V1Property> properties = propertyList.getProperties();
+ Collections.addAll(properties,
WSRP1TypeFactory.createProperty("prefName1", "en",
"newPrefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en",
"newPrefValue2"));
+ V1SetPortletProperties setPortletProperties =
WSRP1TypeFactory.createSetPortletProperties(null, portletContext, propertyList);
+
+ V1PortletContext response = producer.setPortletProperties(setPortletProperties);
+ V1GetPortletProperties getPortletProperties =
WSRP1TypeFactory.createGetPortletProperties(null, response);
+ checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties),
properties);
+
+ portletContext = WSRP1TypeFactory.createPortletContext(handle);
+ setPortletProperties.setPortletContext(portletContext);
+ try
+ {
+ response = producer.setPortletProperties(setPortletProperties);
+ ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should
fail...");
+ }
+ catch (V1InconsistentParameters expected)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testSetPortletPropertiesNoRegistrationWhenRequired()
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
+ List<V1Property> properties = propertyList.getProperties();
+ Collections.addAll(properties,
WSRP1TypeFactory.createProperty("prefName1", "en",
"newPrefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en",
"newPrefValue2"));
+ V1SetPortletProperties setPortletProperties =
WSRP1TypeFactory.createSetPortletProperties(null,
+ WSRP1TypeFactory.createPortletContext(getDefaultHandle()), propertyList);
+
+ try
+ {
+ producer.setPortletProperties(setPortletProperties);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ private V1PortletContext clonePortlet(String handle) throws V1InvalidUserCategory,
V1InconsistentParameters,
+ V1InvalidRegistration, V1MissingParameters, V1OperationFailed, V1AccessDenied,
V1InvalidHandle
+ {
+ V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
+ return producer.clonePortlet(clonePortlet);
+ }
+
+ private List<V1Property> checkGetPropertiesResponse(V1PropertyList response,
List<V1Property> expected)
+ {
+ ExtendedAssert.assertNotNull(response);
+ List<V1Property> properties = response.getProperties();
+ ExtendedAssert.assertEquals(expected.toArray(), properties.toArray(), false,
"Didn't receive expected properties!", new PropertyDecorator());
+ return properties;
+ }
+
+ private void checkPropertyDescriptions(List<V1PropertyDescription> expected,
List<V1PropertyDescription> propertyDescriptions)
+ {
+ ExtendedAssert.assertEquals(expected.size(), propertyDescriptions.size());
+ V1PropertyDescription propDesc = propertyDescriptions.get(0);
+ ExtendedAssert.assertNotNull(propDesc);
+ String name = propDesc.getName();
+ if ("prefName1".equals(name))
+ {
+ assertEquals(expected.get(0), propDesc);
+ assertEquals(expected.get(1), propertyDescriptions.get(1));
+ }
+ else if ("prefName2".equals(name))
+ {
+ assertEquals(expected.get(1), propDesc);
+ assertEquals(expected.get(0), propertyDescriptions.get(1));
+ }
+ else
+ {
+ ExtendedAssert.fail("Unexpected PropertyDescription named '" +
name + "'");
+ }
+ }
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return TEST_BASIC_PORTLET_WAR;
+ }
+
+ private static class PropertyDecorator implements ExtendedAssert.Decorator
+ {
+ private V1Property prop;
+
+ public void decorate(Object decorated)
+ {
+ prop = (V1Property)decorated;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o instanceof ExtendedAssert.DecoratedObject)
+ {
+ ExtendedAssert.DecoratedObject decoratedObject =
(ExtendedAssert.DecoratedObject)o;
+ V1Property that = (V1Property)decoratedObject.getDecorated();
+
+ String name = prop.getName();
+ if (name != null ? !name.equals(that.getName()) : that.getName() != null)
+ {
+ return false;
+ }
+
+ String value = prop.getStringValue();
+ if (value != null ? !value.equals(that.getStringValue()) :
that.getStringValue() != null)
+ {
+ return false;
+ }
+
+ String lang = prop.getLang();
+ if (lang != null ? !lang.equals(that.getLang()) : that.getLang() != null)
+ {
+ return false;
+ }
+
+ List<Object> any = prop.getAny();
+ return !(any != null ? !any.equals(that.getAny()) : that.getAny() != null);
+
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ public String toString()
+ {
+ return new StringBuffer().append("Property:
").append(prop.getName()).append("=")
+ .append(prop.getStringValue()).append("
(").append(prop.getLang()).append(")").toString();
+ }
+ }
+}
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,365 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.registration.Registration;
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1ModifyRegistration;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1RegistrationData;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 12309 $
+ * @since 2.4
+ */
+public class RegistrationTestCase extends V1ProducerBaseTest
+{
+ public RegistrationTestCase() throws Exception
+ {
+ super("RegistrationTestCase");
+ }
+
+ /**
+ * R355: The portal MUST pass a name for itself that uniquely identifies it.
+ *
+ * @throws Exception
+ */
+ public void testUniqueNameRegistration() throws Exception
+ {
+ // not sure how to test this...
+ }
+
+ /**
+ * R356: The portal MAY pass information describing the portal [vendor] type and
version.
+ * <p/>
+ * However, WSRP v1 7.1.1 states: The consumerAgent value MUST start with
"productName.majorVersion.minorVersion"
+ * where "productName" identifies the product the Consumer installed for its
deployment, and majorVersion and
+ * minorVersion are vendor-defined indications of the version of its product. This
string can then contain any
+ * additional characters/words the product or Consumer wish to supply.
+ *
+ * @throws Exception
+ */
+ public void testConsumerAgent() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+ V1RegistrationData regData = createBaseRegData();
+ regData.setConsumerAgent("invalid consumer agent");
+
+ try
+ {
+ producer.register(regData);
+ ExtendedAssert.fail("Trying to register with an invalid consumer agent
String should fail.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+
+
+ regData.setConsumerAgent(WSRPConstants.CONSUMER_AGENT);
+ producer.register(regData);
+ }
+
+ public void testRegistrationHandle() throws V1OperationFailed, V1MissingParameters,
RegistrationException
+ {
+ // check that a registration handle was created
+ V1RegistrationContext rc = registerConsumer();
+ String registrationHandle = rc.getRegistrationHandle();
+ assertNotNull(registrationHandle);
+
+ // check that a registration was created with that handle
+ RegistrationManager registrationManager = producer.getRegistrationManager();
+ Registration registration =
registrationManager.getRegistration(registrationHandle);
+ assertNotNull(registration);
+
+ // check that the registration was persisted...
+ String key = registration.getPersistentKey();
+ assertNotNull(key);
+
+ // ... and that the handle was created by the policy based on the registration key
+ String expectedHandle =
registrationManager.getPolicy().createRegistrationHandleFor(key);
+ assertEquals(expectedHandle, registrationHandle);
+ }
+
+ public void testDeregister() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // deregister
+ producer.deregister(rc);
+
+ // try to get markup, portlet handle doesn't matter since it should fail before
trying to retrieve the portlet
+ V1GetMarkup getMarkup =
WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("Consumer tried to access info with a de-registered
context. Operations should fail.");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+
+ // Get description with old registration context should fail
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ gs.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getServiceDescription(gs);
+ ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+
+ // Get description should still work without registration context
+ gs = getNoRegistrationServiceDescriptionRequest();
+
+ ExtendedAssert.assertNotNull(producer.getServiceDescription(gs));
+ }
+
+ public void testModifyRegistration() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // now modify Producer's set of required registration info
+ String newPropName = "New Prop";
+ RegistrationPropertyDescription regProp = new
RegistrationPropertyDescription(newPropName,
+ new QName("urn:oasis:names:tc:wsrp:v1:types",
"LocalizedString", "ns1"));
+ regProp.setDefaultLabel("New Registration Property");
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().addRegistrationProperty(regProp);
+
+ // try to get markup, portlet handle doesn't matter since it should fail before
trying to retrieve the portlet
+ V1GetMarkup getMarkup =
WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+ getMarkup.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ // WSRP primer recommends returning OperationFailedFault and NOT
InvalidRegistrationFault
+ // kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP
2.0
+ }
+
+ // Get description should return information just as if consumer wasn't
registered
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ gs.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getServiceDescription(gs);
+ ExtendedAssert.fail("Required registration info has been modified:
operations should fail until registration is modified.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ // WSRP primer recommends returning OperationFailedFault and NOT
InvalidRegistrationFault
+ // kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP
2.0
+ }
+
+ // remove registration context, try again and check that we get new registration
info
+ gs.setRegistrationContext(null);
+ List<V1PropertyDescription> pds = producer.getServiceDescription(gs)
+ .getRegistrationPropertyDescription().getPropertyDescriptions();
+ ExtendedAssert.assertEquals(2, pds.size());
+
+ // Check that one of the returned property description is equal to the one we just
added
+ V1PropertyDescription description = pds.get(1);
+ if (description.getName().startsWith("New"))
+ {
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), description);
+ }
+ else
+ {
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), pds.get(0));
+ }
+
+ // Update registration data
+ V1RegistrationData regData = createBaseRegData();
+
regData.getRegistrationProperties().add(WSRP1TypeFactory.createProperty(newPropName,
"en", "blah"));
+
+ // Modify registration and get service description
+ V1ModifyRegistration registration = new V1ModifyRegistration();
+ registration.setRegistrationContext(rc);
+ registration.setRegistrationData(regData);
+ producer.modifyRegistration(registration);
+ gs.setRegistrationContext(rc);
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ public void testModifyRegistrationIncorrectData() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // now modify Producer's set of required registration info
+ String newPropName = "New Prop";
+ RegistrationPropertyDescription regProp = new
RegistrationPropertyDescription(newPropName,
+ new QName("urn:oasis:names:tc:wsrp:v1:types",
"LocalizedString", "ns1"));
+ regProp.setDefaultLabel("New Registration Property");
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().addRegistrationProperty(regProp);
+
+ try
+ {
+ V1ModifyRegistration registration = new V1ModifyRegistration();
+ registration.setRegistrationContext(rc);
+ registration.setRegistrationData(createBaseRegData());
+ producer.modifyRegistration(registration);
+ ExtendedAssert.fail("Passing incorrect data should fail");
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ // expected
+ }
+ }
+
+ public void testRegister() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ V1RegistrationContext registrationContext = registerConsumer();
+ ExtendedAssert.assertNotNull(registrationContext);
+ ExtendedAssert.assertNotNull(registrationContext.getRegistrationHandle());
+
+ gs.setRegistrationContext(registrationContext);
+
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ public void testRegisterWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ registerConsumer();
+ ExtendedAssert.fail("Shouldn't be possible to register if no
registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testDeregisterWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ producer.deregister(null);
+ ExtendedAssert.fail("Shouldn't be possible to deregister if no
registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testModifyRegistrationWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ producer.modifyRegistration(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no
registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testModifyRegistrationNoRegistrationWhenRegistrationRequired() throws
Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ producer.modifyRegistration(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no
registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ public void testDeregisterNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ producer.deregister(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no
registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ReleaseSessions;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Tests the behavior of the ReleaseSession method.
+ *
+ * @author Matt Wringe
+ */
+(a)RunWith(Arquillian.class)
+public class ReleaseSessionTestCase extends NeedPortletHandleTest
+{
+
+ // default portlet war used in this test
+ private static final String DEFAULT_SESSION_PORTLET_WAR =
"test-session-portlet.war";
+
+ private static final Logger log = Logger.getLogger(ReleaseSessionTestCase.class);
+
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return DEFAULT_SESSION_PORTLET_WAR;
+ }
+
+ public ReleaseSessionTestCase() throws Exception
+ {
+ super("SessionWar", DEFAULT_SESSION_PORTLET_WAR);
+ log.debug("Instantiating ReleaseSessionTestCase");
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the
producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp
connects with the pc module
+
ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null),
MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testReleaseSession() throws Exception
+ {
+ // possible registration contexts are: actual RegistrationContext, null, and a made
up value
+ V1RegistrationContext fakeRegContext =
WSRP1TypeFactory.createRegistrationContext("Fake Registration Handle");
+ V1RegistrationContext[] regContexts = new V1RegistrationContext[]{null, null,
fakeRegContext};
+
+ // possible types of sessionIDs include null and a made up value.
+ // Note: a valid session id cannot be used since the sessionID should never be sent
to the consumer
+ String nullSessionID = null;
+ String fakeSessionID = "Fake Session ID";
+
+ String[][] sessionIDs = new String[][]{{nullSessionID},
+ {nullSessionID, nullSessionID},
+ {fakeSessionID},
+ {fakeSessionID, fakeSessionID},
+ {fakeSessionID, nullSessionID},
+ {nullSessionID, fakeSessionID}};
+
+ for (int i = 0; i < regContexts.length; i++)
+ {
+ for (String[] sessionID : sessionIDs)
+ {
+ V1ReleaseSessions releaseSession =
WSRP1TypeFactory.createReleaseSessions(regContexts[i], Arrays.asList(sessionID));
+ releaseSessions(releaseSession, false, i);
+ releaseSessions(releaseSession, true, i);
+ }
+ }
+ }
+
+ private void releaseSessions(V1ReleaseSessions releaseSessions, boolean
useRegistration, int index) throws Exception
+ {
+ setUp();
+ try
+ {
+ if (useRegistration)
+ {
+ configureRegistrationSettings(true, false);
+
+ // faking correct registration context when we're supposed to have one...
previous impl registered consumer
+ // all the time but this cannot be done anymore since we prevent registering
if no registration is required
+ // so we need to wait for the proper case to init the registration context...
Hackish! :(
+ if (index == 0)
+ {
+ releaseSessions.setRegistrationContext(registerConsumer());
+ }
+ }
+ log.info(getSetupString(releaseSessions));
+ producer.releaseSessions(releaseSessions);
+ ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed
Fault." + getSetupString(releaseSessions));
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected fault.
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+
+ private String getSetupString(V1ReleaseSessions releaseSessions)
+ {
+ StringBuffer message = new StringBuffer("ReleaseSessions Setup:\n");
+
+ if (releaseSessions == null)
+ {
+ message.append(" ReleaseSessions : null");
+ }
+ else
+ {
+ V1RegistrationContext regContext = releaseSessions.getRegistrationContext();
+ List<String> sessionIDs = releaseSessions.getSessionIDs();
+ message.append(" RegistrationContext : ").append(regContext != null ?
regContext.getRegistrationHandle() : null);
+ message.append(" | SessionIDs : ");
+ if (sessionIDs != null)
+ {
+ for (int i = 0; i < sessionIDs.size(); i++)
+ {
+ message.append(sessionIDs.get(i)).append(i == sessionIDs.size() - 1 ?
"" : ", ");
+ }
+ }
+
+ }
+
+ if
(producer.getConfigurationService().getConfiguration().getRegistrationRequirements().isRegistrationRequired())
+ {
+ message.append(" | with registration required.");
+ }
+
+ return message.toString();
+ }
+
+}
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.
+ */
+
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at
gnu.org.
+ */
+package org.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.protocol.v1.V1ProducerBaseTest;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import java.util.List;
+
+/**
+ * Tests WSRP Service Description
+ *
+ * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil
Saldhana</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4 (Feb 20, 2006)
+ */
+(a)RunWith(Arquillian.class)
+public class ServiceDescriptionTestCase extends V1ProducerBaseTest
+{
+ public ServiceDescriptionTestCase() throws Exception
+ {
+ super("ServiceDescriptionTestCase");
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the
producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp
connects with the pc module
+
ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null),
MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testNotRequiringRegistration() throws Throwable
+ {
+
producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(false);
+
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
+
+ // registration is not required
+ ExtendedAssert.assertFalse(sd.isRequiresRegistration());
+
+ // No registration properties
+ ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
+ }
+
+ @Test
+ public void testRequiringRegistrationNotProvidingPortlets() throws Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(true,
false);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service
+ V1ServiceDescription sd = producer.getServiceDescription(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+
+ // No offered portlets without registration!
+ ExtendedAssert.assertNull(sd.getOfferedPortlets());
+ }
+
+ @Test
+ public void testRequiringRegistrationProvidingPortlets() throws Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(true,
true);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service, we should have the complete description
+ V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+ }
+
+ @Test
+ public void testLiveDeployment() throws Throwable
+ {
+ try
+ {
+ V1GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest();
+
+ deploy("test-basic-portlet.war");
+ V1ServiceDescription sd = producer.getServiceDescription(gsd);
+ ExtendedAssert.assertEquals(1, sd.getOfferedPortlets().size());
+
+ deploy("test-markup-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have 2 offered portlets
+ ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
+
+ deploy("test-session-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have 3 offered portlets
+ ExtendedAssert.assertEquals(3, sd.getOfferedPortlets().size());
+
+ undeploy("test-markup-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have only 2 offered portlets again
+ ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
+
+ undeploy("test-session-portlet.war");
+ // only basic portlet should still be offered
+ checkServiceDescriptionWithOnlyBasicPortlet(gsd);
+ }
+ finally
+ {
+ undeploy("test-basic-portlet.war");
+ undeploy("test-markup-portlet.war");
+ undeploy("test-session-portlet.war");
+ }
+ }
+
+ private void checkRequiredRegistrationProperties(V1ServiceDescription sd,
RegistrationPropertyDescription regProp)
+ {
+ V1ModelDescription registrationPropertyDescription =
sd.getRegistrationPropertyDescription();
+ ExtendedAssert.assertNotNull(registrationPropertyDescription);
+ List<V1PropertyDescription> propertyDescriptions =
registrationPropertyDescription.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+ ExtendedAssert.assertEquals(1, propertyDescriptions.size());
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp),
propertyDescriptions.get(0));
+ }
+}
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,285 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
+
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
+import org.gatein.wsrp.producer.WSRPProducerBaseTest;
+import org.gatein.wsrp.producer.WSRPProducerImpl;
+import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.gatein.wsrp.producer.v1.WSRP1Producer;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1LocalizedString;
+import org.oasis.wsrp.v1.V1MarkupType;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 12302 $
+ * @since 2.4
+ */
+public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest
+{
+ private static final String CONSUMER = "test-consumer";
+ protected WSRP1Producer producer = WSRP1Producer.getInstance();
+
+
+ public V1ProducerBaseTest() throws Exception
+ {
+ this("V1ProducerBaseTest");
+ }
+
+ protected V1ProducerBaseTest(String name) throws Exception
+ {
+ super(name);
+ }
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ resetRegistrationInfo();
+ }
+
+ public void tearDown() throws Exception
+ {
+ resetRegistrationInfo();
+ super.tearDown();
+ }
+
+ /**
+ * Checks that the specified portlet description corresponds to the expected
description of test-basic-portlet. If
+ * the handle parameter is not null, checks that it corresponds to the specified
portlet decription.
+ *
+ * @param desc the tested PortletDescription
+ * @param handle the PortletHandle to be checked
+ */
+ public void checkBasicPortletDescription(V1PortletDescription desc, String handle)
+ {
+ ExtendedAssert.assertNotNull(desc);
+ /**
+ * @wsrp.specification
+ * Portlet handle must be less than 255 characters (WSRP 1.0 5.1.2)
+ */
+ ExtendedAssert.assertTrue(desc.getPortletHandle().length() <= 255);
+ if (handle != null)
+ {
+ ExtendedAssert.assertEquals(handle, desc.getPortletHandle());
+ }
+ ExtendedAssert.assertEquals("title", desc.getTitle().getValue());
+ List<V1MarkupType> markupTypes = desc.getMarkupTypes();
+ ExtendedAssert.assertEquals(1, markupTypes.size());
+ V1MarkupType markupType = markupTypes.get(0);
+
+ List<String> states = new ArrayList<String>(3);
+ states.add(WSRPConstants.NORMAL_WINDOW_STATE);
+ states.add(WSRPConstants.MAXIMIZED_WINDOW_STATE);
+ states.add(WSRPConstants.MINIMIZED_WINDOW_STATE);
+ V1MarkupType expected = WSRP1TypeFactory.createMarkupType("text/html",
+ Collections.<String>singletonList(WSRPConstants.VIEW_MODE), states,
Collections.<String>singletonList("en"));
+ assertEquals(expected, markupType);
+ }
+
+ protected V1ServiceDescription
checkServiceDescriptionWithOnlyBasicPortlet(V1GetServiceDescription gs)
+ throws Exception
+ {
+ deploy("test-basic-portlet.war");
+ //Invoke the Web Service
+ V1ServiceDescription sd = producer.getServiceDescription(gs);
+
+ ExtendedAssert.assertNotNull("sd != null", sd);
+
+ // Check offered portlets
+ List<V1PortletDescription> offeredPortlets = sd.getOfferedPortlets();
+ ExtendedAssert.assertNotNull(offeredPortlets);
+ ExtendedAssert.assertEquals(1, offeredPortlets.size());
+
+ // Check portlet description
+ V1PortletDescription desc = offeredPortlets.get(0);
+
+ checkBasicPortletDescription(desc, null);
+
+ undeploy("test-basic-portlet.war");
+ return sd; // for further testing...
+ }
+
+ protected V1RegistrationContext registerConsumer() throws V1OperationFailed,
V1MissingParameters
+ {
+ V1RegistrationData registrationData = createBaseRegData();
+ return producer.register(registrationData);
+ }
+
+ protected V1RegistrationData createBaseRegData()
+ {
+ V1RegistrationData regData = WSRP1TypeFactory.createDefaultRegistrationData();
+ regData.setConsumerName(CONSUMER);
+
regData.getRegistrationProperties().add(WSRP1TypeFactory.createProperty("regProp",
"en", "regValue"));
+ return regData;
+ }
+
+ protected RegistrationPropertyDescription configureRegistrationSettings(boolean
requiresRegistration, boolean provideUnregisteredFullDescription)
+ {
+ // define expected registration infos
+ ProducerRegistrationRequirements registrationRequirements =
producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequired(requiresRegistration);
+
registrationRequirements.setRegistrationRequiredForFullDescription(!provideUnregisteredFullDescription);
+
+ if (requiresRegistration)
+ {
+ // fix-me:
http://jira.jboss.com/jira/browse/JBPORTAL-821
+ RegistrationPropertyDescription regProp = new
RegistrationPropertyDescription("regProp",
+ new QName("urn:oasis:names:tc:wsrp:v1:types",
"LocalizedString", "ns1"));
+ regProp.setDefaultLabel("Registration Property");
+ registrationRequirements.addRegistrationProperty(regProp);
+
+ // Use default registration policy: this wiring is normally handled at the
producer start, should maybe use a
+ // registration policy that is automatically configured when none is provided to
avoid having a null one?
+ DefaultRegistrationPolicy defaultRegistrationPolicy = new
DefaultRegistrationPolicy();
+ defaultRegistrationPolicy.setValidator(new
DefaultRegistrationPropertyValidator());
+ registrationRequirements.setPolicy(defaultRegistrationPolicy);
+
+ RegistrationManager registrationManager = producer.getRegistrationManager();
+ registrationManager.setPolicy(defaultRegistrationPolicy);
+
registrationRequirements.addRegistrationPropertyChangeListener(registrationManager);
+
+ // create consumer for policy to be able to make decisions properly
+ try
+ {
+ registrationManager.createConsumer(CONSUMER);
+ }
+ catch (RegistrationException e)
+ {
+ ExtendedAssert.fail("Couldn't create consumer. Cause: " +
e.getLocalizedMessage());
+ }
+
+ return regProp;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected void resetRegistrationInfo() throws RegistrationException
+ {
+ ProducerRegistrationRequirements registrationRequirements =
producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequired(false);
+ registrationRequirements.clearRegistrationProperties();
+ registrationRequirements.clearRegistrationPropertyChangeListeners();
+ producer.getRegistrationManager().clear();
+
registrationRequirements.removeRegistrationPropertyChangeListener(producer.getRegistrationManager());
+ }
+
+ protected V1GetServiceDescription getNoRegistrationServiceDescriptionRequest()
+ {
+ V1GetServiceDescription gs = WSRP1TypeFactory.createGetServiceDescription();
+ gs.getDesiredLocales().add("en-US");
+ gs.getDesiredLocales().add("en");
+ return gs;
+ }
+
+ /** === asserts === * */
+
+ protected static void assertEquals(V1MarkupType expected, V1MarkupType tested)
+ {
+ String message = "Expected: <" + expected + ">, got:
<" + tested + ">. Failed on: ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + "Different classes or not both
null.");
+ }
+
+
+ assertEquals(message + "Extensions", expected.getExtensions(),
tested.getExtensions());
+ assertEquals(message + "Locales", expected.getLocales(),
tested.getLocales());
+ assertEquals(message + "Modes", expected.getModes(),
tested.getModes());
+ assertEquals(message + "Window states", expected.getWindowStates(),
tested.getWindowStates());
+ }
+ }
+
+ protected static void assertEquals(V1PropertyDescription expected,
V1PropertyDescription tested)
+ {
+ String message = "Expected: <" + expected + ">, got:
<" + tested + ">. Failed on ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + "Different classes or not both
null.");
+ }
+
+ assertEquals(message + "extensions.", expected.getExtensions(),
tested.getExtensions());
+ assertEquals(message + "hint.", expected.getHint(),
tested.getHint());
+ assertEquals(message + "label.", expected.getLabel(),
tested.getLabel());
+ ExtendedAssert.assertEquals(message + "name.", expected.getName(),
tested.getName());
+ ExtendedAssert.assertEquals(message + "type.", expected.getType(),
tested.getType());
+ }
+ }
+
+ protected static void assertEquals(String message, V1LocalizedString expected,
V1LocalizedString tested)
+ {
+ String precise = "Expected: <" + expected + ">, got:
<" + tested + ">. Failed on ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + ": Different classes or not both
null.");
+ }
+
+ ExtendedAssert.assertEquals(precise + "lang.", expected.getLang(),
tested.getLang());
+ ExtendedAssert.assertEquals(precise + "resource name.",
expected.getResourceName(), tested.getResourceName());
+ ExtendedAssert.assertEquals(precise + "value.", expected.getValue(),
tested.getValue());
+ }
+ }
+
+ protected void checkException(Exception e, String errorCode)
+ {
+ Throwable cause = e.getCause();
+// ExtendedAssert.assertTrue(cause instanceof SOAPFaultException);
+// ExtendedAssert.assertEquals(errorCode,
((SOAPFaultException)cause).getFault().getLocalPart());
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.gatein.wsrp.registration;
+
+import junit.framework.TestCase;
+import org.gatein.wsrp.WSRPConstants;
+
+import javax.xml.namespace.QName;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 12017 $
+ * @since 2.6
+ */
+public class RegistrationPropertyDescriptionTestCase extends TestCase
+{
+ private RegistrationPropertyDescription desc;
+
+ protected void setUp() throws Exception
+ {
+ desc = new RegistrationPropertyDescription("foo",
WSRPConstants.XSD_STRING);
+ }
+
+ public void testNotify()
+ {
+ TestParent parent = new TestParent();
+ desc.setValueChangeListener(parent);
+ desc.setDefaultHint(null);
+ assertFalse(parent.notifyCalled);
+ parent.resetNotifyCalled();
+ desc.setDefaultHint("hint");
+ assertTrue(parent.notifyCalled);
+ }
+
+ public void testChangingNameUpdatesParent()
+ {
+ TestParent parent = new TestParent();
+ desc.setValueChangeListener(parent);
+ assertNotNull(parent.getRegistrationPropertyWith("foo"));
+
+ desc.setName(QName.valueOf("bar"));
+ assertEquals(desc, parent.getRegistrationPropertyWith("bar"));
+ assertNull(parent.getRegistrationPropertyWith("foo"));
+ }
+
+ public void testModifyIfNeeded()
+ {
+ String oldValue = "old";
+ String newValue = "new";
+ assertEquals(oldValue, desc.modifyIfNeeded(oldValue, oldValue));
+ assertEquals(newValue, desc.modifyIfNeeded(oldValue, newValue));
+ assertEquals(null, desc.modifyIfNeeded(null, null));
+ assertEquals(newValue, desc.modifyIfNeeded(null, newValue));
+ assertEquals(null, desc.modifyIfNeeded(oldValue, null));
+ }
+
+ public void testGetLang()
+ {
+ assertEquals(Locale.getDefault(), desc.getLang());
+ desc.setLabel(new LocalizedString("etiquette", Locale.FRENCH));
+ assertEquals(Locale.FRENCH, desc.getLang());
+ }
+
+ class TestParent implements ValueChangeListener
+ {
+ private boolean notifyCalled;
+
+ // prop name fakes the existence of a property as only one property exists for the
tests
+ private String propName = "foo";
+
+ void resetNotifyCalled()
+ {
+ notifyCalled = false;
+ }
+
+ public RegistrationPropertyDescription getRegistrationPropertyWith(String name)
+ {
+ // return desc only if it matches the name we know about (used to fake property
name updates)
+ if (propName.equals(name))
+ {
+ return desc;
+ }
+
+ return null;
+ }
+
+ public void valueHasChanged(RegistrationPropertyDescription originating, Object
oldValue, Object newValue, boolean isName)
+ {
+ // fake updating the property map if the old name was foo...
+ String oldValueString = oldValue == null ? null : oldValue.toString();
+ if ("foo".equals(oldValueString))
+ {
+ // then set the prop name to the new property name
+ propName = originating.getName().getLocalPart();
+ }
+
+ notifyCalled = true;
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+<!--
+ <bean name="TestDriverServer"
class="org.jboss.unit.remote.driver.RemoteTestDriverServer"/>
+
+ <bean name="TestDriverServerExporter"
+
class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
+ <constructor>
+ <parameter>socket://localhost:5400</parameter>
+ <parameter><inject
bean="TestDriverServer"/></parameter>
+
<parameter>org.jboss.unit.remote.driver.RemoteTestDriver</parameter>
+ </constructor>
+ </bean>
+-->
+ <bean name="WSRPProducer"
class="org.gatein.wsrp.producer.WSRPProducerImpl">
+ <constructor factoryClass="org.gatein.wsrp.producer.ProducerHolder"
factoryMethod="getProducer">
+ <parameter>true</parameter>
+ </constructor>
+ <property name="portletInvoker"><inject
bean="PortletInvoker"/></property>
+ <property name="registrationManager"><inject
bean="RegistrationManagerService"/></property>
+ <property name="configurationService"><inject
bean="ConfigurationService"/></property>
+ </bean>
+
+ <bean name="PortletInvoker"
class="org.gatein.pc.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject
bean="ProducerPersistenceManagerService"/></property>
+ <property name="stateManagementPolicy"><inject
bean="StateManagmentPolicyService"/></property>
+ <property name="stateConverter"><inject
bean="StateConverterService"/></property>
+ </bean>
+
+ <!-- TODO: may need to write a new class for this -->
+ <bean name="ProducerPersistenceManagerService"
class="org.gatein.pc.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <bean name="StateManagmentPolicyService"
class="org.gatein.pc.portlet.impl.state.StateManagementPolicyService">
+ <property name="persistLocally">true</property>
+ </bean>
+
+ <bean name="StateConverterService"
class="org.gatein.pc.portlet.impl.state.StateConverterV0"/>
+
+ <bean name="RegistrationManagerService"
class="org.gatein.registration.impl.RegistrationManagerImpl">
+ <property name="persistenceManager"><inject
bean="RegistrationPersistenceManagerService"/></property>
+ </bean>
+
+ <!-- TODO: may need to write a new class for this -->
+ <bean name="RegistrationPersistenceManagerService"
class="org.gatein.registration.impl.RegistrationPersistenceManagerImpl">
+ </bean>
+
+ <bean name="ConfigurationService"
class="org.gatein.wsrp.config.FileSystemXmlProducerConfigWithReload">
+ <property
name="configFile">conf/producer-config.xml</property>
+ <!-- <property
name="configFile">/tmp/producer-config.xml</property> -->
+ </bean>
+
+ <bean name="SerletAccess"
class="org.gatein.wsrp.servlet.ServletAccess"/>
+
+</deployment>
+
+ <!-- Dummy test WSRP Producer implementation -->
+<!-- <bean name="DummyWSRPProducer"
class="org.gatein.wsrp.test.TestWSRPProducerImpl"/> -->
+
+ <!-- Hack to get access to req/resp -->
+<!-- <bean name="ServletAccess"
class="org.gatein.wsrp.servlet.ServletAccessFilter"/> -->
+
+<!-- <bean name="ServiceFactory"
class="org.gatein.wsrp.services.PerEndpointSOAPInvokerServiceFactory">
+ <property
name="ServiceDescriptionURL">http://localhost:8080/test-wsrp-consumer/ServiceDescriptionService</property>
+ <property
name="MarkupURL">http://localhost:8080/test-wsrp-consumer/MarkupService</property>
+ <property
name="RegistrationURL">http://localhost:8080/test-wsrp-consumer/RegistrationService</property>
+ <property
name="PortletManagementURL">http://localhost:8080/test-wsrp-consumer/PortletManagementService</property>
+ <property name="Env">
+ java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+ java.naming.provider.url=jnp://localhost:1099
+ java.naming.factory.url.pkgs=org.jboss.naming.client
+ j2ee.clientName=wsrp-client
+ </property>
+ <property name="PortJNDIMapping">
+
org.gatein.wsrp.core.WSRP_v1_ServiceDescription_PortType=java:comp/env/service/ServiceDescriptionService
+
org.gatein.wsrp.core.WSRP_v1_Markup_PortType=java:comp/env/service/MarkupService
+
org.gatein.wsrp.core.WSRP_v1_Registration_PortType=java:comp/env/service/RegistrationService
+
org.gatein.wsrp.core.WSRP_v1_PortletManagement_PortType=java:comp/env/service/PortletManagementService
+ </property>
+ </bean>
+
+ <bean name="CachingServiceFactory"
class="CachingServiceFactory">
+ <property name="Delegate"><inject
bean="ServiceFactory"/></property>
+ </bean>
+
+ <bean name="WSRPConsumer"
class="org.gatein.wsrp.consumer.WSRPConsumerImpl">
+ <property name="ServiceFactory"><inject
bean="CachingServiceFactory"/></property>
+ </bean>
+-->
+<!--</deployment> -->
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1 @@
+<producer-configuration/>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,24 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<Context privileged="true">
+</Context>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="PortletApplicationDeployer"
class="org.gatein.pc.mc.PortletApplicationDeployer">
+ <alias>PortletApplicationRegistry</alias>
+ <property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
+ <property name="containerPortletInvoker"><inject
bean="ContainerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The ServletContainerFactory -->
+ <bean name="ServletContainerFactory"
class="org.gatein.wci.impl.DefaultServletContainerFactory">
+ <constructor
factoryClass="org.gatein.wci.impl.DefaultServletContainerFactory"
factoryMethod="getInstance"/>
+ </bean>
+
+ <!-- The servlet container obtained from the ServletContainerFactory -->
+ <bean name="ServletContainer"
class="org.gatein.wci.ServletContainer">
+ <constructor factoryMethod="getServletContainer">
+ <factory bean="ServletContainerFactory"/>
+ </constructor>
+ </bean>
+
+ <!-- The producer persistence manager -->
+ <bean name="ProducerPersistenceManager"
class="org.gatein.pc.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <!-- The producer state management policy -->
+ <bean name="ProducerStateManagementPolicy"
class="org.gatein.pc.portlet.impl.state.StateManagementPolicyService">
+ <property
name="persistLocally"><value>true</value></property>
+ </bean>
+
+ <!-- The producer state converter -->
+ <bean name="ProducerStateConverter"
class="org.gatein.pc.portlet.impl.state.StateConverterV0"/>
+
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker"
class="org.gatein.pc.portlet.PortletInvokerInterceptor">
+ <property name="next"><inject
bean="ConsumerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ConsumerCacheInterceptor"
class="org.gatein.pc.portlet.aspects.ConsumerCacheInterceptor">
+ <property name="next"><inject
bean="PortletCustomizationInterceptor"/></property>
+ </bean>
+ <bean name="PortletCustomizationInterceptor"
class="org.gatein.pc.portlet.aspects.PortletCustomizationInterceptor">
+ <property name="next"><inject
bean="ProducerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The producer portlet invoker -->
+ <bean name="ProducerPortletInvoker"
class="org.gatein.pc.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject
bean="ProducerPersistenceManager"/></property>
+ <property name="stateManagementPolicy"><inject
bean="ProducerStateManagementPolicy"/></property>
+ <property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
+ </bean>
+
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker"
class="org.gatein.pc.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject
bean="ValveInterceptor"/></property>
+ </bean>
+
+ <!-- Container stack -->
+ <bean name="ValveInterceptor"
class="org.gatein.pc.portlet.aspects.ValveInterceptor">
+ <property name="portletApplicationRegistry"><inject
bean="PortletApplicationRegistry"
state="Instantiated"/></property>
+ <property name="next"><inject
bean="SecureTransportInterceptor"/></property>
+ </bean>
+ <bean name="SecureTransportInterceptor"
class="org.gatein.pc.portlet.aspects.SecureTransportInterceptor">
+ <property name="next"><inject
bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor"
class="org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor">
+ <property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
+ <property name="next"><inject
bean="ProducerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ProducerCacheInterceptor"
class="org.gatein.pc.portlet.aspects.ProducerCacheInterceptor">
+ <property name="next"><inject
bean="CCPPInterceptor"/></property>
+ </bean>
+ <bean name="CCPPInterceptor"
class="org.gatein.pc.portlet.aspects.CCPPInterceptor">
+ <property name="next"><inject
bean="RequestAttributeConversationInterceptor"/></property>
+ </bean>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.gatein.pc.portlet.aspects.RequestAttributeConversationInterceptor">
+ <property name="next"><inject
bean="EventPayloadInterceptor"/></property>
+ </bean>
+ <bean name="EventPayloadInterceptor"
class="org.gatein.pc.portlet.aspects.EventPayloadInterceptor">
+ <property name="next"><inject
bean="PortletContainerDispatcher"/></property>
+ </bean>
+ <bean name="PortletContainerDispatcher"
class="org.gatein.pc.portlet.container.ContainerPortletDispatcher">
+ </bean>
+
+</deployment>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <servlet>
+ <servlet-name>ContainerServlet</servlet-name>
+
<servlet-class>org.gatein.wci.tomcat.TC6ContainerServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>PortalServlet</servlet-name>
+ <servlet-class>org.gatein.pc.test.PortalServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>PortalServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Application Scope Set Test Portlet</portlet-name>
+ <display-name>Application Scope Set Test Portlet</display-name>
+
<portlet-class>org.gatein.wsrp.portlet.ApplicationScopeSetPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Application Scope Get Test Portlet</portlet-name>
+ <display-name>Application Scope Get Test Portlet</display-name>
+
<portlet-class>org.gatein.wsrp.portlet.ApplicationScopeGetPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.BasicPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>prefName1</name>
+ <value>prefValue1</value>
+ </preference>
+ <preference>
+ <name>prefName2</name>
+ <value>prefValue2</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Dispatcher Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.DispatcherPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1 @@
+test
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Encode URL Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.EncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Get Locales Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>No Declared Supported Locale Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Incorrect Supported Locale Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>blah</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+
+</portlet-app>
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Implicit Cloning Test Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.ImplicitCloningPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>name</name>
+ <value>initial</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,24 @@
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
+
+<p>Sorry, no help is available.</p>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Markup Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.MarkupPortlet</portlet-class>
+ <expiration-cache>15</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>prefName</name>
+ <value>prefValue</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Multi-valued Test Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.MultiValuedPortlet</portlet-class>
+ <expiration-cache>15</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Render Parameters Test Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.RenderParamPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Render Parameters Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Resource Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.ResourcePortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.ResourceNoEncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Non URL Encoded Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Session Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.SessionPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Session Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>UserContext Test Portlet</portlet-name>
+
<portlet-class>org.gatein.wsrp.portlet.UserContextPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added:
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml
(rev 0)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml 2010-06-15
18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file