JBoss Portal SVN: r10337 - branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet and 23 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-19 17:46:37 -0400 (Wed, 19 Mar 2008)
New Revision: 10337
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/DynaTestContext.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/TestLayoutServiceImpl.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/metadata/TestRenderSetMetaData.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/PortalRenderSet.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/RendererFactoryImpl.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/render/RendererContext.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupContext.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupType.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestProducerBehavior.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupRequest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPRequestContext.java
modules/common/trunk/.classpath
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java
modules/portlet/trunk/.classpath
Log:
Use new MediaType
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,8 +23,8 @@
package org.jboss.portal.core.admin.ui;
import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.IteratorStatus;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.core.impl.model.content.ContentProviderRegistryService;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
@@ -170,7 +170,7 @@
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getCapabilities().getModes("text/html");
+ return portlet.getInfo().getCapabilities().getModes(MediaType.TEXT_HTML);
}
});
portletDecorator.setProperty("windowStates", new AbstractPropertyDecorator(Set.class)
@@ -178,7 +178,7 @@
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getCapabilities().getWindowStates("text/html");
+ return portlet.getInfo().getCapabilities().getWindowStates(MediaType.TEXT_HTML);
}
});
portletDecorator.setProperty("locales", new AbstractPropertyDecorator(Set.class)
@@ -392,7 +392,7 @@
for (Iterator i = renderSets.iterator(); i.hasNext();)
{
ServerRegistrationID renderSetId = (ServerRegistrationID)i.next();
- PortalRenderSet renderSet = layoutService.getRenderSet(renderSetId, MediaType.HTML);
+ PortalRenderSet renderSet = layoutService.getRenderSet(renderSetId, MediaType.TEXT_HTML);
if (renderSet != null)
{
names.put(renderSet.getName(), renderSet.getName());
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -26,9 +26,9 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.Portlet;
@@ -155,7 +155,7 @@
StateString navigationalState,
StateString interactionState) throws PortletInvokerException
{
- PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.HTML, "UTF-8"), navigationalState, this);
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), navigationalState, this);
//
PortletInvocation action = new ActionInvocation(portletInvocationContext);
@@ -171,7 +171,7 @@
ParameterMap navState) throws PortletInvokerException
{
- PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.HTML, "UTF-8"), null, this);
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), null, this);
//
PortletInvocation render = new RenderInvocation(portletInvocationContext);
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.deployment.jboss.info.SessionInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
@@ -42,7 +42,7 @@
{
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
PortletInfo portletInfo = container.getInfo();
SessionInfo sessionInfo = portletInfo.getAttachment(SessionInfo.class);
Modified: branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -26,7 +26,7 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
import org.jboss.portal.portlet.container.managed.ManagedObject;
import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
@@ -230,11 +230,11 @@
//
if (status == LifeCycleStatus.STARTED)
{
- ((PortletContainerInvoker)portletContainerInvoker).addPortletContainer(portletContainer);
+ ((ContainerPortletInvoker)portletContainerInvoker).addPortletContainer(portletContainer);
}
else
{
- ((PortletContainerInvoker)portletContainerInvoker).removePortletContainer(portletContainer);
+ ((ContainerPortletInvoker)portletContainerInvoker).removePortletContainer(portletContainer);
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,9 +23,9 @@
package org.jboss.portal.server.aspects.server;
import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInterceptor;
import org.jboss.portal.server.ServerInvocation;
@@ -60,7 +60,7 @@
}
// Configure the stream info
- ContentInfo info = new MarkupInfo(MediaType.HTML, "UTF-8");
+ ContentInfo info = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
ServerResponse resp = invocation.getResponse();
resp.setContentInfo(info);
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/DynaTestContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/DynaTestContext.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/DynaTestContext.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,9 +25,9 @@
import org.apache.log4j.Logger;
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.IteratorStatus;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.test.framework.driver.DriverCommand;
import org.jboss.portal.test.framework.driver.DriverResponse;
import org.jboss.portal.test.framework.driver.TestDriverException;
@@ -150,7 +150,7 @@
servletContainerFactory = (ServletContainerFactory)MBeanProxy.get(ServletContainerContext.class, new ObjectName("portal:service=ServletContainerFactory"), mbeanServer);
layoutService = (LayoutService)MBeanProxy.get(LayoutService.class, new ObjectName("portal:service=LayoutService"), mbeanServer);
themeService = (ThemeService)MBeanProxy.get(ThemeService.class, new ObjectName("portal:service=ThemeService"), mbeanServer);
- renderSet = layoutService.getRenderSet("testRenderer", MediaType.HTML);
+ renderSet = layoutService.getRenderSet("testRenderer", MediaType.TEXT_HTML);
layout = layoutService.getLayout("generic", true);
theme = themeService.getTheme("testTheme", true);
@@ -249,7 +249,7 @@
private void handleAsync(RequestContext requestContext) throws RenderException, IOException
{
- MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
+ MarkupInfo markupInfo = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
ServletContextDispatcher dispatcher = new ServletContextDispatcher(requestContext.request, requestContext.response, servletContainerFactory.getServletContainer());
ThemeContext themeContext = new ThemeContext(theme, themeService);
@@ -290,7 +290,7 @@
{
requestContext.response.setContentType("text/html");
- MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "UTF-8");
+ MarkupInfo markupInfo = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
ServletContextDispatcher dispatcher = new ServletContextDispatcher(requestContext.request, requestContext.response, servletContainerFactory.getServletContainer());
ThemeContext themeContext = new ThemeContext(theme, themeService);
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/TestLayoutServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/TestLayoutServiceImpl.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/TestLayoutServiceImpl.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,9 +23,10 @@
package org.jboss.portal.test.theme.tmp;
import junit.framework.TestCase;
+
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.PortalRenderSet;
@@ -170,16 +171,16 @@
public void testCreateRenderSets()
{
- PortalRenderSet renderSet = layoutService.getRenderSet("divRenderer", MediaType.HTML);
+ PortalRenderSet renderSet = layoutService.getRenderSet("divRenderer", MediaType.TEXT_HTML);
assertEquals(renderSet.getName(), "divRenderer");
- renderSet = layoutService.getRenderSet("emptyRenderer", MediaType.HTML);
+ renderSet = layoutService.getRenderSet("emptyRenderer", MediaType.TEXT_HTML);
assertEquals(renderSet.getName(), "emptyRenderer");
}
public void testGetRenderSetInfos() throws Exception
{
- PortalRenderSet renderSet = layoutService.getRenderSet("divRenderer", MediaType.HTML);
+ PortalRenderSet renderSet = layoutService.getRenderSet("divRenderer", MediaType.TEXT_HTML);
assertEquals(renderSet.getName(), "divRenderer");
assertTrue(renderSet.isAjaxEnabled());
assertEquals(renderSet.getDecorationRenderer().getClass(), new DynaDecorationRenderer(new DivDecorationRenderer()).getClass());
@@ -187,7 +188,7 @@
assertEquals(renderSet.getRegionRenderer().getClass(), new DynaRegionRenderer(new DivRegionRenderer()).getClass());
assertEquals(renderSet.getWindowRenderer().getClass(), new DynaWindowRenderer(new DivWindowRenderer()).getClass());
- renderSet = layoutService.getRenderSet("emptyRenderer", MediaType.HTML);
+ renderSet = layoutService.getRenderSet("emptyRenderer", MediaType.TEXT_HTML);
assertEquals(renderSet.getName(), "emptyRenderer");
assertFalse(renderSet.isAjaxEnabled());
assertEquals(renderSet.getDecorationRenderer().getClass(), new EmptyDecorationRenderer().getClass());
@@ -198,9 +199,9 @@
public void testRemoveRenderSets() throws LayoutException
{
- assertNotNull(layoutService.getRenderSet("divRenderer", MediaType.HTML));
+ assertNotNull(layoutService.getRenderSet("divRenderer", MediaType.TEXT_HTML));
ServerRegistrationID id = ServerRegistrationID.createPortalLayoutID(runtimeContext.getAppId(), "divRenderer");
layoutService.removeRenderSets(id.getName(0));
- assertNull(layoutService.getRenderSet("divRenderer", MediaType.HTML));
+ assertNull(layoutService.getRenderSet("divRenderer", MediaType.TEXT_HTML));
}
}
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/metadata/TestRenderSetMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/metadata/TestRenderSetMetaData.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/metadata/TestRenderSetMetaData.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,7 +23,10 @@
package org.jboss.portal.test.theme.tmp.metadata;
import junit.framework.TestCase;
-import org.jboss.portal.common.util.MediaType;
+
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.net.media.SubtypeDef;
+import org.jboss.portal.common.net.media.TypeDef;
import org.jboss.portal.theme.deployment.jboss.RenderSetMetaDataFactory;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
@@ -102,7 +105,7 @@
assertNotNull(renderSetMD.getRendererSet());
assertTrue(renderSetMD.getRendererSet().size() == 1);
RendererSetMetaData rendererSetMD = (RendererSetMetaData)renderSetMD.getRendererSet().get(0);
- assertEquals(MediaType.HTML, rendererSetMD.getContentType());
+ assertEquals(MediaType.TEXT_HTML, rendererSetMD.getMediaType());
assertEquals("DivPortletRenderer", rendererSetMD.getPortletRenderer());
renderSetMD = (RenderSetMetaData)setList.get(1);
@@ -111,11 +114,11 @@
assertTrue(renderSetMD.getRendererSet().size() == 2);
rendererSetMD = (RendererSetMetaData)renderSetMD.getRendererSet().get(0);
- assertEquals(MediaType.HTML, rendererSetMD.getContentType());
+ assertEquals(MediaType.TEXT_HTML, rendererSetMD.getMediaType());
assertEquals("EmptyPortletRendererHTML", rendererSetMD.getPortletRenderer());
rendererSetMD = (RendererSetMetaData)renderSetMD.getRendererSet().get(1);
- assertEquals(MediaType.XHTML, rendererSetMD.getContentType());
+ assertEquals(MediaType.TEXT_HTML, rendererSetMD.getMediaType());
assertEquals("EmptyDecorationRendererXHTML", rendererSetMD.getDecorationRenderer());
}
catch (Exception e)
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -22,10 +22,11 @@
package org.jboss.portal.test.theme.tmp.render;
import junit.framework.TestCase;
+
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.test.theme.tmp.TestHelper;
import org.jboss.portal.theme.LayoutService;
@@ -106,7 +107,7 @@
RenderSetMetaData renderSetMD = (RenderSetMetaData)i.next();
layoutService.addRenderSet(runtimeContext, renderSetMD);
}
- renderSet = layoutService.getRenderSet("divRenderer", MediaType.HTML);
+ renderSet = layoutService.getRenderSet("divRenderer", MediaType.TEXT_HTML);
res = new CLResourceLoader().getResource("xml/portal-themes.xml");
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
@@ -132,7 +133,7 @@
portalProps.put(ThemeConstants.PORTAL_PROP_RENDERSET, renderSet.getName());
//
- MarkupInfo streamInfo = new MarkupInfo(MediaType.HTML, "utf-8");
+ MarkupInfo streamInfo = new MarkupInfo(MediaType.TEXT_HTML, "utf-8");
ServerRequest serverRequest = TestHelper.createServerRequest();
// pageresult obj
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,8 +23,8 @@
package org.jboss.portal.theme;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ContentInfo;
-import org.jboss.portal.common.util.MediaType;
import java.util.Collection;
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/PortalRenderSet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/PortalRenderSet.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/PortalRenderSet.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme;
-import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.theme.impl.render.dynamic.DynaDecorationRenderer;
import org.jboss.portal.theme.impl.render.dynamic.DynaPortletRenderer;
import org.jboss.portal.theme.impl.render.dynamic.DynaRegionRenderer;
@@ -49,7 +49,7 @@
private final WindowRenderer windowRenderer;
private final PortletRenderer portletRenderer;
private final DecorationRenderer decorationRenderer;
- private final MediaType contentType;
+ private final MediaType mediaType;
private final String appID;
private final String name;
private final ServerRegistrationID registrationId;
@@ -83,7 +83,7 @@
this.name = renderSetName;
this.appID = runtimeContext.getAppId();
this.registrationId = ServerRegistrationID.createID(ServerRegistrationID.TYPE_RENDERSET, new String[]{appID, name});
- this.contentType = rendererSetMD.getContentType();
+ this.mediaType = rendererSetMD.getMediaType();
this.ajaxEnabled = rendererSetMD.isAjaxEnabled();
if (ajaxEnabled) // wrap the current renderer with the ajax delegator one.
@@ -110,7 +110,7 @@
/** @see PortalRenderSet#getMediaType */
public MediaType getMediaType()
{
- return contentType;
+ return mediaType;
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.deployment.jboss;
-import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
@@ -72,7 +72,7 @@
{
RendererSetMetaData rendererSet = new RendererSetMetaData();
String contentType = attrs.getValue("content-type");
- rendererSet.setContentType(MediaType.parseMimeType(contentType));
+ rendererSet.setMediaType(MediaType.create(contentType));
return rendererSet;
}
return null;
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,8 +23,8 @@
package org.jboss.portal.theme.impl;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ContentInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.LayoutInfo;
@@ -477,7 +477,7 @@
{
throw new IllegalArgumentException("No null arguments allowed [" + info + "] [" + renderSetName + "] [" + streamInfo + "]");
}
- MediaType contentType = streamInfo.getContentType();
- return getRenderSet(renderSetName, contentType);
+ MediaType mediaType = streamInfo.getMediaType();
+ return getRenderSet(renderSetName, mediaType);
}
}
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/RendererFactoryImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/RendererFactoryImpl.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/impl/RendererFactoryImpl.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -120,7 +120,7 @@
//
if (renderSetName != null)
{
- PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getContentType());
+ PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getMediaType());
//
if (renderSet != null)
@@ -160,7 +160,7 @@
//
if (renderSetName != null)
{
- PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getContentType());
+ PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getMediaType());
//
if (renderSet != null)
@@ -201,7 +201,7 @@
//
if (renderSetName != null)
{
- PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getContentType());
+ PortalRenderSet renderSet = layoutServiceInfo.getRenderSet(renderSetName, rendererContext.getMediaType());
//
if (renderSet != null)
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.metadata;
-import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.net.media.MediaType;
/**
* Meta data describing a render set. <p/> exmaple of a render set descriptor: <p/> <portal-renderSet> <renderSet
@@ -42,21 +42,21 @@
*/
public class RendererSetMetaData
{
- private MediaType contentType;
+ private MediaType mediaType;
private String regionRenderer;
private String windowRenderer;
private String decorationRenderer;
private String portletRenderer;
private boolean ajaxEnabled;
- public MediaType getContentType()
+ public MediaType getMediaType()
{
- return contentType;
+ return mediaType;
}
- public void setContentType(MediaType contentType)
+ public void setMediaType(MediaType mediaType)
{
- this.contentType = contentType;
+ this.mediaType = mediaType;
}
public String getRegionRenderer()
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/render/RendererContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/render/RendererContext.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/render/RendererContext.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.theme.render;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.render.renderer.DecorationRenderer;
import org.jboss.portal.theme.render.renderer.DecorationRendererContext;
import org.jboss.portal.theme.render.renderer.PageRenderer;
@@ -121,9 +121,9 @@
return markupInfo;
}
- public MediaType getContentType()
+ public MediaType getMediaType()
{
- return markupInfo.getContentType();
+ return markupInfo.getMediaType();
}
public String getCharset()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupContext.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupContext.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -30,11 +30,13 @@
import java.io.Serializable;
+import org.jboss.portal.common.net.media.MediaType;
+
public class MarkupContext implements Serializable
{
protected java.lang.Boolean useCachedMarkup;
- protected java.lang.String mimeType;
+ protected String mediaType;
protected java.lang.String markupString;
protected byte[] markupBinary;
protected java.lang.String locale;
@@ -47,10 +49,10 @@
{
}
- public MarkupContext(java.lang.Boolean useCachedMarkup, java.lang.String mimeType, java.lang.String markupString, byte[] markupBinary, java.lang.String locale, java.lang.Boolean requiresUrlRewriting, org.jboss.portal.wsrp.core.CacheControl cacheControl, java.lang.String preferredTitle, org.jboss.portal.wsrp.core.Extension[] extensions)
+ public MarkupContext(java.lang.Boolean useCachedMarkup, String mediaType, java.lang.String markupString, byte[] markupBinary, java.lang.String locale, java.lang.Boolean requiresUrlRewriting, org.jboss.portal.wsrp.core.CacheControl cacheControl, java.lang.String preferredTitle, org.jboss.portal.wsrp.core.Extension[] extensions)
{
this.useCachedMarkup = useCachedMarkup;
- this.mimeType = mimeType;
+ this.mediaType = mediaType;
this.markupString = markupString;
this.markupBinary = markupBinary;
this.locale = locale;
@@ -70,14 +72,14 @@
this.useCachedMarkup = useCachedMarkup;
}
- public java.lang.String getMimeType()
+ public String getMediaType()
{
- return mimeType;
+ return mediaType;
}
- public void setMimeType(java.lang.String mimeType)
+ public void setMimeType(String mediaType)
{
- this.mimeType = mimeType;
+ this.mediaType = mediaType;
}
public java.lang.String getMarkupString()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupType.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupType.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/generated/org/jboss/portal/wsrp/core/MarkupType.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -30,10 +30,12 @@
import java.io.Serializable;
+import org.jboss.portal.common.net.media.MediaType;
+
public class MarkupType implements Serializable
{
- protected java.lang.String mimeType;
+ protected MediaType mediaType;
protected java.lang.String[] modes;
protected java.lang.String[] windowStates;
protected java.lang.String[] locales;
@@ -43,23 +45,23 @@
{
}
- public MarkupType(java.lang.String mimeType, java.lang.String[] modes, java.lang.String[] windowStates, java.lang.String[] locales, org.jboss.portal.wsrp.core.Extension[] extensions)
+ public MarkupType(MediaType mediaType, java.lang.String[] modes, java.lang.String[] windowStates, java.lang.String[] locales, org.jboss.portal.wsrp.core.Extension[] extensions)
{
- this.mimeType = mimeType;
+ this.mediaType = mediaType;
this.modes = modes;
this.windowStates = windowStates;
this.locales = locales;
this.extensions = extensions;
}
- public java.lang.String getMimeType()
+ public MediaType getMediaType()
{
- return mimeType;
+ return mediaType;
}
- public void setMimeType(java.lang.String mimeType)
+ public void setMediaType(MediaType mediaType)
{
- this.mimeType = mimeType;
+ this.mediaType = mediaType;
}
public java.lang.String[] getModes()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -87,7 +88,7 @@
WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState()), markupParams.getNavigationalState(),
getMarkup);
- MarkupContext markupContext = WSRPTypeFactory.createMarkupContext("text/html", markupString);
+ MarkupContext markupContext = WSRPTypeFactory.createMarkupContext(MediaType.TEXT_HTML.getValue(), markupString);
markupContext.setRequiresUrlRewriting(Boolean.TRUE);
MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContext);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestProducerBehavior.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestProducerBehavior.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestProducerBehavior.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.wsrp.framework;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.core.LocalizedString;
@@ -59,7 +60,7 @@
{
PortletDescription portletDesc = new PortletDescription();
portletDesc.setPortletHandle(portletHandle);
- portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType("text/html", new String[]{WSRPConstants.VIEW_MODE},
+ portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType(MediaType.TEXT_HTML, new String[]{WSRPConstants.VIEW_MODE},
new String[]{WSRPConstants.NORMAL_WINDOW_STATE}, WSRPConstants.DEFAULT_LOCALES, null)});
String suffixString = suffix == null ? "" : suffix;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -24,8 +24,8 @@
package org.jboss.portal.test.wsrp.framework.support;
import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.StateString;
@@ -56,7 +56,7 @@
public TestPortletInvocationContext()
{
- super(new MarkupInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET));
+ super(new MarkupInfo(MediaType.TEXT_HTML, WSRPConstants.DEFAULT_CHARACTER_SET));
ClassLoader classLoader = getClass().getClassLoader();
HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -600,7 +600,7 @@
// Markup context
MarkupContext markupContext = response.getMarkupContext();
ExtendedAssert.assertNotNull(markupContext);
- ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
+ ExtendedAssert.assertEquals("text/html", markupContext.getMediaType());
ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
ExtendedAssert.assertTrue(markupContext.getRequiresUrlRewriting().booleanValue());
ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -24,6 +24,7 @@
package org.jboss.portal.test.wsrp.v1.producer;
import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.registration.RegistrationException;
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
@@ -125,7 +126,7 @@
MarkupType[] markupTypes = desc.getMarkupTypes();
ExtendedAssert.assertEquals(1, markupTypes.length);
MarkupType markupType = markupTypes[0];
- assertEquals(new MarkupType("text/html", new String[]{WSRPConstants.VIEW_MODE},
+ assertEquals(new MarkupType(MediaType.TEXT_HTML, new String[]{WSRPConstants.VIEW_MODE},
new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
new String[]{"en"}, null), markupType);
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.ActionURL;
@@ -454,14 +455,14 @@
*
* @return
*/
- public static MarkupContext createMarkupContext(String mimeType, String markupString)
+ public static MarkupContext createMarkupContext(String mediaType, String markupString)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME type", "MarkupContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "Media type", "MarkupContext");
if (markupString == null)
{
throw new IllegalArgumentException("MarkupContext requires either a non-null markup string or binary markup.");
}
- return new MarkupContext(Boolean.FALSE, mimeType, markupString, null, null, Boolean.FALSE, null, null, null);
+ return new MarkupContext(Boolean.FALSE, mediaType, markupString, null, null, Boolean.FALSE, null, null, null);
}
/**
@@ -476,14 +477,14 @@
* response message.
* @return a new MarkupContext
*/
- public static MarkupContext createMarkupContext(String mimeType, byte[] markupBinary)
+ public static MarkupContext createMarkupContext(String mediaType, byte[] markupBinary)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME type", "MarkupContext");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "MIME type", "MarkupContext");
if (markupBinary == null || markupBinary.length == 0)
{
throw new IllegalArgumentException("MarkupContext requires either a non-null markup string or binary markup.");
}
- return new MarkupContext(Boolean.FALSE, mimeType, null, markupBinary, null, Boolean.FALSE, null, null, null);
+ return new MarkupContext(Boolean.FALSE, mediaType, null, markupBinary, null, Boolean.FALSE, null, null, null);
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -118,7 +118,7 @@
// todo: need to deal with binary
}
- String mimeType = markupContext.getMimeType();
+ String mimeType = markupContext.getMediaType();
if (mimeType == null || mimeType.length() == 0)
{
return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -111,7 +111,7 @@
markupParams = WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
WSRPUtils.convertLocalesToRFC3066LanguageTagArray(userContext.getLocales()),
- new String[]{streamInfo.getContentType().toString()}, mode, windowState);
+ new String[]{streamInfo.getMediaType().toString()}, mode, windowState);
String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
markupParams.setClientData(WSRPTypeFactory.createClientData(userAgent));
StateString navigationalState = invocation.getNavigationalState();
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
@@ -105,7 +106,7 @@
groupId = other.groupId; // should be duplicate group id?
WSRPCapabilitiesInfo otherCapabilities = (WSRPCapabilitiesInfo)other.getCapabilities();
- capabilities = new WSRPCapabilitiesInfo(new HashMap(otherCapabilities.mimeTypes),
+ capabilities = new WSRPCapabilitiesInfo(new HashMap(otherCapabilities.mediaTypes),
new HashSet(otherCapabilities.modes), new HashSet(otherCapabilities.windowStates),
new HashSet(otherCapabilities.locales));
@@ -272,20 +273,20 @@
private void createCapabilitiesInfo(PortletDescription portletDescription)
{
final MarkupType[] markupTypes = portletDescription.getMarkupTypes();
- final Map mimeTypes = new HashMap(markupTypes.length);
+ final Map<MediaType, MediaTypeInfo> mediaTypes = new HashMap<MediaType, MediaTypeInfo>(markupTypes.length);
capabilities = new WSRPCapabilitiesInfo();
for (MarkupType markupType : markupTypes)
{
- String mimeType = markupType.getMimeType();
- MIMETypeInfo mimeTypeInfo = new MIMETypeInfo(markupType);
- mimeTypes.put(mimeType, mimeTypeInfo);
- capabilities.addModes(mimeTypeInfo.modes);
- capabilities.addWindowStates(mimeTypeInfo.windowStates);
- capabilities.addLocales(mimeTypeInfo.locales);
+ MediaType mediaType = markupType.getMediaType();
+ MediaTypeInfo mediaTypeInfo = new MediaTypeInfo(markupType);
+ mediaTypes.put(mediaType, mediaTypeInfo);
+ capabilities.addModes(mediaTypeInfo.modes);
+ capabilities.addWindowStates(mediaTypeInfo.windowStates);
+ capabilities.addLocales(mediaTypeInfo.locales);
}
- capabilities.setMimeTypes(mimeTypes);
+ capabilities.setMediaTypes(mediaTypes);
}
private void createMetaInfo(PortletDescription portletDescription)
@@ -337,11 +338,11 @@
return null;
}
- class MIMETypeInfo
+ class MediaTypeInfo
{
- public MIMETypeInfo(MarkupType markupType)
+ public MediaTypeInfo(MarkupType markupType)
{
- mimeType = markupType.getMimeType();
+ mimeType = markupType.getMediaType();
String[] modeNames = markupType.getModes();
modes = new HashSet(modeNames.length);
@@ -374,7 +375,7 @@
}
}
- String mimeType;
+ MediaType mimeType;
Set modes;
Set windowStates;
Set locales;
@@ -432,7 +433,7 @@
private class WSRPCapabilitiesInfo implements CapabilitiesInfo
{
- private Map mimeTypes;
+ private Map mediaTypes;
private Set modes;
private Set windowStates;
private Set locales;
@@ -441,22 +442,22 @@
{
}
- private void setMimeTypes(Map mimeTypes)
+ private void setMediaTypes(Map mediaTypes)
{
- this.mimeTypes = mimeTypes;
+ this.mediaTypes = mediaTypes;
}
- public WSRPCapabilitiesInfo(Map mimeTypes, Set modes, Set windowStates, Set locales)
+ public WSRPCapabilitiesInfo(Map mediaTypes, Set modes, Set windowStates, Set locales)
{
- this.mimeTypes = mimeTypes;
+ this.mediaTypes = mediaTypes;
this.modes = modes;
this.windowStates = windowStates;
this.locales = locales;
}
- public Set getMimeTypes()
+ public Set getMediaTypes()
{
- return mimeTypes.keySet();
+ return mediaTypes.keySet();
}
public Set getAllModes()
@@ -464,9 +465,9 @@
return modes;
}
- public Set getModes(String mimeType)
+ public Set getModes(MediaType mediaType)
{
- MIMETypeInfo mimeTypeInfo = (MIMETypeInfo)mimeTypes.get(mimeType);
+ MediaTypeInfo mimeTypeInfo = (MediaTypeInfo)mediaTypes.get(mediaType);
if (mimeTypeInfo == null)
{
return Collections.EMPTY_SET;
@@ -480,9 +481,9 @@
return windowStates;
}
- public Set getWindowStates(String mimeType)
+ public Set getWindowStates(MediaType mediaType)
{
- MIMETypeInfo mimeTypeInfo = (MIMETypeInfo)mimeTypes.get(mimeType);
+ MediaTypeInfo mimeTypeInfo = (MediaTypeInfo)mediaTypes.get(mediaType);
if (mimeTypeInfo == null)
{
return Collections.EMPTY_SET;
@@ -496,9 +497,9 @@
return locales;
}
- public Set getLocales(String mimeType)
+ public Set getLocales(MediaType mediaType)
{
- MIMETypeInfo mimeTypeInfo = (MIMETypeInfo)mimeTypes.get(mimeType);
+ MediaTypeInfo mimeTypeInfo = (MediaTypeInfo)mediaTypes.get(mediaType);
if (mimeTypeInfo == null)
{
return Collections.EMPTY_SET;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupRequest.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupRequest.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.MarkupType;
@@ -57,14 +58,14 @@
this.portlet = portlet;
}
- public String getMimeTypeWithCharset()
+ public String getMediaTypeWithCharset()
{
- return getMimeType() + CHARSET_SEPARATOR + getCharacterSet();
+ return getMediaType() + CHARSET_SEPARATOR + getCharacterSet();
}
- public String getMimeType()
+ public String getMediaType()
{
- return markupType.getMimeType();
+ return markupType.getMediaType().getValue();
}
public String getLocale()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -130,11 +130,11 @@
MarkupContext markupContext;
if (markupString != null)
{
- markupContext = WSRPTypeFactory.createMarkupContext(markupRequest.getMimeType(), markupString);
+ markupContext = WSRPTypeFactory.createMarkupContext(markupRequest.getMediaType(), markupString);
}
else
{
- markupContext = WSRPTypeFactory.createMarkupContext(markupRequest.getMimeTypeWithCharset(), markupBinary);
+ markupContext = WSRPTypeFactory.createMarkupContext(markupRequest.getMediaTypeWithCharset(), markupBinary);
}
markupContext.setLocale(markupRequest.getLocale());
markupContext.setRequiresUrlRewriting(Boolean.TRUE);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
@@ -197,7 +197,7 @@
String desiredMIMEType = desiredMIMETypes[i];
for (int j = 0; j < markupTypes.length; j++)
{
- if (desiredMIMEType.equalsIgnoreCase(markupTypes[j].getMimeType()))
+ if (desiredMIMEType.equals(markupTypes[j].getMediaType()))
{
markupType = markupTypes[j];
break;
@@ -404,9 +404,9 @@
MarkupInfo markupInfo;
try
{
- markupInfo = new MarkupInfo(MediaType.parseMimeType(markupRequest.getMimeType()), markupRequest.getCharacterSet());
+ markupInfo = new MarkupInfo(MediaType.create(markupRequest.getMediaType()), markupRequest.getCharacterSet());
}
- catch (MimeTypeParseException e)
+ catch (IllegalArgumentException e)
{
throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.UNSUPPORTED_MIME_TYPE,
e.getLocalizedMessage(), e);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -193,12 +194,12 @@
log.debug("Constructing portlet description for: " + id);
CapabilitiesInfo capInfo = info.getCapabilities();
- Collection allMimeTypes = capInfo.getMimeTypes();
- MarkupType[] markupTypes = new MarkupType[allMimeTypes.size()];
- Iterator mimeTypes = allMimeTypes.iterator();
- for (int i = 0; mimeTypes.hasNext(); i++)
+ Collection<MediaType> allMediaTypes = capInfo.getMediaTypes();
+ MarkupType[] markupTypes = new MarkupType[allMediaTypes.size()];
+ Iterator<MediaType> mediaTypes = allMediaTypes.iterator();
+ for (int i = 0; mediaTypes.hasNext(); i++)
{
- String mimeType = (String)mimeTypes.next();
+ MediaType mimeType = (MediaType)mediaTypes.next();
markupTypes[i] = new MarkupType(
mimeType,
getModeNamesFrom(capInfo.getModes(mimeType)),
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPRequestContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPRequestContext.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPRequestContext.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -248,7 +248,7 @@
}
else
{
- return new WSRPSimpleRequestContext(markupRequest.getCharacterSet(), markupRequest.getMimeType(), formParams);
+ return new WSRPSimpleRequestContext(markupRequest.getCharacterSet(), markupRequest.getMediaType(), formParams);
}
}
Modified: modules/common/trunk/.classpath
===================================================================
--- modules/common/trunk/.classpath 2008-03-19 19:16:51 UTC (rev 10336)
+++ modules/common/trunk/.classpath 2008-03-19 21:46:37 UTC (rev 10337)
@@ -3,6 +3,7 @@
<classpathentry kind="src" path="mc/src/main/java"/>
<classpathentry kind="src" path="portal/src/main/java"/>
<classpathentry kind="src" path="common/src/main/java"/>
+ <classpathentry kind="src" path="common/src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
<classpathentry kind="output" path="bin"/>
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -34,19 +34,19 @@
{
/** The content type. */
- private final MediaType contentType;
+ private final MediaType mediaType;
- public ContentInfo(MediaType contentType)
+ public ContentInfo(MediaType mediaType)
{
- if (contentType == null)
+ if (mediaType == null)
{
- throw new IllegalArgumentException("Content type cannot be null");
+ throw new IllegalArgumentException("Media type cannot be null");
}
- this.contentType = contentType;
+ this.mediaType = mediaType;
}
- public MediaType getContentType()
+ public MediaType getMediaType()
{
- return contentType;
+ return mediaType;
}
}
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java 2008-03-19 19:16:51 UTC (rev 10336)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java 2008-03-19 21:46:37 UTC (rev 10337)
@@ -36,9 +36,9 @@
/** The charset. */
private final String charset;
- public MarkupInfo(MediaType contentType, String charset)
+ public MarkupInfo(MediaType mediaType, String charset)
{
- super(contentType);
+ super(mediaType);
//
if (charset == null)
Modified: modules/portlet/trunk/.classpath
===================================================================
--- modules/portlet/trunk/.classpath 2008-03-19 19:16:51 UTC (rev 10336)
+++ modules/portlet/trunk/.classpath 2008-03-19 21:46:37 UTC (rev 10337)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
<classpathentry kind="src" path="portlet/src/main/java"/>
<classpathentry kind="src" path="bridge/src/main/java"/>
<classpathentry kind="src" path="controller/src/main/java"/>
@@ -11,5 +10,6 @@
<classpathentry kind="src" path="portlet/src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/home/theute/Java/jdk1.5.0_08/lib/tools.jar"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
<classpathentry kind="output" path="bin"/>
</classpath>
16 years, 3 months
JBoss Portal SVN: r10336 - modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-19 15:16:51 -0400 (Wed, 19 Mar 2008)
New Revision: 10336
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js
Log:
quick collapse onload looks better
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js 2008-03-19 18:05:25 UTC (rev 10335)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js 2008-03-19 19:16:51 UTC (rev 10336)
@@ -47,8 +47,9 @@
for (var i=0; i < targets.length; i++){
try{
var target = targets[i].id.substring(0,targets[i].id.lastIndexOf('-target'));
- $('expand-' + target).hide();
- Effect.Appear('contract-' + target, { duration: 0.0 });
+ $('contract-' + target).hide();
+ new Effect.BlindUp(target + '-target', { duration: 0.0 });
+ Effect.Appear('expand-' + target, { duration: 0.0 });
}catch(e){
// alert(e);
}
16 years, 3 months
JBoss Portal SVN: r10335 - modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-19 14:05:25 -0400 (Wed, 19 Mar 2008)
New Revision: 10335
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js
Log:
remove collapse onload
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js 2008-03-19 14:33:37 UTC (rev 10334)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/admin.js 2008-03-19 18:05:25 UTC (rev 10335)
@@ -42,5 +42,15 @@
//collapse all on page load
window.onload = function(){
- collapseAll()
+// collapseAll()
+ var targets = document.getElementsByClassName('target');
+ for (var i=0; i < targets.length; i++){
+ try{
+ var target = targets[i].id.substring(0,targets[i].id.lastIndexOf('-target'));
+ $('expand-' + target).hide();
+ Effect.Appear('contract-' + target, { duration: 0.0 });
+ }catch(e){
+// alert(e);
+ }
+ }
};
\ No newline at end of file
16 years, 3 months
JBoss Portal SVN: r10334 - in modules/portlet/trunk/portlet: src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl and 5 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-03-19 10:33:37 -0400 (Wed, 19 Mar 2008)
New Revision: 10334
Modified:
modules/portlet/trunk/portlet/pom.xml
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/EscapeXMLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/URLWriteThrowsIOExceptionTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/userinformation/NullProfileForUnauthenticatedIdentityTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/TestCaseAnnotationProcessor.java
Log:
- jsr286 --> jsr168 assertion mappings
- improved test coverage report generation
- start on api assertions
Modified: modules/portlet/trunk/portlet/pom.xml
===================================================================
--- modules/portlet/trunk/portlet/pom.xml 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/pom.xml 2008-03-19 14:33:37 UTC (rev 10334)
@@ -153,22 +153,6 @@
<build>
<plugins>
- <!--<plugin>-->
- <!--<groupId>org.apache.maven.plugins</groupId>-->
- <!--<artifactId>maven-compiler-plugin</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<goals>-->
- <!--<goal>testCompile</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--<configuration>-->
- <!--<testExcludes>-->
- <!--<exclude>org/jboss/portal/unit/reports/*</exclude>-->
- <!--</testExcludes>-->
- <!--</configuration>-->
- <!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -220,26 +204,6 @@
</configuration>
</plugin>
- <!--<plugin>-->
- <!--<groupId>org.apache.myfaces.tobago</groupId>-->
- <!--<artifactId>maven-apt-plugin</artifactId>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<phase>test</phase>-->
- <!--<configuration>-->
- <!--<generated>.apt_generated</generated>-->
- <!--<aptOptions>x=3</aptOptions>-->
- <!--<target>1.5</target>-->
- <!--<nocompile>true</nocompile>-->
- <!--<showWarnings>true</showWarnings>-->
- <!--<factory>org.jboss.portal.unit.reports.TestCaseAPF</factory>-->
- <!--</configuration>-->
- <!--<goals>-->
- <!--<goal>testExecute</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--</plugin>-->
</plugins>
</build>
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/EscapeXMLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/EscapeXMLTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/EscapeXMLTestCase.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -46,7 +46,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-(a)TestCase(Assertion.API_BASE_URL_1)
+(a)TestCase(Assertion.API286_BASE_URL_5)
public class EscapeXMLTestCase
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/URLWriteThrowsIOExceptionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/URLWriteThrowsIOExceptionTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/api/portleturl/URLWriteThrowsIOExceptionTestCase.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -44,7 +44,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-(a)TestCase(Assertion.API_BASE_URL_2)
+(a)TestCase(Assertion.API286_BASE_URL_5)
public class URLWriteThrowsIOExceptionTestCase
{
public URLWriteThrowsIOExceptionTestCase(PortletTestCase seq)
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/PublicRenderParameterTestCase.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -59,7 +59,7 @@
* @version $Revision: 630 $
*/
@TestCase({
- Assertion.JSR168_1000
+ Assertion.JSR286_125
})
public class PublicRenderParameterTestCase
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/resourceserving/ResourceServingTestCase.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -50,7 +50,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-(a)TestCase({Assertion.JSR168_1000})
+(a)TestCase({Assertion.JSR286_123,Assertion.JSR286_125})
public class ResourceServingTestCase
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/userinformation/NullProfileForUnauthenticatedIdentityTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/userinformation/NullProfileForUnauthenticatedIdentityTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/userinformation/NullProfileForUnauthenticatedIdentityTestCase.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -45,7 +45,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-(a)TestCase(/*Assertion.JSR286_302*/)
+(a)TestCase({Assertion.JSR286_302})
public class NullProfileForUnauthenticatedIdentityTestCase
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -24,6 +24,56 @@
import javax.portlet.PortletURL;
import javax.portlet.BaseURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.CacheControl;
+import javax.portlet.ClientDataRequest;
+import javax.portlet.Event;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.MimeResponse;
+import javax.portlet.PortalContext;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletSessionUtil;
+import javax.portlet.PortletURLGenerationListener;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ProcessAction;
+import javax.portlet.ProcessEvent;
+import javax.portlet.RenderMode;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceServingPortlet;
+import javax.portlet.ResourceURL;
+import javax.portlet.StateAwareResponse;
+import javax.portlet.WindowState;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.ActionRequestWrapper;
+import javax.portlet.filter.ActionResponseWrapper;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.EventRequestWrapper;
+import javax.portlet.filter.EventResponseWrapper;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.filter.PortletFilter;
+import javax.portlet.filter.RenderRequestWrapper;
+import javax.portlet.filter.RenderResponseWrapper;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.ResourceRequestWrapper;
+import javax.portlet.filter.ResourceResponseWrapper;
/**
* Define TCK assertions.
@@ -45,6 +95,9 @@
JSR168_6(new TCK(6), "The destroy method must not be called because the initialization is" +
" considered unsuccessful."),
+
+ JSR168_7(new TCK(7),""),
+
JSR168_8(new TCK(8), "A RuntimeException thrown during initialization must be handled as a" +
" PortletException."),
@@ -70,14 +123,20 @@
" method must not be invoked within the current client request"),
JSR168_18(new TCK(18), Status.disabled("spec?"), "If a permanent unavailability is indicated by the UnavailableException, the" +
- " portlet container must remove the portlet from service immediately, call the portlet�s destroy method, and release" +
+ " portlet container must remove the portlet from service immediately, call the portlet's destroy method, and release" +
" the portlet object."),
JSR168_19(new TCK(19), Status.disabled("spec?"), "A RuntimeException thrown during the request handling must be handled as a" +
" PortletException"),
- JSR168_24(new TCK(24), ""),
+ JSR168_24(new TCK(24), "If the root resource bundle does not contain the resources for these values and " +
+ "the values are defined inline, the portlet container must add the inline values as resources of the root " +
+ "resource bundle."),
+ JSR168_25(new TCK(25), "If the portlet definition does not define a resource bundle and the information" +
+ " is defined inline in the deployment descriptor, the portlet container must create a ResourceBundle and populate" +
+ " it, with the inline values, using the keys defined in the PLT.25.10 Resource Bundles Section."),
+
JSR168_26(new TCK(26), "A render URL is an optimization for a special type of action URLs. The" +
" portal/portletcontainer must not invoke the processAction method of the targeted portlet."),
@@ -177,7 +236,7 @@
JSR168_60(new TCK(60), "If the user is not authenticated the getAuthType method must return null"),
JSR168_61(new TCK(61), "If the portlet container supports additional content types for the" +
- " portlet�s output, it must declare the additional content types through the getResponseContentTypes method of the" +
+ " portlet's output, it must declare the additional content types through the getResponseContentTypes method of the" +
" request object. The returned Enumeration of strings should contain the content types the portlet container" +
" supports in order of preference. The first element of the enumeration must be the same content type returned by" +
" the getResponseContentType method."),
@@ -291,7 +350,7 @@
JSR168_95(new TCK(95), Status.postponed("why?"), ""),
JSR168_96(new TCK(96), "All changes made to PortletPreferences object not followed by a call to" +
- " the store method must be discarded when the portlet finishes the 20 processAction method."),
+ " the store method must be discarded when the portlet finishes the processAction method."),
JSR168_97(new TCK(97), "If the store method is invoked within the scope of a render method" +
" invocation, it must throw an IllegalStateException."),
@@ -328,6 +387,11 @@
JSR168_107(new TCK(107), "In addition, if within these portlet requests more than one portlet" +
" creates a session, the session object must be the same for all the portlets in the same portlet application"),
+ JSR168_108(new TCK(108), "PortletSession objects must be scoped at the portlet application context level."),
+
+ JSR168_109(new TCK(109), "The portlet container must not share the PortletSession object or the " +
+ "attributes stored in it among different portlet applications or among different user sessions."),
+
JSR168_110(new TCK(110), "Any object stored in the session using the APPLICATION_SCOPE is" +
" available to any other portlet that belongs to the same portlet application and that handles a request identified" +
" as being a part of the same session."),
@@ -364,7 +428,7 @@
JSR168_120(new TCK(120), Status.jbossUntestable("why?"), ""),
JSR168_121(new TCK(121), "The getRequestDispatcher method takes a String argument describing a" +
- " path within the scope of the PortletContext of a portlet application. This path must begin with a �/� and it is" +
+ " path within the scope of the PortletContext of a portlet application. This path must begin with a / and it is" +
" relative to the PortletContext root."),
JSR168_122(new TCK(122), "The getNamedDispatcher method takes a String argument indicating the" +
@@ -431,8 +495,6 @@
// ******************************************************************************************************************
- JSR168_1000(new TCK(1000), "todo ???"),
-
// PLT.2 Overview
JSR286_1(new TCK(1, "PLT.2.5"), Status.specUntestable(""), "Portlet V2.0 containers must support deploying JSR 168 portlets and the JSR 168 deployment descriptor"),
@@ -443,20 +505,20 @@
JSR286_3(new TCK(3, "PLT.5.1"), Status.specUntestable(""), "In the case where a portlet is deployed as part of a" +
" portlet application marked as distributable, in the web.xml deployment descriptor, a portlet container may " +
"instantiate only one portlet object per portlet definition -in the deployment descriptor- per virtual machine (VM)."),
- JSR286_4(new TCK(4, "PLT.5.2.1"), "The portlet container must load the portlet class using the same ClassLoader " +
+ JSR286_4(new TCK(4, "PLT.5.2.1"), Status.specUntestable(""), "The portlet container must load the portlet class using the same ClassLoader " +
"the servlet container uses for the web application part of the portlet application."),
- JSR286_5(new TCK(5, "PLT.5.2.2"), "After the portlet object is instantiated, the portlet container must initialize " +
+ JSR286_5(new TCK(5, "PLT.5.2.2"), JSR168_4, "After the portlet object is instantiated, the portlet container must initialize " +
"the portlet before invoking it to handle requests."),
- JSR286_6(new TCK(6, "PLT.5.2.2.1"), "During initialization, the portlet object may throw an UnavailableException " +
+ JSR286_6(new TCK(6, "PLT.5.2.2.1"), JSR168_5, "During initialization, the portlet object may throw an UnavailableException " +
"or a PortletException. In this case, the portlet container must not place the portlet object into active " +
"service and it must release the portlet object."),
- JSR286_7(new TCK(7, "PLT.5.2.2.1"), "The destroy method must not be called because the initialization is considered " +
+ JSR286_7(new TCK(7, "PLT.5.2.2.1"), JSR168_6, "The destroy method must not be called because the initialization is considered " +
"unsuccessful."),
- JSR286_8(new TCK(8, "PLT.5.2.2.1"), "The portlet container may reattempt to instantiate and initialize the portlets " +
+ JSR286_8(new TCK(8, "PLT.5.2.2.1"), JSR168_7, "The portlet container may reattempt to instantiate and initialize the portlets " +
"at any time after a failure. The exception to this rule is when an UnavailableException indicates a minimum time " +
"of unavailability. When this happens the portlet container must wait for 30 the specified time to pass before " +
"creating and initializing a new portlet object."),
- JSR286_9(new TCK(9, "PLT.5.2.2.1"), "A RuntimeException thrown during initialization must be handled as a " +
+ JSR286_9(new TCK(9, "PLT.5.2.2.1"), JSR168_8, "A RuntimeException thrown during initialization must be handled as a " +
"PortletException."),
JSR286_10(new TCK(10, "PLT.5.2.3"), Status.specUntestable(""), "Once the destroy method is called on a portlet " +
"object, the portlet container must not route any requests to that portlet object."),
@@ -467,13 +529,13 @@
"destroyed."),
JSR286_13(new TCK(13, "PLT.5.2.3"), Status.specUntestable(""), "After the destroy method completes, the portlet " +
"container must release the portlet object so that it is eligible for garbage collection."),
- JSR286_14(new TCK(14, "PLT.5.4"), "If the client request is triggered by an action URL, the portal/portlet-container " +
+ JSR286_14(new TCK(14, "PLT.5.4"), JSR168_9, "If the client request is triggered by an action URL, the portal/portlet-container " +
"must first trigger the action request by invoking the processAction method of the targeted portlet."),
JSR286_15(new TCK(15, "PLT.5.4"), "The portal/portlet-container must wait until the action request finishes. Then, " +
"the portal/portlet-container should call the processEvent methods of the event receiving portlets and after the " +
"event processing is finished must trigger the render request by invoking the render method for all the portlets " +
"in the portal page with the possible exception of portlets for which their content is being cached."),
- JSR286_16(new TCK(16, "PLT.5.4"), "If the client request is triggered by a render URL, the portal/portlet-container " +
+ JSR286_16(new TCK(16, "PLT.5.4"), JSR168_11, "If the client request is triggered by a render URL, the portal/portlet-container " +
"must invoke the render method for all the portlets in the portal page with the possible exception of portlets " +
"for which their content is being cached."),
JSR286_17(new TCK(17, "PLT.5.4"), "If the client request is triggered by a resource URL, the portal/portlet-container " +
@@ -494,14 +556,14 @@
JSR286_24(new TCK(24, "PLT.5.4.7"), Status.specUntestable(""), "If a permanent unavailability is indicated by the " +
"UnavailableException, the portlet container must remove the portlet from service immediately, call the portlet’s " +
"destroy method, and release the portlet object"),
- JSR286_25(new TCK(25, "PLT.5.4.7"), "A RuntimeException thrown during the request handling must be handled as a " +
+ JSR286_25(new TCK(25, "PLT.5.4.7"), JSR168_19, "A RuntimeException thrown during the request handling must be handled as a " +
"PortletException."),
// PLT.6 Portlet Config
- JSR286_26(new TCK(26, "PLT.6.2"), "If the root resource bundle does not contain the resources for these values and " +
+ JSR286_26(new TCK(26, "PLT.6.2"), JSR168_24, "If the root resource bundle does not contain the resources for these values and " +
"the values are defined inline, the portlet container must add the inline values as resources of the root " +
"resource bundle."),
- JSR286_27(new TCK(27, "PLT.6.2"), "If the portlet definition does not define a resource bundle and the information" +
+ JSR286_27(new TCK(27, "PLT.6.2"), JSR168_25, "If the portlet definition does not define a resource bundle and the information" +
" is defined inline in the deployment descriptor, the portlet container must create a ResourceBundle and populate" +
" it, with the inline values, using the keys defined in the PLT.25.10 Resource Bundles Section."),
JSR286_28(new TCK(28, "PLT.6.3"), "The getDefaultNamespace method of the PortletConfig interface returns the " +
@@ -530,30 +592,30 @@
// PLT,7 Portlet URLs
- JSR286_35(new TCK(35, "PLT.7.1"), "The portal/portlet-container must not invoke the processAction method of the " +
+ JSR286_35(new TCK(35, "PLT.7.1"), JSR168_26, "The portal/portlet-container must not invoke the processAction method of the " +
"targeted portlet of a render URL."),
- JSR286_36(new TCK(36, "PLT.7.1"), "The portal/portlet-container must ensure that all the parameters set when " +
+ JSR286_36(new TCK(36, "PLT.7.1"), JSR168_27, "The portal/portlet-container must ensure that all the parameters set when " +
"constructing the render URL become render parameters of the subsequent render requests for the portlet."),
- JSR286_37(new TCK(37, "PLT.7.1.1"), "A call to any of the setParameter methods must replace any parameter with " +
+ JSR286_37(new TCK(37, "PLT.7.1.1"), JSR168_28, "A call to any of the setParameter methods must replace any parameter with " +
"the same name previously set."),
JSR286_38(new TCK(38, "PLT.7.1.1"), "All the parameters a portlet adds to a BaseURL object must be made available " +
"to the portlet as request parameters."),
- JSR286_39(new TCK(39, "PLT.7.1.1"), "The portlet-container must “x-www-form-urlencoded” encode parameter names and " +
+ JSR286_39(new TCK(39, "PLT.7.1.1"), JSR168_30, "The portlet-container must “x-www-form-urlencoded” encode parameter names and " +
"values added to a BaseURL object."),
- JSR286_40(new TCK(40, "PLT.7.1.1"), "If a portal/portlet-container encodes additional information as parameters, it " +
+ JSR286_40(new TCK(40, "PLT.7.1.1"), JSR168_31, "If a portal/portlet-container encodes additional information as parameters, it " +
"must namespace them properly to avoid collisions with the parameters set and used by the portlet."),
- JSR286_41(new TCK(41, "PLT.7.1.2"), "A portlet cannot create a portlet URL using a portlet mode that is not defined " +
+ JSR286_41(new TCK(41, "PLT.7.1.2"), JSR168_32, "A portlet cannot create a portlet URL using a portlet mode that is not defined " +
"as supported by the portlet or that the user it is not allowed to use. The setPortletMode methods must throw a " +
"PortletModeException in that situation."),
JSR286_42(new TCK(42, "PLT.7.1.2"), "The change of portlet mode must be effective for the request triggered by the " +
"portlet URL."),
JSR286_43(new TCK(43, "PLT.7.1.2"), "If the portlet mode is not set for a URL, it must have the portlet mode of the " +
"current request as default."),
- JSR286_44(new TCK(45, "PLT.7.1.2"), "A portlet cannot create a portlet URL using a window state that is not supported " +
+ JSR286_44(new TCK(45, "PLT.7.1.2"), JSR168_34, "A portlet cannot create a portlet URL using a window state that is not supported " +
"by the portlet container. The setWindowState method must throw a WindowStateException if that is the case."),
JSR286_45(new TCK(44, "PLT.7.1.2"), "If the window state is not set for a URL, it must have the window state of the " +
"current request as default."),
- JSR286_46(new TCK(46, "PLT.7.1.3"), "If setSecure is called with true, the transport for the request triggered with " +
+ JSR286_46(new TCK(46, "PLT.7.1.3"), JSR168_35, "If setSecure is called with true, the transport for the request triggered with " +
"this URL must be secure (i.e. HTTPS)."),
JSR286_47(new TCK(47, "PLT.7.2.1"), "If the portlet application has specified one or more PortletURLGenerationListener " +
"classes in the portlet deployment descriptor the portlet container must call: the method filterActionURL method for " +
@@ -575,9 +637,9 @@
JSR286_52(new TCK(52, "PLT.8.5"), "If no matching annotated method is found GenericPortlet will dispatch to the " +
"doView, doEdit or doHelp method depending on the portlet mode indicated in the request using the doDispatch " +
"method or throws a PortletException if the mode is not VIEW, EDIT, or HELP."),
- JSR286_53(new TCK(53, "PLT.8.6"), "As all portlets must support the VIEW portlet mode, VIEW does not have to be " +
+ JSR286_53(new TCK(53, "PLT.8.6"), JSR168_37, "As all portlets must support the VIEW portlet mode, VIEW does not have to be " +
"indicated."),
- JSR286_54(new TCK(54, "PLT.8.6"), "The portlet must not be invoked in a portlet mode that has not been declared " +
+ JSR286_54(new TCK(54, "PLT.8.6"), JSR168_38, "The portlet must not be invoked in a portlet mode that has not been declared " +
"as supported for a given markup type."),
JSR286_55(new TCK(55, "PLT.8.6"), Status.specUntestable(""), "The portlet container must ignore all references to " +
"custom portlet modes that are not supported by the portal implementation, or that have no mapping to portlet " +
@@ -585,7 +647,7 @@
// PLT.9 Window States
- JSR286_56(new TCK(56, "PLT.9.4"), "If a custom window state defined in the deployment descriptor is not mapped to " +
+ JSR286_56(new TCK(56, "PLT.9.4"), JSR168_40, "If a custom window state defined in the deployment descriptor is not mapped to " +
"a custom window state provided by the portal, portlets must not be invoked in that window state."),
JSR286_57(new TCK(57, "PLT.9.5"), "As all portlets must at least support the pre-defined window states NORMAL, " +
"MAXIMIZED, MINIMIZED, these window states do not have to be indicated."),
@@ -599,13 +661,13 @@
"associated with each portlet application deployed into a portlet container."),
JSR286_60(new TCK(60, "PLT.10.1"), Status.specUntestable(""), "In cases where the container is distributed over many " +
"virtual machines, a portlet application will have an instance of the PortletContext interface for each VM."),
- JSR286_61(new TCK(61, "PLT.10.3"), "The initialization parameters accessible through the PortletContext must be the " +
+ JSR286_61(new TCK(61, "PLT.10.3"), JSR168_43, "The initialization parameters accessible through the PortletContext must be the " +
"same that are accessible through the ServletContext of the portlet application."),
- JSR286_62(new TCK(62, "PLT.10.3"), "A direct consequence of this is that data stored in the ServletContext by " +
+ JSR286_62(new TCK(62, "PLT.10.3"), JSR168_44, "A direct consequence of this is that data stored in the ServletContext by " +
"servlets or JSPs is accessible to portlets through the PortletContext and vice versa."),
- JSR286_63(new TCK(63, "PLT.10.3"), "The PortletContext must offer access to the same set of resources the " +
+ JSR286_63(new TCK(63, "PLT.10.3"), JSR168_45, "The PortletContext must offer access to the same set of resources the " +
"ServletContext exposes."),
- JSR286_64(new TCK(64, "PLT.10.3"), "It must be accessible as a context attribute using the same constant " +
+ JSR286_64(new TCK(64, "PLT.10.3"), JSR168_46, "It must be accessible as a context attribute using the same constant " +
"defined in the Servlet Specification SVR 3 Servlet Context Chapter, javax.servlet.context.tempdir."),
JSR286_65(new TCK(64, "PLT.10.3"), "The portlet context must follow the same behavior and functionality that " +
"the servlet context has for virtual hosting and reloading considerations. (see Servlet Specification SVR 3 " +
@@ -701,22 +763,22 @@
// PLT.12 Portlet Responses
- JSR286_100(new TCK(100, "PLT.12.1.3"), "The getNamespace method must provide the portlet with a mechanism that " +
+ JSR286_100(new TCK(100, "PLT.12.1.3"), JSR168_86, "The getNamespace method must provide the portlet with a mechanism that " +
"ensures the uniqueness of the returned string in the whole portal page"),
JSR286_101(new TCK(101, "PLT.12.1.3"), "The getNamespace method must return the same value for the lifetime of " +
"the portlet window."),
- JSR286_102(new TCK(102, "PLT.12.1.3"), "The getNamespace method must return a valid identifier as defined in the " +
+ JSR286_102(new TCK(102, "PLT.12.1.3"), JSR168_88, "The getNamespace method must return a valid identifier as defined in the " +
"3.8 Identifier Section of the Java Language Specification Second Edition."),
- JSR286_103(new TCK(103, "PLT.12.2.1"), "A call to any of the setRenderParameter methods must replace any " +
+ JSR286_103(new TCK(103, "PLT.12.2.1"), JSR168_72, "A call to any of the setRenderParameter methods must replace any " +
"parameter with the same name previously set."),
- JSR286_104(new TCK(104, "PLT.12.2.2"), "If a portlet attempts to set a portlet mode that it is not allowed to switch " +
+ JSR286_104(new TCK(104, "PLT.12.2.2"), JSR168_69, "If a portlet attempts to set a portlet mode that it is not allowed to switch " +
"to, a PortletModeException must be thrown."),
- JSR286_105(new TCK(105, "PLT.12.2.2"), "If a portlet attempts to set a window state that it is not allowed to switch " +
+ JSR286_105(new TCK(105, "PLT.12.2.2"), JSR168_68, "If a portlet attempts to set a window state that it is not allowed to switch " +
"to, a WindowStateException must be thrown."),
- JSR286_106(new TCK(106, "PLT.12.3.1"), "The sendRedirect(String location) method instructs the portal/portlet-container " +
+ JSR286_106(new TCK(106, "PLT.12.3.1"), JSR168_65, "The sendRedirect(String location) method instructs the portal/portlet-container " +
"to set the appropriate headers and content body to redirect the user to a different URL. A fully qualified URL " +
"or a full path URL must be specified. If a relative path URL is given, an IllegalArgumentException must be thrown."),
- JSR286_107(new TCK(107, "PLT.12.3.1"), "If the sendRedirect(String location) method is called after the setPortletMode, " +
+ JSR286_107(new TCK(107, "PLT.12.3.1"), JSR168_66, "If the sendRedirect(String location) method is called after the setPortletMode, " +
"setWindowState, setRenderParameter or setRenderParameters methods of the ActionResponse interface, an " +
"IllegalStateException must be thrown and the redirection must not be executed."),
JSR286_108(new TCK(108, "PLT.12.3.1"), "If a relative path URL is given, an IllegalArgumentException must be thrown."),
@@ -726,22 +788,22 @@
"key provided with the renderUrlParamName parameter."),
JSR286_111(new TCK(111, "PLT.12.3.1"), "New values for portlet mode, window state, private or public render " +
"parameters must be encoded in the attached render URLcxi,"),
- JSR286_112(new TCK(112, "PLT.12.3.1"), "For the render response the setContentType method must throw an " +
+ JSR286_112(new TCK(112, "PLT.12.3.1"), JSR168_76, "For the render response the setContentType method must throw an " +
"IllegalArgumentException if the content type set does not match (including wildcard matching) any of the " +
"content types returned by the getResponseContentType method of the PortletRequest objectcxii."),
- JSR286_113(new TCK(113, "PLT.12.3.1"), "If the portlet has set a content type, the getContentType method must " +
+ JSR286_113(new TCK(113, "PLT.12.3.1"), JSR168_78, "If the portlet has set a content type, the getContentType method must " +
"return it. Otherwise, the getContentType method must return null."),
- JSR286_114(new TCK(114, "PLT.12.5.2"), "A portlet may generate its content by writing to the OutputStream or to " +
+ JSR286_114(new TCK(114, "PLT.12.5.2"), JSR168_79, "A portlet may generate its content by writing to the OutputStream or to " +
"the Writer of the MimeResponse object. A portlet must use only one of these objects. The portlet container must " +
"throw an IllegalStateException if a portlet attempts to use both."),
- JSR286_115(new TCK(115, "PLT.12.5.5"), "The getBufferSize method returns the size of the underlying buffer being " +
+ JSR286_115(new TCK(115, "PLT.12.5.5"), JSR168_80, "The getBufferSize method returns the size of the underlying buffer being " +
"used. If no buffering is being used, this method must return the int value of 0 (zero)."),
- JSR286_116(new TCK(116, "PLT.12.5.5"), "The portlet can request a preferred buffer size by using the setBufferSize " +
+ JSR286_116(new TCK(116, "PLT.12.5.5"), JSR168_81, "The portlet can request a preferred buffer size by using the setBufferSize " +
"method. The buffer assigned is not required to be the size requested by the portlet, but must be at least as " +
"large as the size requested."),
- JSR286_117(new TCK(117, "PLT.12.5.5"), "The reset method clears data in the buffer when the response is not " +
+ JSR286_117(new TCK(117, "PLT.12.5.5"), JSR168_82, "The reset method clears data in the buffer when the response is not " +
"committed. Properties set by the portlet prior to the reset call must be cleared as well."),
- JSR286_118(new TCK(118, "PLT.12.5.5"), "If the response is committed and the reset or resetBuffer method is called, " +
+ JSR286_118(new TCK(118, "PLT.12.5.5"), JSR168_83, "If the response is committed and the reset or resetBuffer method is called, " +
"an IllegalStateException must be thrown."),
JSR286_119(new TCK(119, "PLT.12.5.5"), "The response and its associated buffer must be unchanged."),
JSR286_120(new TCK(120, "PLT.12.5.5"), "When using a buffer, the container must immediately flush the contents of " +
@@ -817,73 +879,74 @@
// PLT.17 Portlet Preferences
JSR286_148(new TCK(148, "PLT.17.1"), "Preferences attributes can be set to null"),
- JSR286_149(new TCK(149, "PLT.17.1"), "Preferences values must not be modified if the values in the Map are altered"),
- JSR286_150(new TCK(150, "PLT.17.1"), "The reset method must reset a preference attribute to its default value. " +
+ JSR286_149(new TCK(149, "PLT.17.1"), JSR168_91, "Preferences values must not be modified if the values in the Map are altered"),
+ JSR286_150(new TCK(150, "PLT.17.1"), JSR168_92, "The reset method must reset a preference attribute to its default value. " +
"If there is no default value, the preference attribute must be deleted."),
- JSR286_151(new TCK(151, "PLT.17.1"), "If a preference attribute is read only, the setValue, setValues and reset " +
+ JSR286_151(new TCK(151, "PLT.17.1"), JSR168_93, "If a preference attribute is read only, the setValue, setValues and reset " +
"methods must throw a ReadOnlyException when the portlet is in any of the standard modes."),
- JSR286_152(new TCK(152, "PLT.17.1"), "The store method must persist all the changes made to the PortletPreferences " +
+ JSR286_152(new TCK(152, "PLT.17.1"), JSR168_94, "The store method must persist all the changes made to the PortletPreferences " +
"object in the persistent store."),
- JSR286_153(new TCK(153, "PLT.17.1"), "The store method must be conducted as an atomic transaction regardless of how " +
+ JSR286_153(new TCK(153, "PLT.17.1"), JSR168_95, "The store method must be conducted as an atomic transaction regardless of how " +
"many preference attributes have been modified."),
JSR286_154(new TCK(154, "PLT.17.1"), "All changes made to PortletPreferences object not followed by a call to the " +
"store method must be discarded when the portlet finishes the processAction, processEvent, or serveResource method."),
- JSR286_155(new TCK(155, "PLT.17.1"), "If the store method is invoked within the scope of a render method invocation, " +
+ JSR286_155(new TCK(155, "PLT.17.1"), JSR168_97, "If the store method is invoked within the scope of a render method invocation, " +
"it must throw an IllegalStateException."),
JSR286_156(new TCK(156, "PLT.17.1"), "The PortletPreferences object must reflect the current values of the " +
"persistent store when the portlet container invokes the processAction, processEvent, render and serveResource " +
"methods of the portlet."),
- JSR286_157(new TCK(157, "PLT.17.3"), "If a preference attribute definition does not contain the read-only element " +
+ JSR286_157(new TCK(157, "PLT.17.3"), JSR168_99, "If a preference attribute definition does not contain the read-only element " +
"set to true, the preference attribute is modifiable when the portlet is processing an action request in any " +
"of the standard portlet modes (VIEW, EDIT or HELP)."),
- JSR286_158(new TCK(158, "PLT.17.3"), "Portlets are not restricted to use preference attributes defined in the " +
+ JSR286_158(new TCK(158, "PLT.17.3"), JSR168_100, "Portlets are not restricted to use preference attributes defined in the " +
"deployment descriptor. They can programmatically add preference attributes using names not defined in the " +
"deployment descriptor. These preferences attributes must be treated as modifiable attributes."),
- JSR286_159(new TCK(159, "PLT.17.4"), "When a validator is associated with the preferences of a portlet definition, " +
+ JSR286_159(new TCK(159, "PLT.17.4"), JSR168_103, "When a validator is associated with the preferences of a portlet definition, " +
"the store method of the PortletPreferences implementation must invoke the validate method of the validator " +
"before writing the changes to the persistent store."),
- JSR286_160(new TCK(160, "PLT.17.4"), "If a ValidatorException is thrown, the portlet container must cancel the " +
+ JSR286_160(new TCK(160, "PLT.17.4"), JSR168_104, "If a ValidatorException is thrown, the portlet container must cancel the " +
"store operation and it must propagate the exception to the portlet."),
- JSR286_161(new TCK(161, "PLT.17.4"), "If the validation is successful, the store operation must be completed"),
+ JSR286_161(new TCK(161, "PLT.17.4"), JSR168_105, "If the validation is successful, the store operation must be completed"),
// PLT.18 Sessions
- JSR286_162(new TCK(162, "PLT.18.1"), "For portlets within the same portlet application, a portlet container must " +
+ JSR286_162(new TCK(162, "PLT.18.1"), JSR168_106, "For portlets within the same portlet application, a portlet container must " +
"ensure that every portlet request generated as result of a group of requests originated from the portal to " +
"complete a single client request receive or acquire the same session."),
- JSR286_163(new TCK(163, "PLT.18.1"), "In addition, if within these portlet requests more than one portlet creates " +
+ JSR286_163(new TCK(163, "PLT.18.1"), JSR168_107, "In addition, if within these portlet requests more than one portlet creates " +
"a session, the session object must be the same for all the portlets in the same portlet application"),
- JSR286_164(new TCK(164, "PLT.18.2"), "PortletSession objects must be scoped at the portlet application context level."),
- JSR286_165(new TCK(165, "PLT.18.2"), "The portlet container must not share the PortletSession object or the " +
+ JSR286_164(new TCK(164, "PLT.18.2"), JSR168_108, "PortletSession objects must be scoped at the portlet application context level."),
+ JSR286_165(new TCK(165, "PLT.18.2"), JSR168_109, "The portlet container must not share the PortletSession object or the " +
"attributes stored in it among different portlet applications or among different user sessions."),
- JSR286_166(new TCK(166, "PLT.18.3"), "Any object stored in the session using the APPLICATION_SCOPE is available " +
+ JSR286_166(new TCK(166, "PLT.18.3"), JSR168_110, "Any object stored in the session using the APPLICATION_SCOPE is available " +
"to any other portlet that belongs to the same portlet application and that handles a request identified as " +
"being a part of the same session."),
- JSR286_167(new TCK(167, "PLT.18.3"), "Objects stored in the session using the PORTLET_SCOPE must be available to " +
+ JSR286_167(new TCK(167, "PLT.18.3"), JSR168_111, "Objects stored in the session using the PORTLET_SCOPE must be available to " +
"the portlet during requests for the same portlet window that the objects where stored from."),
JSR286_168(new TCK(168, "PLT.18.3"), "The object must be stored in the APPLICATION_SCOPE with the following " +
"fabricated attribute name ‘javax.portlet.p.<ID>?<ATTRIBUTE_NAME>’. <ID> is a unique identification for the " +
- "portlet window (assigned by the portal/portlet-container) that must be equal to the ID returned by the PortletRequest.getWindowID() method and not contain a ‘?’ character."),
- JSR286_169(new TCK(169, "PLT.18.4"), "The container must ensure that all attributes placed in the PortletSession " +
+ "portlet window (assigned by the portal/portlet-container) that must be equal to the ID returned by the" +
+ " PortletRequest.getWindowID() method and not contain a ‘?’ character."),
+ JSR286_169(new TCK(169, "PLT.18.4"), JSR168_113, "The container must ensure that all attributes placed in the PortletSession " +
"are also available in the HttpSession of the portlet application. A direct consequence of this is that data " +
"stored in the HttpSession by servlets or JSPs of the Portlet Application is accessible to portlets through " +
"the PortletSession in the portlet application scope."),
- JSR286_170(new TCK(170, "PLT.18.4"), "Conversely, data stored by portlets in the PortletSession in the portlet " +
+ JSR286_170(new TCK(170, "PLT.18.4"), JSR168_114, "Conversely, data stored by portlets in the PortletSession in the portlet " +
"application scope is accessible to servlets and JSPs through the HttpSession."),
- JSR286_171(new TCK(171, "PLT.18.4"), "If the HttpSession object is invalidated, the PortletSession object must " +
+ JSR286_171(new TCK(171, "PLT.18.4"), JSR168_115, "If the HttpSession object is invalidated, the PortletSession object must " +
"also be invalidated by the portlet container."),
- JSR286_172(new TCK(172, "PLT.18.4"), "If the PortletSession object is invalidated by a portlet, the portlet " +
+ JSR286_172(new TCK(172, "PLT.18.4"), JSR168_116, "If the PortletSession object is invalidated by a portlet, the portlet " +
"container must invalidate the associated HttpSession object."),
- JSR286_173(new TCK(173, "PLT.18.4.1"), "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
+ JSR286_173(new TCK(173, "PLT.18.4.1"), JSR168_117, "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
"methods of the PortletSession interface must provide the same functionality as the methods of the HttpSession " +
"interface with identical names adhering to the following rules: The attribute names must be the same if " +
"APPLICATION_SCOPE scope is used."),
- JSR286_174(new TCK(174, "PLT.18.4.1"), "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
+ JSR286_174(new TCK(174, "PLT.18.4.1"), JSR168_118, "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
"methods of the PortletSession interface must provide the same functionality as the methods of the HttpSession " +
"interface with identical names adhering to the following rules: The attribute name has to conform with the " +
"specified prefixing if PORTLET_SCOPE is used."),
- JSR286_175(new TCK(175, "PLT.18.4.1"), "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
+ JSR286_175(new TCK(175, "PLT.18.4.1"), JSR168_119, "The getAttribute, setAttribute, removeAttribute and getAttributeNames " +
"methods of the PortletSession interface must provide the same functionality as the methods of the HttpSession " +
"interface with identical names adhering to the following rules: The variant of these methods that does not " +
"receive a scope must be treated as PORTLET_SCOPE."),
@@ -1249,16 +1312,21 @@
// PLT.24 Security
- JSR286_307(new TCK(307, "PLT.24.2"), "The values that the Portlet API getRemoteUser and getUserPrincipal methods " +
+ JSR286_307(new TCK(307, "PLT.24.2"), Status.postponed("No security/auth tests for now"), "The values that the Portlet" +
+ " API getRemoteUser and getUserPrincipal methods " +
"return the same values returned by the equivalent methods of the servlet response object."),
- JSR286_308(new TCK(308, "PLT.24.3"), "The container uses the mapping of security-role-ref to security-role when " +
+ JSR286_308(new TCK(308, "PLT.24.3"), Status.postponed("No security/auth tests for now"), "The container uses the " +
+ "mapping of security-role-ref to security-role when " +
"determining the return value of the call."),
- JSR286_309(new TCK(309, "PLT.24.3"), "If the security-role-ref element does not define a role-link element, the " +
+ JSR286_309(new TCK(309, "PLT.24.3"), Status.postponed("No security/auth tests for now"), "If the security-role-ref" +
+ " element does not define a role-link element, the " +
"container must default to checking the role-name element argument against the list of securityrole elements " +
"defined in the web.xml deployment descriptor of the portlet application."),
- JSR286_310(new TCK(310, "PLT.24.4"), "When it is specified, the container must propagate the security identity of " +
+ JSR286_310(new TCK(310, "PLT.24.4"), Status.postponed("No security/auth tests for now"), "When it is specified, the " +
+ "container must propagate the security identity of " +
"the caller to the EJB layer in terms of the security role name defined in the run-as element."),
- JSR286_311(new TCK(311, "PLT.24.4"), "The security role name must be one of the security role names defined for the " +
+ JSR286_311(new TCK(311, "PLT.24.4"), Status.postponed("No security/auth tests for now"), "The security role name must " +
+ "be one of the security role names defined for the " +
"web.xml deployment descriptor."),
@@ -1268,7 +1336,8 @@
// PLT.26 Portlet Tag Library
- JSR286_312(new TCK(312, "PLT.26.1"), "The portlet-container must provide an implementation of the portlet tag library"),
+ JSR286_312(new TCK(312, "PLT.26.1"), Status.disabled("Every testcase test this"), "The portlet-container must provide " +
+ "an implementation of the portlet tag library"),
JSR286_313(new TCK(313, "PLT.26.1"), "The defineObjects tag must define the following variables in the JSP page: " +
"[REF TO THE SPEC]"),
JSR286_314(new TCK(314, "PLT.26.2"), Status.specUntestable(""), "The defineObjects tag must not define any " +
@@ -1358,9 +1427,120 @@
// ******************************************************************************************************************
- API_BASE_URL_1(new API(BaseURL.class), "parameter escapeXML"),
- API_BASE_URL_2(new API(BaseURL.class), "write methods throws an IOException is propagated to caller")
+ API286_ACTION_REQUEST_1(new API(ActionRequest.class), Status.disabled("no methods"), "none"),
+
+ API286_ACTION_RESPONSE_1(new API(ActionResponse.class), "sendRedirect()"),
+
+ API286_BASE_URL_1(new API(BaseURL.class), "setParameter()"),
+ API286_BASE_URL_2(new API(BaseURL.class), "setSecure()"),
+ API286_BASE_URL_3(new API(BaseURL.class), "toString()"),
+ API286_BASE_URL_4(new API(BaseURL.class), "getParameterMap()"),
+ API286_BASE_URL_5(new API(BaseURL.class), "write()"),
+ API286_BASE_URL_6(new API(BaseURL.class), "addProperty()"),
+ API286_BASE_URL_7(new API(BaseURL.class), "setProperty()"),
+
+ API286_CACHE_CONTROL(new API(CacheControl.class), ""),
+
+ API286_CLIENT_DATA_REQUEST(new API(ClientDataRequest.class), ""),
+
+ API286_EVENT(new API(Event.class), ""),
+
+ API286_EVENT_PORTLET(new API(EventPortlet.class), ""),
+
+ API286_EVENT_REQUEST(new API(EventRequest.class), ""),
+
+ API286_EVENT_RESPONSE(new API(EventResponse.class), ""),
+
+ API286_GENERIC_PORTLET(new API(GenericPortlet.class), ""),
+
+ API286_MIME_RESPONSE(new API(MimeResponse.class), ""),
+
+ API286_PORTAL_CONTEXT(new API(PortalContext.class), ""),
+
+ API286_PORTLET(new API(Portlet.class), ""),
+
+ API286_PORTLET_CONFIG(new API(PortletConfig.class), ""),
+
+ API286_PORTLET_EXCEPTION(new API(PortletException.class), ""),
+
+ API286_PORTLET_MODE(new API(PortletMode.class), ""),
+
+ API286_PORTLET_MODE_EXCEPTION(new API(PortletModeException.class), ""),
+
+ API286_PORTLET_PREFERENCES(new API(PortletPreferences.class), ""),
+
+ API286_PORTLET_REQUEST(new API(PortletRequest.class), ""),
+
+ API286_PORTLET_REQUEST_DISPATCHER(new API(PortletRequestDispatcher.class), ""),
+
+ API286_PORTLET_RESPONSE(new API(PortletResponse.class), ""),
+
+ API286_PORTLET_SECURITY_EXCEPTION(new API(PortletSecurityException.class), ""),
+
+ API286_PORTLET_SESSION(new API(PortletSession.class), ""),
+
+ API286_PORTLET_SESSION_UTIL(new API(PortletSessionUtil.class), ""),
+
+ API286_PORTLET_URL(new API(PortletURL.class), ""),
+
+ API286_PORTLET_URL_GENERATION_LISTENER(new API(PortletURLGenerationListener.class), ""),
+
+ API286_PREFERENCES_VALIDATOR(new API(PreferencesValidator.class), ""),
+
+ API286_PROCESS_ACTION(new API(ProcessAction.class), ""),
+
+ API286_PROCESS_EVENT(new API(ProcessEvent.class), ""),
+
+ API286_RENDER_MODE(new API(RenderMode.class), ""),
+
+ API286_RENDER_REQUEST(new API(RenderRequest.class), ""),
+
+ API286_RENDER_RESPONSE(new API(RenderResponse.class), ""),
+
+ API286_RESOURCE_REQUEST(new API(ResourceRequest.class), ""),
+
+ API286_RESOURCE_RESPONSE(new API(ResourceResponse.class), ""),
+
+ API286_RESOURCE_SERVING_PORTLET(new API(ResourceServingPortlet.class), ""),
+
+ API286_RESOURCE_URL(new API(ResourceURL.class), ""),
+
+ API286_STATE_AWARE_RESPONSE(new API(StateAwareResponse.class), ""),
+
+ API286_WINDOW_STATE(new API(WindowState.class), ""),
+
+
+ // Portlet Filter
+
+ API286_ACTION_FILTER(new API(ActionFilter.class), ""),
+
+ API286_ACTION_REQUEST_WRAPPER(new API(ActionRequestWrapper.class), ""),
+
+ API286_ACTION_RESPONSE_WRAPPER(new API(ActionResponseWrapper.class), ""),
+
+ API286_EVENT_FILTER(new API(EventFilter.class), ""),
+
+ API286_EVENT_REQUEST_WRAPPER(new API(EventRequestWrapper.class), ""),
+
+ API286_EVENT_RESPONSE_WRAPPER(new API(EventResponseWrapper.class), ""),
+
+ API286_FILTER_CHAIN(new API(FilterChain.class), ""),
+
+ API286_FILTER_CONFIG(new API(FilterConfig.class), ""),
+
+ API286_PORTLET_FILTER(new API(PortletFilter.class), ""),
+
+ API286_RENDER_REQUEST_WRAPPER(new API(RenderRequestWrapper.class), ""),
+
+ API286_RENDER_RESPONSE_WRAPPER(new API(RenderResponseWrapper.class), ""),
+
+ API286_RESOURCE_FILTER(new API(ResourceFilter.class), ""),
+
+ API286_RESOURCE_REQUEST_WRAPPER(new API(ResourceRequestWrapper.class), ""),
+
+ API286_RESOURCE_RESPONSE_WRAPPER(new API(ResourceResponseWrapper.class), ""),
+
;
/**
@@ -1407,7 +1587,7 @@
public String toString()
{
- return "TCK[index=" + index + ",section=" + section + "]";
+ return "TCK[index=" + index + ";section=" + section + "]";
}
}
@@ -1475,7 +1655,10 @@
public static class Active extends Status
{
-
+ public String toString()
+ {
+ return "ACTIVE";
+ }
}
public static class Inactive extends Status
@@ -1507,6 +1690,11 @@
{
return msg;
}
+
+ public String toString()
+ {
+ return "INACTIVE[" + type.name() + ";" + getMessage() + "]";
+ }
}
public static class Untestable extends Inactive
@@ -1532,6 +1720,12 @@
{
return kind;
}
+
+
+ public String toString()
+ {
+ return "UNTESTABLE[" + kind.name() + ";" + getMessage() + "]";
+ }
}
public static class Duplicate extends Active
@@ -1558,6 +1752,11 @@
{
return description;
}
+
+ public String toString()
+ {
+ return "DUPLICATED[" + target != null ? target.name() : "" + ";" + description + "]";
+ }
}
/** . */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -55,6 +55,10 @@
try
{
+ //Add 168 assertions test cases to related 286
+ mergeAssertions();
+
+
if (!TestCaseAnnotationProcessor.jsr168Assertions.keySet().isEmpty())
{
print(TestCaseAnnotationProcessor.jsr168Assertions, jsr168File, "JSR168_", jsr168Max);
@@ -74,36 +78,117 @@
}
}
+
+ private void mergeAssertions()
+ {
+ Map<String, Set<String>> jsr168a = TestCaseAnnotationProcessor.jsr168Assertions;
+ Map<String, Set<String>> jsr286a = TestCaseAnnotationProcessor.jsr286Assertions;
+
+ Set<String> names286 = jsr286a.keySet();
+
+ for (String name286 : names286)
+ {
+
+ Assertion assertion286 = getAssertion(name286);
+
+ Assertion related168 = assertion286.getAssertion();
+
+ if(related168 != null)
+ {
+ jsr286a.get(name286).addAll(jsr168a.get(related168.name()));
+ }
+
+ }
+ }
+
+
+
private void print(Map<String, Set<String>> map, String fileName, String pre, int max) throws Exception
{
+ // Simple stats
+
+ int total = 0;
+ int tested = 0;
+ int not_tested = 0;
+ int inactive = 0;
+
File f = new File(fileName);
Writer writer = new FileWriter(f, false);
-
+
+ StringBuilder output = new StringBuilder();
for (int i = 1; i <= max; i++)
{
+ total++;
+
String assertionName = pre + i;
Set<String> testCases = map.get(assertionName);
+
+ // Grab Assertion object based on name
+
Assertion assertion = getAssertion(assertionName);
String description = assertion != null ? assertion.getDescription().replaceAll(",", " ").trim() : "";
- writer.write(assertionName + ", " + description + '\n');
+
+ if (assertion != null && assertion.getRef() != null)
+ {
+ output.append(assertionName).append(",").append(assertion.getRef().toString()).append('\n');
+ output.append("DESCRIPTION: ,").append(description).append('\n');
+ }
+ else
+ {
+ output.append(assertionName).append(",").append(description).append('\n');
+ }
+
+
+ if (assertion != null && assertion.getStatus() != null)
+ {
+ Assertion.Status status = assertion.getStatus();
+ output.append("STATUS:,").append(status).append("\n");
+
+ if (status instanceof Assertion.Inactive || status instanceof Assertion.Duplicate)
+ {
+ inactive++;
+ }
+ }
+
+
if (testCases != null)
{
+ tested++;
for (String testCase : testCases)
{
- writer.write(" ," + testCase + "\n");
+ output.append("TEST_CASE: ,").append(testCase).append("\n");
}
}
+ else
+ {
+ not_tested++;
+ output.append("TEST_CASE:,NOT_TESTED\n");
+ }
- writer.write(" ,\n");
+ output.append(" ,\n");
}
+ output.append("\n\n");
+
+ writer.write("STATISTICS:,**************************\n");
+ writer.write("TOTAL:," + total + "\n");
+ writer.write("TESTED:," + tested + "\n");
+ writer.write("NOT TESTED:," + not_tested + "\n");
+ writer.write("INACTIVE:," + inactive + " (POSTPONED; TODO; DISABLED; UNTESTABLE or DUPLICATE) \n");
+ float ratio = (float)tested/(float)(total-inactive);
+ writer.write("TESTED RATIO:," + ratio + " ( TESTED/(TOTAL-INACTIVE) ) \n");
+
+ writer.write("\n\n\n\n");
+ writer.write(output.toString());
+ writer.write("\n");
+
writer.close();
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/TestCaseAnnotationProcessor.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/TestCaseAnnotationProcessor.java 2008-03-19 13:27:45 UTC (rev 10333)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/TestCaseAnnotationProcessor.java 2008-03-19 14:33:37 UTC (rev 10334)
@@ -71,11 +71,14 @@
public static String jsr286AssertionPre = "JSR286";
+ public static String api286AssertionPre = "API286";
public static Map<String, Set<String>> jsr168Assertions = new HashMap<String, Set<String>>();
public static Map<String, Set<String>> jsr286Assertions = new HashMap<String, Set<String>>();
+ public static Map<String, Set<String>> api286Assertions = new HashMap<String, Set<String>>();
+
//private int counter;
public TestCaseAnnotationProcessor(AnnotationProcessorEnvironment env) {
@@ -138,6 +141,10 @@
{
am = jsr286Assertions;
}
+ else if (tck.startsWith(api286AssertionPre))
+ {
+ am = api286Assertions;
+ }
else
{
continue;
16 years, 3 months
JBoss Portal SVN: r10333 - in modules/portlet/trunk: test/src/test/resources/jsr286/ext/portletfilter-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-19 09:27:45 -0400 (Wed, 19 Mar 2008)
New Revision: 10333
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilter.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilterTestCase.java
Modified:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletfilter-war/WEB-INF/portlet.xml
Log:
JBPORTAL-1958 : Cannot map the same filter on 2 different portlets (if declared separately) (test case)
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilter.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilter.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilter.java 2008-03-19 13:27:45 UTC (rev 10333)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.portletfilter;
+
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RepeatedFilter implements RenderFilter
+{
+
+ /** . */
+ public static final Set<String> names = new HashSet<String>();
+
+ public void init(FilterConfig config) throws PortletException
+ {
+ }
+
+ public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ String name = (String)req.getAttribute("NAME");
+ if (name != null)
+ {
+ names.add(name);
+ }
+ }
+
+ public void destroy()
+ {
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilterTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletfilter/RepeatedFilterTestCase.java 2008-03-19 13:27:45 UTC (rev 10333)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.ext.portletfilter;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import java.io.IOException;
+
+/**
+ * Test that a portlet filter mapped 2 times in the descriptor is applied on
+ * each portlet.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase()
+public class RepeatedFilterTestCase
+{
+
+ private String name1;
+ private String name2;
+
+ public RepeatedFilterTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ name1 = ((AbstractUniversalTestPortlet)portlet).getPortletConfig().getPortletName();
+ request.setAttribute("NAME", name1);
+
+ //
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ name2 = ((AbstractUniversalTestPortlet)portlet).getPortletConfig().getPortletName();
+ request.setAttribute("NAME", name2);
+
+ //
+ return null;
+ }
+ });
+ seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ assertEquals(Tools.toSet(name1, name2), RepeatedFilter.names);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletfilter-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletfilter-war/WEB-INF/portlet.xml 2008-03-19 13:00:56 UTC (rev 10332)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/portletfilter-war/WEB-INF/portlet.xml 2008-03-19 13:27:45 UTC (rev 10333)
@@ -35,6 +35,22 @@
</supports>
</portlet>
+ <portlet>
+ <portlet-name>UniversalTestPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>UniversalTestPortletC</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ </portlet>
+
<filter>
<filter-name>FilterConfigFilter</filter-name>
<filter-class>org.jboss.portal.test.portlet.jsr286.ext.portletfilter.FilterConfigFilter</filter-class>
@@ -49,4 +65,20 @@
</init-param>
</filter>
+ <filter>
+ <filter-name>RepeatedFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr286.ext.portletfilter.RepeatedFilter</filter-class>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>RepeatedFilter</filter-name>
+ <portlet-name>UniversalTestPortletB</portlet-name>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>RepeatedFilter</filter-name>
+ <portlet-name>UniversalTestPortletC</portlet-name>
+ </filter-mapping>
+
</portlet-app>
16 years, 3 months
JBoss Portal SVN: r10332 - in modules/portlet/trunk: mc/src/main/java/org/jboss/portal/portlet/mc and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-19 09:00:56 -0400 (Wed, 19 Mar 2008)
New Revision: 10332
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java
Modified:
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
Log:
JBPORTAL-1937 : Rename PortletContainerInvoker to ContainerPortletInvoker
Modified: modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
===================================================================
--- modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -31,7 +31,7 @@
import org.apache.portals.bridges.common.ServletContextProvider;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.invocation.PortletInvocation;
/**
@@ -122,7 +122,7 @@
public BridgeInfo(PortletInvocation invocation)
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
//
this.invocation = invocation;
Modified: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -33,7 +33,7 @@
import org.jboss.portal.portlet.container.managed.ManagedObject;
import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_168_NS;
@@ -107,7 +107,7 @@
private final Map<String, PortletApplicationLifeCycle> applications = new HashMap<String, PortletApplicationLifeCycle>();
/** . */
- private PortletContainerInvoker portletContainerInvoker;
+ private ContainerPortletInvoker containerPortletInvoker;
/** . */
private ManagedObjectRegistryEventBroadcaster broadcaster;
@@ -132,14 +132,14 @@
this.servletContainer = servletContainer;
}
- public PortletContainerInvoker getPortletContainerInvoker()
+ public ContainerPortletInvoker getContainerPortletInvoker()
{
- return portletContainerInvoker;
+ return containerPortletInvoker;
}
- public void setPortletContainerInvoker(PortletContainerInvoker portletContainerInvoker)
+ public void setContainerPortletInvoker(ContainerPortletInvoker containerPortletInvoker)
{
- this.portletContainerInvoker = portletContainerInvoker;
+ this.containerPortletInvoker = containerPortletInvoker;
}
public void onEvent(WebAppEvent event)
@@ -332,11 +332,11 @@
//
if (status == LifeCycleStatus.STARTED)
{
- portletContainerInvoker.addPortletContainer(portletContainer);
+ containerPortletInvoker.addPortletContainer(portletContainer);
}
else
{
- portletContainerInvoker.removePortletContainer(portletContainer);
+ containerPortletInvoker.removePortletContainer(portletContainer);
}
}
}
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-03-19 13:00:56 UTC (rev 10332)
@@ -25,7 +25,7 @@
<bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.mc.PortletApplicationDeployer">
<property name="servletContainer"><inject bean="ServletContainer"/></property>
- <property name="portletContainerInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="containerPortletInvoker"><inject bean="ContainerPortletInvoker"/></property>
</bean>
<!-- The ServletContainerFactory -->
@@ -86,7 +86,7 @@
</bean>
<!-- The portlet container invoker -->
- <bean name="PortletContainerInvoker" class="org.jboss.portal.portlet.container.PortletContainerInvoker">
+ <bean name="ContainerPortletInvoker" class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
<property name="stackFactory"><inject bean="ContainerStackFactory"/></property>
</bean>
@@ -104,7 +104,7 @@
<!-- The producer portlet invoker -->
<bean name="ProducerPortletInvoker" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="portletInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="portletInvoker"><inject bean="ContainerPortletInvoker"/></property>
<property name="persistenceManager"><inject bean="ProducerPersistenceManager"/></property>
<property name="stateManagementPolicy"><inject bean="ProducerStateManagementPolicy"/></property>
<property name="stateConverter"><inject bean="ProducerStateConverter"/></property>
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -25,7 +25,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.web.RequestDispatchCallback;
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.ServletContainerFactory;
@@ -66,7 +66,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
PortletApplication portletApplication = container.getPortletApplication();
ServerContext reqCtx = invocation.getServerContext();
ServletContext targetCtx = portletApplication.getContext().getServletContext();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -69,7 +69,7 @@
Serializable dstPayload = null;
if (srcPayload != null)
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
//
PortletApplication application = container.getPortletApplication();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -30,7 +30,7 @@
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
import org.jboss.portal.portlet.ParametersStateString;
@@ -61,7 +61,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
ContainerPortletInfo containerInfo = (ContainerPortletInfo)container.getInfo();
//
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.TransportGuarantee;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
@@ -44,7 +44,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
PortletInfo containerInfo = container.getInfo();
SecurityInfo securityInfo = containerInfo.getSecurity();
SecurityContext securityContext = invocation.getSecurityContext();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.concurrent.Valve;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletContainerContext;
import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
@@ -61,7 +61,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
- PortletContainerImpl container = (PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ PortletContainerImpl container = (PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
//
Valve valve = container.getValve();
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java (from rev 10331, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -0,0 +1,280 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.container;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationHandler;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPreferenceInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * An implementation of portlet invoker that makes a call to a portlet container.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7226 $
+ */
+public class ContainerPortletInvoker implements PortletInvoker
+{
+
+ /** The key under which the portlet container is stored in the request scope of the invocation. */
+ public static final String PORTLET_CONTAINER = "PORTLET_CONTAINER";
+
+ /** . */
+ private InterceptorStackFactory stackFactory;
+
+ /** . */
+ private Map<String, Portlet> portlets = new HashMap<String, Portlet>();
+
+ /** . */
+ private InvocationHandler handler = new InvocationHandler()
+ {
+ public Object invoke(Invocation invocation) throws Exception, org.jboss.portal.common.invocation.InvocationException
+ {
+ PortletInvocation portletInvocation = (PortletInvocation)invocation;
+
+ //
+ try
+ {
+ portletInvocation.setHandler(null);
+
+ //
+ PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
+ return container.dispatch(portletInvocation);
+ }
+ finally
+ {
+ portletInvocation.setHandler(this);
+ }
+ }
+ };
+
+ public InterceptorStackFactory getStackFactory()
+ {
+ return stackFactory;
+ }
+
+ public void setStackFactory(InterceptorStackFactory stackFactory)
+ {
+ this.stackFactory = stackFactory;
+ }
+
+ public void addPortletContainer(PortletContainer portletContainer)
+ {
+ Map<String, Portlet> portlets = new HashMap<String, Portlet>(this.portlets);
+ PortletImpl portlet = new PortletImpl(portletContainer);
+ portlets.put(portlet.getContext().getId(), portlet);
+
+ //
+ this.portlets = portlets;
+ }
+
+ public void removePortletContainer(PortletContainer portletContainer)
+ {
+ Map<String, Portlet> portlets = new HashMap<String, Portlet>(this.portlets);
+ PortletImpl portlet = new PortletImpl(portletContainer);
+ portlets.remove(portlet.getContext().getId());
+
+ //
+ this.portlets = portlets;
+ }
+
+ public void start() throws Exception
+ {
+ }
+
+ public void stop() throws Exception
+ {
+ }
+
+ public Set<Portlet> getPortlets()
+ {
+ return new HashSet<Portlet>(portlets.values());
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ if (portletContext == null)
+ {
+ throw new IllegalArgumentException("No null portlet id accepted");
+ }
+ String portletId = portletContext.getId();
+ PortletImpl portlet = (PortletImpl)portlets.get(portletId);
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletId);
+ }
+ return portlet;
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException, InvocationException
+ {
+ // Get portlet container
+ PortletContext ctx = invocation.getTarget();
+ PortletImpl portlet = (PortletImpl)getPortlet(ctx);
+ PortletContainer container = portlet.container;
+
+ //
+ InvocationHandler prevHandler = invocation.getHandler();
+ try
+ {
+
+ invocation.setHandler(handler);
+ invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER, container);
+ return (PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
+ }
+ catch (Exception e)
+ {
+ if (e instanceof PortletInvokerException)
+ {
+ throw (PortletInvokerException)e;
+ }
+ else if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException)e;
+ }
+ else
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ finally
+ {
+ invocation.setHandler(prevHandler);
+ invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE, ContainerPortletInvoker.PORTLET_CONTAINER);
+ }
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ PortletImpl portlet = (PortletImpl)portlets.get(portletContext.getId());
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletContext.getId());
+ }
+ ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
+ ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
+ PropertyMap result = new SimplePropertyMap();
+ for (String key : keys)
+ {
+ ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
+ if (pref != null)
+ {
+ result.put(key, pref.getDefaultValue());
+ }
+ }
+ return result;
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ PortletImpl portlet = (PortletImpl)portlets.get(portletContext.getId());
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletContext.getId());
+ }
+ ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
+ ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
+ PropertyMap result = new SimplePropertyMap();
+ for (String key : prefs.getKeys())
+ {
+ ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
+ if (pref != null)
+ {
+ result.put(key, pref.getDefaultValue());
+ }
+ }
+ return result;
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private static class PortletImpl implements Portlet
+ {
+
+ /** . */
+ private final PortletContainer container;
+
+ /** . */
+ private final PortletContext context;
+
+ public PortletImpl(PortletContainer container)
+ {
+ this.container = container;
+ this.context = PortletContext.createPortletContext(container.getPortletApplication().getId() + "." + container.getId());
+ }
+
+ public PortletContext getContext()
+ {
+ return context;
+ }
+
+ public PortletInfo getInfo()
+ {
+ return container.getInfo();
+ }
+
+ public boolean isRemote()
+ {
+ return false;
+ }
+
+ public String toString()
+ {
+ return "Portlet[context=" + context + ",container=" + container + "]";
+ }
+ }
+}
\ No newline at end of file
Property changes on: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
___________________________________________________________________
Name: svn:executable
+
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2008-03-19 13:00:56 UTC (rev 10332)
@@ -1,280 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.InvocationHandler;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerPreferenceInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.SimplePropertyMap;
-import org.jboss.portal.portlet.state.DestroyCloneFailure;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An implementation of portlet invoker that makes a call to a portlet container.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 7226 $
- */
-public class PortletContainerInvoker implements PortletInvoker
-{
-
- /** The key under which the portlet container is stored in the request scope of the invocation. */
- public static final String PORTLET_CONTAINER = "PORTLET_CONTAINER";
-
- /** . */
- private InterceptorStackFactory stackFactory;
-
- /** . */
- private Map<String, Portlet> portlets = new HashMap<String, Portlet>();
-
- /** . */
- private InvocationHandler handler = new InvocationHandler()
- {
- public Object invoke(Invocation invocation) throws Exception, org.jboss.portal.common.invocation.InvocationException
- {
- PortletInvocation portletInvocation = (PortletInvocation)invocation;
-
- //
- try
- {
- portletInvocation.setHandler(null);
-
- //
- PortletContainer container = (PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
- return container.dispatch(portletInvocation);
- }
- finally
- {
- portletInvocation.setHandler(this);
- }
- }
- };
-
- public InterceptorStackFactory getStackFactory()
- {
- return stackFactory;
- }
-
- public void setStackFactory(InterceptorStackFactory stackFactory)
- {
- this.stackFactory = stackFactory;
- }
-
- public void addPortletContainer(PortletContainer portletContainer)
- {
- Map<String, Portlet> portlets = new HashMap<String, Portlet>(this.portlets);
- PortletImpl portlet = new PortletImpl(portletContainer);
- portlets.put(portlet.getContext().getId(), portlet);
-
- //
- this.portlets = portlets;
- }
-
- public void removePortletContainer(PortletContainer portletContainer)
- {
- Map<String, Portlet> portlets = new HashMap<String, Portlet>(this.portlets);
- PortletImpl portlet = new PortletImpl(portletContainer);
- portlets.remove(portlet.getContext().getId());
-
- //
- this.portlets = portlets;
- }
-
- public void start() throws Exception
- {
- }
-
- public void stop() throws Exception
- {
- }
-
- public Set<Portlet> getPortlets()
- {
- return new HashSet<Portlet>(portlets.values());
- }
-
- public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
- {
- if (portletContext == null)
- {
- throw new IllegalArgumentException("No null portlet id accepted");
- }
- String portletId = portletContext.getId();
- PortletImpl portlet = (PortletImpl)portlets.get(portletId);
- if (portlet == null)
- {
- throw new NoSuchPortletException(portletId);
- }
- return portlet;
- }
-
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException, InvocationException
- {
- // Get portlet container
- PortletContext ctx = invocation.getTarget();
- PortletImpl portlet = (PortletImpl)getPortlet(ctx);
- PortletContainer container = portlet.container;
-
- //
- InvocationHandler prevHandler = invocation.getHandler();
- try
- {
-
- invocation.setHandler(handler);
- invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER, container);
- return (PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
- }
- catch (Exception e)
- {
- if (e instanceof PortletInvokerException)
- {
- throw (PortletInvokerException)e;
- }
- else if (e instanceof RuntimeException)
- {
- throw (RuntimeException)e;
- }
- else
- {
- throw new PortletInvokerException(e);
- }
- }
- finally
- {
- invocation.setHandler(prevHandler);
- invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
- }
- }
-
- public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- PortletImpl portlet = (PortletImpl)portlets.get(portletContext.getId());
- if (portlet == null)
- {
- throw new NoSuchPortletException(portletContext.getId());
- }
- ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
- ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
- PropertyMap result = new SimplePropertyMap();
- for (String key : keys)
- {
- ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
- if (pref != null)
- {
- result.put(key, pref.getDefaultValue());
- }
- }
- return result;
- }
-
- public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- PortletImpl portlet = (PortletImpl)portlets.get(portletContext.getId());
- if (portlet == null)
- {
- throw new NoSuchPortletException(portletContext.getId());
- }
- ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
- ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
- PropertyMap result = new SimplePropertyMap();
- for (String key : prefs.getKeys())
- {
- ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
- if (pref != null)
- {
- result.put(key, pref.getDefaultValue());
- }
- }
- return result;
- }
-
- public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- throw new UnsupportedOperationException();
- }
-
- public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- throw new UnsupportedOperationException();
- }
-
- public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- throw new UnsupportedOperationException();
- }
-
- private static class PortletImpl implements Portlet
- {
-
- /** . */
- private final PortletContainer container;
-
- /** . */
- private final PortletContext context;
-
- public PortletImpl(PortletContainer container)
- {
- this.container = container;
- this.context = PortletContext.createPortletContext(container.getPortletApplication().getId() + "." + container.getId());
- }
-
- public PortletContext getContext()
- {
- return context;
- }
-
- public PortletInfo getInfo()
- {
- return container.getInfo();
- }
-
- public boolean isRemote()
- {
- return false;
- }
-
- public String toString()
- {
- return "Portlet[context=" + context + ",container=" + container + "]";
- }
- }
-}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-03-19 13:00:56 UTC (rev 10332)
@@ -38,7 +38,7 @@
<alias>PortletApplicationRegistry</alias>
<property name="servletContainer"><inject bean="ServletContainer"/></property>
<property name="driver"><inject bean="TestDriverServer"/></property>
- <property name="portletContainerInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="containerPortletInvoker"><inject bean="ContainerPortletInvoker"/></property>
</bean>
<!-- The ServletContainerFactory -->
@@ -101,7 +101,7 @@
</bean>
<!-- The portlet container invoker -->
- <bean name="PortletContainerInvoker" class="org.jboss.portal.portlet.container.PortletContainerInvoker">
+ <bean name="ContainerPortletInvoker" class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
<property name="stackFactory"><inject bean="ContainerStackFactory"/></property>
</bean>
@@ -119,7 +119,7 @@
<!-- The producer portlet invoker -->
<bean name="ProducerPortletInvoker" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="portletInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="portletInvoker"><inject bean="ContainerPortletInvoker"/></property>
<property name="persistenceManager"><inject bean="ProducerPersistenceManager"/></property>
<property name="stateManagementPolicy"><inject bean="ProducerStateManagementPolicy"/></property>
<property name="stateConverter"><inject bean="ProducerStateConverter"/></property>
Modified: modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-03-19 12:46:15 UTC (rev 10331)
+++ modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-03-19 13:00:56 UTC (rev 10332)
@@ -38,7 +38,7 @@
<alias>PortletApplicationRegistry</alias>
<property name="servletContainer"><inject bean="ServletContainer"/></property>
<property name="driver"><inject bean="TestDriverServer"/></property>
- <property name="portletContainerInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="containerPortletInvoker"><inject bean="ContainerPortletInvoker"/></property>
</bean>
<!-- The ServletContainerFactory -->
@@ -101,7 +101,7 @@
</bean>
<!-- The portlet container invoker -->
- <bean name="PortletContainerInvoker" class="org.jboss.portal.portlet.container.PortletContainerInvoker">
+ <bean name="ContainerPortletInvoker" class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
<property name="stackFactory"><inject bean="ContainerStackFactory"/></property>
</bean>
@@ -119,7 +119,7 @@
<!-- The producer portlet invoker -->
<bean name="ProducerPortletInvoker" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="portletInvoker"><inject bean="PortletContainerInvoker"/></property>
+ <property name="portletInvoker"><inject bean="ContainerPortletInvoker"/></property>
<property name="persistenceManager"><inject bean="ProducerPersistenceManager"/></property>
<property name="stateManagementPolicy"><inject bean="ProducerStateManagementPolicy"/></property>
<property name="stateConverter"><inject bean="ProducerStateConverter"/></property>
16 years, 3 months
JBoss Portal SVN: r10331 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/info and 2 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2008-03-19 08:46:15 -0400 (Wed, 19 Mar 2008)
New Revision: 10331
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java
Modified:
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java
Log:
[JBPORTAL-1958] - use a List instead of a Map
Modified: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java 2008-03-19 12:29:48 UTC (rev 10330)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java 2008-03-19 12:46:15 UTC (rev 10331)
@@ -95,12 +95,10 @@
assertEquals(LifeCyclePhase.ACTION, filter2.getLifecycle().get(0));
// Filter mapping
- assertTrue(md.getFilterMapping().containsKey("testFilter"));
- assertEquals("Portlet1", md.getFilterMapping().get("testFilter").getPortletNames().get(0));
- assertEquals("Portlet2", md.getFilterMapping().get("testFilter").getPortletNames().get(1));
+ assertEquals("Portlet1", md.getFilterMapping().get(0).getPortletNames().get(0));
+ assertEquals("Portlet2", md.getFilterMapping().get(0).getPortletNames().get(1));
- assertTrue(md.getFilterMapping().containsKey("testFilterZwei"));
- assertEquals("Portlet2", md.getFilterMapping().get("testFilterZwei").getPortletNames().get(0));
+ assertEquals("Portlet2", md.getFilterMapping().get(1).getPortletNames().get(0));
}
catch (Exception e)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-19 12:29:48 UTC (rev 10330)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-19 12:46:15 UTC (rev 10331)
@@ -129,7 +129,7 @@
private static final List<EventDefinitionReferenceMetaData> EMPTY_EVENT_DEFINITION_REFERENCE_LIST = Collections.emptyList();
/** . */
- private static final Map<String,FilterMappingMetaData> EMPTY_FILTER_MAPPING_MAP = Collections.emptyMap();
+ private static final List<FilterMappingMetaData> EMPTY_FILTER_MAPPING_LIST = Collections.emptyList();
/** . */
private static final Map<String,FilterMetaData> EMPTY_FILTER_MAP = Collections.emptyMap();
@@ -228,7 +228,7 @@
}
if (tmp.getFilterMapping() == null)
{
- tmp.setFilterMapping(EMPTY_FILTER_MAPPING_MAP);
+ tmp.setFilterMapping(EMPTY_FILTER_MAPPING_LIST);
}
if (tmp.getContainerRuntimeOptions() == null)
{
@@ -546,7 +546,7 @@
//
List<String> filters = Collections.emptyList();
- for (FilterMappingMetaData filterMappingMD : ((PortletApplication20MetaData)portletApplicationMD).getFilterMapping().values())
+ for (FilterMappingMetaData filterMappingMD : ((PortletApplication20MetaData)portletApplicationMD).getFilterMapping())
{
for (String portletName : filterMappingMD.getPortletNames())
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java 2008-03-19 12:29:48 UTC (rev 10330)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/PortletApplication20MetaData.java 2008-03-19 12:46:15 UTC (rev 10331)
@@ -36,14 +36,10 @@
import org.jboss.portal.portlet.impl.metadata.adapter.ContainerRuntimeAdapter;
import org.jboss.portal.portlet.impl.metadata.adapter.FilterAdapter;
-import org.jboss.portal.portlet.impl.metadata.adapter.FilterMappingAdapter;
import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
-import org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants;
-import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
-import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
@@ -61,7 +57,7 @@
private Map<String, FilterMetaData> filters;
/** The filter mapping (JSR 286) */
- private Map<String, FilterMappingMetaData> filterMapping;
+ private List<FilterMappingMetaData> filterMapping;
/** The events (JSR 286) */
private List<EventDefinitionMetaData> events;
@@ -129,13 +125,12 @@
}
@XmlElement(name = "filter-mapping", namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
- @XmlJavaTypeAdapter(FilterMappingAdapter.class)
- public Map<String, FilterMappingMetaData> getFilterMapping()
+ public List<FilterMappingMetaData> getFilterMapping()
{
return filterMapping;
}
- public void setFilterMapping(Map<String, FilterMappingMetaData> filterMapping)
+ public void setFilterMapping(List<FilterMappingMetaData> filterMapping)
{
this.filterMapping = filterMapping;
}
@@ -144,9 +139,9 @@
{
if(this.filterMapping == null)
{
- this.filterMapping = new LinkedHashMap<String, FilterMappingMetaData>();
+ this.filterMapping = new ArrayList<FilterMappingMetaData>();
}
- this.filterMapping.put(filterMapping.getName(), filterMapping);
+ this.filterMapping.add(filterMapping);
}
@XmlElement(name = "event-definition", namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS)
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java 2008-03-19 12:29:48 UTC (rev 10330)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/metadata/adapter/FilterMappingAdapter.java 2008-03-19 12:46:15 UTC (rev 10331)
@@ -1,58 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.metadata.adapter;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class FilterMappingAdapter
- extends XmlAdapter<List<FilterMappingMetaData>, Map<String, FilterMappingMetaData>>
-{
-
- @Override
- public List<FilterMappingMetaData> marshal(Map<String, FilterMappingMetaData> arg0) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Map<String, FilterMappingMetaData> unmarshal(List<FilterMappingMetaData> list) throws Exception
- {
- Map<String, FilterMappingMetaData> map = new HashMap<String, FilterMappingMetaData>();
- for (FilterMappingMetaData f : list)
- {
- map.put(f.getName(), f);
- }
- return map;
- }
-
-}
16 years, 3 months
JBoss Portal SVN: r10330 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-19 08:29:48 -0400 (Wed, 19 Mar 2008)
New Revision: 10330
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
Log:
- Reintroduce tests, and fixed the tests
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2008-03-19 12:29:48 UTC (rev 10330)
@@ -0,0 +1,743 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.state;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletState;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
+import org.jboss.portal.core.impl.portlet.state.PersistentRegistration;
+import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.AbstractPropertyContext;
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyContext;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.producer.PortletState;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
+import org.jboss.portal.registration.Consumer;
+import org.jboss.portal.registration.ConsumerGroup;
+import org.jboss.portal.registration.Registration;
+import org.jboss.portal.registration.RegistrationLocal;
+import org.jboss.portal.test.core.model.instance.PortletInvocationContextImpl;
+import org.jboss.portal.test.core.model.instance.PortletInvokerSupport;
+import org.jboss.portal.test.core.model.instance.PortletSupport;
+import org.jboss.portal.test.core.model.instance.ValueMapAssert;
+import org.jboss.portal.test.framework.TestParametrization;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.framework.junit.JUnitAdapter;
+import org.jboss.portal.test.framework.junit.POJOJUnitTest;
+import org.jboss.portal.test.framework.mc.TestRuntimeContext;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public class ProducerTestCase extends TestCase
+{
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.DEBUG);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(ProducerTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
+
+ /** Test parameter whether we test registration or not. */
+ private boolean useRegistration;
+
+ /** . */
+ private TestRuntimeContext runtimeContext;
+
+ /** . */
+ private DataSourceSupport.Config dataSourceConfigParameter;
+
+ /** . */
+ private HibernateSupport hibernateSupport;
+
+ /** The persistence manager of the producer. */
+ private PersistentPortletStatePersistenceManager persistenceManager;
+
+ /** The producer. */
+ private ProducerPortletInvoker producer;
+
+ /** The portlet container. */
+ private PortletInvokerSupport portletContainer;
+
+ /** The consumer. */
+ private PortletInvoker consumer;
+
+ /** The registration id created during the setup. */
+ private String registrationId;
+
+ public String getName()
+ {
+ return super.getName() + ",ds=" + dataSourceConfigParameter.getName();
+ }
+
+ public String getUseRegistrationParameter()
+ {
+ return Boolean.toString(useRegistration);
+ }
+
+ public void setUseRegistrationParameter(String useRegistrationParameter)
+ {
+ this.useRegistration = Boolean.valueOf(useRegistrationParameter).booleanValue();
+ }
+
+ public HibernateSupport getHibernateSupport()
+ {
+ return hibernateSupport;
+ }
+
+ public void setHibernateSupport(HibernateSupport hibernateSupport)
+ {
+ this.hibernateSupport = hibernateSupport;
+ }
+
+ public PersistentPortletStatePersistenceManager getPersistenceManager()
+ {
+ return persistenceManager;
+ }
+
+ public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
+ {
+ this.persistenceManager = persistenceManager;
+ }
+
+ public ProducerPortletInvoker getProducer()
+ {
+ return producer;
+ }
+
+ public void setProducer(ProducerPortletInvoker producer)
+ {
+ this.producer = producer;
+ }
+
+ public PortletInvokerSupport getPortletContainer()
+ {
+ return portletContainer;
+ }
+
+ public void setPortletContainer(PortletInvokerSupport portletContainer)
+ {
+ this.portletContainer = portletContainer;
+ }
+
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
+ public PortletInvoker getConsumer()
+ {
+ return consumer;
+ }
+
+ public void setConsumer(PortletInvoker consumer)
+ {
+ this.consumer = consumer;
+ }
+
+ public void setUp() throws Exception
+ {
+ runtimeContext = new TestRuntimeContext("org/jboss/portal/test/core/state/jboss-beans.xml");
+ runtimeContext.addBean("TestBean", this);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
+ runtimeContext.start();
+
+ PortletInvokerSupport.InternalPortlet internalSimplePortlet = portletContainer.addInternalPortlet("SimplePortlet", new PortletSupport("SimplePortlet")
+ {
+ public PortletInvocationResponse invoke(PortletInvocation invocation)
+ {
+ AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
+ return null;
+ }
+ });
+ internalSimplePortlet.addPreference("abc", new StringValue("def"));
+
+ PortletInvokerSupport.InternalPortlet internalCloningPortlet = portletContainer.addInternalPortlet("CloningPortlet", new PortletSupport()
+ {
+ public PortletInvocationResponse invoke(PortletInvocation invocation)
+ {
+ AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
+ return null;
+ }
+ });
+ internalCloningPortlet.addPreference("abc", new StringValue("def"));
+
+ PortletInvokerSupport.InternalPortlet internalCloneFailedCloningPortlet = portletContainer.addInternalPortlet("CloneFailedCloningPortlet", new PortletSupport()
+ {
+ public PortletInvocationResponse invoke(PortletInvocation invocation)
+ {
+ try
+ {
+ AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
+ fail("Was expecting an IllegalStateException");
+ }
+ catch (IllegalStateException expected)
+ {
+ }
+ return null;
+ }
+ });
+ internalCloneFailedCloningPortlet.addPreference("abc", new StringValue("def"));
+
+ PortletInvokerSupport.InternalPortlet internalCloningPortletThrowingRuntimeException = portletContainer.addInternalPortlet("CloningPortletThrowingRuntimeException", new PortletSupport()
+ {
+ public PortletInvocationResponse invoke(PortletInvocation invocation)
+ {
+ AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ props.update(new PropertyChange[]{PropertyChange.newUpdate("_abc", new StringValue("_def"))});
+ throw new RuntimeException("custom_message");
+ }
+ });
+ internalCloningPortletThrowingRuntimeException.addPreference("abc", new StringValue("def"));
+
+ // Create registration
+ if (useRegistration)
+ {
+ beginTX();
+ ConsumerGroup cg = persistenceManager.createConsumerGroup("CG");
+ Consumer consumer = persistenceManager.createConsumer("fooConsumer", "fooConsumer");
+ cg.addConsumer(consumer);
+ Map registrationProperties = new HashMap();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+ Registration reg = persistenceManager.addRegistrationFor("fooConsumer", registrationProperties);
+ registrationId = reg.getId();
+ commitTX();
+ }
+ }
+
+ public void tearDown() throws Exception
+ {
+ // Cleanup any pending transaction
+ TransactionAssert.endTransaction();
+
+ //
+ runtimeContext.stop();
+ }
+
+ public void beginTX()
+ {
+ TransactionAssert.beginTransaction();
+ }
+
+ public void beginRegistrationScopedTX()
+ {
+ TransactionAssert.beginTransaction();
+
+ //
+ if (useRegistration)
+ {
+ Registration reg = persistenceManager.getRegistration(registrationId);
+ RegistrationLocal.setRegistration(reg);
+ }
+ }
+
+ private void rollbackTX()
+ {
+ TransactionAssert.rollbackTransaction(true);
+
+ //
+ if (useRegistration)
+ {
+ RegistrationLocal.setRegistration(null);
+ }
+ }
+
+ public void commitTX()
+ {
+ TransactionAssert.commitTransaction();
+
+ //
+ if (useRegistration)
+ {
+ RegistrationLocal.setRegistration(null);
+ }
+ }
+
+ public void testCloneExistingPOPWithinTx() throws Exception
+ {
+ // Clone a POP
+ beginRegistrationScopedTX();
+ PortletContext cloneCtx = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ commitTX();
+
+ // Check the clone state
+ beginTX();
+ assertTrue(cloneCtx.getId().startsWith("_"));
+ PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(cloneCtx.getId().substring(1));
+ assertNotNull(cloneState);
+ assertEquals(cloneCtx.getId(), "_" + cloneState.getId());
+ assertEquals("SimplePortlet", cloneState.getState().getPortletId());
+ PropertyMap cloneValues = cloneState.getState().getProperties();
+ assertNotNull(cloneValues);
+ assertNotNull(cloneValues.keySet());
+ assertEquals(1, cloneValues.keySet().size());
+ assertEquals(new StringValue("def"), cloneValues.getProperty("abc"));
+ if (useRegistration)
+ {
+ PersistentRegistration registration = cloneState.getRelatedRegistration();
+ assertNotNull(registration);
+ assertEquals(registrationId, registration.getId());
+ }
+ commitTX();
+ }
+
+ public void testCloneExistingCCPWithinTx() throws Exception
+ {
+ // Clone a POP
+ beginTX();
+ PortletContext cloneCtx = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ commitTX();
+
+ // Update CCP state directly
+ beginTX();
+ PropertyMap cloneValues = consumer.getProperties(cloneCtx);
+ PropertyMap newCloneValues = new SimplePropertyMap(cloneValues);
+ newCloneValues.setProperty("abc", new StringValue("fed"));
+ persistenceManager.updateState(cloneCtx.getId().substring(1), newCloneValues);
+ commitTX();
+
+ // Clone the modified CCP
+ beginRegistrationScopedTX();
+ PortletContext cloneCloneCtx = consumer.createClone(cloneCtx);
+ commitTX();
+
+ // Check the clone clone state
+ beginTX();
+ assertTrue(cloneCloneCtx.getId().startsWith("_"));
+ PersistentPortletState cloneCloneState = (PersistentPortletState)persistenceManager.loadState(cloneCloneCtx.getId().substring(1));
+ assertNotNull(cloneCloneState);
+ assertEquals(cloneCloneCtx.getId(), "_" + cloneCloneState.getId());
+ assertEquals("SimplePortlet", cloneCloneState.getState().getPortletId());
+ PropertyMap cloneCloneValues = cloneCloneState.getState().getProperties();
+ assertNotNull(cloneCloneValues);
+ assertNotNull(cloneCloneValues.keySet());
+ assertEquals(1, cloneCloneValues.keySet().size());
+ assertEquals(new StringValue("fed"), cloneCloneValues.getProperty("abc"));
+ if (useRegistration)
+ {
+ PersistentRegistration registration = cloneCloneState.getRelatedRegistration();
+ assertNotNull(registration);
+ assertEquals(registrationId, registration.getId());
+ }
+ commitTX();
+ }
+
+ public void testCloneNullPortletWithinTx() throws Exception
+ {
+ try
+ {
+ beginRegistrationScopedTX();
+ consumer.createClone(null);
+ fail("Was expecting an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ rollbackTX();
+ }
+ }
+
+ public void testDestroyNonExistingPortletWithinTx() throws Exception
+ {
+ beginRegistrationScopedTX();
+ List failures = consumer.destroyClones(Collections.singletonList(PortletContext.createPortletContext("_1")));
+ assertEquals(Collections.singletonList(new DestroyCloneFailure("_1")), failures);
+ commitTX();
+ }
+
+ public void testDestroyNullPortletWithinTx() throws Exception
+ {
+ try
+ {
+ beginRegistrationScopedTX();
+ consumer.destroyClones(null);
+ fail("Was expecting an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ rollbackTX();
+ }
+ }
+
+/*
+ public void _testDestroyInvalidPortletWithinTx() throws Exception
+ {
+ try
+ {
+ TransactionAssert.beginTransaction();
+ statefulPortletInvoker.destroyClone("_invalid");
+ fail("Was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException expected)
+ {
+ TransactionAssert.rollbackTransaction(true);
+ }
+ }
+*/
+
+ public void testDestroyCCPWithinTx() throws Exception
+ {
+ // Clone a POP 2 times
+ beginTX();
+ PortletContext clone1 = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ PortletContext clone2 = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ commitTX();
+
+ // Clone the modified CCP 2 times
+ beginTX();
+ PortletContext cloneOfClone1 = consumer.createClone(clone1);
+ PortletContext cloneOfClone2 = consumer.createClone(clone1);
+ commitTX();
+
+ // Destroy the clone 2
+ beginTX();
+ List failures = consumer.destroyClones(Collections.singletonList(clone2));
+ assertEquals(Collections.EMPTY_LIST, failures);
+ commitTX();
+
+ // Destroy the clone of the clone 2
+ beginTX();
+ failures = consumer.destroyClones(Collections.singletonList(cloneOfClone2));
+ assertEquals(Collections.EMPTY_LIST, failures);
+ commitTX();
+
+ // Destroy the clone 1
+ beginTX();
+ failures = consumer.destroyClones(Collections.singletonList(clone1));
+ assertEquals(Collections.EMPTY_LIST, failures);
+ commitTX();
+
+ // Destroy the clone of the clone 1
+ beginTX();
+ failures = consumer.destroyClones(Collections.singletonList(cloneOfClone1));
+ assertEquals(Collections.EMPTY_LIST, failures);
+ commitTX();
+ }
+
+ public void testInvokeCloneBeforeWritePOPWithinTx() throws Exception
+ {
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(PortletContext.createPortletContext("CloningPortlet"));
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ PortletContext clone = instanceContext.getClonedContext();
+ assertNotNull(clone);
+ PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(clone.getId().substring(1));
+ assertNotNull(cloneState);
+ assertEquals(clone.getId().substring(1), cloneState.getId());
+ assertEquals("CloningPortlet", cloneState.getState().getPortletId());
+ SimplePropertyMap expectedValue = new SimplePropertyMap();
+ expectedValue.setProperty("abc", new StringValue("def"));
+ expectedValue.setProperty("_abc", new StringValue("_def"));
+ ValueMapAssert.assertEquals(expectedValue, cloneState.getState().getProperties());
+ if (useRegistration)
+ {
+ PersistentRegistration registration = cloneState.getRelatedRegistration();
+ assertNotNull(registration);
+ assertEquals(registrationId, registration.getId());
+ }
+ commitTX();
+ }
+
+ public void testInvokeReadWritePOPWithinTx() throws Exception
+ {
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_WRITE);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ assertNull(instanceContext.getClonedContext());
+ assertNull(instanceContext.getModifiedContext());
+ commitTX();
+ }
+
+ public void testInvokeReadOnlyPOPWithinTx() throws Exception
+ {
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_ONLY);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ assertNull(instanceContext.getClonedContext());
+ assertNull(instanceContext.getModifiedContext());
+ commitTX();
+ }
+
+ public void testInvokeCloneBeforeWriteCCPWithinTx() throws Exception
+ {
+ beginTX();
+ PortletContext cloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloningPortlet"));
+ commitTX();
+
+ // Modify the state of the CCP
+ beginTX();
+ PortletState cloningPortletState = persistenceManager.loadState(cloningPortletId.getId().substring(1)).getState();
+ SimplePropertyMap newCloningPortletStateValue = new SimplePropertyMap(cloningPortletState.getProperties());
+ newCloningPortletStateValue.setProperty("abc", new StringValue("deff"));
+ persistenceManager.updateState(cloningPortletId.getId().substring(1), newCloningPortletStateValue);
+ commitTX();
+
+ //
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(cloningPortletId);
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ PortletContext clone = instanceContext.getClonedContext();
+ assertNotNull(clone);
+ PersistentPortletState cloneState = (PersistentPortletState)persistenceManager.loadState(clone.getId().substring(1));
+ assertNotNull(cloneState);
+ assertEquals(clone.getId().substring(1), cloneState.getId());
+ assertEquals("CloningPortlet", cloneState.getState().getPortletId());
+ SimplePropertyMap expectedValue = new SimplePropertyMap();
+ expectedValue.setProperty("abc", new StringValue("deff"));
+ expectedValue.setProperty("_abc", new StringValue("_def"));
+ ValueMapAssert.assertEquals(expectedValue, cloneState.getState().getProperties());
+ if (useRegistration)
+ {
+ PersistentRegistration registration = cloneState.getRelatedRegistration();
+ assertNotNull(registration);
+ assertEquals(registrationId, registration.getId());
+ }
+ commitTX();
+ }
+
+ public void testInvokeReadWriteCCPWithinTx() throws Exception
+ {
+ beginTX();
+ PortletContext cloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloningPortlet"));
+ commitTX();
+
+ //
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(cloningPortletId);
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_WRITE);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ assertNull(instanceContext.getClonedContext());
+ PortletStateContext state = persistenceManager.loadState(cloningPortletId.getId().substring(1));
+ assertNotNull(state);
+ assertEquals("CloningPortlet", state.getState().getPortletId());
+ assertEquals(cloningPortletId.getId().substring(1), state.getId());
+ SimplePropertyMap expectedValue = new SimplePropertyMap();
+ expectedValue.setProperty("abc", new StringValue("def"));
+ expectedValue.setProperty("_abc", new StringValue("_def"));
+ ValueMapAssert.assertEquals(expectedValue, state.getState().getProperties());
+ commitTX();
+ }
+
+ public void testInvokeReadOnlyCCPWithinTx() throws Exception
+ {
+ beginTX();
+ PortletContext cloneFailedCloningPortletId = consumer.createClone(PortletContext.createPortletContext("CloneFailedCloningPortlet"));
+ commitTX();
+
+ //
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(cloneFailedCloningPortletId);
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.READ_ONLY);
+ action.setInstanceContext(instanceContext);
+ consumer.invoke(action);
+ commitTX();
+
+ // Check state
+ beginTX();
+ assertNull(instanceContext.getClonedContext());
+ commitTX();
+ }
+
+ public void testInvokeCloneBeforeWritePOPWithinTxThrowsException() throws Exception
+ {
+ beginRegistrationScopedTX();
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setTarget(PortletContext.createPortletContext("CloningPortletThrowingRuntimeException"));
+ action.setUserContext(new AbstractUserContext("julien"));
+ AbstractInstanceContext instanceContext = new AbstractInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setInstanceContext(instanceContext);
+ try
+ {
+ consumer.invoke(action);
+ fail("Was expecting RuntimeException");
+ }
+ catch (RuntimeException expected)
+ {
+ assertEquals("custom_message", expected.getMessage());
+ rollbackTX();
+ }
+
+ // Check state
+ beginTX();
+ assertNull(instanceContext.getClonedContext());
+ commitTX();
+ }
+
+ public void _testGetProperties()
+ {
+
+ }
+
+ /** todo : should check the portlet metadata as well */
+ public void testGetCCP() throws Exception
+ {
+ // Clone a POP
+ beginTX();
+ PortletContext cloneContext = consumer.createClone(PortletContext.createPortletContext("SimplePortlet"));
+ commitTX();
+
+ //
+ beginTX();
+ Portlet portlet = consumer.getPortlet(cloneContext);
+ assertEquals(cloneContext, portlet.getContext());
+ assertEquals("SimplePortlet", portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
+ commitTX();
+
+ // Clone the modified CCP
+ beginTX();
+ PortletContext cloneCloneContext = consumer.createClone(cloneContext);
+ commitTX();
+
+ //
+ beginTX();
+ portlet = consumer.getPortlet(cloneCloneContext);
+ assertEquals(cloneCloneContext, portlet.getContext());
+ assertEquals("SimplePortlet", portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
+ commitTX();
+ }
+
+ public void _testCloneNonExistingPortletWithinTx() throws Exception
+ {
+ try
+ {
+ beginTX();
+ consumer.createClone(PortletContext.createPortletContext("UnknownPortlet"));
+ fail("Was expecting no such portlet exception");
+ }
+ catch (NoSuchPortletException e)
+ {
+ rollbackTX();
+ }
+
+ // todo check state
+
+// try
+// {
+// TransactionAssert.beginTransaction();
+// statefulPortletInvoker.createClone("_1");
+// fail("Was expecting no such portlet exception");
+// }
+// catch (NoSuchPortletException e)
+// {
+// TransactionAssert.rollbackTransaction(true);
+// }
+
+ // todo check state
+ }
+}
16 years, 3 months
JBoss Portal SVN: r10329 - in branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model: instance and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-19 08:16:51 -0400 (Wed, 19 Mar 2008)
New Revision: 10329
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/260/
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/backward-jboss-beans.xml
Log:
- Removed Backward compatibility test
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/backward-jboss-beans.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/backward-jboss-beans.xml 2008-03-19 12:14:13 UTC (rev 10328)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/backward-jboss-beans.xml 2008-03-19 12:16:51 UTC (rev 10329)
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer">
-
- <bean name="TestCaseConfig" class="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>TestCaseConfig</parameter>
- </constructor>
- </bean>
-
- <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>DataSourceConfig</parameter>
- </constructor>
- </bean>
-
- <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>HibernateConfig</parameter>
- </constructor>
- </bean>
-
- <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
- </bean>
-
- <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
- </bean>
-
- <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
- <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- </bean>
-
- <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
- <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
- property="connectionManagerReference"/></property>
- <property name="config"><inject bean="DataSourceConfig"/></property>
- </bean>
-
- <bean name="InstanceHibernateSupport260" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
- <property name="config"><inject bean="HibernateConfig"/></property>
- <property name="mappings">
- <list elementClass="java.lang.String">
- <value>org/jboss/portal/test/core/model/260/instance/domain.hbm.xml</value>
- </list>
- </property>
- <property name="jNDIName">java:/InstanceSessionFactory260</property>
- </bean>
-
- <bean name="PortletHibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
- <property name="config"><inject bean="HibernateConfig"/></property>
- <property name="mappings">
- <list elementClass="java.lang.String">
- <value>conf/hibernate/portlet/domain.hbm.xml</value>
- </list>
- </property>
- <property name="jNDIName">java:/PortletSessionFactory</property>
- </bean>
-
- <bean name="StateConverter" class="org.jboss.portal.portlet.impl.state.StateConverterV0">
- </bean>
- <bean name="StateManagementPolicy" class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
- <property name="persistLocally">true</property>
- </bean>
- <bean name="PersistenceManager"
- class="org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager">
- <property name="sessionFactoryJNDIName">java:/PortletSessionFactory</property>
- </bean>
- <bean name="PortletContainer" class="org.jboss.portal.test.core.model.instance.PortletInvokerSupport">
- </bean>
- <bean name="Producer" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="persistenceManager"><inject bean="PersistenceManager"/></property>
- <property name="portletInvoker"><inject bean="PortletContainer"/></property>
- <property name="stateManagementPolicy"><inject bean="StateManagementPolicy"/></property>
- <property name="stateConverter"><inject bean="StateConverter"/></property>
- </bean>
-
- <bean name="StackFactory" class="org.jboss.portal.common.invocation.EmptyInterceptorStackFactory">
- </bean>
- <bean name="ContainerContext260"
- class="org.jboss.portal.core.impl.model.instance.persistent.PersistentInstanceContainerContext">
- <property name="sessionFactoryJNDIName">java:/InstanceSessionFactory260</property>
- <property name="cacheNaturalId">true</property>
- </bean>
- <bean name="InstanceContainer260" class="org.jboss.portal.core.impl.model.instance.InstanceContainerImpl">
- <property name="cloneOnCreate">true</property>
- <property name="portletInvoker"><inject bean="Producer"/></property>
- <property name="containerContext"><inject bean="ContainerContext260"/></property>
- <property name="stackFactory"><inject bean="StackFactory"/></property>
- <property name="performSecurityChecks">false</property>
- </bean>
-
- <bean name="TestBean" class="org.jboss.portal.test.core.model.instance.BackwardCompatibilityInstanceTestCase">
- <constructor factoryMethod="getBean">
- <factory bean="BeanFactory"/>
- <parameter>TestBean</parameter>
- </constructor>
- <property name="portletContainer"><inject bean="PortletContainer"/></property>
- <property name="instanceHibernateSupport260"><inject bean="InstanceHibernateSupport260"/></property>
- <property name="portletHibernateSupport"><inject bean="PortletHibernateSupport"/></property>
- <property name="instanceContainer260"><inject bean="InstanceContainer260"/></property>
- <!-- property name="persistenceManager"><inject bean="PersistenceManager"/></property-->
- <!-- property name="producer"><inject bean="Producer"/></property-->
- <property name="mappings">
- <list elementClass="java.lang.String">
- <value>conf/hibernate/instance/domain.hbm.xml</value>
- </list>
- </property>
- <property name="config"><inject bean="HibernateConfig"/></property>
- </bean>
-</deployment>
16 years, 3 months
JBoss Portal SVN: r10328 - in branches/JBoss_Portal_Branch_2_7/core: src/main/org/jboss/portal/test/core/model and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-19 08:14:13 -0400 (Wed, 19 Mar 2008)
New Revision: 10328
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvocationContextImpl.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvokerSupport.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletSupport.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/ValueMapAssert.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/build.xml
Log:
- Reintroduce tests, and fixed the tests
- Removed Backward compatibility test
Modified: branches/JBoss_Portal_Branch_2_7/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-03-19 10:21:01 UTC (rev 10327)
+++ branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-03-19 12:14:13 UTC (rev 10328)
@@ -639,10 +639,6 @@
outfile="TEST-RegistrationPersistenceManagerTestCase">
</zest>
- <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.BackwardCompatibilityInstanceTestCase">
- <parameter name="Config" value="backward-jboss-beans.xml"/>
- </zest>
-
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
<test todir="${test.reports}"
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2008-03-19 12:14:13 UTC (rev 10328)
@@ -0,0 +1,1064 @@
+/******************************************************************************
+ * 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, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.portal.test.core.model.instance;
+
+import junit.framework.TestSuite;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.core.controller.Controller;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.core.impl.model.instance.AbstractInstanceCustomization;
+import org.jboss.portal.core.impl.model.instance.AbstractInstanceDefinition;
+import org.jboss.portal.core.impl.model.instance.InstanceContainerImpl;
+import org.jboss.portal.core.impl.model.portal.WindowImpl;
+import org.jboss.portal.core.impl.portlet.state.PersistentPortletStatePersistenceManager;
+import org.jboss.portal.core.model.instance.DuplicateInstanceException;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceDefinition;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.info.ContainerMetaInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.state.AbstractPropertyContext;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyContext;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.producer.ProducerPortletInvoker;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.test.core.HttpServletRequestWrapperImpl;
+import org.jboss.portal.test.framework.AbstractPortalTestCase;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.framework.mc.TestRuntimeContext;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Test Case that tests the authorization for instances via the instance container
+ * <p/>
+ * todo : configure instance with POP todo : configure instance with CCP todo : duplicate instance name todo : clone
+ * before write without creating instance todo : destroy instance and all its children !!!!
+ *
+ * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8872 $
+ * @since Apr 4, 2006
+ */
+public class InstanceContainerTestCase extends AbstractPortalTestCase
+{
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.ERROR);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ return AbstractPortalTestCase.suite(InstanceContainerTestCase.class);
+ }
+
+ private class TestPortletSupport extends PortletSupport
+ {
+
+ private PortletInvocation invocation;
+
+ public TestPortletSupport()
+ {
+ super("Foo");
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation)
+ {
+ this.invocation = invocation;
+ try
+ {
+ return execute();
+ }
+ finally
+ {
+ this.invocation = null;
+ }
+ }
+
+ public PortletInvocationResponse execute()
+ {
+ return null;
+ }
+
+ public void setProperty(String key, String value) throws IllegalStateException
+ {
+ AbstractPropertyContext props = (AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ props.update(new PropertyChange[]{PropertyChange.newUpdate(key, new StringValue(value))});
+ }
+ }
+
+ /** . */
+ private boolean persistLocally;
+
+ /** . */
+ private boolean cloneOnCreate;
+
+ /** . */
+ private boolean cacheNaturalId;
+
+ /** . */
+ private HibernateSupport instanceHibernateSupport;
+
+ /** . */
+ private HibernateSupport portletHibernateSupport;
+
+ /** . */
+ private InstanceContainerImpl instanceContainer;
+
+ /** . */
+ private PersistentPortletStatePersistenceManager persistenceManager;
+
+ /** . */
+ private ProducerPortletInvoker producer;
+
+ /** . */
+ private PortletInvokerSupport portletContainer;
+
+ /** . */
+ private String config;
+
+ public String getName()
+ {
+ return super.getName() + ",persistLocally=" + persistLocally + ",cacheNaturalId=" + cacheNaturalId + ",cloneOnCreate=" + cloneOnCreate;
+ }
+
+ public String getPersistLocallyParameter()
+ {
+ return Boolean.toString(persistLocally);
+ }
+
+ public void setPersistLocallyParameter(String persistLocallyParameter)
+ {
+ this.persistLocally = Boolean.valueOf(persistLocallyParameter).booleanValue();
+ }
+
+ public String getCloneOnCreateParameter()
+ {
+ return Boolean.toString(cloneOnCreate);
+ }
+
+ public void setCloneOnCreateParameter(String cloneOnCreateParameter)
+ {
+ this.cloneOnCreate = Boolean.valueOf(cloneOnCreateParameter).booleanValue();
+ }
+
+ public String getCacheNaturalIdParameter()
+ {
+ return Boolean.toString(cacheNaturalId);
+ }
+
+ public void setCacheNaturalIdParameter(String cacheNaturalIdParameter)
+ {
+ this.cacheNaturalId = Boolean.valueOf(cacheNaturalIdParameter).booleanValue();
+ }
+
+ public String getConfigParameter()
+ {
+ return config;
+ }
+
+ public void setConfigParameter(String configParameter)
+ {
+ this.config = configParameter;
+ }
+
+ public boolean isPersistLocally()
+ {
+ return persistLocally;
+ }
+
+ public boolean isCloneOnCreate()
+ {
+ return cloneOnCreate;
+ }
+
+ public boolean isCacheNaturalId()
+ {
+ return cacheNaturalId;
+ }
+
+ public HibernateSupport getInstanceHibernateSupport()
+ {
+ return instanceHibernateSupport;
+ }
+
+ public void setInstanceHibernateSupport(HibernateSupport instanceHibernateSupport)
+ {
+ this.instanceHibernateSupport = instanceHibernateSupport;
+ }
+
+ public HibernateSupport getPortletHibernateSupport()
+ {
+ return portletHibernateSupport;
+ }
+
+ public void setPortletHibernateSupport(HibernateSupport portletHibernateSupport)
+ {
+ this.portletHibernateSupport = portletHibernateSupport;
+ }
+
+ public InstanceContainerImpl getInstanceContainer()
+ {
+ return instanceContainer;
+ }
+
+ public void setInstanceContainer(InstanceContainerImpl instanceContainer)
+ {
+ this.instanceContainer = instanceContainer;
+ }
+
+ public PersistentPortletStatePersistenceManager getPersistenceManager()
+ {
+ return persistenceManager;
+ }
+
+ public void setPersistenceManager(PersistentPortletStatePersistenceManager persistenceManager)
+ {
+ this.persistenceManager = persistenceManager;
+ }
+
+ public ProducerPortletInvoker getProducer()
+ {
+ return producer;
+ }
+
+ public void setProducer(ProducerPortletInvoker portletInvoker)
+ {
+ this.producer = portletInvoker;
+ }
+
+ public PortletInvokerSupport getPortletContainer()
+ {
+ return portletContainer;
+ }
+
+ public void setPortletContainer(PortletInvokerSupport portletContainer)
+ {
+ this.portletContainer = portletContainer;
+ }
+
+ protected void configureRuntimeContext(TestRuntimeContext runtimeContext)
+ {
+ runtimeContext.addBean("TestCaseConfig", this);
+ }
+
+ protected String getConfigLocationPrefix()
+ {
+ return "org/jboss/portal/test/core/model/instance/";
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testConfigureInstance() throws Exception
+ {
+ PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new PortletSupport());
+ internalPortlet.addPreference("abc", new StringValue("def"));
+
+ //
+ TransactionAssert.beginTransaction();
+ Instance instance = instanceContainer.createDefinition("MyInstance", "MyPortlet", true);
+ assertNotNull(instance);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+// Session session = instanceHibernateSupport.getCurrentSession();
+// List instances = session.createQuery("from InstanceDefinitionImpl").list();
+// assertEquals(1, instances.size());
+// InstanceDefinitionImpl instanceImpl = (InstanceDefinitionImpl)instances.get(0);
+// assertEquals(true, instanceImpl.isModifiable());
+ assertEquals(1, instanceContainer.getDefinitions().size());
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ assertEquals(true, instanceImpl.isModifiable());
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instance = instanceContainer.getDefinition("MyInstance");
+ instance.setProperties(new PropertyChange[]{PropertyChange.newUpdate("abc", new StringValue("_def")), PropertyChange.newUpdate("ghi", new StringValue("_jkl"))});
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instance = instanceContainer.getDefinition("MyInstance");
+ PropertyMap props = instance.getProperties((Set)CollectionBuilder.hashSet().add("abc").add("ghi").get());
+ PropertyMap expectedProps = new SimplePropertyMap();
+ expectedProps.setProperty("abc", new StringValue("_def"));
+ expectedProps.setProperty("ghi", new StringValue("_jkl"));
+ ValueMapAssert.assertEquals(expectedProps, props);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+// session = instanceHibernateSupport.getCurrentSession();
+// instances = session.createQuery("from AbstractInstanceDefinition").list();
+// assertEquals(1, instances.size());
+// instanceImpl = (AbstractInstanceDefinition)instances.get(0);
+// assertEquals(true, instanceImpl.isModifiable());
+ assertEquals(1, instanceContainer.getDefinitions().size());
+ instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ assertEquals(true, instanceImpl.isModifiable());
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testConfigureInstanceWithoutPortlet() throws Exception
+ {
+ try
+ {
+ TransactionAssert.beginTransaction();
+ instanceContainer.createDefinition("MyInstance", "UnknownPortlet");
+ fail("Was expecting NoSuchPortletException");
+ }
+ catch (NoSuchPortletException expected)
+ {
+ // We expect that the transaction is marked for rollback
+ TransactionAssert.rollbackTransaction();
+ }
+
+ //
+ TransactionAssert.beginTransaction();
+ assertEquals(0, instanceContainer.getDefinitions().size());
+// Session session = instanceHibernateSupport.getCurrentSession();
+// assertEquals(0, session.createQuery("from AbstractInstanceDefinition").list().size());
+// assertEquals(0, portletHibernateSupport.getCurrentSession().createQuery("from PersistentPortletState").list().size());
+ TransactionAssert.commitTransaction();
+ }
+
+ public Portlet getSinglePOP() throws PortletInvokerException
+ {
+ assertNotNull(instanceContainer);
+ PortletInvoker portletInvoker = instanceContainer.getPortletInvoker();
+ assertNotNull(portletInvoker);
+ Set portlets = portletInvoker.getPortlets();
+ assertNotNull(portlets);
+ assertEquals(1, portlets.size());
+ Portlet p = (Portlet)portlets.iterator().next();
+ assertNotNull(p);
+ return p;
+ }
+
+ private abstract class TestCloneBeforeWrite
+ {
+
+ /** . */
+ private final String identity;
+
+ /** . */
+ private final boolean cloneInstance;
+
+ /** . */
+ private final boolean expectException;
+
+ /** . */
+ private final TransactionAssert.Terminator terminator;
+
+ public TestCloneBeforeWrite(String identity, boolean cloneInstance, boolean expectException, TransactionAssert.Terminator terminator)
+ {
+ this.identity = identity;
+ this.cloneInstance = cloneInstance;
+ this.expectException = expectException;
+ this.terminator = terminator;
+ }
+
+ public abstract PortletInvocationResponse execute(TestPortletSupport portlet);
+
+ public void execute() throws Exception
+ {
+ PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport()
+ {
+ public PortletInvocationResponse execute()
+ {
+ return TestCloneBeforeWrite.this.execute(this);
+ }
+ });
+ internalPortlet.addPreference("_abc", new StringValue("_def"));
+ String popId = getSinglePOP().getContext().getId();
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.createDefinition("MyInstance", popId, cloneInstance);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ InstanceDefinition instanceDef = instanceContainer.getDefinition("MyInstance");
+ Instance instance = instanceDef;
+ if (identity != null)
+ {
+ instance = instanceDef.getCustomization(identity);
+ }
+
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+
+ action.setUserContext(identity == null ? new AbstractUserContext() : new AbstractUserContext(identity));
+ try
+ {
+ instance.invoke(action);
+ if (expectException)
+ {
+ fail("Was expecting runtime exception");
+ }
+ }
+ catch (RuntimeException e)
+ {
+ if (expectException)
+ {
+ assertEquals("custom_message", e.getMessage());
+ }
+ else
+ {
+ e.printStackTrace();
+ fail("Was not expecting a runtime exception");
+ }
+ }
+ TransactionAssert.endTransaction(terminator);
+ }
+ }
+
+ /** . */
+ public void testInvokePOPReadOnly() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite(null, false, false, TransactionAssert.MUST_COMMIT)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ try
+ {
+ portlet.setProperty("abc", "def");
+ fail("Was expecting an IllegalStateException");
+ }
+ catch (IllegalStateException expected)
+ {
+ }
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokeCCPReadOnly() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite(null, true, false, TransactionAssert.MUST_COMMIT)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ try
+ {
+ portlet.setProperty("abc", "def");
+ fail("Was expecting an IllegalStateException");
+ }
+ catch (IllegalStateException expected)
+ {
+ }
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokePOPCloneBeforeWrite() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", false, false, TransactionAssert.MUST_COMMIT)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(1, userInstances.size());
+ AbstractInstanceCustomization userInstance = (AbstractInstanceCustomization)userInstances.iterator().next();
+ PortletContext userPortletContext = userInstance.getPortletContext();
+ assertNotNull(userPortletContext);
+ PropertyMap userProps = instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ assertNotNull(userProps);
+ PropertyMap expectedProps = new SimplePropertyMap();
+ expectedProps.setProperty("abc", new StringValue("def"));
+ expectedProps.setProperty("_abc", new StringValue("_def"));
+ ValueMapAssert.assertEquals(expectedProps, userProps);
+ Portlet userPortlet = instanceContainer.getPortletInvoker().getPortlet(userPortletContext);
+ assertNotNull(userPortlet);
+ assertEquals("Foo", userPortlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
+ TransactionAssert.commitTransaction();
+
+ // Erase state
+ TransactionAssert.beginTransaction();
+ instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ instanceImpl.destroyCustomization("julien");
+ TransactionAssert.commitTransaction();
+
+ // Check state has been destroyed on consumer and producer
+ TransactionAssert.beginTransaction();
+ instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ if (persistLocally)
+ {
+ try
+ {
+ instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ fail("Was expecting a NoSuchPortletException to be thrown");
+ }
+ catch (NoSuchPortletException expected)
+ {
+ }
+ }
+ else
+ {
+ instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ }
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokeCCPCloneBeforeWrite() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", true, false, TransactionAssert.MUST_COMMIT)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(1, userInstances.size());
+ AbstractInstanceCustomization userInstance = (AbstractInstanceCustomization)userInstances.iterator().next();
+ PortletContext userPortletContext = userInstance.getPortletContext();
+ assertNotNull(userPortletContext);
+ PropertyMap userProps = instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ assertNotNull(userProps);
+ PropertyMap expectedProps = new SimplePropertyMap();
+ expectedProps.setProperty("abc", new StringValue("def"));
+ expectedProps.setProperty("_abc", new StringValue("_def"));
+ ValueMapAssert.assertEquals(expectedProps, userProps);
+ Portlet userPortlet = instanceContainer.getPortletInvoker().getPortlet(userPortletContext);
+ assertNotNull(userPortlet);
+ assertEquals("Foo", userPortlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString());
+ TransactionAssert.commitTransaction();
+
+ // Erase state
+ TransactionAssert.beginTransaction();
+ instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ instanceImpl.destroyCustomization("julien");
+ TransactionAssert.commitTransaction();
+
+ // Check state has been destroyed on consumer and producer
+ TransactionAssert.beginTransaction();
+ instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instanceImpl);
+ userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ if (persistLocally)
+ {
+ try
+ {
+ instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ fail("Was expecting a NoSuchPortletException to be thrown");
+ }
+ catch (NoSuchPortletException expected)
+ {
+ }
+ }
+ else
+ {
+ instanceContainer.getPortletInvoker().getProperties(userPortletContext);
+ }
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokePOPCloneBeforeWriteRollback() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", false, false, TransactionAssert.MUST_ROLLBACK)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokeCCPCloneBeforeWriteRollback() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", true, false, TransactionAssert.MUST_ROLLBACK)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ return null;
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokePOPCloneBeforeWritePortletThrowsRuntimeException() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", false, true, TransactionAssert.MARKED_AS_ROLLBACK)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ throw new RuntimeException("custom_message");
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ /** . */
+ public void testInvokeCCPCloneBeforeWritePortletThrowsRuntimeException() throws Exception
+ {
+ TestCloneBeforeWrite test = new TestCloneBeforeWrite("julien", true, true, TransactionAssert.MARKED_AS_ROLLBACK)
+ {
+ public PortletInvocationResponse execute(TestPortletSupport portlet)
+ {
+ portlet.setProperty("abc", "def");
+ throw new RuntimeException("custom_message");
+ }
+ };
+ test.execute();
+
+ // Check state
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ Collection userInstances = instanceImpl.getCustomizations();
+ assertNotNull(userInstances);
+ assertEquals(0, userInstances.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testDestroyCCPInstance() throws Exception
+ {
+ PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport()
+ {
+ public PortletInvocationResponse execute()
+ {
+ setProperty("abc", "def");
+ return null;
+ }
+ });
+ internalPortlet.addPreference("_abc", new StringValue("_def"));
+
+ // Create the instance
+ TransactionAssert.beginTransaction();
+ instanceContainer.createDefinition("MyInstance", "MyPortlet", true);
+ TransactionAssert.commitTransaction();
+
+ // Create a clone for a user
+ TransactionAssert.beginTransaction();
+ Instance instance = instanceContainer.getDefinition("MyInstance").getCustomization("julien");
+ PortletInvocation action = new ActionInvocation(new PortletInvocationContextImpl());
+ action.setUserContext(new AbstractUserContext("julien"));
+ instance.invoke(action);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ AbstractInstanceDefinition instanceImpl = (AbstractInstanceDefinition)instanceContainer.getDefinition("MyInstance");
+ PortletContext sharedPortletContext = instanceImpl.getPortletContext();
+ assertNotNull(producer.getPortlet(sharedPortletContext));
+ assertNotNull(instance);
+ Collection children = instanceImpl.getCustomizations();
+ assertNotNull(children);
+ assertEquals(1, children.size());
+ AbstractInstanceCustomization userInstance = (AbstractInstanceCustomization)children.iterator().next();
+ PortletContext userPortletContext = userInstance.getPortletContext();
+ assertNotNull(producer.getPortlet(userPortletContext));
+ assertNotNull(userInstance);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.destroyDefinition("MyInstance");
+ TransactionAssert.commitTransaction();
+
+ //
+ if (persistLocally)
+ {
+ TransactionAssert.beginTransaction();
+ try
+ {
+ producer.getPortlet(userPortletContext);
+ fail("Was expecting a NoSuchPortletException");
+ }
+ catch (NoSuchPortletException expected)
+ {
+ }
+ try
+ {
+ producer.getPortlet(sharedPortletContext);
+ fail("Was expecting a NoSuchPortletException");
+ }
+ catch (NoSuchPortletException expected)
+ {
+ }
+ TransactionAssert.commitTransaction();
+ }
+ }
+
+ public void testRecreate() throws Exception
+ {
+ PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport());
+ internalPortlet.addPreference("_abc", new StringValue("_def"));
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.createDefinition("MyInstance", "MyPortlet");
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ Instance instance = instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instance);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.destroyDefinition("MyInstance");
+ instanceContainer.createDefinition("MyInstance", "MyPortlet");
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instance = instanceContainer.getDefinition("MyInstance");
+ assertNotNull(instance);
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testCreateDefinitionThrowsDuplicateInstanceException() throws PortletInvokerException, DuplicateInstanceException
+ {
+ PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport());
+ internalPortlet.addPreference("_abc", new StringValue("_def"));
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.createDefinition("MyInstance", "MyPortlet");
+ TransactionAssert.commitTransaction();
+
+ TransactionAssert.beginTransaction();
+ try
+ {
+ instanceContainer.createDefinition("MyInstance", "MyPortlet");
+ fail("Was expecting a NoSuchPortletException");
+ }
+ catch (DuplicateInstanceException expected)
+ {
+ // Duplicate instance exception does not mark the transaction as rollback
+ TransactionAssert.commitTransaction();
+ }
+ }
+
+ /** . */
+ private final Set securityBindings1 = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(new RoleSecurityBinding("a,b", "admin")).add(new RoleSecurityBinding("a", "user")).get());
+
+ /** . */
+ private final Set securityBindings2 = Collections.unmodifiableSet((Set)CollectionBuilder.hashSet().add(new RoleSecurityBinding("a,b", "user")).get());
+
+ public void testSecurityConfiguration() throws Exception
+ {
+ portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport());
+
+ //
+ TransactionAssert.beginTransaction();
+ String instanceId = instanceContainer.createDefinition("MyInstance", "MyPortlet").getId();
+ TransactionAssert.commitTransaction();
+
+ //
+ DomainConfigurator configurator = instanceContainer.getConfigurator();
+ assertNotNull(configurator);
+
+ //
+ TransactionAssert.beginTransaction();
+ configurator.setSecurityBindings(instanceId, securityBindings1);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ Set bindings = configurator.getSecurityBindings(instanceId);
+ assertNotNull(bindings);
+ assertEquals(securityBindings1, bindings);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ configurator.setSecurityBindings(instanceId, securityBindings2);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ bindings = configurator.getSecurityBindings(instanceId);
+ assertNotNull(bindings);
+ assertEquals(securityBindings2, bindings);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ configurator.removeSecurityBindings(instanceId);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ bindings = configurator.getSecurityBindings(instanceId);
+ assertNotNull(bindings);
+ assertEquals(0, bindings.size());
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testDestroyInstanceWithSecurityConfiguration() throws Exception
+ {
+ portletContainer.addInternalPortlet("MyPortlet", new TestPortletSupport());
+
+ //
+ TransactionAssert.beginTransaction();
+ String instanceId = instanceContainer.createDefinition("MyInstance", "MyPortlet").getId();
+ TransactionAssert.commitTransaction();
+
+ //
+ DomainConfigurator configurator = instanceContainer.getConfigurator();
+ assertNotNull(configurator);
+
+ //
+ TransactionAssert.beginTransaction();
+ configurator.setSecurityBindings(instanceId, securityBindings1);
+ TransactionAssert.commitTransaction();
+
+ //
+ TransactionAssert.beginTransaction();
+ instanceContainer.destroyDefinition(instanceId);
+ TransactionAssert.commitTransaction();
+ }
+
+
+
+
+//
+//// /**Tests the authorization of portal objects */
+//// public void testInstanceAuthorization() throws Exception
+//// {
+//// container.start();
+////
+//// //Populate the container with constraints
+//// hibernate.beginTransaction();
+//// constructInstances();
+//// setUpSecurity("portletInstanceA","view", SecurityConstants.UNCHECKED_ROLE_NAME);
+//// setUpSecurity("portletInstanceB","view", SecurityConstants.UNCHECKED_ROLE_NAME);
+//// setUpSecurity("portletInstanceC","view", SecurityConstants.UNCHECKED_ROLE_NAME);
+//// hibernate.commitTransaction();
+////
+//// hibernate.beginTransaction();
+//// SecurityAssociation.setSubject(new Subject());
+//// PortalAuthorizationManager manager = container.getPortalAuthorizationManagerFactory().getManager();
+//// assertTrue("view perm on portletInstanceA", manager.hasPermission("portletInstanceA", "view",type));
+//// assertTrue("view perm on portletInstanceB", manager.hasPermission("portletInstanceB", "view",type));
+//// assertTrue("view perm on portletInstanceC", manager.hasPermission("portletInstanceC", "view",type));
+//// hibernate.commitTransaction();
+//// container.stop();
+//// }
+////
+//// /**Tests the authorization of portal objects */
+//// public void testInstanceAuthorizationForAdmin() throws Exception
+//// {
+//// container.start();
+////
+//// //Populate the container with constraints
+//// hibernate.beginTransaction();
+//// constructInstances();
+//// setUpSecurity("portletInstanceA","view", "admin");
+//// setUpSecurity("portletInstanceB","view", "admin");
+//// setUpSecurity("portletInstanceC","view", "admin");
+//// hibernate.commitTransaction();
+////
+//// hibernate.beginTransaction();
+//// setUpSubjectForRole("admin",new String[]{"admin"});
+////
+//// PortalAuthorizationManager manager = container.getPortalAuthorizationManagerFactory().getManager();
+//// assertTrue("view perm on portletInstanceA",
+//// manager.hasPermission("portletInstanceA", "view",type));
+//// assertTrue("view perm on portletInstanceB",
+//// manager.hasPermission("portletInstanceB", "view",type));
+//// assertTrue("view perm on portletInstanceC",
+//// manager.hasPermission("portletInstanceC", "view",type));
+//// hibernate.commitTransaction();
+//// container.stop();
+//// }
+////
+//
+//
+////
+////
+//// /**
+//// * Should be automated to construct from a xxx-yyy.xml
+//// * Example : portal-object.xml
+//// */
+//// private void constructInstances() throws Exception
+//// {
+//// assertNotNull("portletInstanceA is not null", constructInstance("portletInstanceA", null));
+//// assertNotNull("portletInstanceB is not null", constructInstance("portletInstanceB", null));
+//// assertNotNull("portletInstanceC is not null", constructInstance("portletInstanceC", null));
+//// }
+////
+////
+//// private InstanceImpl constructInstance(String instanceA, String portletId) throws DuplicateInstanceException, NoSuchPortletException
+//// {
+//// InstanceImpl instanceImpl = (InstanceImpl)container.getInstance(instanceA);
+//// if(instanceImpl == null)
+//// {
+//// instanceImpl = (InstanceImpl)container.createInstances(instanceA, portletId);
+//// }
+//// return instanceImpl;
+//// }
+////
+////
+//// private void setUpSecurity(String uri,String perm, String role) throws Exception
+//// {
+//// PolicyContext.setContextID(CONTEXT_ID);
+//// AuthorizationDomain authDomain = container.getAuthorizationDomain();
+//// assertNotNull("AuthorizationDomain != null", authDomain);
+//// DomainConfigurator dc = authDomain.getConfigurator();
+//// assertNotNull("DomainConfigurator != null", dc);
+//// JACCPortalAuthorizationManagerFactory factory = new JACCPortalAuthorizationManagerFactory();
+//// JBossAuthorizationDomainRegistryImpl registry = new JBossAuthorizationDomainRegistryImpl();
+//// registry.addDomain(container);
+//// factory.setAuthorizationDomainRegistry(registry);
+//// container.setAuthorizationDomainRegistry(registry);
+//// container.setPortalAuthorizationManagerFactory(factory);
+//// dc.setConstraints(uri, this.getSecurityConstraints(perm,role));
+//// }
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvocationContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvocationContextImpl.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvocationContextImpl.java 2008-03-19 12:14:13 UTC (rev 10328)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.instance;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public class PortletInvocationContextImpl extends AbstractPortletInvocationContext
+{
+
+ public PortletInvocationContextImpl()
+ {
+ super(null);
+ //
+ addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ }
+
+ @Override
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ // FIXME getClientRequest
+ return null;
+ }
+
+ @Override
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ // FIXME getClientResponse
+ return null;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat format)
+ {
+ // FIXME renderURL
+ return null;
+ }
+
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvokerSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvokerSupport.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletInvokerSupport.java 2008-03-19 12:14:13 UTC (rev 10328)
@@ -0,0 +1,259 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.instance;
+
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.InvalidPortletIdException;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.SimplePropertyMap;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public class PortletInvokerSupport implements PortletInvoker
+{
+
+ /** . */
+ private Map portlets;
+
+ public PortletInvokerSupport()
+ {
+ this.portlets = new HashMap();
+ }
+
+ public void setValid(String portletId, boolean valid)
+ {
+ getInternalPortlet(portletId).valid = valid;
+ }
+
+ public InternalPortlet addInternalPortlet(String portletId)
+ {
+ return addInternalPortlet(portletId, new PortletSupport());
+ }
+
+ public InternalPortlet addInternalPortlet(String portletId, PortletSupport support)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (support == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ InternalPortlet portlet = new InternalPortlet(portletId, support);
+ if (portlets.put(portletId, portlet) != null)
+ {
+ throw new IllegalStateException();
+ }
+ return portlet;
+ }
+
+ public PortletInvokerSupport removeInternalPortlet(String portletId)
+ {
+ if (portlets.remove(portletId) == null)
+ {
+ throw new IllegalStateException();
+ }
+ return this;
+ }
+
+ public InternalPortlet getInternalPortlet(String portletId)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ InternalPortlet portlet = (InternalPortlet)portlets.get(portletId);
+ if (portlet == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return portlet;
+ }
+
+ public Set getPortlets()
+ {
+ return new HashSet(portlets.values());
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ return internalGetPortlet(portletContext);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ PortletContext portletContext = invocation.getTarget();
+ InternalPortlet portlet = internalGetPortlet(portletContext);
+ return portlet.support.invoke(invocation);
+ }
+
+ private InternalPortlet internalGetPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ if (portletContext == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ String portletId = portletContext.getId();
+ InternalPortlet portlet = (InternalPortlet)portlets.get(portletId);
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletId);
+ }
+ if (portlet.isValid() == false)
+ {
+ throw new InvalidPortletIdException(portletId);
+ }
+ return portlet;
+ }
+
+ public static class InternalPortlet implements Portlet
+ {
+
+ /** . */
+ private final PortletContext portletContext;
+
+ /** . */
+ private final PortletSupport support;
+
+ /** . */
+ private boolean valid;
+
+ /** . */
+ private Map state;
+
+ public InternalPortlet(String portletId, PortletSupport support)
+ {
+ if (portletId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (support == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.portletContext = PortletContext.createPortletContext(portletId);
+ this.support = support;
+ this.valid = true;
+ this.state = new HashMap();
+ }
+
+ public void addPreference(String key, Value value)
+ {
+ ((ContainerPortletInfo)support.getPortletInfo()).getPreferences().addContainerPreference(key, value, false, null, null);
+ state.put(key, value);
+ }
+
+ public void addPreference(String key, Value value, Boolean readOnly)
+ {
+ ((ContainerPortletInfo)support.getPortletInfo()).getPreferences().addContainerPreference(key, value, readOnly, null, null);
+ state.put(key, value);
+ }
+
+ public PortletContext getContext()
+ {
+ return portletContext;
+ }
+
+ public PortletInfo getInfo()
+ {
+ return support.getPortletInfo();
+ }
+
+ public boolean isRemote()
+ {
+ return false;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ InternalPortlet internalPortlet = internalGetPortlet(portletContext);
+ PropertyMap props = new SimplePropertyMap();
+ for (Iterator i = keys.iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ Value value = (Value)internalPortlet.state.get(key);
+ if (value != null)
+ {
+ props.put(key, value.clone());
+ }
+ }
+ return props;
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ InternalPortlet internalPortlet = internalGetPortlet(portletContext);
+ PropertyMap props = new SimplePropertyMap();
+ for (Iterator i = internalPortlet.state.keySet().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ Value value = (Value)internalPortlet.state.get(key);
+ if (value != null)
+ {
+ props.put(key, value.clone());
+ }
+ }
+ return props;
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List destroyClones(List portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletSupport.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletSupport.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/PortletSupport.java 2008-03-19 12:14:13 UTC (rev 10328)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.instance;
+
+import java.util.Locale;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.impl.info.ContainerMetaInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public class PortletSupport
+{
+
+ /** . */
+ protected final PortletInfo info;
+
+ /** . */
+ protected boolean valid;
+
+ public PortletSupport(PortletInfo info)
+ {
+ if (info == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.info = info;
+ this.valid = true;
+ }
+
+ public PortletSupport()
+ {
+ this(new ContainerPortletInfo(null, new ContainerPreferencesInfo(null), null, null, null, null, null, null, null, null, null));
+ }
+
+ public PortletSupport(String displayName)
+ {
+ ContainerMetaInfo cmi = new ContainerMetaInfo();
+ cmi.addMetaValue(ContainerMetaInfo.DISPLAY_NAME, new LocalizedString(displayName, Locale.ENGLISH));
+ this.info = new ContainerPortletInfo(null, new ContainerPreferencesInfo(null), cmi, null, null, null, null, null, null, null, null);
+ this.valid = true;
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ throw new PortletInvokerException("No implementations");
+ }
+
+ public PortletInfo getPortletInfo()
+ {
+ return info;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/ValueMapAssert.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/ValueMapAssert.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/instance/ValueMapAssert.java 2008-03-19 12:14:13 UTC (rev 10328)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.core.model.instance;
+
+import junit.framework.Assert;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8786 $
+ */
+public class ValueMapAssert extends Assert
+{
+ public static void assertEquals(PropertyMap vm1, PropertyMap vm2)
+ {
+ if (vm1 == null)
+ {
+ if (vm2 != null)
+ {
+ fail("Value map should be null");
+ }
+ }
+ else
+ {
+ if (vm2 == null)
+ {
+ fail("Value map should not be null");
+ }
+ assertEquals("Value maps don't have the same keys", new HashSet(vm1.keySet()), new HashSet(vm2.keySet()));
+ for (Iterator i = vm1.keySet().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ Value v1 = vm1.getProperty(key);
+ Value v2 = vm2.getProperty(key);
+ assertEquals("Values for key " + key + " are not equals", v1, v2);
+ }
+ }
+ }
+
+
+}
16 years, 3 months