Author: julien(a)jboss.com
Date: 2007-03-23 20:45:54 -0400 (Fri, 23 Mar 2007)
New Revision: 6810
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java
Log:
fixed core module test cases
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-03-23
21:20:41 UTC (rev 6809)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-03-24
00:45:54 UTC (rev 6810)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.ContentProviderRegistry;
+import org.jboss.portal.core.model.content.ContentProvider;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.content.spi.handler.ContentHandler;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -236,7 +237,17 @@
*/
public ContentHandler getContentHandler(ContentType contentType)
{
- return contentProviderRegistry.getContentProvider(contentType).getHandler();
+ ContentProvider contentProvider =
contentProviderRegistry.getContentProvider(contentType);
+
+ //
+ if (contentProvider != null)
+ {
+ return contentProvider.getHandler();
+ }
+ else
+ {
+ return null;
+ }
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-03-23
21:20:41 UTC (rev 6809)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-03-24
00:45:54 UTC (rev 6810)
@@ -185,7 +185,10 @@
ContentHandler handler = getContentHandler();
//
- handler.contentDestroyed(contextId, this);
+ if (handler != null)
+ {
+ handler.contentDestroyed(contextId, this);
+ }
}
private Content getContent()
@@ -209,10 +212,7 @@
ContentType contentType = getContentType();
//
- ContentHandler handler = context.getContentHandler(contentType);
-
- //
- return handler;
+ return context.getContentHandler(contentType);
}
public Iterator getParameterNames()
Modified:
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java 2007-03-23
21:20:41 UTC (rev 6809)
+++
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java 2007-03-24
00:45:54 UTC (rev 6810)
@@ -23,13 +23,14 @@
package org.jboss.portal.test.core.model.content;
import org.jboss.portal.core.model.content.spi.ContentState;
+import org.jboss.portal.core.model.content.spi.handler.ContentHandler;
import org.jboss.portal.core.model.content.Content;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class NullContentHandler
+public class NullContentHandler implements ContentHandler
{
public Content newContent(String contextId, ContentState state)
{
Modified:
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-03-23
21:20:41 UTC (rev 6809)
+++
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-03-24
00:45:54 UTC (rev 6810)
@@ -31,12 +31,14 @@
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.ContentProviderRegistry;
+import org.jboss.portal.core.model.content.ContentProvider;
import org.jboss.portal.core.model.content.spi.ContentState;
import org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl;
import org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory;
import org.jboss.portal.test.core.PortalBaseTestCase;
-import org.jboss.portal.test.core.model.content.NullContentHandler;
import org.jboss.portal.test.core.model.content.NullContent;
+import org.jboss.portal.test.core.model.content.NullContentProvider;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.common.test.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
@@ -51,6 +53,7 @@
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.Collection;
/**
* Portal Object Container Test Cases based on the microcontainer architecture
@@ -84,7 +87,9 @@
JBossAuthorizationDomainRegistryImpl registry;
JACCPortalAuthorizationManagerFactory factory;
- NullContentHandler handler;
+ ContentProviderRegistry contentProviderRegistry;
+ ContentProvider contentProvider = new NullContentProvider(ContentType.PORTLET);
+// NullContentHandler handler;
public void setUp() throws Exception
{
@@ -98,34 +103,42 @@
factory.setAuthorizationDomainRegistry(registry);
//
+ contentProviderRegistry = new ContentProviderRegistry()
+ {
+ public Collection getContentTypes()
+ {
+ return Collections.singleton(ContentType.PORTLET);
+ }
+ public ContentProvider getContentProvider(ContentType contentType)
+ {
+ return ContentType.PORTLET.equals(contentType) ? contentProvider : null;
+ }
+ };
+
+ //
container = new PersistentPortalObjectContainer();
container.setSessionFactoryJNDIName("java:/SessionFactory");
container.setAuthorizationDomainRegistry(registry);
container.setPortalAuthorizationManagerFactory(factory);
+ container.setContentProviderRegistry(contentProviderRegistry);
//
- handler = new NullContentHandler();
-// handler.setContentType(ContentType.PORTLET.toString());
-// handler.setRegistry(container);
-
- //
registry.start();
factory.start();
container.start();
-// handler.start();
}
public void tearDown() throws Exception
{
super.tearDown();
-// handler.destroy();
container.destroy();
factory.destroy();
registry.destroy();
container = null;
registry = null;
- handler = null;
factory = null;
+ contentProviderRegistry = null;
+ contentProvider = null;
}
/** todo same with a transaction wrapping the start method */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java 2007-03-23
21:20:41 UTC (rev 6809)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java 2007-03-24
00:45:54 UTC (rev 6810)
@@ -41,6 +41,7 @@
{
this.mode = mode;
addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
}
public ActionContextImpl()