Author: julien_viet
Date: 2011-06-24 17:52:27 -0400 (Fri, 24 Jun 2011)
New Revision: 6743
Added:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationContextImpl.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployer.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployment.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletContainerContextImpl.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletFilterContextImpl.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/AbstractMetaDataTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ContainerRuntimeOptionTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomPortletModeTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomWindowStateTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/FilterTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/GeneralMetaDataTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ListenerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/PortletTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/RenderParameterTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/SecurityConstraintTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/UserAttributeTestEverythingTestCase.java
components/pc/trunk/portlet/src/test/resources/metadata/
components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml
components/pc/trunk/portlet/src/test/resources/metadata/listener/
components/pc/trunk/portlet/src/test/resources/metadata/runtimeoption/
Removed:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationContextImpl.java
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployer.java
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployment.java
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletContainerContextImpl.java
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletFilterContextImpl.java
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/staxnav/
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/AbstractMetaDataTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ContainerRuntimeOptionTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomPortletModeTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomWindowStateTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/EventTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/FilterTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/GeneralMetaDataTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ListenerTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/PortletTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/RenderParameterTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/SecurityConstraintTestEverythingTestCase.java
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/UserAttributeTestEverythingTestCase.java
components/pc/trunk/mc/src/test/resources/metadata/
components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml
Modified:
components/pc/trunk/mc/src/test/resources/local-jboss-unit.xml
components/pc/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-portal-beans.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/Element.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/TestPortletApplicationDeployer.java
components/pc/trunk/test/servers/jboss42/src/test/build.xml
components/pc/trunk/test/servers/jboss51/src/test/build.xml
components/pc/trunk/test/servers/jboss6/src/test/build.xml
components/pc/trunk/test/servers/jetty6/src/test/build.xml
components/pc/trunk/test/servers/tomcat6/src/test/build.xml
components/pc/trunk/test/servers/tomcat7/src/test/build.xml
Log:
move code from mc module to portlet module
Deleted:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationContextImpl.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationContextImpl.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,72 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.mc;
-
-import org.gatein.pc.portlet.container.PortletApplicationContext;
-import org.gatein.pc.portlet.container.managed.ManagedPortletApplication;
-import org.gatein.wci.WebApp;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletApplicationContextImpl implements PortletApplicationContext
-{
-
- /** . */
- private final WebApp webApp;
-
- ManagedPortletApplication managedPortletApplication;
-
- public PortletApplicationContextImpl(WebApp webApp)
- {
- this.webApp = webApp;
- }
-
- public ServletContext getServletContext()
- {
- return webApp.getServletContext();
- }
-
- public String getContextPath()
- {
- return webApp.getContextPath();
- }
-
- public ClassLoader getClassLoader()
- {
- return webApp.getClassLoader();
- }
-
- public void managedStart()
- {
- managedPortletApplication.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletApplication.managedStop();
- }
-}
Deleted:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployer.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployer.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployer.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,348 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.mc;
-
-import org.gatein.common.logging.Logger;
-import org.gatein.common.io.IOTools;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.pc.api.PortletInvoker;
-import org.gatein.pc.mc.staxnav.PortletApplicationMetaDataBuilder;
-import org.gatein.pc.portlet.container.ContainerPortletInvoker;
-import org.gatein.pc.portlet.container.PortletContainer;
-import org.gatein.pc.portlet.container.managed.LifeCycleStatus;
-import org.gatein.pc.portlet.container.managed.ManagedObject;
-import org.gatein.pc.portlet.container.managed.ManagedObjectEvent;
-import org.gatein.pc.portlet.container.managed.ManagedObjectLifeCycleEvent;
-import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEvent;
-import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventBroadcaster;
-import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.gatein.pc.portlet.container.managed.ManagedPortletApplication;
-import org.gatein.pc.portlet.container.managed.PortletApplicationRegistry;
-import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
-import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.wci.ServletContainer;
-import org.gatein.wci.ServletContainerFactory;
-import org.gatein.wci.WebApp;
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-import org.gatein.wci.WebAppListener;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletApplicationDeployer implements WebAppListener,
PortletApplicationRegistry
-{
-
- /** . */
- private Logger log = LoggerFactory.getLogger(PortletApplicationDeployer.class);
-
- /** . */
- private PortletApplicationRegistry registry;
-
- /** . */
- private ServletContainer servletContainer;
-
- private ServletContainerFactory servletContainerFactory;
-
- /** . */
- private Map<String, PortletApplicationDeployment> deploymentMap = new
HashMap<String, PortletApplicationDeployment>();
-
- /** . */
- private ClassLoader classLoader;
-
- /** . */
- private final Map<String, PortletApplicationLifeCycle> applications = new
HashMap<String, PortletApplicationLifeCycle>();
-
- /** . */
- private ContainerPortletInvoker containerPortletInvoker;
-
- /** . */
- private ManagedObjectRegistryEventBroadcaster broadcaster;
-
- public PortletApplicationRegistry getRegistry()
- {
- return registry;
- }
-
- public void setRegistry(PortletApplicationRegistry registry)
- {
- this.registry = registry;
- }
-
- public ServletContainer getServletContainer()
- {
- if (servletContainer == null)
- {
- servletContainer = servletContainerFactory.getServletContainer();
- }
- return servletContainer;
- }
-
- public void setServletContainer(ServletContainer servletContainer)
- {
- throw new UnsupportedOperationException("Inject ServletContainerFactory
instead!");
- }
-
- public ServletContainerFactory getServletContainerFactory()
- {
- return servletContainerFactory;
- }
-
- public void setServletContainerFactory(ServletContainerFactory
servletContainerFactory)
- {
- this.servletContainerFactory = servletContainerFactory;
- }
-
- public PortletInvoker getContainerPortletInvoker()
- {
- return containerPortletInvoker;
- }
-
- public void setContainerPortletInvoker(PortletInvoker containerPortletInvoker)
- {
- if (containerPortletInvoker instanceof ContainerPortletInvoker)
- {
- this.containerPortletInvoker =
(ContainerPortletInvoker)containerPortletInvoker;
- }
- else
- {
- if (containerPortletInvoker == null)
- {
- return; // this method is called with null on shutdown
- }
- throw new IllegalArgumentException("PortletApplicationDeployer can only
accept ContainerPortletInvokers!");
- }
- }
-
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
- String cp = event.getWebApp().getContextPath();
- switch (lifeCycleEvent.getType())
- {
- case WebAppLifeCycleEvent.ADDED:
- log.debug("Going to install war file" + cp);
- add(event.getWebApp());
- log.debug("Installed war file" + cp);
- break;
- case WebAppLifeCycleEvent.REMOVED:
- try
- {
- log.debug("Going to uninstall war file" + cp);
- remove(event.getWebApp());
- log.debug("Uninstalled war file" + cp);
- }
- catch (Throwable e)
- {
- log.error("Uninstalled war file " + cp + " with an
error", e);
- }
- break;
- }
- }
- }
-
- protected void add(WebApp webApp)
- {
- //
- PortletApplication10MetaData metaData = buildPortletApplicationMetaData(webApp);
- if (metaData != null)
- {
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- PortletApplicationDeployment deployment = new
PortletApplicationDeployment(broadcaster, webApp, metaData);
- deploymentMap.put(webApp.getContextPath(), deployment);
- deployment.install();
-
- //
- PortletApplicationLifeCycle portletApplicationLifeCycle =
deployment.getPortletApplicationLifeCycle();
- applications.put(portletApplicationLifeCycle.getId(),
portletApplicationLifeCycle);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
- }
-
- private void remove(WebApp webApp)
- {
- PortletApplicationDeployment deployment =
deploymentMap.remove(webApp.getContextPath());
- if (deployment != null)
- {
- PortletApplicationLifeCycle portletApplicationLifeCycle =
deployment.getPortletApplicationLifeCycle();
- applications.remove(portletApplicationLifeCycle.getId());
-
- //
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- deployment.uninstall();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
- }
-
- public void start()
- {
- broadcaster = new ManagedObjectRegistryEventBroadcaster();
- classLoader = Thread.currentThread().getContextClassLoader();
-
- //
- broadcaster.addListener(bridgeToInvoker);
- getServletContainer().addWebAppListener(this);
- }
-
- public void stop()
- {
- // This should generate remove web app event and in cascade clear the registry
- // as well as the portlet container invoker
- getServletContainer().removeWebAppListener(this);
-
- //
- classLoader = null;
- broadcaster = null;
- }
-
- protected PortletApplication10MetaData buildPortletApplicationMetaData(WebApp webApp)
- {
- try
- {
- URL url =
webApp.getServletContext().getResource("/WEB-INF/portlet.xml");
- if (url != null)
- {
- InputStream in = null;
- try
- {
- in = IOTools.safeBufferedWrapper(url.openStream());
-
- //
- PortletApplicationMetaDataBuilder builder = new
PortletApplicationMetaDataBuilder();
-
- //
- return builder.build(in);
-
-/*
- // Validate
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setSchemaValidation(false);
- unmarshaller.setValidation(false);
-
- //
- PortletApplicationModelFactory factory = new
PortletApplicationModelFactory();
-
- // Unmarshal
- PortletApplication10MetaData portletApplicationMD =
(PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory),
null);
-
- //
- return portletApplicationMD;
-*/
- }
- finally
- {
- IOTools.safeClose(in);
- }
- }
- }
- catch (Exception e)
- {
- log.error("Cannot read portlet.xml", e);
- }
- return null;
- }
-
- public Collection<? extends ManagedPortletApplication>
getManagedPortletApplications()
- {
- return applications.values();
- }
-
- public ManagedPortletApplication getManagedPortletApplication(String id)
- {
- return applications.get(id);
- }
-
- public void addListener(ManagedObjectRegistryEventListener listener)
- {
- broadcaster.addListener(listener);
- }
-
- public void removeListener(ManagedObjectRegistryEventListener listener)
- {
- broadcaster.addListener(listener);
- }
-
- /** Bridge managed object event to add/remove portlet container in portlet container
invoker. */
- private final ManagedObjectRegistryEventListener bridgeToInvoker = new
ManagedObjectRegistryEventListener()
- {
- public void onEvent(ManagedObjectRegistryEvent event)
- {
- if (event instanceof ManagedObjectEvent)
- {
- ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
- ManagedObject managedObject = managedObjectEvent.getManagedObject();
-
- //
- if (managedObject instanceof PortletContainerLifeCycle)
- {
- PortletContainerLifeCycle portletContainerLifeCycle =
(PortletContainerLifeCycle)managedObject;
- PortletContainer portletContainer =
portletContainerLifeCycle.getPortletContainer();
-
- //
- if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
- {
- ManagedObjectLifeCycleEvent lifeCycleEvent =
(ManagedObjectLifeCycleEvent)managedObjectEvent;
-
- //
- LifeCycleStatus status = lifeCycleEvent.getStatus();
-
- //
- if (status == LifeCycleStatus.STARTED)
- {
- containerPortletInvoker.addPortletContainer(portletContainer);
- }
- else
- {
- containerPortletInvoker.removePortletContainer(portletContainer);
- }
- }
- }
- }
- }
- };
-}
Deleted:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployment.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployment.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployment.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,169 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.mc;
-
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.pc.portlet.impl.info.ContainerInfoBuilder;
-import org.gatein.pc.portlet.impl.info.ContainerInfoBuilderContext;
-import org.gatein.pc.portlet.impl.info.ContainerPortletInfo;
-import org.gatein.pc.portlet.impl.info.ContainerFilterInfo;
-import org.gatein.pc.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
-import org.gatein.pc.portlet.impl.jsr168.PortletApplicationImpl;
-import org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl;
-import org.gatein.pc.portlet.impl.jsr168.PortletFilterImpl;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
-import org.gatein.pc.portlet.impl.container.PortletFilterLifeCycle;
-import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
-import org.gatein.pc.portlet.container.object.PortletApplicationObject;
-import org.gatein.pc.portlet.container.object.PortletContainerObject;
-import org.gatein.pc.portlet.container.object.PortletFilterObject;
-import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.gatein.wci.WebApp;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletApplicationDeployment
-{
-
- /** . */
- private final Logger log;
-
- /** . */
- private final WebApp webApp;
-
- /** . */
- private final PortletApplication10MetaData metaData;
-
- /** . */
- private final ManagedObjectRegistryEventListener listener;
-
- /** . */
- private PortletApplicationLifeCycle portletApplicationLifeCycle;
-
- public PortletApplicationDeployment(
- ManagedObjectRegistryEventListener listener,
- WebApp webApp,
- PortletApplication10MetaData metaData)
- {
- this.listener = listener;
- this.webApp = webApp;
- this.metaData = metaData;
- this.log = LoggerFactory.getLogger(PortletApplicationDeployment.class +
"." + webApp.getContextPath().replace('.', '_'));
- }
-
- public PortletApplicationLifeCycle getPortletApplicationLifeCycle()
- {
- return portletApplicationLifeCycle;
- }
-
- void install()
- {
-
- log.debug("Starting installation");
-
- //
- ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(metaData, webApp);
- ContainerInfoBuilder builder = new ContainerInfoBuilder(webApp.getContextPath(),
metaData, builderContext);
- builder.build();
-
- //
- PortletApplicationObject portletApplicationObject = new
PortletApplicationImpl(builder.getApplication());
- PortletApplicationContextImpl portletApplicationContext = new
PortletApplicationContextImpl(webApp);
-
-
- //
- portletApplicationLifeCycle = new PortletApplicationLifeCycle(
- listener,
- portletApplicationContext,
- portletApplicationObject);
-
- // Needed for the managed callbacks
- portletApplicationContext.managedPortletApplication = portletApplicationLifeCycle;
-
- //
- for (ContainerFilterInfo filterInfo :
builder.getApplication().getFilters().values())
- {
- PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
- PortletFilterContextImpl portletFilterContext = new PortletFilterContextImpl();
-
- //
- PortletFilterLifeCycle portletFilterLifeCycle =
portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
-
- // Needed for the managed callbacks
- portletFilterContext.managedPortletFilter = portletFilterLifeCycle;
- }
-
- //
- for (ContainerPortletInfo containerInfo : builder.getPortlets())
- {
- PortletContainerObject portletContainerObject = new
PortletContainerImpl(containerInfo);
- PortletContainerContextImpl portletContainerContext = new
PortletContainerContextImpl();
-
- //
- PortletContainerLifeCycle portletContainerLifeCycle =
portletApplicationLifeCycle.addPortletContainer(portletContainerContext,
portletContainerObject);
-
- // Needed for the managed callbacks
- portletContainerContext.managedPortletContainer = portletContainerLifeCycle;
-
- // Now create deps
- for (String filterRef : containerInfo.getFilterRefs())
- {
- PortletFilterLifeCycle portletFilterLifeCycle =
portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
-
- //
- if (portletFilterLifeCycle != null)
- {
- portletApplicationLifeCycle.addDependency(portletFilterLifeCycle,
portletContainerLifeCycle);
- }
- else
- {
- // todo
- }
- }
- }
-
- //
- portletApplicationLifeCycle.create();
-
- //
- portletApplicationLifeCycle.managedStart();
-
- //
-
- }
-
- void uninstall()
- {
- log.debug("Uninstalling");
-
- //
- portletApplicationLifeCycle.managedStop();
-
- //
- log.debug("Uninstalled");
- }
-}
Deleted:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletContainerContextImpl.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletContainerContextImpl.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletContainerContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.mc;
-
-import org.gatein.pc.portlet.container.PortletContainerContext;
-import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletContainerContextImpl implements PortletContainerContext
-{
-
- /** . */
- ManagedPortletContainer managedPortletContainer;
-
- public void managedStart()
- {
- managedPortletContainer.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletContainer.managedStop();
- }
-}
Deleted:
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletFilterContextImpl.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletFilterContextImpl.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletFilterContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,46 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.mc;
-
-import org.gatein.pc.portlet.container.PortletFilterContext;
-import org.gatein.pc.portlet.container.managed.ManagedPortletFilter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletFilterContextImpl implements PortletFilterContext
-{
-
- ManagedPortletFilter managedPortletFilter;
-
- public void managedStart()
- {
- managedPortletFilter.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletFilter.managedStop();
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/AbstractMetaDataTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/AbstractMetaDataTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/AbstractMetaDataTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,113 +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.gatein.pc.mc.metadata;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-import org.gatein.pc.mc.staxnav.PortletApplicationMetaDataBuilder;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-
-import org.xml.sax.SAXException;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractMetaDataTestCase extends TestCase
-{
-
- /** Test parameter for using xml binding annotation. */
- public static final String ANNOTATION_BINDING = "annotation";
-
- /** Annotation or ObjectModelFactory parsing. */
- private String parser = ANNOTATION_BINDING;
-
- protected PortletApplication20MetaData _unmarshall10(String file) throws SAXException,
IOException
- {
- return _unmarshall10(file, false);
- }
-
- protected PortletApplication20MetaData _unmarshall10(String file, boolean fail) throws
SAXException, IOException
- {
- try
- {
- PortletApplicationMetaDataBuilder builder = new
PortletApplicationMetaDataBuilder();
- String path = getPath(file);
- URL url = new URL(path);
- InputStream in = url.openStream();
- assertNotNull(in);
- PortletApplication20MetaData build = builder.build(in);
- if (fail)
- {
- throw new AssertionFailedError("Was expecting unmarshalling of " +
file + " to fail");
- }
- return build;
- }
- catch (Exception e)
- {
- if (fail)
- {
- // OK
- return null;
- }
- else
- {
- throw fail(e);
- }
- }
- }
-
- protected final Error fail(Throwable t)
- {
- AssertionFailedError afe = new AssertionFailedError();
- afe.initCause(t);
- throw afe;
- }
-
- protected final Error fail(Throwable t, String msg)
- {
- AssertionFailedError afe = new AssertionFailedError(msg);
- afe.initCause(t);
- throw afe;
- }
-
- protected String getPath(String file)
- {
- URL url = Thread.currentThread().getContextClassLoader().getResource(file);
- if (url == null)
- {
- fail(file + " not found.");
- }
- return url.toString();
- }
-
- protected InputStream getStream(String file)
- {
- return Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
- }
-
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ContainerRuntimeOptionTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ContainerRuntimeOptionTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ContainerRuntimeOptionTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.gatein.pc.mc.metadata;
-
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.common.ContainerRuntimeMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class ContainerRuntimeOptionTestCase extends AbstractMetaDataTestCase
-{
-
- public void test021() throws Exception
- {
- PortletApplication20MetaData md =
_unmarshall10("metadata/runtimeoption/portlet.xml");
- PortletMetaData portlet = md.getPortlet("portlet-name");
- assertNotNull(portlet);
- Map<String, ContainerRuntimeMetaData> m =
portlet.getContainerRuntimeOptions();
-
assertEquals(Collections.singleton("portlet_container_runtime_option_name"),
m.keySet());
- ContainerRuntimeMetaData option =
m.get("portlet_container_runtime_option_name");
- assertEquals(Arrays.asList("portlet_container_runtime_option_value"),
option.getValues());
- assertNull(md.getContainerRuntimeOptions());
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomPortletModeTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomPortletModeTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomPortletModeTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,112 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import org.gatein.pc.portlet.impl.metadata.CustomPortletModeMetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class CustomPortletModeTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
-
- public void test01()
- {
- try
- {
- String xmlFile = "metadata/customPortletMode/portlet1.xml";
-
- PortletApplication10MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
- assertNotNull(md.getCustomPortletModes());
-
- CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
- assertNotNull(cmd1);
- assertEquals("mode1", cmd1.getId());
- assertEquals("Custom", cmd1.getPortletMode());
- assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
- assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
-
- assertNotNull(md.getCustomPortletModes().get("Custom2"));
- }
- catch (Exception e)
- {
- fail(e);
- }
- }
-
- public void test02()
- {
- try
- {
-
- String xmlFile = "metadata/customPortletMode/portlet2.xml";
-
- PortletApplication20MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
- assertNotNull(cmd1);
- assertEquals("Custom", cmd1.getPortletMode());
- assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
- assertEquals(true, cmd1.isPortalManaged());
- assertEquals("cmode1", cmd1.getId());
-
- CustomPortletModeMetaData cmd2 =
md.getCustomPortletModes().get("Custom2");
- assertNotNull(cmd2);
- assertEquals("Custom2", cmd2.getPortletMode());
- assertEquals(false, cmd2.isPortalManaged());
-
- CustomPortletModeMetaData cmd3 =
md.getCustomPortletModes().get("Custom3");
- assertNotNull(cmd3);
- assertEquals("Custom3", cmd3.getPortletMode());
-
- // default value
- assertEquals(true, cmd3.isPortalManaged());
- assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
- assertEquals("Portlet Mode Three",
cmd3.getDescription().getDefaultString());
-
-
- }
- catch (Exception e)
- {
- fail(e);
- }
- }
-
- public void test03() throws Exception
- {
- String xmlFile = "metadata/customPortletMode/portlet1-fail.xml";
- _unmarshall10(xmlFile, true);
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomWindowStateTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomWindowStateTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomWindowStateTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,98 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import org.gatein.pc.portlet.impl.metadata.CustomWindowStateMetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class CustomWindowStateTestEverythingTestCase extends AbstractMetaDataTestCase
-{
- public void test01()
- {
- try
- {
-
- String xmlFile = "metadata/customWindowState/portlet1.xml";
-
- PortletApplication10MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
-
- CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
- assertEquals("WindowState",
cws1.getDescription().getDefaultString());
- assertEquals("windowState1", cws1.getWindowState());
- assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
- assertEquals("foo", cws1.getId());
- CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
- assertNotNull(cws2);
-
- CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
- assertEquals("drei", cws3.getId());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
- public void test02()
- {
- try
- {
-
- String xmlFile = "metadata/customWindowState/portlet2.xml";
-
- PortletApplication20MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
- assertEquals("WindowState",
cws1.getDescription().getDefaultString());
- assertEquals("windowState1", cws1.getWindowState());
- assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
- assertEquals("foo", cws1.getId());
-
- CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
- assertNotNull(cws2);
-
- CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
- assertEquals("drei", cws3.getId());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/EventTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/EventTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/EventTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,123 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import javax.xml.namespace.QName;
-
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.event.EventDefinitionMetaData;
-import org.gatein.pc.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class EventTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void _test01()
- {
- try
- {
-
- String xmlFile = "metadata/event/portlet-event1.xml";
-
- _unmarshall10(xmlFile);
- fail();
- }
- catch (Exception e)
- {
- // ok
- }
- }
-
- public void test02()
- {
- try
- {
-
- String xmlFile = "metadata/event/portlet-event2.xml";
-
- PortletApplication20MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- EventDefinitionMetaData emd = md.getEvents().get(0);
- QName qname = emd.getQname();
- assertEquals("eventID", emd.getId());
-
assertEquals("http://example.com/testEvents",
qname.getNamespaceURI());
- assertEquals("portletEvent", qname.getLocalPart());
- assertEquals("x", qname.getPrefix());
- assertEquals("org.jboss.portal.event.invoke.refill.beer",
emd.getValueType());
- assertEquals("descriptionDefaultLanguage",
emd.getDescription().getDefaultString());
- assertEquals("descriptionDefaultLanguage",
emd.getDescription().getString(new Locale("en"), false));
- assertEquals("Beschreibung in Deutsch",
emd.getDescription().getString(new Locale("de"), false));
-
- EventDefinitionMetaData emd2 = md.getEvents().get(1);
-
- assertNull(emd2.getQname());
- assertEquals("hellouh", emd2.getName());
- assertEquals("hello", emd2.getAlias().get(0).getLocalPart());
-
- // portlet event reference testing
- PortletMetaData p1 = md.getPortlet("Portlet2");
- QName referenceQName = new
QName("http://example.com/testEvents",
"portletEvent");
- assertNotNull(p1);
- assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p1.getPortletClass());
-
- EventDefinitionReferenceMetaData ermd1 =
p1.getSupportedProcessingEvent().get(0);
- assertNotNull(ermd1);
- assertEquals(referenceQName, ermd1.getQname());
-
- EventDefinitionReferenceMetaData ermd2 =
p1.getSupportedProcessingEvent().get(1);
- assertNotNull(ermd2);
- assertEquals("hellouh", ermd2.getName());
-
- EventDefinitionReferenceMetaData ermd3 =
p1.getSupportedPublishingEvent().get(0);
- assertNotNull(ermd3);
- assertEquals(referenceQName, ermd3.getQname());
-
- EventDefinitionReferenceMetaData ermd4 =
p1.getSupportedPublishingEvent().get(1);
- assertNotNull(ermd4);
- assertEquals("hellouh", ermd4.getName());
-
- }
- catch (Exception e)
- {
- fail(e);
- }
- }
-
- // JULIEN : find a way to make that validated somehow
- public void _test021() throws Exception
- {
- // "Should fail: name and qname defined!"
- String xmlFile = "metadata/event/portlet-event2-fail.xml";
- _unmarshall10(xmlFile, true);
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/FilterTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/FilterTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/FilterTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,97 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import org.gatein.pc.api.LifeCyclePhase;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.common.InitParamMetaData;
-import org.gatein.pc.portlet.impl.metadata.filter.FilterMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class FilterTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void test01() throws Exception
- {
- _unmarshall10("metadata/filter/portlet-filter1.xml", true);
- }
-
- public void test02()
- {
- try
- {
- String xmlFile = "metadata/filter/portlet-filter2.xml";
-
- PortletApplication20MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
-
- FilterMetaData filter = md.getFilter("testFilter");
- assertNotNull(filter);
- assertEquals("org.jboss.portal.meta.NoExistingClass",
filter.getFilterClass());
- assertEquals("testFilter", filter.getFilterName());
- assertEquals(LifeCyclePhase.ACTION, filter.getLifecycle().get(0));
- assertEquals(LifeCyclePhase.RENDER, filter.getLifecycle().get(1));
-
- assertEquals("test", filter.getDescription().getDefaultString());
- assertEquals("bla", filter.getDescription().getString(new
Locale("de"), false));
-
- assertEquals("foo", filter.getDisplayName().getString(new
Locale("fr"), false));
- assertEquals("foobar", filter.getDisplayName().getDefaultString());
-
- InitParamMetaData ip = filter.getInitParams().get(0);
- assertEquals("eins", ip.getId());
- assertEquals("foo", ip.getName());
- assertEquals("bar", ip.getValue());
- assertNotNull(ip.getDescription());
-
- InitParamMetaData ip2 = filter.getInitParams().get(1);
- assertEquals("test", ip2.getName());
- assertEquals("testing", ip2.getValue());
- assertNull(ip2.getId());
-
- //
- FilterMetaData filter2 = md.getFilter("testFilterZwei");
- assertEquals("testFilterZwei", filter2.getFilterName());
- assertEquals(LifeCyclePhase.ACTION, filter2.getLifecycle().get(0));
-
- // Filter mapping
- assertEquals("Portlet1",
md.getFilterMapping().get(0).getPortletNames().get(0));
- assertEquals("Portlet2",
md.getFilterMapping().get(0).getPortletNames().get(1));
-
- assertEquals("Portlet2",
md.getFilterMapping().get(1).getPortletNames().get(0));
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/GeneralMetaDataTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/GeneralMetaDataTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/GeneralMetaDataTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,141 +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.gatein.pc.mc.metadata;
-
-import java.net.URI;
-import java.util.Locale;
-
-import org.gatein.pc.portlet.impl.metadata.ListenerMetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.PublicRenderParameterMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class GeneralMetaDataTestCase extends AbstractMetaDataTestCase
-{
-
- public void test01()
- {
- try
- {
- PortletApplication10MetaData md =
_unmarshall10("metadata/general/portlet1.xml");
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
- }
- catch (Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-
- public void test02()
- {
- try
- {
- PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet2.xml");
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
- }
- catch (Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-
- public void test021()
- {
- try
- {
- PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet2-jsr286.xml");
- assertEquals("2.0", md.getVersion());
- assertTrue(md instanceof PortletApplication20MetaData);
-
- assertEquals("MyResourceBundle", md.getResourceBundle());
- assertEquals(new URI("foobar"), md.getDefaultNamespace());
-
- PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
-
- assertEquals("Public render parameter one",
prp1.getDescription().getDefaultString());
- assertEquals("param1", prp1.getId());
- assertEquals("param1", prp1.getName());
- assertEquals("Parameter1", prp1.getAlias().get(0).getLocalPart());
- assertEquals("Parameter2", prp1.getAlias().get(1).getLocalPart());
- assertEquals("blub", prp1.getIdentifier());
-
- assertEquals("foobar",
md.getContainerRuntimeOption("foo").getValues().get(0));
- assertEquals("foobar2",
md.getContainerRuntimeOption("foo").getValues().get(1));
-
- ListenerMetaData listener1 = md.getListeners().get(0);
- assertNotNull(listener1);
- assertEquals("listener.MyListener", listener1.getListenerClass());
- assertEquals("Mein Zuh\u00f6rer Eins",
listener1.getDisplayName().getString(new Locale("de"), false));
- assertEquals("Beschreibung", listener1.getDescription().getString(new
Locale("de"), false));
-
- assertNotNull(md.getListeners().get(1));
-
- assertEquals("MyResourceBundle", md.getResourceBundle());
- assertEquals(new URI("foobar"), md.getDefaultNamespace());
- }
- catch (Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-
- public void test01_generated()
- {
- try
- {
- PortletApplication10MetaData md =
_unmarshall10("metadata/general/portlet-app_1_0.xml");
-
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
- assertNotNull(md.getCustomPortletModes());
-
- }
- catch(Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-
- public void test02_generated()
- {
- try
- {
- PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet-app_2_0.xml");
- assertEquals("2.0", md.getVersion());
- assertTrue(md instanceof PortletApplication20MetaData);
- }
- catch(Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ListenerTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ListenerTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ListenerTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.gatein.pc.mc.metadata;
-
-import org.gatein.pc.portlet.impl.metadata.ListenerMetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class ListenerTestCase extends AbstractMetaDataTestCase
-{
-
- public void test021()
- {
- try
- {
- PortletApplication20MetaData md =
_unmarshall10("metadata/listener/portlet2.xml");
- List<ListenerMetaData> listeners = md.getListeners();
- assertNotNull(listeners);
- assertEquals(1, listeners.size());
- ListenerMetaData listenerMD = listeners.get(0);
- assertNotNull(listenerMD);
- assertEquals("MyListener", listenerMD.getListenerClass());
- }
- catch (Exception e)
- {
- throw fail(e, "No exception expected");
- }
- }
-
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/PortletTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/PortletTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/PortletTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,496 +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.gatein.pc.mc.metadata;
-
-import java.util.List;
-import java.util.Locale;
-
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletMetaDataConstants;
-import org.gatein.pc.portlet.impl.metadata.common.InitParamMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletInfoMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.SupportsMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class PortletTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void test01()
- {
- try
- {
- String xmlFile = "metadata/portlet/portlet1.xml";
-
- PortletApplication10MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
-
- Locale fr = new Locale("fr");
- Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
-
- PortletMetaData p1 = md.getPortlet("Portlet1");
- assertNotNull(p1);
- assertEquals(md, p1.getPortletApplication());
- assertEquals("fragmichnicht", p1.getId());
- assertEquals("Portlet1", p1.getPortletName());
- assertEquals(default_locale, p1.getDescription().getDefaultLocale());
- assertEquals("default", p1.getDescription().getDefaultString());
- assertEquals("defaut", p1.getDescription().getString(fr, false));
- assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
- assertEquals("display", p1.getDisplayName().getDefaultString());
- assertEquals("affichage", p1.getDisplayName().getString(fr, false));
- assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
-
- InitParamMetaData ip1 = p1.getInitParams().get(0);
- assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
- assertEquals("first parameter",
ip1.getDescription().getDefaultString());
- assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
- assertEquals("one", ip1.getName());
- assertEquals("1", ip1.getValue());
-
- InitParamMetaData ip2 = p1.getInitParams().get(1);
- assertNotNull(ip2);
- assertEquals("second parameter",
ip2.getDescription().getDefaultString());
- assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
- assertEquals("two", ip2.getName());
- assertEquals("2", ip2.getValue());
-
- // Expiration cache
- assertEquals(0, p1.getExpirationCache());
-
- SupportsMetaData smd1 = p1.getSupports().get(0);
- assertEquals("text/html", smd1.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
-
- SupportsMetaData smd2 = p1.getSupports().get(1);
- assertEquals("text/wml", smd2.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
-
- assertEquals("MyResourceBundle", p1.getResourceBundle());
-
- List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
- assertEquals(3, localeList.size());
- assertEquals("en", localeList.get(0).getLocale());
- assertEquals("fr", localeList.get(1).getLocale());
- assertEquals("fr_FR", localeList.get(2).getLocale());
-
- PortletInfoMetaData pimd = p1.getPortletInfo();
- assertNotNull(pimd);
- assertEquals("very long portlet title", pimd.getTitle());
- assertEquals("short portlet title", pimd.getShortTitle());
- assertEquals("a,b,c,d,e,f", pimd.getKeywords());
-
- PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
- assertNotNull(ppmd);
-
- assertEquals("MyValidator", ppmd.getPreferenceValidator());
- assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
- assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
- assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
- assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
- assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
- assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
-
- SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
- assertNotNull(srrmd1);
- assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
- assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
-
- SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
- assertNotNull(srrmd2);
- assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
- assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
- assertEquals("ROLE_LINK", srrmd2.getRoleLink());
-
- // Portlet 2
-
- PortletMetaData p2 = md.getPortlet("Portlet2");
- assertNotNull(p2);
- assertEquals(md, p2.getPortletApplication());
- assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p2.getPortletClass());
- assertEquals("text/html", p2.getSupports().get(0).getMimeType());
- assertEquals("test the portlet session",
p2.getPortletInfo().getTitle());
-
- // default value should be 0
- assertEquals(0, p2.getExpirationCache());
-
- PortletMetaData p3 = md.getPortlet("Portlet3");
- assertNotNull(p3);
- assertEquals(md, p3.getPortletApplication());
-
- PortletMetaData p4 = md.getPortlet("Portlet4");
- assertNotNull(p4);
- assertEquals(md, p4.getPortletApplication());
-
- PortletMetaData p5 = md.getPortlet("Portlet5");
- assertNotNull(p5);
- assertEquals(md, p5.getPortletApplication());
- PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
- assertEquals("1",
ppmd5.getPortletPreferences().get("one").getValue().get(0));
- assertEquals("2",
ppmd5.getPortletPreferences().get("two").getValue().get(0));
- assertEquals(false,
ppmd5.getPortletPreferences().get("two").isReadOnly());
- assertEquals("3",
ppmd5.getPortletPreferences().get("three").getValue().get(0));
- assertEquals(true,
ppmd5.getPortletPreferences().get("three").isReadOnly());
- assertEquals("1",
ppmd5.getPortletPreferences().get("all").getValue().get(0));
- assertEquals("2",
ppmd5.getPortletPreferences().get("all").getValue().get(1));
- assertEquals("3",
ppmd5.getPortletPreferences().get("all").getValue().get(2));
-
- PortletMetaData p6 = md.getPortlet("Portlet6");
- assertNotNull(p6);
- assertEquals(md, p6.getPortletApplication());
- assertEquals("Portlet6", p6.getResourceBundle());
- assertEquals(3, p6.getSupportedLocale().size());
- assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
- assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
- assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
-
- PortletMetaData p7 = md.getPortlet("Portlet7");
- assertNotNull(p7);
-
- PortletMetaData p8 = md.getPortlet("Portlet8");
- assertNotNull(p8);
-
- PortletMetaData p9 = md.getPortlet("Portlet9");
- assertNotNull(p9);
-
- PortletMetaData p10 = md.getPortlet("Portlet10");
- assertNotNull(p10);
-
- PortletMetaData p11 = md.getPortlet("Portlet11");
- assertNotNull(p11);
-
- PortletMetaData p12 = md.getPortlet("Portlet12");
- assertNotNull(p12);
- assertEquals(60, p12.getExpirationCache());
-
- PortletMetaData p13 = md.getPortlet("Portlet13");
- assertNotNull(p13);
-
- }
- catch (Exception e)
- {
- throw fail(e);
- }
- }
-
- public void test02()
- {
- try
- {
- String xmlFile = "metadata/portlet/portlet2.xml";
-
- PortletApplication20MetaData md = this._unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- Locale fr = new Locale("fr");
- Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
-
- PortletMetaData p1 = md.getPortlet("Portlet1");
- assertNotNull(p1);
- assertEquals("fragmichnicht2", p1.getId());
- assertEquals("Portlet1", p1.getPortletName());
- assertEquals(default_locale, p1.getDescription().getDefaultLocale());
- assertEquals("default", p1.getDescription().getDefaultString());
- assertEquals("defaut", p1.getDescription().getString(fr, false));
- assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
- assertEquals("display", p1.getDisplayName().getDefaultString());
- assertEquals("affichage", p1.getDisplayName().getString(fr, false));
- assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
-
- InitParamMetaData ip1 = p1.getInitParams().get(0);
- assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
- assertEquals("first parameter",
ip1.getDescription().getDefaultString());
- assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
- assertEquals("one", ip1.getName());
- assertEquals("1", ip1.getValue());
-
- InitParamMetaData ip2 = p1.getInitParams().get(1);
- assertNotNull(ip2);
- assertEquals("second parameter",
ip2.getDescription().getDefaultString());
- assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
- assertEquals("two", ip2.getName());
- assertEquals("2", ip2.getValue());
-
- // Expiration cache
- assertEquals(0, p1.getExpirationCache());
-
- // cache Scope - JSR 286
- assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
-
- SupportsMetaData smd1 = p1.getSupports().get(0);
- assertEquals("text/html", smd1.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
- assertEquals(Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
-
- SupportsMetaData smd2 = p1.getSupports().get(1);
- assertEquals("text/wml", smd2.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
-
- List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
- assertEquals(3, localeList.size());
- assertEquals("en", localeList.get(0).getLocale());
- assertEquals("fr", localeList.get(1).getLocale());
- assertEquals("fr_FR", localeList.get(2).getLocale());
-
- assertEquals("MyResourceBundle", p1.getResourceBundle());
-
- PortletInfoMetaData pimd = p1.getPortletInfo();
- assertNotNull(pimd);
- assertEquals("very long portlet title", pimd.getTitle());
- assertEquals("short portlet title", pimd.getShortTitle());
- assertEquals("a,b,c,d,e,f", pimd.getKeywords());
-
- PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
- assertNotNull(ppmd);
- assertEquals("MyValidator", ppmd.getPreferenceValidator());
- assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
- assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
- assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
- assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
- assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
- assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
-
- SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
- assertNotNull(srrmd1);
- assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
- assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
-
- SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
- assertNotNull(srrmd2);
- assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
- assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
- assertEquals("ROLE_LINK", srrmd2.getRoleLink());
-
- // Portlet2
-
- PortletMetaData p2 = md.getPortlet("Portlet2");
- assertNotNull(p2);
- assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p2.getPortletClass());
- assertEquals("text/html", p2.getSupports().get(0).getMimeType());
- assertEquals("test the portlet session",
p2.getPortletInfo().getTitle());
-
- PortletMetaData p3 = md.getPortlet("Portlet3");
- assertNotNull(p3);
-
- PortletMetaData p4 = md.getPortlet("Portlet4");
- assertNotNull(p4);
-
- PortletMetaData p5 = md.getPortlet("Portlet5");
- assertNotNull(p5);
- PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
- assertEquals("1",
ppmd5.getPortletPreferences().get("one").getValue().get(0));
- assertEquals("2",
ppmd5.getPortletPreferences().get("two").getValue().get(0));
- assertEquals(false,
ppmd5.getPortletPreferences().get("two").isReadOnly());
- assertEquals("3",
ppmd5.getPortletPreferences().get("three").getValue().get(0));
- assertEquals(true,
ppmd5.getPortletPreferences().get("three").isReadOnly());
- assertEquals("1",
ppmd5.getPortletPreferences().get("all").getValue().get(0));
- assertEquals("2",
ppmd5.getPortletPreferences().get("all").getValue().get(1));
- assertEquals("3",
ppmd5.getPortletPreferences().get("all").getValue().get(2));
-
- PortletMetaData p6 = md.getPortlet("Portlet6");
- assertNotNull(p6);
- assertEquals("Portlet6", p6.getResourceBundle());
- assertEquals(3, p6.getSupportedLocale().size());
- assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
- assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
- assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
-
- PortletMetaData p7 = md.getPortlet("Portlet7");
- assertNotNull(p7);
-
- PortletMetaData p8 = md.getPortlet("Portlet8");
- assertNotNull(p8);
-
- PortletMetaData p9 = md.getPortlet("Portlet9");
- assertNotNull(p9);
-
- PortletMetaData p10 = md.getPortlet("Portlet10");
- assertNotNull(p10);
-
- PortletMetaData p11 = md.getPortlet("Portlet11");
- assertNotNull(p11);
-
- PortletMetaData p12 = md.getPortlet("Portlet12");
- assertNotNull(p12);
- assertEquals(60, p12.getExpirationCache());
-
- PortletMetaData p13 = md.getPortlet("Portlet13");
- assertNotNull(p13);
- }
- catch (Exception e)
- {
- throw fail(e);
- }
- }
-
- public void test021()
- {
- try
- {
- String xmlFile = "metadata/portlet/portlet2-jsr286.xml";
-
- PortletApplication20MetaData md = this._unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- Locale fr = new Locale("fr");
- Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
-
- PortletMetaData p1 = md.getPortlet("Portlet1");
- assertNotNull(p1);
- assertEquals("fragmichnicht2", p1.getId());
- assertEquals("Portlet1", p1.getPortletName());
- assertEquals(default_locale, p1.getDescription().getDefaultLocale());
- assertEquals("default", p1.getDescription().getDefaultString());
- assertEquals("defaut", p1.getDescription().getString(fr, false));
- assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
- assertEquals("display", p1.getDisplayName().getDefaultString());
- assertEquals("affichage", p1.getDisplayName().getString(fr, false));
- assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
-
- InitParamMetaData ip1 = p1.getInitParams().get(0);
- assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
- assertEquals("first parameter",
ip1.getDescription().getDefaultString());
- assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
- assertEquals("one", ip1.getName());
- assertEquals("1", ip1.getValue());
-
- InitParamMetaData ip2 = p1.getInitParams().get(1);
- assertNotNull(ip2);
- assertEquals("second parameter",
ip2.getDescription().getDefaultString());
- assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
- assertEquals("two", ip2.getName());
- assertEquals("2", ip2.getValue());
-
- // Expiration cache
- assertEquals(0, p1.getExpirationCache());
-
- SupportsMetaData smd1 = p1.getSupports().get(0);
- assertEquals("text/html", smd1.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
- // window state jsr 286
- assertEquals(WindowState.create("MAXIMIZED"),
smd1.getWindowStates().get(0).getWindowState());
- assertEquals(WindowState.create("NORMAL"),
smd1.getWindowStates().get(1).getWindowState());
-
- SupportsMetaData smd2 = p1.getSupports().get(1);
- assertEquals("foo", smd2.getId());
- assertEquals("text/wml", smd2.getMimeType());
- assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
- assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
- // window state jsr 286
- assertEquals(WindowState.create("NORMAL"),
smd2.getWindowStates().get(0).getWindowState());
- assertEquals(WindowState.create("CUSTOM"),
smd2.getWindowStates().get(1).getWindowState());
-
- List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
- assertEquals(3, localeList.size());
- assertEquals("en", localeList.get(0).getLocale());
- assertEquals("fr", localeList.get(1).getLocale());
- assertEquals("fr_FR", localeList.get(2).getLocale());
-
- assertEquals("MyResourceBundle", p1.getResourceBundle());
-
- PortletInfoMetaData pimd = p1.getPortletInfo();
- assertNotNull(pimd);
- assertEquals("very long portlet title", pimd.getTitle());
- assertEquals("short portlet title", pimd.getShortTitle());
- assertEquals("a,b,c,d,e,f", pimd.getKeywords());
-
- PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
- assertNotNull(ppmd);
- assertEquals("MyValidator", ppmd.getPreferenceValidator());
- assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
- assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
- assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
- assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
- assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
- assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
- assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
-
- SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
- assertNotNull(srrmd1);
- assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
- assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
-
- SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
- assertNotNull(srrmd2);
- assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
- assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
- assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
- assertEquals("ROLE_LINK", srrmd2.getRoleLink());
-
- // JSR 286 properties
- assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
-
assertEquals("http://example.com/testEvents",
p1.getSupportedProcessingEvent().get(0).getQname()
- .getNamespaceURI());
- assertEquals("portletEvent",
p1.getSupportedProcessingEvent().get(0).getQname().getLocalPart());
- assertEquals("x",
p1.getSupportedProcessingEvent().get(0).getQname().getPrefix());
- assertEquals("foo", p1.getSupportedPublicRenderParameters().get(0));
- assertEquals("bar", p1.getSupportedPublicRenderParameters().get(1));
- assertEquals("foo2", p1.getSupportedPublicRenderParameters().get(2));
- assertEquals("foo2bar",
p1.getSupportedPublicRenderParameters().get(3));
-
- assertTrue(p1.getContainerRuntimeOptions().containsKey("option1"));
- assertTrue(p1.getContainerRuntimeOptions().containsKey("option2"));
- assertEquals("value1",
p1.getContainerRuntimeOptions().get("option1").getValues().get(0));
- assertEquals("value2",
p1.getContainerRuntimeOptions().get("option1").getValues().get(1));
- assertEquals("value3",
p1.getContainerRuntimeOptions().get("option2").getValues().get(0));
- }
- catch (Exception e)
- {
- throw fail(e);
- }
- }
-
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/RenderParameterTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/RenderParameterTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/RenderParameterTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,75 +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.gatein.pc.mc.metadata;
-
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.PublicRenderParameterMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class RenderParameterTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void test02()
- {
- try
- {
-
- String xmlFile = "metadata/renderParameter/portlet2.xml";
-
- PortletApplication20MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
- assertNotNull(prp1);
-
- assertEquals("blah", prp1.getIdentifier());
- assertEquals("renderParameter1", prp1.getName());
-
-
- PublicRenderParameterMetaData prp2 = md.getPublicRenderParameters().get(1);
- assertEquals("foo", prp2.getQname().getLocalPart());
- assertEquals("x", prp2.getQname().getPrefix());
- assertEquals("http://someurl.com",
prp2.getQname().getNamespaceURI());
-
- assertEquals("fooo", prp1.getAlias().get(0).getLocalPart());
- assertEquals("rP1", prp1.getAlias().get(1).getLocalPart());
-
- assertEquals("foo", prp2.getAlias().get(0).getLocalPart());
- assertEquals("http://someurl.alias.com",
prp2.getAlias().get(0).getNamespaceURI());
- assertEquals("s", prp2.getAlias().get(0).getPrefix());
-
- assertEquals("render parameter foo",
prp1.getDescription().getDefaultString());
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/SecurityConstraintTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/SecurityConstraintTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/SecurityConstraintTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,209 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import org.gatein.pc.api.TransportGuarantee;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
-import org.gatein.pc.portlet.impl.metadata.security.SecurityConstraintMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class SecurityConstraintTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void test01()
- {
- try
- {
-
- String xmlFile = "metadata/security/portlet1.xml";
-
- PortletApplication10MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
- assertEquals("1.0", md.getVersion());
-
- SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
- assertNotNull(scd1);
- assertEquals("test", scd1.getDisplayName().getDefaultString());
- assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
- assertEquals(TransportGuarantee.NONE,
scd1.getUserDataConstraint().getTransportGuarantee());
-
- assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
- assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
- assertEquals("foo", scd1.getId());
-
- SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
- assertNotNull(scd2);
- assertEquals(TransportGuarantee.INTEGRAL,
scd2.getUserDataConstraint().getTransportGuarantee());
- assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
- assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
- assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
-
- try
- {
- scd2.getPortletList().getPortletNames().get(1);
- fail("2nd security constraint should only contain one element,");
- }
- catch (IndexOutOfBoundsException e)
- {
- // expected java.lang.IndexOutOfBoundsException
- }
-
- PortletMetaData pmd1 = md.getPortlet("foo");
- assertNotNull(pmd1);
-
- PortletMetaData pmd2 = md.getPortlet("foobar");
- assertNotNull(pmd2);
- }
- catch (Exception e)
- {
- fail(e);
- }
- }
-
- /*
- public void test011()
- {
- try
- {
-
- String xmlFile = "security/portlet1-fail1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
-
- unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
-
- fail();
- }
- catch(Exception e)
- {
- // OK
- }
- }
-
- public void test012()
- {
- try
- {
-
- String xmlFile = "security/portlet1-fail1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
-
- unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
- fail();
- }
- catch(Exception e)
- {
- // OK
- }
- }
- */
-
- public void test02()
- {
- try
- {
-
- String xmlFile = "metadata/security/portlet2.xml";
-
- PortletApplication20MetaData md = this._unmarshall10( xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
- assertEquals("2.0", md.getVersion());
-
- SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
- assertNotNull(scd1);
- assertEquals("test", scd1.getDisplayName().getDefaultString());
- assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
- assertEquals("foo", scd1.getId());
-
- assertEquals(TransportGuarantee.NONE,
scd1.getUserDataConstraint().getTransportGuarantee());
- assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
- assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
-
-
- SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
- assertNotNull(scd2);
- assertEquals(TransportGuarantee.INTEGRAL,
scd2.getUserDataConstraint().getTransportGuarantee());
- assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
- assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
- assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
-
- try
- {
- scd2.getPortletList().getPortletNames().get(1);
- fail("2nd security constraint should only contain one element,");
- }
- catch (IndexOutOfBoundsException e)
- {
- // expected java.lang.IndexOutOfBoundsException
- }
-
- }
- catch (Exception e)
- {
- fail(e);
- }
- }
- /*
- public void test021()
- {
- try
- {
-
- String xmlFile = "security/portlet2-fail1.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
-
- unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
- fail();
- }
- catch(Exception e)
- {
- // OK
- }
- }
-
- public void test022()
- {
- try
- {
-
- String xmlFile = "security/portlet2-fail2.xml";
- String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
-
- unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
- fail();
- }
- catch(Exception e)
- {
- // OK
- }
- }
- */
-}
Deleted:
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/UserAttributeTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/UserAttributeTestEverythingTestCase.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/UserAttributeTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,95 +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.gatein.pc.mc.metadata;
-
-import java.util.Locale;
-
-import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
-import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
-import org.gatein.pc.portlet.impl.metadata.UserAttributeMetaData;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
- * @version $Revision$
- */
-public class UserAttributeTestEverythingTestCase extends AbstractMetaDataTestCase
-{
-
- public void test01()
- {
- try
- {
- String xmlFile = "metadata/userAttribute/portlet1.xml";
-
- PortletApplication10MetaData md = _unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication10MetaData);
-
- UserAttributeMetaData umb = md.getUserAttributes().get("blub");
- assertNotNull(umb);
- assertEquals("notFoo", umb.getId());
- assertNull(umb.getDescription());
-
- UserAttributeMetaData umd = md.getUserAttributes().get("foo");
- assertNotNull(umd);
- assertEquals("realFoo", umd.getId());
- assertEquals("foobar", umd.getDescription().getDefaultString());
- assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
- public void test02()
- {
- try
- {
- String xmlFile = "metadata/userAttribute/portlet2.xml";
-
- PortletApplication20MetaData md = this._unmarshall10(xmlFile);
- assertNotNull(md);
- assertTrue(md instanceof PortletApplication20MetaData);
-
- UserAttributeMetaData umb = md.getUserAttributes().get("blub");
- assertNotNull(umb);
- assertEquals("notFoo", umb.getId());
- assertNull(umb.getDescription());
-
- UserAttributeMetaData umd = md.getUserAttributes().get("foo");
- assertNotNull(umd);
- assertEquals("realFoo", umd.getId());
- assertEquals("foobar", umd.getDescription().getDefaultString());
- assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail();
- }
- }
-
-}
Modified: components/pc/trunk/mc/src/test/resources/local-jboss-unit.xml
===================================================================
--- components/pc/trunk/mc/src/test/resources/local-jboss-unit.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/mc/src/test/resources/local-jboss-unit.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -5,63 +5,63 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<test>
- <class
name="org.gatein.pc.mc.metadata.CustomPortletModeTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.CustomPortletModeTestEverythingTestCase"
/>
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.CustomWindowStateTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.CustomWindowStateTestEverythingTestCase"
/>
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class name="org.gatein.pc.mc.metadata.EventTestEverythingTestCase"
/>
+ <class
name="org.gatein.pc.portlet.deployment.EventTestEverythingTestCase" />
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.FilterTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.FilterTestEverythingTestCase" />
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class name="org.gatein.pc.mc.metadata.GeneralMetaDataTestCase"
/>
+ <class
name="org.gatein.pc.portlet.deployment.GeneralMetaDataTestCase" />
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.PortletTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.PortletTestEverythingTestCase" />
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.RenderParameterTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.RenderParameterTestEverythingTestCase"
/>
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.SecurityConstraintTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.SecurityConstraintTestEverythingTestCase"
/>
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
</parameter>
</test>
<test>
- <class
name="org.gatein.pc.mc.metadata.UserAttributeTestEverythingTestCase" />
+ <class
name="org.gatein.pc.portlet.deployment.UserAttributeTestEverythingTestCase"
/>
<parameter name="parser">
<value>annotation</value>
<value>factory</value>
Modified:
components/pc/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-portal-beans.xml
===================================================================
---
components/pc/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-portal-beans.xml 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-portal-beans.xml 2011-06-24
21:52:27 UTC (rev 6743)
@@ -23,7 +23,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="PortletApplicationDeployer"
class="org.gatein.pc.mc.PortletApplicationDeployer">
+ <bean name="PortletApplicationDeployer"
class="org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployer">
<alias>PortletApplicationRegistry</alias>
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
<property name="containerPortletInvoker"><inject
bean="ContainerPortletInvoker"/></property>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2011-06-24 20:54:47 UTC (rev 6742)
+++ components/pc/trunk/portlet/pom.xml 2011-06-24 21:52:27 UTC (rev 6743)
@@ -36,6 +36,10 @@
<artifactId>ccpp</artifactId>
</dependency>
<dependency>
+ <groupId>org.staxnav</groupId>
+ <artifactId>staxnav.core</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
Copied:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationContextImpl.java
(from rev 6681,
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationContextImpl.java)
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationContextImpl.java
(rev 0)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * 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.gatein.pc.portlet.impl.deployment;
+
+import org.gatein.pc.portlet.container.PortletApplicationContext;
+import org.gatein.pc.portlet.container.managed.ManagedPortletApplication;
+import org.gatein.wci.WebApp;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletApplicationContextImpl implements PortletApplicationContext
+{
+
+ /** . */
+ private final WebApp webApp;
+
+ ManagedPortletApplication managedPortletApplication;
+
+ public PortletApplicationContextImpl(WebApp webApp)
+ {
+ this.webApp = webApp;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return webApp.getServletContext();
+ }
+
+ public String getContextPath()
+ {
+ return webApp.getContextPath();
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return webApp.getClassLoader();
+ }
+
+ public void managedStart()
+ {
+ managedPortletApplication.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletApplication.managedStop();
+ }
+}
Copied:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployer.java
(from rev 6740,
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployer.java)
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployer.java
(rev 0)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployer.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,335 @@
+/******************************************************************************
+ * 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.gatein.pc.portlet.impl.deployment;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.io.IOTools;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.pc.api.PortletInvoker;
+import org.gatein.pc.portlet.impl.deployment.staxnav.PortletApplicationMetaDataBuilder;
+import org.gatein.pc.portlet.container.ContainerPortletInvoker;
+import org.gatein.pc.portlet.container.PortletContainer;
+import org.gatein.pc.portlet.container.managed.LifeCycleStatus;
+import org.gatein.pc.portlet.container.managed.ManagedObject;
+import org.gatein.pc.portlet.container.managed.ManagedObjectEvent;
+import org.gatein.pc.portlet.container.managed.ManagedObjectLifeCycleEvent;
+import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEvent;
+import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventBroadcaster;
+import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.gatein.pc.portlet.container.managed.ManagedPortletApplication;
+import org.gatein.pc.portlet.container.managed.PortletApplicationRegistry;
+import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
+import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.wci.ServletContainer;
+import org.gatein.wci.ServletContainerFactory;
+import org.gatein.wci.WebApp;
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppLifeCycleEvent;
+import org.gatein.wci.WebAppListener;
+import org.staxnav.ValueType;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletApplicationDeployer implements WebAppListener,
PortletApplicationRegistry
+{
+
+ /** . */
+ private Logger log = LoggerFactory.getLogger(PortletApplicationDeployer.class);
+
+ /** . */
+ private PortletApplicationRegistry registry;
+
+ /** . */
+ private ServletContainer servletContainer;
+
+ private ServletContainerFactory servletContainerFactory;
+
+ /** . */
+ private Map<String, PortletApplicationDeployment> deploymentMap = new
HashMap<String, PortletApplicationDeployment>();
+
+ /** . */
+ private ClassLoader classLoader;
+
+ /** . */
+ private final Map<String, PortletApplicationLifeCycle> applications = new
HashMap<String, PortletApplicationLifeCycle>();
+
+ /** . */
+ private ContainerPortletInvoker containerPortletInvoker;
+
+ /** . */
+ private ManagedObjectRegistryEventBroadcaster broadcaster;
+
+ public PortletApplicationRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(PortletApplicationRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public ServletContainer getServletContainer()
+ {
+ if (servletContainer == null)
+ {
+ servletContainer = servletContainerFactory.getServletContainer();
+ }
+ return servletContainer;
+ }
+
+ public void setServletContainer(ServletContainer servletContainer)
+ {
+ throw new UnsupportedOperationException("Inject ServletContainerFactory
instead!");
+ }
+
+ public ServletContainerFactory getServletContainerFactory()
+ {
+ return servletContainerFactory;
+ }
+
+ public void setServletContainerFactory(ServletContainerFactory
servletContainerFactory)
+ {
+ this.servletContainerFactory = servletContainerFactory;
+ }
+
+ public PortletInvoker getContainerPortletInvoker()
+ {
+ return containerPortletInvoker;
+ }
+
+ public void setContainerPortletInvoker(PortletInvoker containerPortletInvoker)
+ {
+ if (containerPortletInvoker instanceof ContainerPortletInvoker)
+ {
+ this.containerPortletInvoker =
(ContainerPortletInvoker)containerPortletInvoker;
+ }
+ else
+ {
+ if (containerPortletInvoker == null)
+ {
+ return; // this method is called with null on shutdown
+ }
+ throw new IllegalArgumentException("PortletApplicationDeployer can only
accept ContainerPortletInvokers!");
+ }
+ }
+
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
+ String cp = event.getWebApp().getContextPath();
+ switch (lifeCycleEvent.getType())
+ {
+ case WebAppLifeCycleEvent.ADDED:
+ log.debug("Going to install war file" + cp);
+ add(event.getWebApp());
+ log.debug("Installed war file" + cp);
+ break;
+ case WebAppLifeCycleEvent.REMOVED:
+ try
+ {
+ log.debug("Going to uninstall war file" + cp);
+ remove(event.getWebApp());
+ log.debug("Uninstalled war file" + cp);
+ }
+ catch (Throwable e)
+ {
+ log.error("Uninstalled war file " + cp + " with an
error", e);
+ }
+ break;
+ }
+ }
+ }
+
+ protected void add(WebApp webApp)
+ {
+ //
+ PortletApplication10MetaData metaData = buildPortletApplicationMetaData(webApp);
+ if (metaData != null)
+ {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ PortletApplicationDeployment deployment = new
PortletApplicationDeployment(broadcaster, webApp, metaData);
+ deploymentMap.put(webApp.getContextPath(), deployment);
+ deployment.install();
+
+ //
+ PortletApplicationLifeCycle portletApplicationLifeCycle =
deployment.getPortletApplicationLifeCycle();
+ applications.put(portletApplicationLifeCycle.getId(),
portletApplicationLifeCycle);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ private void remove(WebApp webApp)
+ {
+ PortletApplicationDeployment deployment =
deploymentMap.remove(webApp.getContextPath());
+ if (deployment != null)
+ {
+ PortletApplicationLifeCycle portletApplicationLifeCycle =
deployment.getPortletApplicationLifeCycle();
+ applications.remove(portletApplicationLifeCycle.getId());
+
+ //
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ deployment.uninstall();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ public void start()
+ {
+ broadcaster = new ManagedObjectRegistryEventBroadcaster();
+ classLoader = Thread.currentThread().getContextClassLoader();
+
+ //
+ broadcaster.addListener(bridgeToInvoker);
+ getServletContainer().addWebAppListener(this);
+ }
+
+ public void stop()
+ {
+ // This should generate remove web app event and in cascade clear the registry
+ // as well as the portlet container invoker
+ getServletContainer().removeWebAppListener(this);
+
+ //
+ classLoader = null;
+ broadcaster = null;
+ }
+
+ protected PortletApplication10MetaData buildPortletApplicationMetaData(WebApp webApp)
+ {
+ try
+ {
+ URL url =
webApp.getServletContext().getResource("/WEB-INF/portlet.xml");
+ if (url != null)
+ {
+ InputStream in = null;
+ try
+ {
+ in = IOTools.safeBufferedWrapper(url.openStream());
+
+ //
+ ValueType vt = null;
+
+ //
+ PortletApplicationMetaDataBuilder builder = new
PortletApplicationMetaDataBuilder();
+
+ //
+ return builder.build(in);
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot read portlet.xml", e);
+ }
+ return null;
+ }
+
+ public Collection<? extends ManagedPortletApplication>
getManagedPortletApplications()
+ {
+ return applications.values();
+ }
+
+ public ManagedPortletApplication getManagedPortletApplication(String id)
+ {
+ return applications.get(id);
+ }
+
+ public void addListener(ManagedObjectRegistryEventListener listener)
+ {
+ broadcaster.addListener(listener);
+ }
+
+ public void removeListener(ManagedObjectRegistryEventListener listener)
+ {
+ broadcaster.addListener(listener);
+ }
+
+ /** Bridge managed object event to add/remove portlet container in portlet container
invoker. */
+ private final ManagedObjectRegistryEventListener bridgeToInvoker = new
ManagedObjectRegistryEventListener()
+ {
+ public void onEvent(ManagedObjectRegistryEvent event)
+ {
+ if (event instanceof ManagedObjectEvent)
+ {
+ ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
+ ManagedObject managedObject = managedObjectEvent.getManagedObject();
+
+ //
+ if (managedObject instanceof PortletContainerLifeCycle)
+ {
+ PortletContainerLifeCycle portletContainerLifeCycle =
(PortletContainerLifeCycle)managedObject;
+ PortletContainer portletContainer =
portletContainerLifeCycle.getPortletContainer();
+
+ //
+ if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
+ {
+ ManagedObjectLifeCycleEvent lifeCycleEvent =
(ManagedObjectLifeCycleEvent)managedObjectEvent;
+
+ //
+ LifeCycleStatus status = lifeCycleEvent.getStatus();
+
+ //
+ if (status == LifeCycleStatus.STARTED)
+ {
+ containerPortletInvoker.addPortletContainer(portletContainer);
+ }
+ else
+ {
+ containerPortletInvoker.removePortletContainer(portletContainer);
+ }
+ }
+ }
+ }
+ }
+ };
+}
Copied:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployment.java
(from rev 6681,
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletApplicationDeployment.java)
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployment.java
(rev 0)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletApplicationDeployment.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * 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.gatein.pc.portlet.impl.deployment;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.pc.portlet.impl.info.ContainerInfoBuilder;
+import org.gatein.pc.portlet.impl.info.ContainerInfoBuilderContext;
+import org.gatein.pc.portlet.impl.info.ContainerPortletInfo;
+import org.gatein.pc.portlet.impl.info.ContainerFilterInfo;
+import org.gatein.pc.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
+import org.gatein.pc.portlet.impl.jsr168.PortletApplicationImpl;
+import org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl;
+import org.gatein.pc.portlet.impl.jsr168.PortletFilterImpl;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.container.PortletApplicationLifeCycle;
+import org.gatein.pc.portlet.impl.container.PortletFilterLifeCycle;
+import org.gatein.pc.portlet.impl.container.PortletContainerLifeCycle;
+import org.gatein.pc.portlet.container.object.PortletApplicationObject;
+import org.gatein.pc.portlet.container.object.PortletContainerObject;
+import org.gatein.pc.portlet.container.object.PortletFilterObject;
+import org.gatein.pc.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.gatein.wci.WebApp;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletApplicationDeployment
+{
+
+ /** . */
+ private final Logger log;
+
+ /** . */
+ private final WebApp webApp;
+
+ /** . */
+ private final PortletApplication10MetaData metaData;
+
+ /** . */
+ private final ManagedObjectRegistryEventListener listener;
+
+ /** . */
+ private PortletApplicationLifeCycle portletApplicationLifeCycle;
+
+ public PortletApplicationDeployment(
+ ManagedObjectRegistryEventListener listener,
+ WebApp webApp,
+ PortletApplication10MetaData metaData)
+ {
+ this.listener = listener;
+ this.webApp = webApp;
+ this.metaData = metaData;
+ this.log = LoggerFactory.getLogger(PortletApplicationDeployment.class +
"." + webApp.getContextPath().replace('.', '_'));
+ }
+
+ public PortletApplicationLifeCycle getPortletApplicationLifeCycle()
+ {
+ return portletApplicationLifeCycle;
+ }
+
+ void install()
+ {
+
+ log.debug("Starting installation");
+
+ //
+ ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(metaData, webApp);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(webApp.getContextPath(),
metaData, builderContext);
+ builder.build();
+
+ //
+ PortletApplicationObject portletApplicationObject = new
PortletApplicationImpl(builder.getApplication());
+ PortletApplicationContextImpl portletApplicationContext = new
PortletApplicationContextImpl(webApp);
+
+
+ //
+ portletApplicationLifeCycle = new PortletApplicationLifeCycle(
+ listener,
+ portletApplicationContext,
+ portletApplicationObject);
+
+ // Needed for the managed callbacks
+ portletApplicationContext.managedPortletApplication = portletApplicationLifeCycle;
+
+ //
+ for (ContainerFilterInfo filterInfo :
builder.getApplication().getFilters().values())
+ {
+ PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
+ PortletFilterContextImpl portletFilterContext = new PortletFilterContextImpl();
+
+ //
+ PortletFilterLifeCycle portletFilterLifeCycle =
portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
+
+ // Needed for the managed callbacks
+ portletFilterContext.managedPortletFilter = portletFilterLifeCycle;
+ }
+
+ //
+ for (ContainerPortletInfo containerInfo : builder.getPortlets())
+ {
+ PortletContainerObject portletContainerObject = new
PortletContainerImpl(containerInfo);
+ PortletContainerContextImpl portletContainerContext = new
PortletContainerContextImpl();
+
+ //
+ PortletContainerLifeCycle portletContainerLifeCycle =
portletApplicationLifeCycle.addPortletContainer(portletContainerContext,
portletContainerObject);
+
+ // Needed for the managed callbacks
+ portletContainerContext.managedPortletContainer = portletContainerLifeCycle;
+
+ // Now create deps
+ for (String filterRef : containerInfo.getFilterRefs())
+ {
+ PortletFilterLifeCycle portletFilterLifeCycle =
portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
+
+ //
+ if (portletFilterLifeCycle != null)
+ {
+ portletApplicationLifeCycle.addDependency(portletFilterLifeCycle,
portletContainerLifeCycle);
+ }
+ else
+ {
+ // todo
+ }
+ }
+ }
+
+ //
+ portletApplicationLifeCycle.create();
+
+ //
+ portletApplicationLifeCycle.managedStart();
+
+ //
+
+ }
+
+ void uninstall()
+ {
+ log.debug("Uninstalling");
+
+ //
+ portletApplicationLifeCycle.managedStop();
+
+ //
+ log.debug("Uninstalled");
+ }
+}
Copied:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletContainerContextImpl.java
(from rev 6681,
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletContainerContextImpl.java)
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletContainerContextImpl.java
(rev 0)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletContainerContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.gatein.pc.portlet.impl.deployment;
+
+import org.gatein.pc.portlet.container.PortletContainerContext;
+import org.gatein.pc.portlet.container.managed.ManagedPortletContainer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContainerContextImpl implements PortletContainerContext
+{
+
+ /** . */
+ ManagedPortletContainer managedPortletContainer;
+
+ public void managedStart()
+ {
+ managedPortletContainer.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletContainer.managedStop();
+ }
+}
Copied:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletFilterContextImpl.java
(from rev 6681,
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/PortletFilterContextImpl.java)
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletFilterContextImpl.java
(rev 0)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/PortletFilterContextImpl.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.gatein.pc.portlet.impl.deployment;
+
+import org.gatein.pc.portlet.container.PortletFilterContext;
+import org.gatein.pc.portlet.container.managed.ManagedPortletFilter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletFilterContextImpl implements PortletFilterContext
+{
+
+ ManagedPortletFilter managedPortletFilter;
+
+ public void managedStart()
+ {
+ managedPortletFilter.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletFilter.managedStop();
+ }
+}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/Element.java
===================================================================
--- components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/staxnav/Element.java 2011-06-24
19:41:41 UTC (rev 6738)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/Element.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -17,7 +17,7 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.gatein.pc.mc.staxnav;
+package org.gatein.pc.portlet.impl.deployment.staxnav;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java
===================================================================
---
components/pc/trunk/mc/src/main/java/org/gatein/pc/mc/staxnav/PortletApplicationMetaDataBuilder.java 2011-06-24
19:41:41 UTC (rev 6738)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -17,7 +17,7 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.gatein.pc.mc.staxnav;
+package org.gatein.pc.portlet.impl.deployment.staxnav;
import org.gatein.common.i18n.LocaleFormat;
import org.gatein.common.i18n.LocalizedString;
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/AbstractMetaDataTestCase.java
(from rev 6740,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/AbstractMetaDataTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/AbstractMetaDataTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/AbstractMetaDataTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.gatein.pc.portlet.impl.deployment.staxnav.PortletApplicationMetaDataBuilder;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMetaDataTestCase extends TestCase
+{
+
+ /** Test parameter for using xml binding annotation. */
+ public static final String ANNOTATION_BINDING = "annotation";
+
+ /** Annotation or ObjectModelFactory parsing. */
+ private String parser = ANNOTATION_BINDING;
+
+ protected PortletApplication20MetaData _unmarshall10(String file) throws SAXException,
IOException
+ {
+ return _unmarshall10(file, false);
+ }
+
+ protected PortletApplication20MetaData _unmarshall10(String file, boolean fail) throws
SAXException, IOException
+ {
+ try
+ {
+ PortletApplicationMetaDataBuilder builder = new
PortletApplicationMetaDataBuilder();
+ String path = getPath(file);
+ URL url = new URL(path);
+ InputStream in = url.openStream();
+ assertNotNull(in);
+ PortletApplication20MetaData build = builder.build(in);
+ if (fail)
+ {
+ throw new AssertionFailedError("Was expecting unmarshalling of " +
file + " to fail");
+ }
+ return build;
+ }
+ catch (Exception e)
+ {
+ if (fail)
+ {
+ // OK
+ return null;
+ }
+ else
+ {
+ throw fail(e);
+ }
+ }
+ }
+
+ protected final Error fail(Throwable t)
+ {
+ AssertionFailedError afe = new AssertionFailedError();
+ afe.initCause(t);
+ throw afe;
+ }
+
+ protected final Error fail(Throwable t, String msg)
+ {
+ AssertionFailedError afe = new AssertionFailedError(msg);
+ afe.initCause(t);
+ throw afe;
+ }
+
+ protected String getPath(String file)
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(file);
+ if (url == null)
+ {
+ fail(file + " not found.");
+ }
+ return url.toString();
+ }
+
+ protected InputStream getStream(String file)
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
+ }
+
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ContainerRuntimeOptionTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ContainerRuntimeOptionTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ContainerRuntimeOptionTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ContainerRuntimeOptionTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.pc.portlet.deployment;
+
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.common.ContainerRuntimeMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class ContainerRuntimeOptionTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test021() throws Exception
+ {
+ PortletApplication20MetaData md =
_unmarshall10("metadata/runtimeoption/portlet.xml");
+ PortletMetaData portlet = md.getPortlet("portlet-name");
+ assertNotNull(portlet);
+ Map<String, ContainerRuntimeMetaData> m =
portlet.getContainerRuntimeOptions();
+
assertEquals(Collections.singleton("portlet_container_runtime_option_name"),
m.keySet());
+ ContainerRuntimeMetaData option =
m.get("portlet_container_runtime_option_name");
+ assertEquals(Arrays.asList("portlet_container_runtime_option_value"),
option.getValues());
+ assertNull(md.getContainerRuntimeOptions());
+ }
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomPortletModeTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomPortletModeTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomPortletModeTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomPortletModeTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import org.gatein.pc.portlet.impl.metadata.CustomPortletModeMetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomPortletModeTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/customPortletMode/portlet1.xml";
+
+ PortletApplication10MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
+
+ CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
+ assertNotNull(cmd1);
+ assertEquals("mode1", cmd1.getId());
+ assertEquals("Custom", cmd1.getPortletMode());
+ assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
+ assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
+
+ assertNotNull(md.getCustomPortletModes().get("Custom2"));
+ }
+ catch (Exception e)
+ {
+ fail(e);
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customPortletMode/portlet2.xml";
+
+ PortletApplication20MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ CustomPortletModeMetaData cmd1 =
md.getCustomPortletModes().get("Custom");
+ assertNotNull(cmd1);
+ assertEquals("Custom", cmd1.getPortletMode());
+ assertEquals("portletMode1",
cmd1.getDescription().getDefaultString());
+ assertEquals(true, cmd1.isPortalManaged());
+ assertEquals("cmode1", cmd1.getId());
+
+ CustomPortletModeMetaData cmd2 =
md.getCustomPortletModes().get("Custom2");
+ assertNotNull(cmd2);
+ assertEquals("Custom2", cmd2.getPortletMode());
+ assertEquals(false, cmd2.isPortalManaged());
+
+ CustomPortletModeMetaData cmd3 =
md.getCustomPortletModes().get("Custom3");
+ assertNotNull(cmd3);
+ assertEquals("Custom3", cmd3.getPortletMode());
+
+ // default value
+ assertEquals(true, cmd3.isPortalManaged());
+ assertEquals("eigener portlet modus",
cmd1.getDescription().getString(new Locale("de"), false));
+ assertEquals("Portlet Mode Three",
cmd3.getDescription().getDefaultString());
+
+
+ }
+ catch (Exception e)
+ {
+ fail(e);
+ }
+ }
+
+ public void test03() throws Exception
+ {
+ String xmlFile = "metadata/customPortletMode/portlet1-fail.xml";
+ _unmarshall10(xmlFile, true);
+ }
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomWindowStateTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/CustomWindowStateTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomWindowStateTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/CustomWindowStateTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import org.gatein.pc.portlet.impl.metadata.CustomWindowStateMetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomWindowStateTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+ public void test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customWindowState/portlet1.xml";
+
+ PortletApplication10MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
+ assertEquals("WindowState",
cws1.getDescription().getDefaultString());
+ assertEquals("windowState1", cws1.getWindowState());
+ assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
+ assertEquals("foo", cws1.getId());
+ CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
+ assertNotNull(cws2);
+
+ CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
+ assertEquals("drei", cws3.getId());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customWindowState/portlet2.xml";
+
+ PortletApplication20MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ CustomWindowStateMetaData cws1 =
md.getCustomWindowStates().get("windowState1");
+ assertEquals("WindowState",
cws1.getDescription().getDefaultString());
+ assertEquals("windowState1", cws1.getWindowState());
+ assertEquals("Offenes Fenster", cws1.getDescription().getString(new
Locale("de"), false));
+ assertEquals("foo", cws1.getId());
+
+ CustomWindowStateMetaData cws2 =
md.getCustomWindowStates().get("windowState2");
+ assertNotNull(cws2);
+
+ CustomWindowStateMetaData cws3 =
md.getCustomWindowStates().get("windowState3");
+ assertEquals("drei", cws3.getId());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/EventTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.event.EventDefinitionMetaData;
+import org.gatein.pc.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class EventTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void _test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/event/portlet-event1.xml";
+
+ _unmarshall10(xmlFile);
+ fail();
+ }
+ catch (Exception e)
+ {
+ // ok
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/event/portlet-event2.xml";
+
+ PortletApplication20MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ EventDefinitionMetaData emd = md.getEvents().get(0);
+ QName qname = emd.getQname();
+ assertEquals("eventID", emd.getId());
+
assertEquals("http://example.com/testEvents",
qname.getNamespaceURI());
+ assertEquals("portletEvent", qname.getLocalPart());
+ assertEquals("x", qname.getPrefix());
+ assertEquals("org.jboss.portal.event.invoke.refill.beer",
emd.getValueType());
+ assertEquals("descriptionDefaultLanguage",
emd.getDescription().getDefaultString());
+ assertEquals("descriptionDefaultLanguage",
emd.getDescription().getString(new Locale("en"), false));
+ assertEquals("Beschreibung in Deutsch",
emd.getDescription().getString(new Locale("de"), false));
+
+ EventDefinitionMetaData emd2 = md.getEvents().get(1);
+
+ assertNull(emd2.getQname());
+ assertEquals("hellouh", emd2.getName());
+ assertEquals("hello", emd2.getAlias().get(0).getLocalPart());
+
+ // portlet event reference testing
+ PortletMetaData p1 = md.getPortlet("Portlet2");
+ QName referenceQName = new
QName("http://example.com/testEvents",
"portletEvent");
+ assertNotNull(p1);
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p1.getPortletClass());
+
+ EventDefinitionReferenceMetaData ermd1 =
p1.getSupportedProcessingEvent().get(0);
+ assertNotNull(ermd1);
+ assertEquals(referenceQName, ermd1.getQname());
+
+ EventDefinitionReferenceMetaData ermd2 =
p1.getSupportedProcessingEvent().get(1);
+ assertNotNull(ermd2);
+ assertEquals("hellouh", ermd2.getName());
+
+ EventDefinitionReferenceMetaData ermd3 =
p1.getSupportedPublishingEvent().get(0);
+ assertNotNull(ermd3);
+ assertEquals(referenceQName, ermd3.getQname());
+
+ EventDefinitionReferenceMetaData ermd4 =
p1.getSupportedPublishingEvent().get(1);
+ assertNotNull(ermd4);
+ assertEquals("hellouh", ermd4.getName());
+
+ }
+ catch (Exception e)
+ {
+ fail(e);
+ }
+ }
+
+ // JULIEN : find a way to make that validated somehow
+ public void _test021() throws Exception
+ {
+ // "Should fail: name and qname defined!"
+ String xmlFile = "metadata/event/portlet-event2-fail.xml";
+ _unmarshall10(xmlFile, true);
+ }
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/FilterTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/FilterTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/FilterTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/FilterTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import org.gatein.pc.api.LifeCyclePhase;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.common.InitParamMetaData;
+import org.gatein.pc.portlet.impl.metadata.filter.FilterMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class FilterTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test01() throws Exception
+ {
+ _unmarshall10("metadata/filter/portlet-filter1.xml", true);
+ }
+
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/filter/portlet-filter2.xml";
+
+ PortletApplication20MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ FilterMetaData filter = md.getFilter("testFilter");
+ assertNotNull(filter);
+ assertEquals("org.jboss.portal.meta.NoExistingClass",
filter.getFilterClass());
+ assertEquals("testFilter", filter.getFilterName());
+ assertEquals(LifeCyclePhase.ACTION, filter.getLifecycle().get(0));
+ assertEquals(LifeCyclePhase.RENDER, filter.getLifecycle().get(1));
+
+ assertEquals("test", filter.getDescription().getDefaultString());
+ assertEquals("bla", filter.getDescription().getString(new
Locale("de"), false));
+
+ assertEquals("foo", filter.getDisplayName().getString(new
Locale("fr"), false));
+ assertEquals("foobar", filter.getDisplayName().getDefaultString());
+
+ InitParamMetaData ip = filter.getInitParams().get(0);
+ assertEquals("eins", ip.getId());
+ assertEquals("foo", ip.getName());
+ assertEquals("bar", ip.getValue());
+ assertNotNull(ip.getDescription());
+
+ InitParamMetaData ip2 = filter.getInitParams().get(1);
+ assertEquals("test", ip2.getName());
+ assertEquals("testing", ip2.getValue());
+ assertNull(ip2.getId());
+
+ //
+ FilterMetaData filter2 = md.getFilter("testFilterZwei");
+ assertEquals("testFilterZwei", filter2.getFilterName());
+ assertEquals(LifeCyclePhase.ACTION, filter2.getLifecycle().get(0));
+
+ // Filter mapping
+ assertEquals("Portlet1",
md.getFilterMapping().get(0).getPortletNames().get(0));
+ assertEquals("Portlet2",
md.getFilterMapping().get(0).getPortletNames().get(1));
+
+ assertEquals("Portlet2",
md.getFilterMapping().get(1).getPortletNames().get(0));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/GeneralMetaDataTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/GeneralMetaDataTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/GeneralMetaDataTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/GeneralMetaDataTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,141 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.net.URI;
+import java.util.Locale;
+
+import org.gatein.pc.portlet.impl.metadata.ListenerMetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.PublicRenderParameterMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class GeneralMetaDataTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test01()
+ {
+ try
+ {
+ PortletApplication10MetaData md =
_unmarshall10("metadata/general/portlet1.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ }
+ catch (Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+ PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet2.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+ }
+ catch (Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+
+ public void test021()
+ {
+ try
+ {
+ PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet2-jsr286.xml");
+ assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ assertEquals("MyResourceBundle", md.getResourceBundle());
+ assertEquals(new URI("foobar"), md.getDefaultNamespace());
+
+ PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+
+ assertEquals("Public render parameter one",
prp1.getDescription().getDefaultString());
+ assertEquals("param1", prp1.getId());
+ assertEquals("param1", prp1.getName());
+ assertEquals("Parameter1", prp1.getAlias().get(0).getLocalPart());
+ assertEquals("Parameter2", prp1.getAlias().get(1).getLocalPart());
+ assertEquals("blub", prp1.getIdentifier());
+
+ assertEquals("foobar",
md.getContainerRuntimeOption("foo").getValues().get(0));
+ assertEquals("foobar2",
md.getContainerRuntimeOption("foo").getValues().get(1));
+
+ ListenerMetaData listener1 = md.getListeners().get(0);
+ assertNotNull(listener1);
+ assertEquals("listener.MyListener", listener1.getListenerClass());
+ assertEquals("Mein Zuh\u00f6rer Eins",
listener1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals("Beschreibung", listener1.getDescription().getString(new
Locale("de"), false));
+
+ assertNotNull(md.getListeners().get(1));
+
+ assertEquals("MyResourceBundle", md.getResourceBundle());
+ assertEquals(new URI("foobar"), md.getDefaultNamespace());
+ }
+ catch (Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+
+ public void test01_generated()
+ {
+ try
+ {
+ PortletApplication10MetaData md =
_unmarshall10("metadata/general/portlet-app_1_0.xml");
+
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
+
+ }
+ catch(Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+
+ public void test02_generated()
+ {
+ try
+ {
+ PortletApplication20MetaData md =
_unmarshall10("metadata/general/portlet-app_2_0.xml");
+ assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
+ }
+ catch(Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ListenerTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/ListenerTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ListenerTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/ListenerTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.pc.portlet.deployment;
+
+import org.gatein.pc.portlet.impl.metadata.ListenerMetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class ListenerTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test021()
+ {
+ try
+ {
+ PortletApplication20MetaData md =
_unmarshall10("metadata/listener/portlet2.xml");
+ List<ListenerMetaData> listeners = md.getListeners();
+ assertNotNull(listeners);
+ assertEquals(1, listeners.size());
+ ListenerMetaData listenerMD = listeners.get(0);
+ assertNotNull(listenerMD);
+ assertEquals("MyListener", listenerMD.getListenerClass());
+ }
+ catch (Exception e)
+ {
+ throw fail(e, "No exception expected");
+ }
+ }
+
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/PortletTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/PortletTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/PortletTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/PortletTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,496 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletMetaDataConstants;
+import org.gatein.pc.portlet.impl.metadata.common.InitParamMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletInfoMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.SupportsMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet1.xml";
+
+ PortletApplication10MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals(md, p1.getPortletApplication());
+ assertEquals("fragmichnicht", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter",
ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter",
ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // Portlet 2
+
+ PortletMetaData p2 = md.getPortlet("Portlet2");
+ assertNotNull(p2);
+ assertEquals(md, p2.getPortletApplication());
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p2.getPortletClass());
+ assertEquals("text/html", p2.getSupports().get(0).getMimeType());
+ assertEquals("test the portlet session",
p2.getPortletInfo().getTitle());
+
+ // default value should be 0
+ assertEquals(0, p2.getExpirationCache());
+
+ PortletMetaData p3 = md.getPortlet("Portlet3");
+ assertNotNull(p3);
+ assertEquals(md, p3.getPortletApplication());
+
+ PortletMetaData p4 = md.getPortlet("Portlet4");
+ assertNotNull(p4);
+ assertEquals(md, p4.getPortletApplication());
+
+ PortletMetaData p5 = md.getPortlet("Portlet5");
+ assertNotNull(p5);
+ assertEquals(md, p5.getPortletApplication());
+ PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
+ assertEquals("1",
ppmd5.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2",
ppmd5.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false,
ppmd5.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3",
ppmd5.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true,
ppmd5.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1",
ppmd5.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2",
ppmd5.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3",
ppmd5.getPortletPreferences().get("all").getValue().get(2));
+
+ PortletMetaData p6 = md.getPortlet("Portlet6");
+ assertNotNull(p6);
+ assertEquals(md, p6.getPortletApplication());
+ assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
+
+ PortletMetaData p7 = md.getPortlet("Portlet7");
+ assertNotNull(p7);
+
+ PortletMetaData p8 = md.getPortlet("Portlet8");
+ assertNotNull(p8);
+
+ PortletMetaData p9 = md.getPortlet("Portlet9");
+ assertNotNull(p9);
+
+ PortletMetaData p10 = md.getPortlet("Portlet10");
+ assertNotNull(p10);
+
+ PortletMetaData p11 = md.getPortlet("Portlet11");
+ assertNotNull(p11);
+
+ PortletMetaData p12 = md.getPortlet("Portlet12");
+ assertNotNull(p12);
+ assertEquals(60, p12.getExpirationCache());
+
+ PortletMetaData p13 = md.getPortlet("Portlet13");
+ assertNotNull(p13);
+
+ }
+ catch (Exception e)
+ {
+ throw fail(e);
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet2.xml";
+
+ PortletApplication20MetaData md = this._unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals("fragmichnicht2", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter",
ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter",
ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ // cache Scope - JSR 286
+ assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // Portlet2
+
+ PortletMetaData p2 = md.getPortlet("Portlet2");
+ assertNotNull(p2);
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet",
p2.getPortletClass());
+ assertEquals("text/html", p2.getSupports().get(0).getMimeType());
+ assertEquals("test the portlet session",
p2.getPortletInfo().getTitle());
+
+ PortletMetaData p3 = md.getPortlet("Portlet3");
+ assertNotNull(p3);
+
+ PortletMetaData p4 = md.getPortlet("Portlet4");
+ assertNotNull(p4);
+
+ PortletMetaData p5 = md.getPortlet("Portlet5");
+ assertNotNull(p5);
+ PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
+ assertEquals("1",
ppmd5.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2",
ppmd5.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false,
ppmd5.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3",
ppmd5.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true,
ppmd5.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1",
ppmd5.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2",
ppmd5.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3",
ppmd5.getPortletPreferences().get("all").getValue().get(2));
+
+ PortletMetaData p6 = md.getPortlet("Portlet6");
+ assertNotNull(p6);
+ assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
+
+ PortletMetaData p7 = md.getPortlet("Portlet7");
+ assertNotNull(p7);
+
+ PortletMetaData p8 = md.getPortlet("Portlet8");
+ assertNotNull(p8);
+
+ PortletMetaData p9 = md.getPortlet("Portlet9");
+ assertNotNull(p9);
+
+ PortletMetaData p10 = md.getPortlet("Portlet10");
+ assertNotNull(p10);
+
+ PortletMetaData p11 = md.getPortlet("Portlet11");
+ assertNotNull(p11);
+
+ PortletMetaData p12 = md.getPortlet("Portlet12");
+ assertNotNull(p12);
+ assertEquals(60, p12.getExpirationCache());
+
+ PortletMetaData p13 = md.getPortlet("Portlet13");
+ assertNotNull(p13);
+ }
+ catch (Exception e)
+ {
+ throw fail(e);
+ }
+ }
+
+ public void test021()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet2-jsr286.xml";
+
+ PortletApplication20MetaData md = this._unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals("fragmichnicht2", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet",
p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter",
ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr,
false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter",
ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr,
false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("EDIT"),
smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd1.getPortletModes().get(2).getPortletMode());
+ // window state jsr 286
+ assertEquals(WindowState.create("MAXIMIZED"),
smd1.getWindowStates().get(0).getWindowState());
+ assertEquals(WindowState.create("NORMAL"),
smd1.getWindowStates().get(1).getWindowState());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("foo", smd2.getId());
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(org.gatein.pc.api.Mode.create("VIEW"),
smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(org.gatein.pc.api.Mode.create("HELP"),
smd2.getPortletModes().get(1).getPortletMode());
+ // window state jsr 286
+ assertEquals(WindowState.create("NORMAL"),
smd2.getWindowStates().get(0).getWindowState());
+ assertEquals(WindowState.create("CUSTOM"),
smd2.getWindowStates().get(1).getWindowState());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1",
ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false,
ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3",
ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true,
ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1",
ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2",
ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3",
ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link",
srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link",
srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr,
false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // JSR 286 properties
+ assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
+
assertEquals("http://example.com/testEvents",
p1.getSupportedProcessingEvent().get(0).getQname()
+ .getNamespaceURI());
+ assertEquals("portletEvent",
p1.getSupportedProcessingEvent().get(0).getQname().getLocalPart());
+ assertEquals("x",
p1.getSupportedProcessingEvent().get(0).getQname().getPrefix());
+ assertEquals("foo", p1.getSupportedPublicRenderParameters().get(0));
+ assertEquals("bar", p1.getSupportedPublicRenderParameters().get(1));
+ assertEquals("foo2", p1.getSupportedPublicRenderParameters().get(2));
+ assertEquals("foo2bar",
p1.getSupportedPublicRenderParameters().get(3));
+
+ assertTrue(p1.getContainerRuntimeOptions().containsKey("option1"));
+ assertTrue(p1.getContainerRuntimeOptions().containsKey("option2"));
+ assertEquals("value1",
p1.getContainerRuntimeOptions().get("option1").getValues().get(0));
+ assertEquals("value2",
p1.getContainerRuntimeOptions().get("option1").getValues().get(1));
+ assertEquals("value3",
p1.getContainerRuntimeOptions().get("option2").getValues().get(0));
+ }
+ catch (Exception e)
+ {
+ throw fail(e);
+ }
+ }
+
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/RenderParameterTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/RenderParameterTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/RenderParameterTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/RenderParameterTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.PublicRenderParameterMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RenderParameterTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/renderParameter/portlet2.xml";
+
+ PortletApplication20MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+ assertNotNull(prp1);
+
+ assertEquals("blah", prp1.getIdentifier());
+ assertEquals("renderParameter1", prp1.getName());
+
+
+ PublicRenderParameterMetaData prp2 = md.getPublicRenderParameters().get(1);
+ assertEquals("foo", prp2.getQname().getLocalPart());
+ assertEquals("x", prp2.getQname().getPrefix());
+ assertEquals("http://someurl.com",
prp2.getQname().getNamespaceURI());
+
+ assertEquals("fooo", prp1.getAlias().get(0).getLocalPart());
+ assertEquals("rP1", prp1.getAlias().get(1).getLocalPart());
+
+ assertEquals("foo", prp2.getAlias().get(0).getLocalPart());
+ assertEquals("http://someurl.alias.com",
prp2.getAlias().get(0).getNamespaceURI());
+ assertEquals("s", prp2.getAlias().get(0).getPrefix());
+
+ assertEquals("render parameter foo",
prp1.getDescription().getDefaultString());
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/SecurityConstraintTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/SecurityConstraintTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/SecurityConstraintTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/SecurityConstraintTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,209 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import org.gatein.pc.api.TransportGuarantee;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.portlet.PortletMetaData;
+import org.gatein.pc.portlet.impl.metadata.security.SecurityConstraintMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class SecurityConstraintTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/security/portlet1.xml";
+
+ PortletApplication10MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
+ assertNotNull(scd1);
+ assertEquals("test", scd1.getDisplayName().getDefaultString());
+ assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
+ assertEquals(TransportGuarantee.NONE,
scd1.getUserDataConstraint().getTransportGuarantee());
+
+ assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
+ assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
+ assertEquals("foo", scd1.getId());
+
+ SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
+ assertNotNull(scd2);
+ assertEquals(TransportGuarantee.INTEGRAL,
scd2.getUserDataConstraint().getTransportGuarantee());
+ assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
+
+ try
+ {
+ scd2.getPortletList().getPortletNames().get(1);
+ fail("2nd security constraint should only contain one element,");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // expected java.lang.IndexOutOfBoundsException
+ }
+
+ PortletMetaData pmd1 = md.getPortlet("foo");
+ assertNotNull(pmd1);
+
+ PortletMetaData pmd2 = md.getPortlet("foobar");
+ assertNotNull(pmd2);
+ }
+ catch (Exception e)
+ {
+ fail(e);
+ }
+ }
+
+ /*
+ public void test011()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet1-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
+
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+
+ public void test012()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet1-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+ */
+
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/security/portlet2.xml";
+
+ PortletApplication20MetaData md = this._unmarshall10( xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
+ assertNotNull(scd1);
+ assertEquals("test", scd1.getDisplayName().getDefaultString());
+ assertEquals("Test", scd1.getDisplayName().getString(new
Locale("de"), false));
+ assertEquals("foo", scd1.getId());
+
+ assertEquals(TransportGuarantee.NONE,
scd1.getUserDataConstraint().getTransportGuarantee());
+ assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
+ assertEquals("foobar",
scd1.getPortletList().getPortletNames().get(1));
+
+
+ SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
+ assertNotNull(scd2);
+ assertEquals(TransportGuarantee.INTEGRAL,
scd2.getUserDataConstraint().getTransportGuarantee());
+ assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint",
scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint",
scd1.getUserDataConstraint().getDescription().getString(new Locale("de"),
false));
+
+ try
+ {
+ scd2.getPortletList().getPortletNames().get(1);
+ fail("2nd security constraint should only contain one element,");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // expected java.lang.IndexOutOfBoundsException
+ }
+
+ }
+ catch (Exception e)
+ {
+ fail(e);
+ }
+ }
+ /*
+ public void test021()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet2-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+
+ public void test022()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet2-fail2.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+ */
+}
Copied:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/UserAttributeTestEverythingTestCase.java
(from rev 6738,
components/pc/trunk/mc/src/test/java/org/gatein/pc/mc/metadata/UserAttributeTestEverythingTestCase.java)
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/UserAttributeTestEverythingTestCase.java
(rev 0)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/UserAttributeTestEverythingTestCase.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.pc.portlet.deployment;
+
+import java.util.Locale;
+
+import org.gatein.pc.portlet.impl.metadata.PortletApplication10MetaData;
+import org.gatein.pc.portlet.impl.metadata.PortletApplication20MetaData;
+import org.gatein.pc.portlet.impl.metadata.UserAttributeMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
+ * @version $Revision$
+ */
+public class UserAttributeTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/userAttribute/portlet1.xml";
+
+ PortletApplication10MetaData md = _unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+
+ UserAttributeMetaData umb = md.getUserAttributes().get("blub");
+ assertNotNull(umb);
+ assertEquals("notFoo", umb.getId());
+ assertNull(umb.getDescription());
+
+ UserAttributeMetaData umd = md.getUserAttributes().get("foo");
+ assertNotNull(umd);
+ assertEquals("realFoo", umd.getId());
+ assertEquals("foobar", umd.getDescription().getDefaultString());
+ assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/userAttribute/portlet2.xml";
+
+ PortletApplication20MetaData md = this._unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ UserAttributeMetaData umb = md.getUserAttributes().get("blub");
+ assertNotNull(umb);
+ assertEquals("notFoo", umb.getId());
+ assertNull(umb.getDescription());
+
+ UserAttributeMetaData umd = md.getUserAttributes().get("foo");
+ assertNotNull(umd);
+ assertEquals("realFoo", umd.getId());
+ assertEquals("foobar", umd.getDescription().getDefaultString());
+ assertEquals("fuhbar", umd.getDescription().getString(new
Locale("de"), true));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Deleted:
components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml
===================================================================
---
components/pc/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml 2011-06-20
16:49:45 UTC (rev 6681)
+++
components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,73 +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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- version="2.0">
-
- <filter>
- <description>test</description>
- <description xml:lang="de">bla</description>
- <display-name xml:lang="fr">foo</display-name>
- <display-name>foobar</display-name>
- <filter-name>testFilter</filter-name>
- <filter-class>
- org.jboss.portal.meta.NoExistingClass
- </filter-class>
- <lifecycle>ACTION_PHASE</lifecycle>
- <lifecycle>RENDER_PHASE</lifecycle>
- <init-param id="eins">
- <description xml:lang="fr">biere</description>
- <description>beer</description>
- <name>foo</name>
- <value>bar</value>
- </init-param>
- <init-param>
- <name>test</name>
- <value>testing</value>
- </init-param>
- </filter>
-
- <filter>
- <filter-name>testFilterZwei</filter-name>
- <filter-class>org.jboss.portal.meta.NoExistingClass</filter-class>
- <lifecycle>ACTION_PHASE</lifecycle>
- </filter>
-
- <filter>
- <filter-name>foo</filter-name>
- </filter>
-
- <filter-mapping>
- <filter-name>testFilter</filter-name>
- <portlet-name>Portlet1</portlet-name>
- <portlet-name>Portlet2</portlet-name>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>testFilterZwei</filter-name>
- <portlet-name>Portlet2</portlet-name>
- </filter-mapping>
-
-</portlet-app>
\ No newline at end of file
Copied: components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml
(from rev 6738,
components/pc/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml)
===================================================================
--- components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml
(rev 0)
+++
components/pc/trunk/portlet/src/test/resources/metadata/filter/portlet-filter2.xml 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <filter>
+ <description>test</description>
+ <description xml:lang="de">bla</description>
+ <display-name xml:lang="fr">foo</display-name>
+ <display-name>foobar</display-name>
+ <filter-name>testFilter</filter-name>
+ <filter-class>
+ org.jboss.portal.meta.NoExistingClass
+ </filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ <init-param id="eins">
+ <description xml:lang="fr">biere</description>
+ <description>beer</description>
+ <name>foo</name>
+ <value>bar</value>
+ </init-param>
+ <init-param>
+ <name>test</name>
+ <value>testing</value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>testFilterZwei</filter-name>
+ <filter-class>org.jboss.portal.meta.NoExistingClass</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ </filter>
+
+<!--
+ <filter>
+ <filter-name>foo</filter-name>
+ </filter>
+-->
+
+ <filter-mapping>
+ <filter-name>testFilter</filter-name>
+ <portlet-name>Portlet1</portlet-name>
+ <portlet-name>Portlet2</portlet-name>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>testFilterZwei</filter-name>
+ <portlet-name>Portlet2</portlet-name>
+ </filter-mapping>
+
+</portlet-app>
Deleted:
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml
===================================================================
---
components/pc/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml 2011-06-20
16:49:45 UTC (rev 6681)
+++
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml 2011-06-24
21:52:27 UTC (rev 6743)
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
- version="2.0"
- id="id">
- <portlet id="id">
- <description xml:lang="en">description</description>
- <portlet-name>portlet-name</portlet-name>
- <display-name xml:lang="en">display-name</display-name>
- <portlet-class>portlet-class</portlet-class>
- <init-param id="id">
- <description xml:lang="en">description</description>
- <name>name</name>
- <value>value</value>
- </init-param>
- <expiration-cache>0</expiration-cache>
- <cache-scope>PRIVATE</cache-scope>
- <supports id="id">
- <mime-type>mime-type</mime-type>
- <portlet-mode>portlet-mode</portlet-mode>
- <window-state>window-state</window-state>
- </supports>
- <supported-locale>supported-locale</supported-locale>
- <resource-bundle>resource-bundle</resource-bundle>
- <portlet-info id="id">
- <title>title</title>
- <short-title>short-title</short-title>
- <keywords>keywords</keywords>
- </portlet-info>
- <portlet-preferences id="id">
- <preference id="id">
- <name>name</name>
- <value>value</value>
- <read-only>true</read-only>
- </preference>
- <preferences-validator>preferences-validator</preferences-validator>
- </portlet-preferences>
- <security-role-ref id="id">
- <description xml:lang="en">description</description>
- <role-name>NMTOKEN</role-name>
- <role-link>role-link</role-link>
- </security-role-ref>
- <supported-processing-event id="id">
- <qname>QName</qname>
- </supported-processing-event>
- <supported-publishing-event id="id">
- <qname>QName</qname>
- </supported-publishing-event>
-
<supported-public-render-parameter>supported-public-render-parameter</supported-public-render-parameter>
- <container-runtime-option>
- <name>name</name>
- <value>value</value>
- </container-runtime-option>
- </portlet>
- <custom-portlet-mode id="id">
- <description xml:lang="en">description</description>
- <portlet-mode>portlet-mode</portlet-mode>
- <portal-managed>true</portal-managed>
- </custom-portlet-mode>
- <custom-window-state id="id">
- <description xml:lang="en">description</description>
- <window-state>window-state</window-state>
- </custom-window-state>
- <user-attribute id="id">
- <description xml:lang="en">description</description>
- <name>name</name>
- </user-attribute>
- <security-constraint id="id">
- <display-name xml:lang="en">display-name</display-name>
- <portlet-collection>
- <portlet-name>portlet-name</portlet-name>
- </portlet-collection>
- <user-data-constraint id="id">
- <description xml:lang="en">description</description>
- <transport-guarantee>CONFIDENTIAL</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
- <resource-bundle>resource-bundle</resource-bundle>
- <filter>
- <description xml:lang="en">description</description>
- <display-name xml:lang="en">display-name</display-name>
- <filter-name>filter-name</filter-name>
- <filter-class>filter-class</filter-class>
- <lifecycle>RENDER_PHASE</lifecycle>
- <init-param id="">
- <description xml:lang="en">description</description>
- <name>name</name>
- <value>value</value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>filter-name</filter-name>
- <portlet-name>portlet-name</portlet-name>
- </filter-mapping>
- <default-namespace>http://tempuri.org</default-namespace>
- <event-definition id="id">
- <description xml:lang="en">description</description>
- <qname>QName</qname>
- <alias>QName</alias>
- <value-type>value-type</value-type>
- </event-definition>
- <public-render-parameter id="id">
- <description xml:lang="en">description</description>
- <identifier>identifier</identifier>
- <qname>QName</qname>
- <alias>QName</alias>
- </public-render-parameter>
- <listener id="id">
- <description xml:lang="en">description</description>
- <display-name xml:lang="en">display-name</display-name>
- <listener-class>listener-class</listener-class>
- </listener>
- <container-runtime-option>
- <name>name</name>
- <value>value</value>
- </container-runtime-option>
-</portlet-app>
Copied:
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml (from
rev 6738, components/pc/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml)
===================================================================
--- components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml
(rev 0)
+++
components/pc/trunk/portlet/src/test/resources/metadata/general/portlet-app_2_0.xml 2011-06-24
21:52:27 UTC (rev 6743)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0"
+ id="id">
+ <portlet id="id">
+ <description xml:lang="en">description</description>
+ <portlet-name>portlet-name</portlet-name>
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-class>portlet-class</portlet-class>
+ <init-param id="id">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ <value>value</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <cache-scope>PRIVATE</cache-scope>
+ <supports id="id">
+ <mime-type>mime-type</mime-type>
+ <portlet-mode>portlet-mode</portlet-mode>
+ <window-state>window-state</window-state>
+ </supports>
+ <supported-locale>supported-locale</supported-locale>
+ <resource-bundle>resource-bundle</resource-bundle>
+ <portlet-info id="id">
+ <title>title</title>
+ <short-title>short-title</short-title>
+ <keywords>keywords</keywords>
+ </portlet-info>
+ <portlet-preferences id="id">
+ <preference id="id">
+ <name>name</name>
+ <value>value</value>
+ <read-only>true</read-only>
+ </preference>
+ <preferences-validator>preferences-validator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref id="id">
+ <description xml:lang="en">description</description>
+ <role-name>NMTOKEN</role-name>
+ <role-link>role-link</role-link>
+ </security-role-ref>
+ <supported-processing-event id="id">
+ <qname>QName</qname>
+ </supported-processing-event>
+ <supported-publishing-event id="id">
+ <qname>QName</qname>
+ </supported-publishing-event>
+
<supported-public-render-parameter>supported-public-render-parameter</supported-public-render-parameter>
+ <container-runtime-option>
+ <name>portlet_container_runtime_option_name</name>
+ <value>portlet_container_runtime_option_value</value>
+ </container-runtime-option>
+ </portlet>
+ <custom-portlet-mode id="id">
+ <description xml:lang="en">description</description>
+ <portlet-mode>portlet-mode</portlet-mode>
+ <portal-managed>true</portal-managed>
+ </custom-portlet-mode>
+ <custom-window-state id="id">
+ <description xml:lang="en">description</description>
+ <window-state>window-state</window-state>
+ </custom-window-state>
+ <user-attribute id="id">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ </user-attribute>
+ <security-constraint id="id">
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-collection>
+ <portlet-name>portlet-name</portlet-name>
+ </portlet-collection>
+ <user-data-constraint id="id">
+ <description xml:lang="en">description</description>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <resource-bundle>resource-bundle</resource-bundle>
+ <filter>
+ <description xml:lang="en">description</description>
+ <display-name xml:lang="en">display-name</display-name>
+ <filter-name>filter-name</filter-name>
+ <filter-class>filter-class</filter-class>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ <init-param id="">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ <value>value</value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>filter-name</filter-name>
+ <portlet-name>portlet-name</portlet-name>
+ </filter-mapping>
+ <default-namespace>http://tempuri.org</default-namespace>
+ <event-definition id="id">
+ <description xml:lang="en">description</description>
+ <qname>QName</qname>
+ <alias>QName</alias>
+ <value-type>value-type</value-type>
+ </event-definition>
+ <public-render-parameter id="id">
+ <description xml:lang="en">description</description>
+ <identifier>identifier</identifier>
+ <qname>QName</qname>
+ <alias>QName</alias>
+ </public-render-parameter>
+ <listener id="id">
+ <description xml:lang="en">description</description>
+ <display-name xml:lang="en">display-name</display-name>
+ <listener-class>listener-class</listener-class>
+ </listener>
+ <container-runtime-option>
+ <name>application_container_runtime_option_name</name>
+ <value>application_container_runtime_option_value</value>
+ </container-runtime-option>
+</portlet-app>
Modified:
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/TestPortletApplicationDeployer.java
===================================================================
---
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/TestPortletApplicationDeployer.java 2011-06-24
20:54:47 UTC (rev 6742)
+++
components/pc/trunk/test/core/src/main/java/org/gatein/pc/test/TestPortletApplicationDeployer.java 2011-06-24
21:52:27 UTC (rev 6743)
@@ -24,7 +24,7 @@
package org.gatein.pc.test;
import org.gatein.wci.WebApp;
-import org.gatein.pc.mc.PortletApplicationDeployer;
+import org.gatein.pc.portlet.impl.deployment.PortletApplicationDeployer;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
Modified: components/pc/trunk/test/servers/jboss42/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/jboss42/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/jboss42/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -18,11 +18,11 @@
<path refid="portal-common"/>
<path refid="portal-web"/>
<path refid="portal-portlet"/>
- <path refid="staxnav"/>
<path location="${org.jboss:jboss-common-core:jar}"/>
</path>
<path id="JBoss-4.2-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>
Modified: components/pc/trunk/test/servers/jboss51/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/jboss51/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/jboss51/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -18,11 +18,11 @@
<path refid="portal-common"/>
<path refid="portal-web"/>
<path refid="portal-portlet"/>
- <path refid="staxnav"/>
<path location="${org.jboss:jboss-common-core:jar}"/>
</path>
<path id="JBoss-5.1-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>
Modified: components/pc/trunk/test/servers/jboss6/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/jboss6/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/jboss6/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -18,11 +18,11 @@
<path refid="portal-common"/>
<path refid="portal-web"/>
<path refid="portal-portlet"/>
- <path refid="staxnav"/>
<path location="${org.jboss:jboss-common-core:jar}"/>
</path>
<path id="JBoss-6-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>
Modified: components/pc/trunk/test/servers/jetty6/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/jetty6/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/jetty6/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -19,7 +19,6 @@
<path refid="portal-web"/>
<path refid="portal-portlet"/>
<path refid="jboss-unit"/>
- <path refid="staxnav"/>
<pathelement path="${apache-xerces:xercesImpl:jar}"/>
<pathelement path="${apache-xerces:resolver:jar}"/>
<pathelement path="${apache-xerces.xml-apis:jar}"/>
@@ -27,6 +26,7 @@
</path>
<path id="Jetty-6.1-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>
Modified: components/pc/trunk/test/servers/tomcat6/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/tomcat6/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/tomcat6/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -19,13 +19,13 @@
<path refid="portal-web"/>
<path refid="portal-portlet"/>
<path refid="jboss-unit"/>
- <path refid="staxnav"/>
<pathelement location="${apache-xerces:xercesImpl:jar}"/>
<pathelement location="${apache-xerces:xml-apis:jar}"/>
<pathelement location="${apache-xerces:resolver:jar}"/>
</path>
<path id="Tomcat-6.0-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>
Modified: components/pc/trunk/test/servers/tomcat7/src/test/build.xml
===================================================================
--- components/pc/trunk/test/servers/tomcat7/src/test/build.xml 2011-06-24 20:54:47 UTC
(rev 6742)
+++ components/pc/trunk/test/servers/tomcat7/src/test/build.xml 2011-06-24 21:52:27 UTC
(rev 6743)
@@ -19,7 +19,6 @@
<path refid="portal-web"/>
<path refid="portal-portlet"/>
<path refid="jboss-unit"/>
- <path refid="staxnav"/>
<pathelement path="${apache-xerces:xercesImpl:jar}"/>
<pathelement path="${apache-xerces:resolver:jar}"/>
<pathelement path="${apache-xerces.xml-apis:jar}"/>
@@ -27,6 +26,7 @@
</path>
<path id="Tomcat-7.0-shared">
+ <path refid="staxnav"/>
<path refid="portal-common-shared"/>
<path refid="portal-web-shared"/>
<path refid="portal-portlet-shared"/>