gatein SVN: r6196 - portal/trunk/component/web/resources/src/main/java/org/exoplatform/web/application/javascript.
by do-not-reply@jboss.org
Author: theute
Date: 2011-04-12 14:59:42 -0400 (Tue, 12 Apr 2011)
New Revision: 6196
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
Log:
GTNPORTAL-1182: Wrong merging javascript
Modified: portal/trunk/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
--- portal/trunk/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2011-04-12 14:11:23 UTC (rev 6195)
+++ portal/trunk/component/web/resources/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2011-04-12 18:59:42 UTC (rev 6196)
@@ -326,7 +326,7 @@
}
catch (Exception e)
{
- log.error("Error when generating minified javascript, will use normal javascript instead", e);
+ log.warn("Error when generating minified javascript, will use normal javascript instead", e);
jsBytes = bytes;
}
// Remove miliseconds because string of date retrieve from Http header doesn't have miliseconds
13 years, 9 months
gatein SVN: r6195 - in components/pc/trunk: api/src/test/java/org/gatein/pc/api and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-12 10:11:23 -0400 (Tue, 12 Apr 2011)
New Revision: 6195
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
Log:
- GTNPC-58:
+ Re-implemented reference and dereference methods. Added test cases and fixed a couple of issues.
+ Added internal PCComponents interface.
+ Removed id parameter from dereference method.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-12 10:12:33 UTC (rev 6194)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-12 14:11:23 UTC (rev 6195)
@@ -56,7 +56,7 @@
public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + INVOKER_SEPARATOR + CONSUMER_CLONE_ID);
public static final String INVALID_PORTLET_CONTEXT = "Invalid portlet context: ";
- private final PortletContextComponents components;
+ private final PCComponents components;
protected PortletContext(String id) throws IllegalArgumentException
{
@@ -67,169 +67,188 @@
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "portlet id", "PortletContext");
- PortletContextComponents components = null;
- boolean isSimpleAppPortlet = false;
- boolean isOpaquePortlet = false;
- boolean isCompoundAppPortlet = false;
- boolean isCloned = false;
+ PCComponents components;
// components
if (interpret)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "portlet id", "PortletContext");
- String trimmedId = id.trim();
+ components = interpretIntoComponents(id);
+ }
+ else
+ {
+ components = new UninterpretedPortletContextComponents(id);
+ }
- try
+ this.components = components;
+ }
+
+ private PCComponents interpretIntoComponents(String id)
+ {
+ String trimmedId = id.trim();
+ try
+ {
+ if (trimmedId.startsWith(PREFIX))
{
- if (trimmedId.startsWith(PREFIX))
+ // check the case: /application.portlet
+ int separator = trimmedId.indexOf(SEPARATOR); // find first separator, other separator are considered part of the portlet name
+ String portletName = trimmedId.substring(separator + 1).trim();
+ String appName = trimmedId.substring(1, separator).trim();
+ if (separator != -1 && appName.length() > 0 && portletName.length() > 0)
{
- // check the case: /application.portlet
- int separator = trimmedId.indexOf(SEPARATOR); // find first separator, other separator are considered part of the portlet name
- String portletName = trimmedId.substring(separator + 1).trim();
- String appName = trimmedId.substring(1, separator).trim();
- isSimpleAppPortlet = separator != -1 && appName.length() > 0 && portletName.length() > 0;
- if (isSimpleAppPortlet)
- {
- components = new InterpretedPortletContextComponents(null, appName, portletName, null);
- }
+ return new InterpretedPortletContextComponents(null, appName, portletName, null);
}
else
{
- if (!(trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX) || trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX)))
+ throw new IllegalArgumentException("Application name and portlet names were both empty.");
+ }
+ }
+ else
+ {
+ if (!(trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX) || trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX)))
+ {
+ int invoker = trimmedId.indexOf(INVOKER_SEPARATOR);
+ int prefix = trimmedId.indexOf(PREFIX);
+
+ boolean isCompoundAppPortlet = false;
+ if (prefix != -1)
{
- int invoker = trimmedId.indexOf(INVOKER_SEPARATOR);
- int prefix = trimmedId.indexOf(PREFIX);
+ // check if we have the case: invokerId./something
+ if (invoker > 0 && invoker < prefix)
+ {
+ String invokerId = trimmedId.substring(0, invoker).trim();
- if (prefix != -1)
- {
- // check if we have the case: invokerId./something
- if (invoker > 0 && invoker < prefix)
+ int separator = trimmedId.indexOf(SEPARATOR, prefix);
+ // check the case: invokerId./application.portlet
+ if (separator != -1)
{
- String invokerId = trimmedId.substring(0, invoker).trim();
-
- int separator = trimmedId.indexOf(SEPARATOR, prefix);
- // check the case: invokerId./application.portlet
- if (separator != -1)
+ String portletName = trimmedId.substring(separator + 1).trim();
+ trimmedId = trimmedId.substring(invoker + 1).trim();
+ String applicationName = trimmedId.substring(1, trimmedId.indexOf(SEPARATOR)).trim();
+ isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
+ if (isCompoundAppPortlet)
{
- String portletName = trimmedId.substring(separator + 1).trim();
- trimmedId = trimmedId.substring(invoker + 1).trim();
- String applicationName = trimmedId.substring(1, trimmedId.indexOf(SEPARATOR)).trim();
- isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
- if (isCompoundAppPortlet)
- {
- components = new InterpretedPortletContextComponents(invokerId, applicationName, portletName, null);
- }
+ return new InterpretedPortletContextComponents(invokerId, applicationName, portletName, null);
}
}
}
+ }
- // check if we have the case: invokerId.something
- if (!isCompoundAppPortlet && invoker > 0)
+ // check if we have the case: invokerId.something
+ if (!isCompoundAppPortlet && invoker > 0)
+ {
+ String invokerId = trimmedId.substring(0, invoker).trim();
+
+ if (invokerId.length() > 0)
{
- String invokerId = trimmedId.substring(0, invoker).trim();
+ String portletNameOrStateId = trimmedId.substring(invoker + 1).trim();
- if (invokerId.length() > 0)
+ if (portletNameOrStateId.length() > 0)
{
- String portletNameOrStateId = trimmedId.substring(invoker + 1).trim();
-
- if (portletNameOrStateId.length() > 0)
+ boolean isProducerClone = portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = portletNameOrStateId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
{
- boolean isProducerClone = portletNameOrStateId.startsWith(PRODUCER_CLONE_ID_PREFIX);
- boolean isConsumerClone = portletNameOrStateId.startsWith(CONSUMER_CLONE_ID_PREFIX);
- if (isProducerClone || isConsumerClone)
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ portletNameOrStateId = portletNameOrStateId.substring(prefixLength).trim();
+ if (portletNameOrStateId.length() > 0)
{
- int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
- portletNameOrStateId = portletNameOrStateId.substring(prefixLength).trim();
- if (portletNameOrStateId.length() > 0)
- {
- isCloned = true;
- components = new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
- }
+ return new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
}
- else
- {
- isOpaquePortlet = true;
- components = new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, null);
- }
}
+ else
+ {
+ return new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, null);
+ }
}
}
}
- else
+
+ // we're in the case where we have an arbitrary string
+ throw new IllegalArgumentException("'" + trimmedId + "' doesn't fit any known PortletContext formats");
+ }
+ else
+ {
+ boolean isProducerClone = trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX);
+ boolean isConsumerClone = trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX);
+ if (isProducerClone || isConsumerClone)
{
- boolean isProducerClone = trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX);
- boolean isConsumerClone = trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX);
- if (isProducerClone || isConsumerClone)
+ int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
+ trimmedId = trimmedId.substring(prefixLength).trim();
+ if (trimmedId.length() > 0)
{
- int prefixLength = isProducerClone ? PRODUCER_CLONE_PREFIX_LENGTH : CONSUMER_CLONE_PREFIX_LENGTH;
- trimmedId = trimmedId.substring(prefixLength).trim();
- if (trimmedId.length() > 0)
- {
- isCloned = true;
- components = new InterpretedPortletContextComponents(null, null, trimmedId, isProducerClone);
- }
+ return new InterpretedPortletContextComponents(null, null, trimmedId, isProducerClone);
}
}
+
+ // we're in the case where we have an arbitrary string
+ throw new IllegalArgumentException("'" + trimmedId + "' doesn't fit any known PortletContext formats");
}
}
- catch (Exception e)
- {
- throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id, e);
- }
}
- else
+ catch (Exception e)
{
- components = new UninterpretedPortletContextComponents(id);
+ throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id, e);
}
-
- if (interpret && !(isSimpleAppPortlet || isCompoundAppPortlet || isOpaquePortlet || isCloned))
- {
- throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id);
- }
-
- this.components = components;
}
- protected PortletContext(PortletContextComponents components)
+ protected PortletContext(PCComponents components)
{
ParameterValidation.throwIllegalArgExceptionIfNull(components, "portlet context components");
this.components = components;
}
- public static PortletContext dereference(String invokerId, PortletContext compoundPortletContext)
+ public static PortletContext dereference(PortletContext compoundPortletContext)
{
- String portletId = compoundPortletContext.getId().substring(invokerId.length() + INVOKER_SEPARATOR.length());
- if (compoundPortletContext instanceof StatefulPortletContext)
+ ParameterValidation.throwIllegalArgExceptionIfNull(compoundPortletContext, "PortletContext to dereference");
+
+ PCComponents components = compoundPortletContext.getInternalComponents();
+ if (!components.isInterpreted())
{
- StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)compoundPortletContext;
- return StatefulPortletContext.create(portletId, compoundStatefulPortletContext);
+ try
+ {
+ // try interpretation to see if we can extract an invoker id from the components
+ components = compoundPortletContext.interpret();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // we couldn't interpret the given portlet context so return it as is
+ return compoundPortletContext;
+ }
}
- else
- {
- return createPortletContext(portletId);
- }
+
+ return createCopyWithNewComponents(compoundPortletContext, components.createCopyWithoutInvoker());
}
+ protected PCComponents interpret()
+ {
+ return interpretIntoComponents(components.getId());
+ }
+
public static PortletContext reference(String invokerId, PortletContext portletContext)
{
- String compoundPortletId = reference(portletContext.getId(), invokerId);
- if (portletContext instanceof StatefulPortletContext)
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext to reference");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(invokerId, "Invoker id to reference with", null);
+
+ final PCComponents newComponents = portletContext.getInternalComponents().createCopyWithInvoker(invokerId);
+
+ return createCopyWithNewComponents(portletContext, newComponents);
+ }
+
+ private static PortletContext createCopyWithNewComponents(PortletContext portletContextToCopy, PCComponents newComponents)
+ {
+ if (portletContextToCopy instanceof StatefulPortletContext)
{
- StatefulPortletContext<?> statefulPortletContext = (StatefulPortletContext<?>)portletContext;
- return StatefulPortletContext.create(compoundPortletId, statefulPortletContext);
+ StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)portletContextToCopy;
+ return StatefulPortletContext.create(newComponents, compoundStatefulPortletContext);
}
else
{
- return createPortletContext(compoundPortletId);
+ return new PortletContext(newComponents);
}
}
- private static String reference(String portletId, String invokerId)
- {
- return invokerId + INVOKER_SEPARATOR + portletId;
- }
-
public boolean equals(Object o)
{
if (this == o)
@@ -334,39 +353,51 @@
public PortletContextComponents getComponents()
{
+ return getInternalComponents();
+ }
+
+ private PCComponents getInternalComponents()
+ {
return components;
}
public static interface PortletContextComponents
{
- public String getApplicationName();
+ String getApplicationName();
- public String getPortletName();
+ String getPortletName();
- public String getInvokerName();
+ String getInvokerName();
- public boolean isCloned();
+ boolean isCloned();
- public boolean isProducerCloned();
+ boolean isProducerCloned();
- public boolean isConsumerCloned();
+ boolean isConsumerCloned();
- public String getStateId();
+ String getStateId();
- public String getId();
+ String getId();
- public boolean isInterpreted();
+ boolean isInterpreted();
}
- private static class InterpretedPortletContextComponents implements PortletContextComponents
+ protected static interface PCComponents extends PortletContextComponents
{
+ PCComponents createCopyWithoutInvoker();
+
+ PCComponents createCopyWithInvoker(String invoker);
+ }
+
+ private static class InterpretedPortletContextComponents implements PCComponents
+ {
private final String applicationName;
private final String portletName;
private final String invokerName;
private final Boolean producerCloned;
private final String id;
- public InterpretedPortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
+ InterpretedPortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
{
this.producerCloned = producerCloned;
@@ -428,9 +459,19 @@
{
return true;
}
+
+ public PCComponents createCopyWithoutInvoker()
+ {
+ return new InterpretedPortletContextComponents(null, applicationName, portletName, producerCloned);
+ }
+
+ public PCComponents createCopyWithInvoker(String invoker)
+ {
+ return new InterpretedPortletContextComponents(invoker, applicationName, portletName, producerCloned);
+ }
}
- private static class UninterpretedPortletContextComponents implements PortletContextComponents
+ private static class UninterpretedPortletContextComponents implements PCComponents
{
private static final String ERROR = "This PortletContext was not intepreted, only the portlet name is available!";
private final String portletName;
@@ -484,5 +525,15 @@
{
return false;
}
+
+ public PCComponents createCopyWithoutInvoker()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public PCComponents createCopyWithInvoker(String invoker)
+ {
+ return new InterpretedPortletContextComponents(invoker, null, portletName, null);
+ }
}
}
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-12 10:12:33 UTC (rev 6194)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-12 14:11:23 UTC (rev 6195)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.pc.api;
import org.gatein.common.util.ParameterValidation;
@@ -40,6 +40,11 @@
return new StatefulPortletContext<S>(id, spc.type, spc.state);
}
+ static <S extends Serializable> StatefulPortletContext<S> create(PortletContext.PCComponents components, StatefulPortletContext<S> spc)
+ {
+ return new StatefulPortletContext<S>(components, spc.type, spc.state);
+ }
+
public static <S extends Serializable> StatefulPortletContext<S> create(
String id,
PortletStateType<S> type,
@@ -58,15 +63,24 @@
{
super(id);
- //
ParameterValidation.throwIllegalArgExceptionIfNull(type, "Portlet type");
ParameterValidation.throwIllegalArgExceptionIfNull(state, "Portlet state");
- //
this.type = type;
this.state = state;
}
+ StatefulPortletContext(PCComponents components, PortletStateType<S> type, S state)
+ {
+ super(components);
+
+ ParameterValidation.throwIllegalArgExceptionIfNull(type, "Portlet type");
+ ParameterValidation.throwIllegalArgExceptionIfNull(state, "Portlet state");
+
+ this.type = type;
+ this.state = state;
+ }
+
public PortletStateType<S> getType()
{
return type;
Modified: components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-12 10:12:33 UTC (rev 6194)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-12 14:11:23 UTC (rev 6195)
@@ -31,6 +31,27 @@
*/
public class PortletContextTestCase extends TestCase
{
+ public void testSimple()
+ {
+ try
+ {
+ PortletContext.createPortletContext("foo");
+ fail("Invalid by default");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ final PortletContext foo = PortletContext.createPortletContext("foo", false);
+ assertEquals("foo", foo.getId());
+ final PortletContext.PortletContextComponents components = foo.getComponents();
+ assertNotNull(components);
+ assertFalse(components.isInterpreted());
+ assertEquals("foo", components.getId());
+ assertEquals("foo", components.getPortletName());
+ }
+
public void testGetComponents()
{
PortletContext context = PortletContext.createPortletContext("/applicationName.portletName");
@@ -65,6 +86,16 @@
// expected
}
+ try
+ {
+ PortletContext.createPortletContext("/app");
+ fail("invalid");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
String portletId = "applicationName" + PortletContext.INVOKER_SEPARATOR + "portletName";
context = PortletContext.createPortletContext(portletId);
assertEquals(portletId, context.getId());
@@ -363,4 +394,55 @@
// expected
}
}
+
+ public void testReference()
+ {
+ final String invoker = "invoker";
+ final PortletContext context = PortletContext.createPortletContext("app", "portlet");
+
+ final PortletContext referenced = PortletContext.reference(invoker, context);
+ final PortletContext.PortletContextComponents components = referenced.getComponents();
+ assertTrue(components.isInterpreted());
+
+ assertEquals(invoker, components.getInvokerName());
+
+ final PortletContext.PortletContextComponents originalComponents = context.getComponents();
+ assertEquals(originalComponents.getApplicationName(), components.getApplicationName());
+ assertEquals(originalComponents.getPortletName(), components.getPortletName());
+ assertEquals(originalComponents.isCloned(), components.isCloned());
+ assertEquals(originalComponents.isConsumerCloned(), components.isConsumerCloned());
+ assertEquals(originalComponents.isProducerCloned(), components.isProducerCloned());
+ }
+
+ public void testDereferenceDoesNotAffectNonReferencedPortletContexts()
+ {
+ final PortletContext foo = PortletContext.createPortletContext("foo", false);
+ assertEquals(foo, PortletContext.dereference(foo));
+ }
+
+ public void testDereferenceWorksOnValidUninterpretedPortletContexts()
+ {
+ final String invoker = "foo";
+ final PortletContext referenced = PortletContext.createPortletContext(invoker + PortletContext.INVOKER_SEPARATOR + "portlet", false);
+ final PortletContext dereferenced = PortletContext.dereference(referenced);
+
+ // force interpretation of referenced
+ final PortletContext.PortletContextComponents referencedComponents = referenced.interpret();
+ assertTrue(referencedComponents.isInterpreted());
+ assertEquals(invoker, referencedComponents.getInvokerName());
+
+ final PortletContext.PortletContextComponents dereferencedComponents = dereferenced.getComponents();
+ assertTrue(dereferencedComponents.isInterpreted());
+
+ assertEquals(referencedComponents.getPortletName(), dereferencedComponents.getPortletName());
+ assertNull(dereferencedComponents.getInvokerName());
+ assertFalse(dereferenced.getId().contains(invoker));
+ }
+
+ public void testReferencingRoundtrip()
+ {
+ final PortletContext context = PortletContext.createPortletContext("app", "portlet");
+ final PortletContext referencedContext = PortletContext.reference("invoker", context);
+ assertEquals(context, PortletContext.dereference(referencedContext));
+ }
}
Modified: components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
--- components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-12 10:12:33 UTC (rev 6194)
+++ components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-12 14:11:23 UTC (rev 6195)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.pc.federation.impl;
import org.gatein.pc.api.Portlet;
@@ -242,7 +242,7 @@
private PortletContext dereference(PortletContext compoundPortletContext)
{
- return PortletContext.dereference(id, compoundPortletContext);
+ return PortletContext.dereference(compoundPortletContext);
}
private PortletContext reference(PortletContext portletContext)
13 years, 9 months
gatein SVN: r6194 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-12 06:12:33 -0400 (Tue, 12 Apr 2011)
New Revision: 6194
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
Log:
- Updated for PC changes.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-04-12 09:34:59 UTC (rev 6193)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-04-12 10:12:33 UTC (rev 6194)
@@ -40,7 +40,6 @@
import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
import org.gatein.pc.api.state.PropertyMap;
-import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
import org.gatein.pc.portlet.impl.spi.AbstractPortletInvocationContext;
import org.gatein.pc.portlet.state.SimplePropertyMap;
import org.gatein.wsrp.UserContextConverter;
@@ -935,7 +934,7 @@
org.oasis.wsrp.v2.PortletContext portletContext = importedPortlet.getNewPortletContext();
PortletContext apiPC = PortletContext.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState(), false);
// we need to reference the resulting PortletContext so that it can then be used properly
- importIdToPortletContext.put(importedPortlet.getImportID(), FederatingPortletInvokerService.reference(apiPC, getProducerId()));
+ importIdToPortletContext.put(importedPortlet.getImportID(), PortletContext.reference(getProducerId(), apiPC));
}
}
13 years, 9 months
gatein SVN: r6192 - sandbox.
by do-not-reply@jboss.org
Author: theute
Date: 2011-04-12 04:02:24 -0400 (Tue, 12 Apr 2011)
New Revision: 6192
Added:
sandbox/convertigo/
Log:
Creating convertigo sandbox
13 years, 9 months
gatein SVN: r6190 - components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers.
by do-not-reply@jboss.org
Author: mwringe
Date: 2011-04-11 13:37:10 -0400 (Mon, 11 Apr 2011)
New Revision: 6190
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
Log:
Remove unneeded dependency which causes the build to fail.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-11 11:24:52 UTC (rev 6189)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-11 17:37:10 UTC (rev 6190)
@@ -26,7 +26,6 @@
import com.google.common.base.Function;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
-import com.sun.tools.corba.se.idl.InvalidArgument;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
13 years, 9 months
gatein SVN: r6189 - in components/pc/trunk: federation/src/test/java/org/gatein/pc/federation and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-11 07:24:52 -0400 (Mon, 11 Apr 2011)
New Revision: 6189
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
Log:
- GTNPC-58: Fixed test case. Note that the previous commit changed the value of INVOKER_SEPARATOR which used to be '.' to '+'
to make sure that there wasn't any unintentional collisions with SEPARATOR value ('.') in the parsing and outputing code.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-11 11:03:57 UTC (rev 6188)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-11 11:24:52 UTC (rev 6189)
@@ -37,7 +37,11 @@
private static final String PREFIX = "/";
private static final char SEPARATOR = '.';
- /** The separator used in the id to route to the correct invoker. */
+
+ /**
+ * The separator used in the id to route to the correct invoker. TODO: change value back once tests have been done to
+ * remove incidental use of value
+ */
public static final String INVOKER_SEPARATOR = "+";
public static final String PRODUCER_CLONE_ID_PREFIX = "_";
Modified: components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-11 11:03:57 UTC (rev 6188)
+++ components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-11 11:24:52 UTC (rev 6189)
@@ -182,7 +182,7 @@
@Test
public void testGetPortletOnFederatedInvoker() throws PortletInvokerException
{
- PortletContext federatedContext = PortletContext.createPortletContext(federatedInvoker.getId() + "." + portletContext.getId());
+ PortletContext federatedContext = PortletContext.createPortletContext(federatedInvoker.getId() + PortletContext.INVOKER_SEPARATOR + portletContext.getId());
Portlet samePortlet = federatedInvoker.getPortlet(federatedContext);
assertNotNull(samePortlet);
assertEquals(samePortlet.getContext(), federatedContext);
13 years, 9 months
gatein SVN: r6188 - epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-04-11 07:03:57 -0400 (Mon, 11 Apr 2011)
New Revision: 6188
Modified:
epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl
Log:
JBEPP-566: Edit Portlet dialog - tabs are switched by "mouse click" but dialog buttons are updated on "mouse down"
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl 2011-04-11 10:29:34 UTC (rev 6187)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl 2011-04-11 11:03:57 UTC (rev 6188)
@@ -25,7 +25,7 @@
<div class="$className">
<div class="LeftTab">
<div class="RightTab">
- <div class="MiddleTab" onmousedown="eXo.UIPortletForm.hideSaveButton(this)" onclick="eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, '$uiform.id', 'EditMode');$actionLink"><%= _ctx.appRes("UIPortletForm.tab.label.EditMode") %></div>
+ <div class="MiddleTab" onclick="eXo.UIPortletForm.hideSaveButton(this); eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, '$uiform.id', 'EditMode');$actionLink"><%= _ctx.appRes("UIPortletForm.tab.label.EditMode") %></div>
</div>
</div>
</div>
@@ -44,7 +44,7 @@
<div class="$className">
<div class="LeftTab">
<div class="RightTab">
- <div class="MiddleTab" onmousedown="eXo.UIPortletForm.showSaveButton(this)" onclick="eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, '$uiform.id', '$inputSet.id');$actionLink">$tabName</div>
+ <div class="MiddleTab" onclick="eXo.UIPortletForm.showSaveButton(this); eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, '$uiform.id', '$inputSet.id');$actionLink">$tabName</div>
</div>
</div>
</div>
13 years, 9 months
gatein SVN: r6187 - in components/pc/trunk: api/src/test/java/org/gatein/pc/api and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-11 06:29:34 -0400 (Mon, 11 Apr 2011)
New Revision: 6187
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
Log:
- GTNPC-58:
+ Moved logic for federated portlet context creation to PortletContext. Still needs to be better abstracted (in particular, reference and dereference methods).
+ Changed PortletContextComponents to an interface and introduced UninterpretedPortletContextComponents so that now a PortletContext always has components, interpreted or not.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -37,6 +37,8 @@
private static final String PREFIX = "/";
private static final char SEPARATOR = '.';
+ /** The separator used in the id to route to the correct invoker. */
+ public static final String INVOKER_SEPARATOR = "+";
public static final String PRODUCER_CLONE_ID_PREFIX = "_";
public static final int PRODUCER_CLONE_PREFIX_LENGTH = PRODUCER_CLONE_ID_PREFIX.length();
@@ -47,10 +49,9 @@
public static final String CONSUMER_CLONE_DUMMY_STATE_ID = "dumbvalue";
public static final String CONSUMER_CLONE_ID = PRODUCER_CLONE_ID_PREFIX + CONSUMER_CLONE_DUMMY_STATE_ID;
- public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + SEPARATOR + CONSUMER_CLONE_ID);
+ public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + INVOKER_SEPARATOR + CONSUMER_CLONE_ID);
public static final String INVALID_PORTLET_CONTEXT = "Invalid portlet context: ";
- protected final String id;
private final PortletContextComponents components;
protected PortletContext(String id) throws IllegalArgumentException
@@ -86,14 +87,14 @@
isSimpleAppPortlet = separator != -1 && appName.length() > 0 && portletName.length() > 0;
if (isSimpleAppPortlet)
{
- components = new PortletContextComponents(null, appName, portletName, null);
+ components = new InterpretedPortletContextComponents(null, appName, portletName, null);
}
}
else
{
if (!(trimmedId.startsWith(PRODUCER_CLONE_ID_PREFIX) || trimmedId.startsWith(CONSUMER_CLONE_ID_PREFIX)))
{
- int invoker = trimmedId.indexOf(SEPARATOR);
+ int invoker = trimmedId.indexOf(INVOKER_SEPARATOR);
int prefix = trimmedId.indexOf(PREFIX);
if (prefix != -1)
@@ -113,7 +114,7 @@
isCompoundAppPortlet = invokerId.length() > 0 && applicationName.length() > 0 && portletName.length() > 0;
if (isCompoundAppPortlet)
{
- components = new PortletContextComponents(invokerId, applicationName, portletName, null);
+ components = new InterpretedPortletContextComponents(invokerId, applicationName, portletName, null);
}
}
}
@@ -139,13 +140,13 @@
if (portletNameOrStateId.length() > 0)
{
isCloned = true;
- components = new PortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
+ components = new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, isProducerClone);
}
}
else
{
isOpaquePortlet = true;
- components = new PortletContextComponents(invokerId, null, portletNameOrStateId, null);
+ components = new InterpretedPortletContextComponents(invokerId, null, portletNameOrStateId, null);
}
}
}
@@ -162,7 +163,7 @@
if (trimmedId.length() > 0)
{
isCloned = true;
- components = new PortletContextComponents(null, null, trimmedId, isProducerClone);
+ components = new InterpretedPortletContextComponents(null, null, trimmedId, isProducerClone);
}
}
}
@@ -173,6 +174,10 @@
throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id, e);
}
}
+ else
+ {
+ components = new UninterpretedPortletContextComponents(id);
+ }
if (interpret && !(isSimpleAppPortlet || isCompoundAppPortlet || isOpaquePortlet || isCloned))
{
@@ -180,16 +185,47 @@
}
this.components = components;
- this.id = components != null ? components.getId() : id;
}
protected PortletContext(PortletContextComponents components)
{
ParameterValidation.throwIllegalArgExceptionIfNull(components, "portlet context components");
this.components = components;
- this.id = components.getId();
}
+ public static PortletContext dereference(String invokerId, PortletContext compoundPortletContext)
+ {
+ String portletId = compoundPortletContext.getId().substring(invokerId.length() + INVOKER_SEPARATOR.length());
+ if (compoundPortletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)compoundPortletContext;
+ return StatefulPortletContext.create(portletId, compoundStatefulPortletContext);
+ }
+ else
+ {
+ return createPortletContext(portletId);
+ }
+ }
+
+ public static PortletContext reference(String invokerId, PortletContext portletContext)
+ {
+ String compoundPortletId = reference(portletContext.getId(), invokerId);
+ if (portletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext<?> statefulPortletContext = (StatefulPortletContext<?>)portletContext;
+ return StatefulPortletContext.create(compoundPortletId, statefulPortletContext);
+ }
+ else
+ {
+ return createPortletContext(compoundPortletId);
+ }
+ }
+
+ private static String reference(String portletId, String invokerId)
+ {
+ return invokerId + INVOKER_SEPARATOR + portletId;
+ }
+
public boolean equals(Object o)
{
if (this == o)
@@ -199,24 +235,24 @@
if (o instanceof PortletContext)
{
PortletContext that = (PortletContext)o;
- return id.equals(that.id);
+ return getId().equals(that.getId());
}
return false;
}
public int hashCode()
{
- return id.hashCode();
+ return getId().hashCode();
}
public String getId()
{
- return id;
+ return components.getId();
}
public String toString()
{
- return "PortletContext[" + id + "]";
+ return "PortletContext[" + getId() + "]";
}
/**
@@ -289,7 +325,7 @@
applicationName = applicationName.substring(1);
}
- return new PortletContext(new PortletContextComponents(null, applicationName, portletName, null));
+ return new PortletContext(new InterpretedPortletContextComponents(null, applicationName, portletName, null));
}
public PortletContextComponents getComponents()
@@ -297,14 +333,36 @@
return components;
}
- public static class PortletContextComponents
+ public static interface PortletContextComponents
{
+ public String getApplicationName();
+
+ public String getPortletName();
+
+ public String getInvokerName();
+
+ public boolean isCloned();
+
+ public boolean isProducerCloned();
+
+ public boolean isConsumerCloned();
+
+ public String getStateId();
+
+ public String getId();
+
+ public boolean isInterpreted();
+ }
+
+ private static class InterpretedPortletContextComponents implements PortletContextComponents
+ {
private final String applicationName;
private final String portletName;
private final String invokerName;
private final Boolean producerCloned;
+ private final String id;
- public PortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
+ public InterpretedPortletContextComponents(String invokerName, String applicationName, String portletNameOrStateId, Boolean producerCloned)
{
this.producerCloned = producerCloned;
@@ -316,6 +374,10 @@
this.applicationName = applicationName;
this.portletName = portletNameOrStateId;
this.invokerName = invokerName;
+
+ id = (invokerName == null ? "" : invokerName + INVOKER_SEPARATOR)
+ + (applicationName == null ? "" : PREFIX + applicationName + SEPARATOR)
+ + (portletName == null ? "" : (producerCloned != null ? (producerCloned ? PRODUCER_CLONE_ID_PREFIX : CONSUMER_CLONE_ID_PREFIX) : "") + portletName);
}
public String getApplicationName()
@@ -355,9 +417,68 @@
public String getId()
{
- return (invokerName == null ? "" : invokerName + SEPARATOR)
- + (applicationName == null ? "" : PREFIX + applicationName + SEPARATOR)
- + (portletName == null ? "" : (producerCloned != null ? (producerCloned ? PRODUCER_CLONE_ID_PREFIX : CONSUMER_CLONE_ID_PREFIX) : "") + portletName);
+ return id;
}
+
+ public boolean isInterpreted()
+ {
+ return true;
+ }
}
+
+ private static class UninterpretedPortletContextComponents implements PortletContextComponents
+ {
+ private static final String ERROR = "This PortletContext was not intepreted, only the portlet name is available!";
+ private final String portletName;
+
+ private UninterpretedPortletContextComponents(String portletName)
+ {
+ this.portletName = portletName;
+ }
+
+ public String getApplicationName()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getInvokerName()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isProducerCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public boolean isConsumerCloned()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getStateId()
+ {
+ throw new IllegalStateException(ERROR);
+ }
+
+ public String getId()
+ {
+ return portletName;
+ }
+
+ public boolean isInterpreted()
+ {
+ return false;
+ }
+ }
}
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/StatefulPortletContext.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -67,8 +67,9 @@
this.state = state;
}
- public PortletStateType<S> getType() {
- return type;
+ public PortletStateType<S> getType()
+ {
+ return type;
}
public boolean equals(Object o)
@@ -114,6 +115,6 @@
public String toString()
{
- return "StatefulPortletContext[" + id + "," + type.toString(state) + "]";
+ return "StatefulPortletContext[" + getId() + "," + type.toString(state) + "]";
}
}
Modified: components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/PortletContextTestCase.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -37,6 +37,7 @@
assertEquals("/applicationName.portletName", context.getId());
PortletContext.PortletContextComponents components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
@@ -47,6 +48,7 @@
assertEquals("/applicationName.portletName", context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
@@ -63,10 +65,12 @@
// expected
}
- context = PortletContext.createPortletContext("applicationName.portletName");
- assertEquals("applicationName.portletName", context.getId());
+ String portletId = "applicationName" + PortletContext.INVOKER_SEPARATOR + "portletName";
+ context = PortletContext.createPortletContext(portletId);
+ assertEquals(portletId, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("applicationName", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("portletName", components.getPortletName());
@@ -77,6 +81,7 @@
assertEquals("/applicationName.portlet.Name", context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portlet.Name", components.getPortletName());
@@ -97,6 +102,7 @@
assertEquals("/applicationName.portlet Name", context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portlet Name", components.getPortletName());
@@ -106,40 +112,47 @@
public void testPortletContextWithInvokerId()
{
- PortletContext context = PortletContext.createPortletContext("local./foo.bar");
- assertEquals("local./foo.bar", context.getId());
+ String id = "local" + PortletContext.INVOKER_SEPARATOR + "/foo.bar";
+ PortletContext context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
PortletContext.PortletContextComponents components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("local", components.getInvokerName());
assertEquals("foo", components.getApplicationName());
assertEquals("bar", components.getPortletName());
assertFalse(components.isCloned());
assertNull(components.getStateId());
- context = PortletContext.createPortletContext(" local\t . / foo \t. \t\n bar");
- assertEquals("local./foo.bar", context.getId());
+ context = PortletContext.createPortletContext(" local\t " + PortletContext.INVOKER_SEPARATOR + " / foo \t. \t\n bar");
+ assertEquals("local" + PortletContext.INVOKER_SEPARATOR + "/foo.bar", context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("local", components.getInvokerName());
assertEquals("foo", components.getApplicationName());
assertEquals("bar", components.getPortletName());
assertFalse(components.isCloned());
assertNull(components.getStateId());
- context = PortletContext.createPortletContext("local.foo.bar");
- assertEquals("local.foo.bar", context.getId());
+ id = "local" + PortletContext.INVOKER_SEPARATOR + "foo.bar";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("local", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("foo.bar", components.getPortletName());
assertFalse(components.isCloned());
assertNull(components.getStateId());
- context = PortletContext.createPortletContext("local./foo");
- assertEquals("local./foo", context.getId());
+ id = "local" + PortletContext.INVOKER_SEPARATOR + "/foo";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("local", components.getInvokerName());
assertNull(components.getApplicationName());
assertEquals("/foo", components.getPortletName());
@@ -155,6 +168,7 @@
assertEquals("/applicationName.portletName", context.getId());
PortletContext.PortletContextComponents components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
@@ -171,6 +185,7 @@
assertEquals("/applicationName.portletName", context.getId());
PortletContext.PortletContextComponents components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertEquals("applicationName", components.getApplicationName());
assertEquals("portletName", components.getPortletName());
@@ -182,8 +197,72 @@
public void testShouldWorkWithoutInterpretation()
{
PortletContext context = PortletContext.createPortletContext("foo", false);
- assertNull(context.getComponents());
+ PortletContext.PortletContextComponents components = context.getComponents();
+ assertNotNull(components);
+ assertFalse(components.isInterpreted());
assertEquals("foo", context.getId());
+ assertEquals("foo", components.getPortletName());
+ assertEquals(components.getId(), context.getId());
+
+ try
+ {
+ components.getApplicationName();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.getInvokerName();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.getStateId();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isConsumerCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ components.isProducerCloned();
+ fail("Unintrepreted so only component available is portlet name");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
}
public void testAcceptProducerClones()
@@ -193,10 +272,12 @@
checkClones(PortletContext.PRODUCER_CLONE_ID_PREFIX);
- context = PortletContext.createPortletContext("foo." + PortletContext.CONSUMER_CLONE_ID);
- assertEquals("foo." + PortletContext.CONSUMER_CLONE_ID, context.getId());
+ String id = "foo" + PortletContext.INVOKER_SEPARATOR + PortletContext.CONSUMER_CLONE_ID;
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("foo", components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
@@ -212,26 +293,30 @@
assertEquals(clonePrefix + "clone", context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertNull(components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
assertTrue(components.isCloned());
assertEquals("clone", components.getStateId());
- context = PortletContext.createPortletContext("foo." + clonePrefix + "clone");
- assertEquals("foo." + clonePrefix + "clone", context.getId());
+ String id = "foo" + PortletContext.INVOKER_SEPARATOR + clonePrefix + "clone";
+ context = PortletContext.createPortletContext(id);
+ assertEquals(id, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("foo", components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
assertTrue(components.isCloned());
assertEquals("clone", components.getStateId());
- context = PortletContext.createPortletContext("foo \t \n. " + clonePrefix + " \t\nclone");
- assertEquals("foo." + clonePrefix + "clone", context.getId());
+ context = PortletContext.createPortletContext("foo \t \n " + PortletContext.INVOKER_SEPARATOR + " \t" + clonePrefix + " \t\nclone");
+ assertEquals(id, context.getId());
components = context.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals("foo", components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
@@ -248,6 +333,7 @@
{
PortletContext.PortletContextComponents components = PortletContext.LOCAL_CONSUMER_CLONE.getComponents();
assertNotNull(components);
+ assertTrue(components.isInterpreted());
assertEquals(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, components.getInvokerName());
assertNull(components.getApplicationName());
assertNull(components.getPortletName());
Modified: components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
--- components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -197,7 +197,7 @@
{
DestroyCloneFailure failure = failures.get(i);
String cloneId = failure.getPortletId();
- failure = new DestroyCloneFailure(FederatingPortletInvokerService.reference(cloneId, id));
+ failure = new DestroyCloneFailure(PortletContext.reference(id, PortletContext.createPortletContext(cloneId)).getId());
failures.set(i, failure);
}
@@ -242,12 +242,12 @@
private PortletContext dereference(PortletContext compoundPortletContext)
{
- return FederatingPortletInvokerService.dereference(compoundPortletContext, id);
+ return PortletContext.dereference(id, compoundPortletContext);
}
private PortletContext reference(PortletContext portletContext)
{
- return FederatingPortletInvokerService.reference(portletContext, id);
+ return PortletContext.reference(id, portletContext);
}
}
Modified: components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
--- components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -62,47 +62,11 @@
/** . */
private static final Logger log = LoggerFactory.getLogger(FederatingPortletInvokerService.class);
- /** The separator used in the id to route to the correct invoker. */
- public static final String SEPARATOR = ".";
-
/** The registred FederatedPortletInvokers. */
private volatile Map<String, FederatedPortletInvoker> registry = new HashMap<String, FederatedPortletInvoker>();
private NullInvokerHandler nullHandler = NullInvokerHandler.DEFAULT_HANDLER;
- public static PortletContext dereference(PortletContext compoundPortletContext, String invokerId)
- {
- String portletId = compoundPortletContext.getId().substring(invokerId.length() + SEPARATOR.length());
- if (compoundPortletContext instanceof StatefulPortletContext)
- {
- StatefulPortletContext<?> compoundStatefulPortletContext = (StatefulPortletContext<?>)compoundPortletContext;
- return StatefulPortletContext.create(portletId, compoundStatefulPortletContext);
- }
- else
- {
- return PortletContext.createPortletContext(portletId);
- }
- }
-
- public static PortletContext reference(PortletContext portletContext, String invokerId)
- {
- String compoundPortletId = reference(portletContext.getId(), invokerId);
- if (portletContext instanceof StatefulPortletContext)
- {
- StatefulPortletContext<?> statefulPortletContext = (StatefulPortletContext<?>)portletContext;
- return StatefulPortletContext.create(compoundPortletId, statefulPortletContext);
- }
- else
- {
- return PortletContext.createPortletContext(compoundPortletId);
- }
- }
-
- static String reference(String portletId, String invokerId)
- {
- return invokerId + SEPARATOR + portletId;
- }
-
public synchronized FederatedPortletInvoker registerInvoker(String federatedId, PortletInvoker federatedInvoker)
{
if (federatedId == null)
Modified: components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
===================================================================
--- components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
+++ components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-04-11 10:29:34 UTC (rev 6187)
@@ -54,8 +54,8 @@
private static final PortletContext PORTLET = PortletContext.createPortletContext("/webapp.portlet", false);
private static final String INVOKER_ID = "foo";
private static final PortletContext LOCAL_PORTLET = PortletContext.createPortletContext("/web.local", false);
- private static final PortletContext REFERENCED_PORTLET = FederatingPortletInvokerService.reference(PORTLET, INVOKER_ID);
- private static final PortletContext REFERENCED_LOCAL_PORTLET = FederatingPortletInvokerService.reference(LOCAL_PORTLET, PortletInvoker.LOCAL_PORTLET_INVOKER_ID);
+ private static final PortletContext REFERENCED_PORTLET = PortletContext.reference(INVOKER_ID, PORTLET);
+ private static final PortletContext REFERENCED_LOCAL_PORTLET = PortletContext.reference(PortletInvoker.LOCAL_PORTLET_INVOKER_ID, LOCAL_PORTLET);
/** . */
private FederatingPortletInvoker federatingInvoker;
@@ -231,8 +231,8 @@
}
});
- assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext(federatedId + FederatingPortletInvokerService.SEPARATOR + context.getId())));
- assertEquals(portlet, federatingInvoker.getPortlet(FederatingPortletInvokerService.reference(context, federatedId)));
+ assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.createPortletContext(federatedId + PortletContext.INVOKER_SEPARATOR + context.getId())));
+ assertEquals(portlet, federatingInvoker.getPortlet(PortletContext.reference(federatedId, context)));
}
private class TestFederatedPortletInvoker extends PortletInvokerSupport implements FederatedPortletInvoker
@@ -248,9 +248,9 @@
{
// fake dereferencing of compound portlet id
String portletId = portletContext.getId();
- if (portletId.startsWith(getId() + FederatingPortletInvokerService.SEPARATOR))
+ if (portletId.startsWith(getId() + PortletContext.INVOKER_SEPARATOR))
{
- return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf(FederatingPortletInvokerService.SEPARATOR) + 1)));
+ return super.getPortlet(PortletContext.createPortletContext(portletId.substring(portletId.indexOf(PortletContext.INVOKER_SEPARATOR) + 1)));
}
else
{
13 years, 9 months
gatein SVN: r6186 - in components/wsrp/trunk: admin-gui/src/main/java/org/gatein/wsrp/admin/ui and 11 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-08 16:59:33 -0400 (Fri, 08 Apr 2011)
New Revision: 6186
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandlerTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java
components/wsrp/trunk/pom.xml
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
components/wsrp/trunk/producer/src/test/java/org/gatein/registration/RegistrationTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/invoker/RegistrationCheckingPortletInvokerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
Log:
- GTNWSRP-220: Upgraded to snapshot of PC 2.3.0-Beta2 and updated code and tests as needed.
- Removed dependency of BeanContext on Log4J that was masked by transititive dependencies.
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -23,8 +23,9 @@
package org.gatein.wsrp.admin.ui;
-import org.apache.log4j.Logger;
import org.gatein.common.util.ParameterValidation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.text.MessageFormat;
import java.util.Locale;
@@ -39,7 +40,7 @@
*/
public abstract class BeanContext
{
- protected final static Logger log = Logger.getLogger(BeanContext.class);
+ protected final static Logger log = LoggerFactory.getLogger(BeanContext.class);
public static final String STATUS = "status";
private static final String DEFAULT_RESOURCE_NAME = "Resource";
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -251,7 +251,7 @@
PortletContext context;
byte[] state = portletContext.getPortletState();
- context = PortletContext.createPortletContext(handle, state);
+ context = PortletContext.createPortletContext(handle, state, false);
return context;
}
@@ -261,7 +261,7 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletContext");
PortletContext context;
- context = PortletContext.createPortletContext(portletHandle, state);
+ context = PortletContext.createPortletContext(portletHandle, state, false);
return context;
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -666,7 +666,7 @@
log.debug("Portlet '" + portletHandle + "' will store persistent state for each user.");
}
- wsrpPortlet = new WSRPPortlet(PortletContext.createPortletContext(portletHandle), info);
+ wsrpPortlet = new WSRPPortlet(PortletContext.createPortletContext(portletHandle, false), info);
// add the portlet to the appropriate group if needed
String portletGroupId = portletDescription.getGroupID();
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -456,7 +456,7 @@
new Holder<Lifetime>(),
new Holder<List<Extension>>()
);
- PortletContext newPortletContext = PortletContext.createPortletContext(handle.value, portletState.value);
+ PortletContext newPortletContext = PortletContext.createPortletContext(handle.value, portletState.value, false);
portlet.setPortletContext(newPortletContext);
return newPortletContext;
}
@@ -933,7 +933,7 @@
for (ImportedPortlet importedPortlet : importedPortlets)
{
org.oasis.wsrp.v2.PortletContext portletContext = importedPortlet.getNewPortletContext();
- PortletContext apiPC = PortletContext.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState());
+ PortletContext apiPC = PortletContext.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState(), false);
// we need to reference the resulting PortletContext so that it can then be used properly
importIdToPortletContext.put(importedPortlet.getImportID(), FederatingPortletInvokerService.reference(apiPC, getProducerId()));
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -263,14 +263,14 @@
// activate caching for this test so that we can simulate portlet deployment on the producer with a cached SD
info.setExpirationCacheSeconds(1000);
- org.gatein.pc.api.PortletContext portletContext = org.gatein.pc.api.PortletContext.createPortletContext("test");
+ org.gatein.pc.api.PortletContext portletContext = org.gatein.pc.api.PortletContext.createPortletContext("test", false);
Portlet portlet = info.getPortlet(portletContext);
assertNotNull(portlet);
assertEquals(portletContext, portlet.getContext());
assertEquals(1, behavior.getCallCount());
// test2 is not in the service description, so it should be looked up via Portlet Management...
- portletContext = org.gatein.pc.api.PortletContext.createPortletContext("test2");
+ portletContext = org.gatein.pc.api.PortletContext.createPortletContext(TestPortletManagementBehavior.HANDLE_FOR_GET_DESCRIPTION, false);
// add portlet management behavior
TestPortletManagementBehavior pmBehavior = new TestPortletManagementBehavior();
serviceFactory.getRegistry().setPortletManagementBehavior(pmBehavior);
@@ -282,8 +282,9 @@
// try again, this time without a portlet management interface, the service description should be refreshed
serviceFactory.getRegistry().setPortletManagementBehavior(null);
// simulate a new portlet deployment since last time the SD was refreshed
- behavior.addPortletDescription(behavior.createPortletDescription("test3", null));
- portletContext = org.gatein.pc.api.PortletContext.createPortletContext("test3");
+ final String handle = "test3";
+ behavior.addPortletDescription(behavior.createPortletDescription(handle, null));
+ portletContext = org.gatein.pc.api.PortletContext.createPortletContext(handle, false);
portlet = info.getPortlet(portletContext);
assertEquals(2, behavior.getCallCount());
assertNotNull(portlet);
@@ -462,11 +463,13 @@
private static class TestPortletManagementBehavior extends PortletManagementBehavior
{
+ public static final String HANDLE_FOR_GET_DESCRIPTION = "test2";
+
@Override
public void getPortletDescription(@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext, @WebParam(name = "portletContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext, @WebParam(name = "userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name = "desiredLocales", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales, @WebParam(name = "portletDescription", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<PortletDescription> portletDescription, @WebParam(name = "resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) thr!
ows AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
super.getPortletDescription(registrationContext, portletContext, userContext, desiredLocales, portletDescription, resourceList, extensions);
- portletDescription.value = createPortletDescription("test2", null);
+ portletDescription.value = createPortletDescription(HANDLE_FOR_GET_DESCRIPTION, null);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandlerTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandlerTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandlerTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -56,7 +56,7 @@
public static final String NAMESPACE = "NAMESPACE";
public static final String PORTLETID = "PORTLETID";
public static final MockWSRPConsumer CONSUMER = new MockWSRPConsumer("foo");
- public static final PortletContext PORTLET_CONTEXT = PortletContext.createPortletContext(PORTLETID);
+ public static final PortletContext PORTLET_CONTEXT = PortletContext.createPortletContext(PORTLETID, false);
public static final TestPortletInvocationContext CONTEXT = new TestPortletInvocationContext();
public static final URLFormat FORMAT = new URLFormat(false, false, true, true);
@@ -110,25 +110,25 @@
{
String markup;
String expected;
-
+
String resourceID = WSRPResourceURL.encodeResource(null, new URL("http://localhost:8080/test-resource-portlet/gif/logo.gif"), false);
-
+
//test with &
markup = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";
+ expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";
processMarkupAndCheck(markup, expected);
-
+
//test with &
markup = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";
+ expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";
processMarkupAndCheck(markup, expected);
-
+
//test with /x26
markup = "<img src='wsrp_rewrite?wsrp-urlType=resource\\x26wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif\\x26wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar\\x26mock:resourceID=" + resourceID + "'/>";
+ expected = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar\\x26mock:resourceID=" + resourceID + "'/>";
processMarkupAndCheck(markup, expected);
}
-
+
/*public void testResourceURLs()
{
String markup;
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -292,7 +292,7 @@
}
RenderInvocation render = new RenderInvocation(invocationContext);
- render.setTarget(PortletContext.createPortletContext(portletHandle));
+ render.setTarget(PortletContext.createPortletContext(portletHandle, false));
render.setMode(mode);
render.setWindowState(state);
if (navigationalState != null)
@@ -318,7 +318,7 @@
action.setInstanceContext(new AbstractInstanceContext(portletHandle));
action.setSecurityContext(new AbstractSecurityContext(MockHttpServletRequest.createMockRequest(null)));
action.setUserContext(new MockUserContext());
- action.setTarget(PortletContext.createPortletContext(portletHandle));
+ action.setTarget(PortletContext.createPortletContext(portletHandle, false));
RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -53,7 +53,7 @@
public void testClone() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
ExtendedAssert.assertNotNull(clone);
ExtendedAssert.assertFalse(original.equals(clone));
@@ -73,7 +73,7 @@
public void testGetSetProperties() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PropertyMap props = consumer.getProperties(original);
checkProperties(props, BasicPortletManagementBehavior.PROPERTY_VALUE);
@@ -97,7 +97,7 @@
public void testSetResetSameProperty() throws PortletInvokerException
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
try
@@ -130,7 +130,7 @@
BehaviorRegistry behaviorRegistry = producer.getBehaviorRegistry();
behaviorRegistry.setPortletManagementBehavior(new DestroyClonesPortletManagementBehavior(behaviorRegistry));
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
ExtendedAssert.assertNotNull(clone);
Portlet portlet = consumer.getPortlet(clone);
@@ -152,7 +152,7 @@
// re-create clone and try again with an added invalid portlet context
clone = consumer.createClone(PortletStateType.OPAQUE, original);
- PortletContext invalidContext = PortletContext.createPortletContext("invalid");
+ PortletContext invalidContext = PortletContext.createPortletContext("invalid", false);
clones.add(invalidContext);
result = consumer.destroyClones(clones);
ExtendedAssert.assertEquals(1, result.size());
@@ -170,7 +170,7 @@
public void testInvalidSetProperties() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
try
{
consumer.setProperties(original, null);
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -60,10 +60,10 @@
public void testGetPortlet() throws Exception
{
//obtain one portlet
- Portlet portlet = consumer.getPortlet(PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE));
+ Portlet portlet = consumer.getPortlet(PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false));
checkPortlet(portlet, "", BasicMarkupBehavior.PORTLET_HANDLE);
- portlet = consumer.getPortlet(PortletContext.createPortletContext(SessionMarkupBehavior.PORTLET_HANDLE));
+ portlet = consumer.getPortlet(PortletContext.createPortletContext(SessionMarkupBehavior.PORTLET_HANDLE, false));
checkPortlet(portlet, "2", SessionMarkupBehavior.PORTLET_HANDLE);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -225,7 +225,8 @@
PortletInvocationResponse response = consumer.invoke(render);
String resourceID = WSRPResourceURL.encodeResource(null, new URL("http://localhost:8080/test-resource-portlet/gif/logo.gif"), false);
- String expectedResult = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";;
+ String expectedResult = "<img src='http://test/mock:type=resource?mock:ComponentID=foobar&mock:resourceID=" + resourceID + "'/>";
+ ;
//NOTE: the value we get back is from the TestPortletInvocationContext, not what we would normally receive
checkRenderResult(response, expectedResult);
@@ -295,7 +296,7 @@
}
RenderInvocation render = new RenderInvocation(invocationContext);
- render.setTarget(PortletContext.createPortletContext(portletHandle));
+ render.setTarget(PortletContext.createPortletContext(portletHandle, false));
render.setMode(mode);
render.setWindowState(state);
if (navigationalState != null)
@@ -321,7 +322,7 @@
action.setInstanceContext(new AbstractInstanceContext(portletHandle));
action.setSecurityContext(new AbstractSecurityContext(MockHttpServletRequest.createMockRequest(null)));
action.setUserContext(new MockUserContext());
- action.setTarget(PortletContext.createPortletContext(portletHandle));
+ action.setTarget(PortletContext.createPortletContext(portletHandle, false));
RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -55,7 +55,7 @@
public void testClone() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
ExtendedAssert.assertNotNull(clone);
ExtendedAssert.assertFalse(original.equals(clone));
@@ -75,7 +75,7 @@
public void testGetSetProperties() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PropertyMap props = consumer.getProperties(original);
checkProperties(props, BasicPortletManagementBehavior.PROPERTY_VALUE);
@@ -99,7 +99,7 @@
public void testSetResetSameProperty() throws PortletInvokerException
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
try
@@ -131,7 +131,7 @@
BehaviorRegistry behaviorRegistry = producer.getBehaviorRegistry();
behaviorRegistry.setPortletManagementBehavior(new DestroyClonesPortletManagementBehavior(behaviorRegistry));
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
ExtendedAssert.assertNotNull(clone);
Portlet portlet = consumer.getPortlet(clone);
@@ -153,7 +153,7 @@
// re-create clone and try again with an added invalid portlet context
clone = consumer.createClone(PortletStateType.OPAQUE, original);
- PortletContext invalidContext = PortletContext.createPortletContext("invalid");
+ PortletContext invalidContext = PortletContext.createPortletContext("invalid", false);
clones.add(invalidContext);
result = consumer.destroyClones(clones);
ExtendedAssert.assertEquals(1, result.size());
@@ -171,7 +171,7 @@
public void testInvalidSetProperties() throws Exception
{
- PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
try
{
consumer.setProperties(original, null);
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -82,10 +82,10 @@
public void testGetPortlet() throws Exception
{
//obtain one portlet
- Portlet portlet = consumer.getPortlet(PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE));
+ Portlet portlet = consumer.getPortlet(PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false));
checkPortlet(portlet, "", BasicMarkupBehavior.PORTLET_HANDLE);
- portlet = consumer.getPortlet(PortletContext.createPortletContext(SessionMarkupBehavior.PORTLET_HANDLE));
+ portlet = consumer.getPortlet(PortletContext.createPortletContext(SessionMarkupBehavior.PORTLET_HANDLE, false));
checkPortlet(portlet, "2", SessionMarkupBehavior.PORTLET_HANDLE);
}
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/pom.xml 2011-04-08 20:59:33 UTC (rev 6186)
@@ -21,7 +21,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -46,7 +47,7 @@
</scm>
<properties>
- <version.gatein.pc>2.3.0-Beta01</version.gatein.pc>
+ <version.gatein.pc>2.3.0-Beta02-SNAPSHOT</version.gatein.pc>
<version.gatein.common>2.0.4-Beta02</version.gatein.common>
<version.gatein.wci>2.1.0-Beta01</version.gatein.wci>
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -26,6 +26,7 @@
import com.google.common.base.Function;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
+import com.sun.tools.corba.se.idl.InvalidArgument;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
@@ -389,7 +390,9 @@
ErrorCodes.Codes errorCode;
String reason;
- if (e instanceof NoSuchPortletException || e instanceof InvalidHandle)
+ final String message = e.getLocalizedMessage();
+ if (e instanceof NoSuchPortletException || e instanceof InvalidHandle
+ || (e instanceof IllegalArgumentException && message != null && message.contains(org.gatein.pc.api.PortletContext.INVALID_PORTLET_CONTEXT)))
{
errorCode = ErrorCodes.Codes.INVALIDHANDLE;
reason = "The specified portlet handle is invalid";
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/registration/RegistrationTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/registration/RegistrationTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/registration/RegistrationTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -160,18 +160,18 @@
public void testPortletContextOperations() throws RegistrationException
{
- PortletContext foo = PortletContext.createPortletContext("foo");
+ PortletContext foo = PortletContext.createPortletContext("webapp", "foo");
registration.addPortletContext(foo);
assertTrue(registration.knows(foo));
- assertTrue(registration.knows("foo"));
+ assertTrue(registration.knows(foo.getId()));
Set<PortletContext> knownPortletContexts = registration.getKnownPortletContexts();
assertEquals(1, knownPortletContexts.size());
assertTrue(knownPortletContexts.contains(foo));
registration.removePortletContext(foo);
assertFalse(registration.knows(foo));
- assertFalse(registration.knows("foo"));
+ assertFalse(registration.knows(foo.getId()));
knownPortletContexts = registration.getKnownPortletContexts();
assertTrue(knownPortletContexts.isEmpty());
}
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -57,7 +57,7 @@
*/
public class MimeResponseProcessorTestCase extends TestCase
{
- private static final String PORTLET_HANDLE = "portletHandle";
+ private static final String PORTLET_HANDLE = "/app.portletHandle";
public void testShouldUseProvidedNamespace() throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, UnsupportedWindowState, InvalidRegistration, ModifyRegistrationRequired
{
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/invoker/RegistrationCheckingPortletInvokerTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/invoker/RegistrationCheckingPortletInvokerTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/invoker/RegistrationCheckingPortletInvokerTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -48,7 +48,7 @@
invoker.setRegistrationManager(registrationManager);
PortletInvoker next = mock(PortletInvoker.class);
- PortletContext portletContext = PortletContext.createPortletContext("foo");
+ PortletContext portletContext = PortletContext.createPortletContext("app", "portlet");
Portlet portlet = mock(Portlet.class);
when(next.getPortlet(portletContext)).thenReturn(portlet);
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2011-04-08 20:24:23 UTC (rev 6185)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/PortletManagementTestCase.java 2011-04-08 20:59:33 UTC (rev 6186)
@@ -1314,9 +1314,10 @@
assertEquals(0, response.getCopiedPortlets().size());
assertEquals(1, response.getFailedPortlets().size());
- assertTrue(response.getFailedPortlets().get(0).getPortletHandles().contains(fakePortletContext1));
- assertTrue(response.getFailedPortlets().get(0).getPortletHandles().contains(fakePortletContext2));
- assertTrue(response.getFailedPortlets().get(0).getErrorCode().getLocalPart().contains("InvalidHandle"));
+ final FailedPortlets failedPortlets = response.getFailedPortlets().get(0);
+ assertTrue(failedPortlets.getPortletHandles().contains(fakePortletContext1));
+ assertTrue(failedPortlets.getPortletHandles().contains(fakePortletContext2));
+ assertTrue(failedPortlets.getErrorCode().getLocalPart().contains("InvalidHandle"));
}
@Test
13 years, 9 months
gatein SVN: r6185 - components/pc/trunk/api/src/main/java/org/gatein/pc/api.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-04-08 16:24:23 -0400 (Fri, 08 Apr 2011)
New Revision: 6185
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
Log:
- GTNPC-58: Added constant for error message in case an id is interpreted as invalid to facilitate downstream processing (i.e. allow discrimination of IllegalArgumentException via exception message) :/
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-08 11:29:01 UTC (rev 6184)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletContext.java 2011-04-08 20:24:23 UTC (rev 6185)
@@ -48,6 +48,7 @@
public static final String CONSUMER_CLONE_ID = PRODUCER_CLONE_ID_PREFIX + CONSUMER_CLONE_DUMMY_STATE_ID;
public final static PortletContext LOCAL_CONSUMER_CLONE = PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + SEPARATOR + CONSUMER_CLONE_ID);
+ public static final String INVALID_PORTLET_CONTEXT = "Invalid portlet context: ";
protected final String id;
private final PortletContextComponents components;
@@ -169,13 +170,13 @@
}
catch (Exception e)
{
- throw new IllegalArgumentException("Couldn't interpret id '" + id + "'", e);
+ throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id, e);
}
}
if (interpret && !(isSimpleAppPortlet || isCompoundAppPortlet || isOpaquePortlet || isCloned))
{
- throw new IllegalArgumentException("Couldn't interpret id '" + id + "'");
+ throw new IllegalArgumentException(INVALID_PORTLET_CONTEXT + id);
}
this.components = components;
13 years, 9 months