[jboss-svn-commits] JBoss Portal SVN: r5181 - in trunk: build build/ide/intellij/idea50/modules/bridge build/ide/intellij/idea50/modules/federation build/ide/intellij/idea50/modules/identity build/ide/intellij/idea50/modules/portlet build/ide/intellij/idea50/modules/security build/ide/intellij/idea50/modules/server build/ide/intellij/idea50/modules/theme build/ide/intellij/idea50/modules/wsrp core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/state portlet/src/main/org/jboss/portal/portlet/test portlet/src/main/org/jboss/portal/test/portlet/state
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 12 13:05:25 EDT 2006
Author: julien at jboss.com
Date: 2006-09-12 13:05:13 -0400 (Tue, 12 Sep 2006)
New Revision: 5181
Removed:
trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java
trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleUserContext.java
trunk/core/src/main/org/jboss/portal/test/core/state/SimpleInstanceContext.java
Modified:
trunk/build/build.xml
trunk/build/ide/intellij/idea50/modules/bridge/bridge.iml
trunk/build/ide/intellij/idea50/modules/federation/federation.iml
trunk/build/ide/intellij/idea50/modules/identity/identity.iml
trunk/build/ide/intellij/idea50/modules/portlet/portlet.iml
trunk/build/ide/intellij/idea50/modules/security/security.iml
trunk/build/ide/intellij/idea50/modules/server/server.iml
trunk/build/ide/intellij/idea50/modules/theme/theme.iml
trunk/build/ide/intellij/idea50/modules/wsrp/wsrp.iml
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/InstanceContextImpl.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/state/RemoteStoreProducerStatefulPortletInvokerTestCase.java
Log:
merge similar implementations of context interfaces
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/build.xml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -142,7 +142,7 @@
</group>
<group name="security">
- <include modules="common, test, security"/>
+ <include modules="common, test, jems, security"/>
</group>
<group name="faces">
Modified: trunk/build/ide/intellij/idea50/modules/bridge/bridge.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/bridge/bridge.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/bridge/bridge.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -50,6 +50,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/federation/federation.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/federation/federation.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/federation/federation.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -48,6 +48,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/identity/identity.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -84,6 +84,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/portlet/portlet.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/portlet/portlet.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/portlet/portlet.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -141,6 +141,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/security/security.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/security/security.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/security/security.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -12,7 +12,6 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="common" />
<orderEntry type="module" module-name="server" />
- <orderEntry type="module" module-name="api" />
<orderEntry type="module-library">
<library>
<CLASSES>
@@ -103,6 +102,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/server/server.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/server/server.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/server/server.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -84,6 +84,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/theme/theme.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/theme/theme.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/theme/theme.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -67,7 +67,6 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module" module-name="api" />
<orderEntry type="module-library">
<library>
<CLASSES>
@@ -95,6 +94,8 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
+ <orderEntry type="module" module-name="api" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/wsrp/wsrp.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/wsrp/wsrp.iml 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/build/ide/intellij/idea50/modules/wsrp/wsrp.iml 2006-09-12 17:05:13 UTC (rev 5181)
@@ -146,6 +146,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jems" />
<orderEntryProperties />
<javadoc-paths>
<root url="http://java.sun.com/j2ee/1.4/docs/api/" />
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -19,6 +19,8 @@
import org.jboss.portal.portlet.test.support.info.PreferencesInfoSupport;
import org.jboss.portal.portlet.test.support.PortletInvokerSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
+import org.jboss.portal.portlet.test.ActionContextImpl;
+import org.jboss.portal.portlet.test.UserContextImpl;
import org.jboss.portal.portlet.state.producer.ProducerPortletInvoker;
import org.jboss.portal.portlet.state.AbstractPropertyContext;
import org.jboss.portal.portlet.state.PropertyChange;
@@ -288,8 +290,8 @@
//
TransactionAssert.beginTransaction();
instance = instanceContainer.getInstance("MyInstance");
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
- action.setUserContext(new SimpleUserContext("julien"));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
+ action.setUserContext(new UserContextImpl("julien"));
instance.invoke(action);
TransactionAssert.commitTransaction();
@@ -356,8 +358,8 @@
Instance instance = instanceContainer.getInstance("MyInstance");
//
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
- action.setUserContext(new SimpleUserContext("julien"));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
+ action.setUserContext(new UserContextImpl("julien"));
instance.invoke(action);
TransactionAssert.rollbackTransaction(false);
@@ -399,8 +401,8 @@
//
TransactionAssert.beginTransaction();
Instance instance = instanceContainer.getInstance("MyInstance");
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
- action.setUserContext(new SimpleUserContext("julien"));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
+ action.setUserContext(new UserContextImpl("julien"));
try
{
instance.invoke(action);
@@ -449,8 +451,8 @@
// Create a clone for a user
TransactionAssert.beginTransaction();
Instance instance = instanceContainer.getInstance("MyInstance");
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
- action.setUserContext(new SimpleUserContext("julien"));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
+ action.setUserContext(new UserContextImpl("julien"));
instance.invoke(action);
TransactionAssert.commitTransaction();
Deleted: trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleActionContext.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -1,107 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.test.core.model.instance;
-
-import org.jboss.portal.portlet.support.spi.ActionContextSupport;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.invocation.Scope;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SimpleActionContext extends ActionContextSupport
-{
-
- /** . */
- private Map requestAttrs;
-
- /** . */
- private final Mode mode;
-
- public SimpleActionContext(Mode mode)
- {
- this.mode = mode;
- this.requestAttrs = new HashMap();
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public void setAttribute(Scope scope, String name, Object value)
- {
- if (scope == null)
- {
- throw new IllegalArgumentException();
- }
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- if (PortletInvocation.REQUEST_SCOPE.equals(scope))
- {
- if (value != null)
- {
- requestAttrs.put(name, value);
- }
- else
- {
- requestAttrs.remove(name);
- }
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
-
- public Object getAttribute(Scope scope, String name)
- {
- if (scope == null)
- {
- throw new IllegalArgumentException();
- }
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
- if (PortletInvocation.REQUEST_SCOPE.equals(scope))
- {
- return requestAttrs.get(name);
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
-
- public void removeAttribute(Scope attrScope, String attrName)
- {
- setAttribute(attrScope, attrName, null);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleUserContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleUserContext.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/SimpleUserContext.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -1,45 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.test.core.model.instance;
-
-import org.jboss.portal.portlet.support.spi.UserContextSupport;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SimpleUserContext extends UserContextSupport
-{
-
- /** . */
- private final String id;
-
- public SimpleUserContext(String id)
- {
- this.id = id;
- }
-
- public String getId()
- {
- return id;
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -33,9 +33,10 @@
import org.jboss.portal.test.framework.junit.DatabaseTestSuite;
import org.jboss.portal.test.framework.junit.TransactionAssert;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.core.model.instance.SimpleActionContext;
-import org.jboss.portal.test.core.model.instance.SimpleUserContext;
import org.jboss.portal.portlet.test.ValueMapAssert;
+import org.jboss.portal.portlet.test.ActionContextImpl;
+import org.jboss.portal.portlet.test.UserContextImpl;
+import org.jboss.portal.portlet.test.InstanceContextImpl;
import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
import org.jboss.portal.portlet.NoSuchPortletException;
@@ -395,10 +396,10 @@
public void testInvokeCloneBeforeWritePOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext("CloningPortlet"));
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.CLONE_BEFORE_WRITE);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -421,10 +422,10 @@
public void testInvokeReadWritePOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext("CloneFailedCloningPortlet"));
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_WRITE);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.READ_WRITE);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -438,10 +439,10 @@
public void testInvokeReadOnlyPOPWithinTx() throws Exception
{
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext("CloneFailedCloningPortlet"));
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_ONLY);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.READ_ONLY);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -468,10 +469,10 @@
//
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, cloningPortletId);
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.CLONE_BEFORE_WRITE);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -499,10 +500,10 @@
//
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, cloningPortletId);
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_WRITE);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.READ_WRITE);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -529,10 +530,10 @@
//
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, cloneFailedCloningPortletId);
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.READ_ONLY);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.READ_ONLY);
action.setInstanceContext(instanceContext);
producer.invoke(action);
TransactionAssert.commitTransaction();
@@ -546,10 +547,10 @@
public void testInvokeCloneBeforeWritePOPWithinTxThrowsException() throws Exception
{
TransactionAssert.beginTransaction();
- PortletInvocation action = new ActionInvocation(new SimpleActionContext(Mode.VIEW));
+ PortletInvocation action = new ActionInvocation(new ActionContextImpl(Mode.VIEW));
action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext("CloningPortletThrowingRuntimeException"));
- action.setUserContext(new SimpleUserContext("julien"));
- SimpleInstanceContext instanceContext = new SimpleInstanceContext("whatever", AccessMode.CLONE_BEFORE_WRITE);
+ action.setUserContext(new UserContextImpl("julien"));
+ InstanceContextImpl instanceContext = new InstanceContextImpl("whatever", AccessMode.CLONE_BEFORE_WRITE);
action.setInstanceContext(instanceContext);
try
{
Deleted: trunk/core/src/main/org/jboss/portal/test/core/state/SimpleInstanceContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/SimpleInstanceContext.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/SimpleInstanceContext.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -1,82 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.test.core.state;
-
-import org.jboss.portal.portlet.support.spi.InstanceContextSupport;
-import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.portlet.state.PortletClonedEvent;
-import org.jboss.portal.portlet.state.PortletModifiedEvent;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.StateEvent;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SimpleInstanceContext extends InstanceContextSupport
-{
-
- private final String id;
- private final AccessMode accessMode;
- private PortletContext clonedContext;
- private PortletContext modifiedContext;
-
- public SimpleInstanceContext(String id, AccessMode accessMode)
- {
- this.id = id;
- this.accessMode = accessMode;
- }
-
- public String getId()
- {
- return id;
- }
-
- public AccessMode getAccessMode()
- {
- return accessMode;
- }
-
- public void onStateEvent(StateEvent event)
- {
- if (event instanceof PortletClonedEvent)
- {
- PortletClonedEvent pce = (PortletClonedEvent)event;
- clonedContext = pce.getClonedContext();
- }
- else if (event instanceof PortletModifiedEvent)
- {
- PortletModifiedEvent pme = (PortletModifiedEvent)event;
- clonedContext = pme.getModifiedContext();
- }
- }
-
- public PortletContext getClonedContext()
- {
- return clonedContext;
- }
-
- public PortletContext getModifiedContext()
- {
- return modifiedContext;
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/InstanceContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/InstanceContextImpl.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/InstanceContextImpl.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -23,7 +23,10 @@
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.state.PortletClonedEvent;
+import org.jboss.portal.portlet.state.PortletModifiedEvent;
import org.jboss.portal.portlet.StateEvent;
+import org.jboss.portal.portlet.PortletContext;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -38,6 +41,15 @@
/** . */
private final AccessMode accessMode;
+ /** . */
+ private String clonedId;
+
+ /** . */
+ private PortletContext clonedContext;
+
+ /** . */
+ private PortletContext modifiedContext;
+
public InstanceContextImpl(String id)
{
this(id, AccessMode.READ_ONLY);
@@ -71,6 +83,35 @@
public void onStateEvent(StateEvent event)
{
- // No op
+ if (event instanceof PortletClonedEvent)
+ {
+ PortletClonedEvent pce = (PortletClonedEvent)event;
+ clonedContext = pce.getClonedContext();
+ }
+ else if (event instanceof PortletModifiedEvent)
+ {
+ PortletModifiedEvent pme = (PortletModifiedEvent)event;
+ modifiedContext = pme.getModifiedContext();
+ }
+ else if (event instanceof org.jboss.portal.portlet.PortletClonedEvent)
+ {
+ org.jboss.portal.portlet.PortletClonedEvent pce = (org.jboss.portal.portlet.PortletClonedEvent)event;
+ clonedId = pce.getClonedId();
+ }
}
+
+ public String getClonedId()
+ {
+ return clonedId;
+ }
+
+ public PortletContext getClonedContext()
+ {
+ return clonedContext;
+ }
+
+ public PortletContext getModifiedContext()
+ {
+ return modifiedContext;
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -23,8 +23,6 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.StateEvent;
-import org.jboss.portal.portlet.PortletClonedEvent;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.impl.state.producer.ProducerPersistenceManagerService;
@@ -191,7 +189,7 @@
protected ActionInvocation createAction(Object portletRef, AccessMode accessMode)
{
ActionContextImpl actionCtx = new ActionContextImpl();
- MyInstanceContext instanceCtx = new MyInstanceContext("blah", accessMode);
+ InstanceContextImpl instanceCtx = new InstanceContextImpl("blah", accessMode);
//
ActionInvocation action = new ActionInvocation(actionCtx);
@@ -202,8 +200,8 @@
protected Object getImplicitClonedRef(ActionInvocation action)
{
- MyInstanceContext instanceCtx = (MyInstanceContext)action.getInstanceContext();
- return instanceCtx.clonedId;
+ InstanceContextImpl instanceCtx = (InstanceContextImpl)action.getInstanceContext();
+ return instanceCtx.getClonedId();
}
protected Object getModifiedPortletRef(ActionInvocation action)
@@ -218,25 +216,4 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
-
- public static class MyInstanceContext extends InstanceContextImpl
- {
-
- /** . */
- protected String clonedId;
-
- public MyInstanceContext(String id, AccessMode accessMode)
- {
- super(id, accessMode);
- }
-
- public void onStateEvent(StateEvent event)
- {
- if (event instanceof PortletClonedEvent)
- {
- PortletClonedEvent pce = (PortletClonedEvent)event;
- clonedId = pce.getClonedId();
- }
- }
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -185,7 +185,7 @@
protected ActionInvocation createAction(Object portletRef, AccessMode accessMode)
{
ActionContextImpl actionCtx = new ActionContextImpl();
- MyInstanceContext instanceCtx = new MyInstanceContext("blah", accessMode);
+ InstanceContextImpl instanceCtx = new InstanceContextImpl("blah", accessMode);
//
ActionInvocation action = new ActionInvocation(actionCtx);
@@ -196,8 +196,8 @@
protected Object getImplicitClonedRef(ActionInvocation action)
{
- MyInstanceContext instanceCtx = (MyInstanceContext)action.getInstanceContext();
- return instanceCtx.clonedContext;
+ InstanceContextImpl instanceCtx = (InstanceContextImpl)action.getInstanceContext();
+ return instanceCtx.getClonedContext();
}
private Portlet getSinglePOP()
@@ -207,33 +207,4 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
-
- public static class MyInstanceContext extends InstanceContextImpl
- {
-
- /** . */
- protected PortletContext clonedContext;
-
- /** . */
- protected PortletContext modifiedContext;
-
- public MyInstanceContext(String id, AccessMode accessMode)
- {
- super(id, accessMode);
- }
-
- public void onStateEvent(StateEvent event)
- {
- if (event instanceof PortletClonedEvent)
- {
- PortletClonedEvent pce = (PortletClonedEvent)event;
- clonedContext = pce.getClonedContext();
- }
- else if (event instanceof PortletModifiedEvent)
- {
- PortletModifiedEvent pce = (PortletModifiedEvent)event;
- clonedContext = pce.getModifiedContext();
- }
- }
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/state/RemoteStoreProducerStatefulPortletInvokerTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/state/RemoteStoreProducerStatefulPortletInvokerTestCase.java 2006-09-12 16:51:45 UTC (rev 5180)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/state/RemoteStoreProducerStatefulPortletInvokerTestCase.java 2006-09-12 17:05:13 UTC (rev 5181)
@@ -22,6 +22,7 @@
package org.jboss.portal.test.portlet.state;
import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.test.InstanceContextImpl;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -36,7 +37,7 @@
protected Object getModifiedPortletRef(ActionInvocation action)
{
- MyInstanceContext instanceCtx = (MyInstanceContext)action.getInstanceContext();
- return instanceCtx.modifiedContext;
+ InstanceContextImpl instanceCtx = (InstanceContextImpl)action.getInstanceContext();
+ return instanceCtx.getModifiedContext();
}
}
More information about the jboss-svn-commits
mailing list