JBoss Portal SVN: r7368 - in trunk: core/src/main/org/jboss/portal/test/core/model/portal and 11 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-31 02:02:24 -0400 (Thu, 31 May 2007)
New Revision: 7368
Added:
trunk/test/src/main/org/jboss/portal/test/framework/AbstractPortalTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
trunk/wsrp/src/resources/tests/test-consumer-jar/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/consumer/
trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/consumer/persistent-jboss-beans.xml
Modified:
trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/wsrp/build.xml
Log:
- Extracted AbstractPortalTestCase from PortalBaseTestCase and put it in test module so that classes from modules outside core can access it.
- First commit of ConsumerRegistryTestCase. Doesn't work properly: not calling setUp for some reason resulting in not being able to initiate transactions...
- Added test-consumer-jar dir to host persistent-jboss-beans.xml for ConsumerRegistryTestCase.
- Updated (and fixed) build.xml.
Modified: trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java 2007-05-30 22:22:20 UTC (rev 7367)
+++ trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java 2007-05-31 06:02:24 UTC (rev 7368)
@@ -29,25 +29,14 @@
*/
package org.jboss.portal.test.core;
-import junit.framework.TestCase;
-import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.SimpleLayout;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.framework.AbstractPortalTestCase;
import org.jboss.security.SecurityAssociation;
import org.jboss.security.SimpleGroup;
import org.jboss.security.SimplePrincipal;
-import org.jboss.security.jacc.DelegatingPolicy;
import javax.security.auth.Subject;
-import javax.security.jacc.PolicyContext;
-import java.security.Policy;
import java.security.Principal;
import java.security.acl.Group;
import java.util.HashSet;
@@ -60,51 +49,8 @@
* @version $Revision$
* @since Apr 7, 2006
*/
-public abstract class PortalBaseTestCase extends TestCase
+public abstract class PortalBaseTestCase extends AbstractPortalTestCase
{
-
- /** . */
- protected TestRuntimeContext runtimeContext;
-
- /** . */
- protected DataSourceSupport.Config dataSourceConfigParameter;
-
- /** . */
- protected HibernateSupport hibernate;
-
- static
- {
- Appender appender = new ConsoleAppender(new SimpleLayout());
- Logger.getRoot().addAppender(appender);
- Logger.getRoot().setLevel(Level.DEBUG);
- Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
- }
-
- public HibernateSupport getHibernate()
- {
- return hibernate;
- }
-
- public DataSourceSupport.Config getDataSourceConfigParameter()
- {
- return dataSourceConfigParameter;
- }
-
- public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
- {
- this.dataSourceConfigParameter = dataSourceConfigParameter;
- }
-
- public void setHibernate(HibernateSupport hibernate)
- {
- this.hibernate = hibernate;
- }
-
- public String getName()
- {
- return super.getName() + ",ds=" + dataSourceConfigParameter.getName();
- }
-
protected Set getDefaultSecurityConstraints()
{
Set constraints = new HashSet();
@@ -124,34 +70,6 @@
// Setup custom policy
}
- protected void setUp() throws Exception
- {
- runtimeContext = new TestRuntimeContext(getConfigLocation());
- runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
- runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
- runtimeContext.start();
-
- //
- PolicyContext.setContextID("ctxid");
- }
-
- protected void tearDown() throws Exception
- {
- /**
- * Need to delete the context information set in the policy provider
- * for this test as it will affect the next test that is being run.
- * The alternative is that each test sets its own context id.
- */
- DelegatingPolicy p = (DelegatingPolicy)Policy.getPolicy();
- p.delete("ctxid");
- p.refresh();
- runtimeContext.stop();
- }
-
- /** Override to provide the location of the microcontainer xml */
- protected abstract String getConfigLocation();
-
protected void setUpSubjectForRole(String username, String[] roleNames) throws Exception
{
Group roleGroup = new SimpleGroup("Roles");
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java 2007-05-30 22:22:20 UTC (rev 7367)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/AbstractPortalObjectContainerTestCase.java 2007-05-31 06:02:24 UTC (rev 7368)
@@ -22,20 +22,15 @@
******************************************************************************/
package org.jboss.portal.test.core.model.portal;
-import org.jboss.portal.test.core.PortalBaseTestCase;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.common.test.TestParameterValue;
+import org.jboss.portal.common.test.TestParametrization;
import org.jboss.portal.common.test.junit.JUnitAdapter;
-import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
-import junit.framework.TestSuite;
+import org.jboss.portal.test.core.PortalBaseTestCase;
-import java.net.URL;
-
/**
* Portal Object Container Test Cases based on the microcontainer architecture
*
@@ -52,18 +47,6 @@
/** . */
protected PortalAuthorizationManagerFactory authorizationManagerFactory;
- public static TestSuite suite(Class testClass) throws Exception
- {
- TestParametrization parametrization = JUnitAdapter.getParametrization();
- URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
- POJOJUnitTest abc = new POJOJUnitTest(testClass);
- JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
- TestSuite suite = new TestSuite();
- suite.addTest(adapter);
- return suite;
- }
-
public String getName()
{
TestParametrization parametrization = JUnitAdapter.getParametrization();
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-05-30 22:22:20 UTC (rev 7367)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-05-31 06:02:24 UTC (rev 7368)
@@ -23,25 +23,26 @@
package org.jboss.portal.test.core.model.portal;
import junit.framework.TestSuite;
-import org.jboss.portal.core.model.portal.PortalContainer;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.util.CollectionBuilder;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.spi.handler.ContentState;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.core.model.content.spi.handler.ContentState;
+import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.test.core.model.content.SimpleContent;
-import org.jboss.portal.common.junit.TransactionAssert;
-import org.jboss.portal.common.util.CollectionBuilder;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
+import org.jboss.portal.test.framework.AbstractPortalTestCase;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
-import java.util.ArrayList;
-import java.util.Comparator;
/**
* Portal Object Container Test Cases based on the microcontainer architecture
@@ -55,7 +56,7 @@
public static TestSuite suite() throws Exception
{
- return AbstractPortalObjectContainerTestCase.suite(PortalObjectContainerTestCase.class);
+ return AbstractPortalTestCase.suite(PortalObjectContainerTestCase.class);
}
/** todo same with a transaction wrapping the start method */
@@ -199,7 +200,7 @@
public void testPortalNode() throws Exception
{
-
+
}
public void testRecreate() throws Exception
@@ -229,8 +230,8 @@
}
/**
+ * @throws Exception
* @todo test contentState / get/set property
- * @throws Exception
*/
public void testCopy() throws Exception
{
Added: trunk/test/src/main/org/jboss/portal/test/framework/AbstractPortalTestCase.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/AbstractPortalTestCase.java (rev 0)
+++ trunk/test/src/main/org/jboss/portal/test/framework/AbstractPortalTestCase.java 2007-05-31 06:02:24 UTC (rev 7368)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.framework;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.security.jacc.DelegatingPolicy;
+
+import javax.security.jacc.PolicyContext;
+import java.net.URL;
+import java.security.Policy;
+
+/**
+ * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public abstract class AbstractPortalTestCase extends TestCase
+{
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.DEBUG);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ }
+
+ /** . */
+ protected TestRuntimeContext runtimeContext;
+ /** . */
+ protected DataSourceSupport.Config dataSourceConfigParameter;
+ /** . */
+ protected HibernateSupport hibernate;
+
+ public HibernateSupport getHibernate()
+ {
+ return hibernate;
+ }
+
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
+ public void setHibernate(HibernateSupport hibernate)
+ {
+ this.hibernate = hibernate;
+ }
+
+ public String getName()
+ {
+ return super.getName() + ",ds=" + dataSourceConfigParameter.getName();
+ }
+
+ protected void setUp() throws Exception
+ {
+ runtimeContext = new TestRuntimeContext(getConfigLocation());
+ runtimeContext.addBean("TestBean", this);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getName()));
+ runtimeContext.start();
+
+ //
+ PolicyContext.setContextID("ctxid");
+
+ System.out.println("AbstractPortalTestCase.setUp");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ /**
+ * Need to delete the context information set in the policy provider
+ * for this test as it will affect the next test that is being run.
+ * The alternative is that each test sets its own context id.
+ */
+ DelegatingPolicy p = (DelegatingPolicy)Policy.getPolicy();
+ p.delete("ctxid");
+ p.refresh();
+ runtimeContext.stop();
+ }
+
+ /** Override to provide the location of the microcontainer xml */
+ protected abstract String getConfigLocation();
+
+ public static TestSuite suite(Class testClass) throws Exception
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(testClass);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
+}
Property changes on: trunk/test/src/main/org/jboss/portal/test/framework/AbstractPortalTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-05-30 22:22:20 UTC (rev 7367)
+++ trunk/wsrp/build.xml 2007-05-31 06:02:24 UTC (rev 7368)
@@ -434,10 +434,11 @@
<target name="package-consumer-test" description="Generates Consumer-specific test artifacts" depends="compile">
<jar jarfile="${build.lib.test}/test-consumer-lib.jar">
- <fileset dir="${build.classes}/">
- <include name="org/jboss/portal/test/wsrp/framework/**"/>
- <include name="org/jboss/portal/test/wsrp/consumer/*.class"/>
- </fileset>
+ <fileset dir="${build.resources.test}/test-consumer-jar"/>
+ <fileset dir="${build.classes}/">
+ <include name="org/jboss/portal/test/wsrp/framework/**"/>
+ <include name="org/jboss/portal/test/wsrp/consumer/*.class"/>
+ </fileset>
</jar>
</target>
@@ -769,7 +770,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
<!--<zest todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.ConsumerRegistryTestCase"
outfile="TEST-ConsumerRegistryTestCase">
- <parameter name="ConfigLocation" value="org/jboss/portal/test/wsrp/consumer/transient-jboss-beans.xml"/>
+ <parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>-->
</x-test>
<x-sysproperty>
@@ -782,6 +783,8 @@
<x-classpath>
<fileset dir="${build.lib}" includes="portal-wsrp-lib.jar"/>
<fileset dir="${build.lib.test}" includes="test-consumer-lib.jar"/>
+ <pathelement location="${jboss.portal-test.root}/etc"/>
+ <!-- Needed to access datasources.xml -->
<path refid="jboss.microcontainer.classpath"/>
<path refid="library.classpath"/>
<path refid="dependentmodule.classpath"/>
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java 2007-05-31 06:02:24 UTC (rev 7368)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.wsrp.consumer;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.common.test.TestParameterValue;
+import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.test.framework.AbstractPortalTestCase;
+import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.consumer.ConsumerException;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
+import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
+import org.jboss.portal.wsrp.consumer.ProducerInfo;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerRegistryTestCase extends AbstractPortalTestCase
+{
+ private ConsumerRegistry registry;
+
+ public static TestSuite suite() throws Exception
+ {
+ return AbstractPortalTestCase.suite(ConsumerRegistryTestCase.class);
+ }
+
+ protected String getConfigLocation()
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ TestParameterValue paramValue = parametrization.getParameterValue("Config");
+ return "org/jboss/portal/test/wsrp/consumer/" + paramValue.get();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ System.out.println("ConsumerRegistryTestCase.setUp");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public ConsumerRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(ConsumerRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public void testCRUD()
+ {
+ TransactionAssert.beginTransaction();
+ String id = "test";
+ WSRPConsumer consumer = registry.createConsumer(id, null);
+ assertNotNull(consumer);
+ assertEquals(id, consumer.getProducerId());
+ ProducerInfo info = consumer.getProducerInfo();
+ assertNotNull(info);
+ assertEquals(consumer.getProducerId(), info.getId());
+ EndpointConfigurationInfo endpoint = info.getEndpointConfigurationInfo();
+ assertNotNull(endpoint);
+ assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getServiceDescriptionURL());
+ assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getMarkupURL());
+ assertNull(info.getRegistrationInfo());
+ TransactionAssert.commitTransaction();
+
+ TransactionAssert.beginTransaction();
+ try
+ {
+ registry.createConsumer(id, null);
+ fail("Shouldn't be possible to create a consumer with an existing id");
+ }
+ catch (ConsumerException expected)
+ {
+ }
+ TransactionAssert.commitTransaction();
+
+ TransactionAssert.beginTransaction();
+ consumer = registry.getConsumer(id);
+ assertNotNull(consumer);
+ assertEquals(id, consumer.getProducerId());
+ info = consumer.getProducerInfo();
+ assertNotNull(info);
+ assertEquals(consumer.getProducerId(), info.getId());
+ endpoint = info.getEndpointConfigurationInfo();
+ assertNotNull(endpoint);
+ assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getServiceDescriptionURL());
+ assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getMarkupURL());
+ assertNull(info.getRegistrationInfo());
+
+ assertNull(registry.getConsumer("inexistent"));
+ Collection consumers = registry.getConfiguredConsumers();
+ assertNotNull(consumers);
+ assertEquals(1, consumers.size());
+ assertTrue(consumers.contains(consumer));
+ TransactionAssert.commitTransaction();
+
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/consumer/persistent-jboss-beans.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/consumer/persistent-jboss-beans.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-consumer-jar/org/jboss/portal/test/wsrp/consumer/persistent-jboss-beans.xml 2007-05-31 06:02:24 UTC (rev 7368)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
+ property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>conf/consumer/hibernate/domain.hbm.xml</value>
+ </list>
+ </property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ </bean>
+
+ <bean name="FederatingPortletInvoker"
+ class="org.jboss.portal.portlet.federation.impl.FederatingPortletInvokerService"/>
+ <bean name="PortalEventListenerRegistry" class="org.jboss.portal.core.event.PortalEventListenerRegistryImpl"/>
+
+ <bean name="ConsumerRegistry" class="org.jboss.portal.wsrp.consumer.ConsumerRegistryService">
+ <property name="sessionFactoryJNDIName">java:/SessionFactory</property>
+ <property name="federatingPortletInvoker">
+ <inject bean="FederatingPortletInvoker" property="federatingPortletInvoker"/>
+ </property>
+ <property name="portalEventListenerRegistry">
+ <inject bean="PortalEventListenerRegistry" property="portalEventListenerRegistry"/>
+ </property>
+ </bean>
+
+ <bean name="TestBean" class="org.jboss.portal.test.wsrp.consumer.ConsumerRegistryTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>TestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject bean="HibernateSupport"/></property>
+ <property name="registry"><inject bean="ConsumerRegistry"/></property>
+ </bean>
+</deployment>
16 years, 12 months
JBoss Portal SVN: r7367 - trunk/core-cms/src/main/org/jboss/portal/core/cms/servlet.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-30 18:22:20 -0400 (Wed, 30 May 2007)
New Revision: 7367
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSPreviewServlet.java
Log:
- Removed redundant casts.
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSPreviewServlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSPreviewServlet.java 2007-05-30 22:22:01 UTC (rev 7366)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSPreviewServlet.java 2007-05-30 22:22:20 UTC (rev 7367)
@@ -22,22 +22,21 @@
******************************************************************************/
package org.jboss.portal.core.cms.servlet;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityServiceController;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.IdentityServiceController;
-import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.cms.impl.jcr.JCRCMS;
-import org.hibernate.SessionFactory;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.naming.InitialContext;
@@ -56,23 +55,23 @@
private static final long serialVersionUID = 1676227756085242093L;
/**
- *
+ *
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
{
- String path = (String)request.getParameter("p");
- String version = (String)request.getParameter("v");
- String language = (String)request.getParameter("l");
+ String path = request.getParameter("p");
+ String version = request.getParameter("v");
+ String language = request.getParameter("l");
try
{
MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
CMS CMSService = (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
IdentityServiceController identityService = (IdentityServiceController)MBeanProxy.get(
- IdentityServiceController.class, new ObjectName("portal:service=Module,type=IdentityServiceController"), mbeanServer);
-
+ IdentityServiceController.class, new ObjectName("portal:service=Module,type=IdentityServiceController"), mbeanServer);
+
//Setup the Identity of the user accessing this servlet
- this.setupUser(request, identityService);
+ this.setupUser(request, identityService);
Command getCMD = CMSService.getCommandFactory().createFileGetCommand(path, version, new Locale(language));
File file = (File)CMSService.execute(getCMD);
@@ -104,43 +103,39 @@
}
/**
- *
+ *
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
{
doGet(request, response);
}
-
- /**
- *
- * @param identityService
- */
- private void setupUser(HttpServletRequest request,IdentityServiceController identityService) throws Exception
+
+ /** @param identityService */
+ private void setupUser(HttpServletRequest request, IdentityServiceController identityService) throws Exception
{
String remoteUser = (String)request.getSession().getAttribute("remoteUser");
- if(remoteUser != null && remoteUser.trim().length() > 0)
+ if (remoteUser != null && remoteUser.trim().length() > 0)
{
User user = (User)request.getSession().getAttribute("cmsIdentity");
-
- if( user == null ||
- !user.getUserName().equals(remoteUser) //This happens if another user is now logged in to the same session...rare scenario
- )
+
+ if (user == null ||
+ !user.getUserName().equals(remoteUser) //This happens if another user is now logged in to the same session...rare scenario
+ )
{
user = this.getUser(remoteUser, identityService);
request.getSession().setAttribute("cmsIdentity", user);
- }
-
+ }
+
JCRCMS.getUserInfo().set(user);
}
}
-
+
/**
- *
* @param identityService
* @return
* @throws Exception
*/
- private User getUser(String remoteUser,IdentityServiceController identityService) throws Exception
+ private User getUser(String remoteUser, IdentityServiceController identityService) throws Exception
{
User user = null;
SessionFactory identitySessionFactory = (SessionFactory)new InitialContext().lookup("java:/portal/IdentitySessionFactory");
@@ -150,15 +145,15 @@
try
{
UserModule userModule = (UserModule)
- identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
- user = userModule.findUserByUserName(remoteUser);
+ identityService.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ user = userModule.findUserByUserName(remoteUser);
success = true;
}
finally
{
- if(transaction != null)
+ if (transaction != null)
{
- if(success)
+ if (success)
{
transaction.commit();
}
@@ -167,8 +162,8 @@
transaction.rollback();
}
}
-
- if(session != null)
+
+ if (session != null)
{
session.close();
}
16 years, 12 months
JBoss Portal SVN: r7366 - in trunk: build/ide/intellij/idea60/modules/portlet-server and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-05-30 18:22:01 -0400 (Wed, 30 May 2007)
New Revision: 7366
Modified:
trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
trunk/build/ide/intellij/idea60/modules/portlet-server/portlet-server.iml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
Log:
- Fixed compilation problem with MarkupTestCase on JDK 1.4.
- Minor improvements to project files.
Modified: trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-05-30 21:23:17 UTC (rev 7365)
+++ trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-05-30 22:22:01 UTC (rev 7366)
@@ -94,6 +94,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/hibernate/lib/hibernate3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/portlet-server/portlet-server.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/portlet-server/portlet-server.iml 2007-05-30 21:23:17 UTC (rev 7365)
+++ trunk/build/ide/intellij/idea60/modules/portlet-server/portlet-server.iml 2007-05-30 22:22:01 UTC (rev 7366)
@@ -5,6 +5,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../portlet-server">
<sourceFolder url="file://$MODULE_DIR$/../../../../../../portlet-server/src/main" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/../../../../../../portlet-server/output" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-05-30 21:23:17 UTC (rev 7365)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-05-30 22:22:01 UTC (rev 7366)
@@ -491,8 +491,8 @@
MarkupContext markupContext = response.getMarkupContext();
ExtendedAssert.assertNotNull(markupContext);
String markupString = markupContext.getMarkupString();
- ExtendedAssert.assertTrue(markupString.contains("count = " + count));
- ExtendedAssert.assertTrue(markupString.contains("<a href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>"));
+ ExtendedAssert.assertString1ContainsString2(markupString, "count = " + count);
+ ExtendedAssert.assertString1ContainsString2(markupString, "<a href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>");
// checking session
checkSessionForCurrentlyDeployedPortlet(response);
16 years, 12 months
JBoss Portal SVN: r7365 - in trunk/cms/src: main/org/jboss/portal/test/cms/security and 1 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-05-30 17:23:17 -0400 (Wed, 30 May 2007)
New Revision: 7365
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
Log:
incorporating patch for move and copy commands jump the permissions - JBPORTAL-1465
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-05-30 18:59:23 UTC (rev 7364)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-05-30 21:23:17 UTC (rev 7365)
@@ -285,18 +285,29 @@
if(command instanceof CopyCommand)
{
path = ((CopyCommand)command).msFromPath;
+ hasManageAccess = this.computeAccess(user,path,"manage");
+ if(hasManageAccess)
+ {
+ path = ((CopyCommand)command).msToPath;
+ hasManageAccess = this.computeAccess(user,path,"manage");
+ }
}
else if(command instanceof DeleteCommand)
{
path = ((DeleteCommand)command).msPath;
+ hasManageAccess = this.computeAccess(user,path,"manage");
}
else if(command instanceof MoveCommand)
{
path = ((MoveCommand)command).msFromPath;
+ hasManageAccess = this.computeAccess(user,path,"manage");
+ if(hasManageAccess)
+ {
+ path = ((MoveCommand)command).msToPath;
+ hasManageAccess = this.computeAccess(user,path,"manage");
+ }
}
-
- hasManageAccess = this.computeAccess(user,path,"manage");
-
+
return hasManageAccess;
}
//-----------------------------------------------------------------------------------------------------------------------------------------
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java 2007-05-30 18:59:23 UTC (rev 7364)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/security/TestManageAccess.java 2007-05-30 21:23:17 UTC (rev 7365)
@@ -40,6 +40,9 @@
{
String rejectPath = "/default/private";
String allowedPath = "/default/images";
+ String supportPath = "/default/support.html";
+ String copyPath = "/support.html";
+
/**
*
@@ -94,7 +97,7 @@
return folder;
}
-
+
/**
*
*
@@ -139,8 +142,7 @@
Folder deletedFolder = (Folder)this.service.execute(get);
assertNull(deletedFolder);
}
-
-
+
/**
*
* @throws Exception
@@ -246,4 +248,78 @@
assertTrue(cmeMessage.indexOf("Access to this resource is denied") == -1);
}
}
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testCopyToDeniedDestination() throws Exception
+ {
+ this.runAs("user");
+
+ //Copy the file to the folder
+ try
+ {
+ Command copyCommand = this.service.getCommandFactory().createCopyCommand(this.supportPath,this.copyPath);
+ this.service.execute(copyCommand);
+
+ //Make sure copy operation did not happen
+ //I should not get here
+ assertTrue(false);
+ }
+ catch(CMSException cme)
+ {
+ String cmeMessage = cme.toString();
+ if(cmeMessage.indexOf("Access to this resource is denied") != -1)
+ {
+ //Make sure copy operation did not happen
+ Command exists = (Command)this.service.getCommandFactory().createItemExistsCommand(this.copyPath);
+ boolean existsValue = ((Boolean)this.service.execute(exists)).booleanValue();
+ assertFalse(existsValue);
+ }
+ else
+ {
+ throw cme;
+ }
+ }
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testMoveToDeniedDestination() throws Exception
+ {
+ this.runAs("user");
+
+ //Move the file from the folder
+ try
+ {
+ Command moveCommand = this.service.getCommandFactory().createMoveCommand(this.supportPath,this.copyPath);
+ this.service.execute(moveCommand);
+
+ //Make sure copy operation did not happen
+ //I should not get here
+ assertTrue(false);
+ }
+ catch(CMSException cme)
+ {
+ String cmeMessage = cme.toString();
+ if(cmeMessage.indexOf("Access to this resource is denied") != -1)
+ {
+ //Make sure move operation didnot happen
+ Command exists = (Command)this.service.getCommandFactory().createItemExistsCommand(this.copyPath);
+ boolean existsValue = ((Boolean)this.service.execute(exists)).booleanValue();
+ assertFalse(existsValue);
+
+ exists = (Command)this.service.getCommandFactory().createItemExistsCommand(this.supportPath);
+ existsValue = ((Boolean)this.service.execute(exists)).booleanValue();
+ assertTrue(existsValue);
+ }
+ else
+ {
+ throw cme;
+ }
+ }
+ }
}
Modified: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-05-30 18:59:23 UTC (rev 7364)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-05-30 21:23:17 UTC (rev 7365)
@@ -121,13 +121,21 @@
<permission name="cms" action="manage">
<role name="Admin"/>
</permission>
- </criteria>
+ </criteria>
<!-- permissions on the private/protected node -->
<criteria name="path" value="/default/private">
<permission name="cms" action="manage">
<role name="Admin"/>
</permission>
</criteria>
+ <!--
+ permissions on the /default/support.html node used to test atomicity of copy/move operations
+ -->
+ <criteria name="path" value="/default/support.html">
+ <permission name="cms" action="manage">
+ <role name="User"/>
+ </permission>
+ </criteria>
</policy>
]]>
</property>
16 years, 12 months
JBoss Portal SVN: r7364 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-30 14:59:23 -0400 (Wed, 30 May 2007)
New Revision: 7364
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
Log:
Revert to have something working
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-05-30 16:31:55 UTC (rev 7363)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-05-30 18:59:23 UTC (rev 7364)
@@ -10,8 +10,6 @@
<ui:define name="content">
- <c:if test="#{instancemgr.selectedPlugin == null}">
-
<h:form>
<table id="instancesTable2" width="100%">
@@ -60,7 +58,6 @@
</ul>
</h:form>
- </c:if>
<c:if test="#{instancemgr.selectedPlugin != null}">
16 years, 12 months
JBoss Portal SVN: r7363 - in trunk: core-admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-05-30 12:31:55 -0400 (Wed, 30 May 2007)
New Revision: 7363
Modified:
trunk/core-admin/build.xml
trunk/core/build.xml
Log:
added convenience build targets for deployment during development
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-05-30 14:15:29 UTC (rev 7362)
+++ trunk/core/build.xml 2007-05-30 16:31:55 UTC (rev 7363)
@@ -723,4 +723,26 @@
</junitreport>
</target>
+ <!--
+ Some convenience build targets to help deployment during development
+ -->
+ <target name="deploy-explode" depends="output,explode">
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-exploded.sar"/>
+ </copy>
+ </target>
+ <target name="explode-ha" depends="init">
+ <explode
+ file="${build.lib}/jboss-portal-ha.sar"
+ todir="${build.lib}"
+ name="jboss-portal-ha-exploded.sar"
+ />
+ </target>
+ <target name="deploy-ha-explode" description="Deploy high availability." depends="output-ha,explode-ha">
+ <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
+ <copy todir="${jboss.home}/server/${portal-ha.deploy.dir}/jboss-portal-ha.sar" overwrite="true">
+ <fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
+ </copy>
+ </target>
</project>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-05-30 14:15:29 UTC (rev 7362)
+++ trunk/core-admin/build.xml 2007-05-30 16:31:55 UTC (rev 7363)
@@ -262,7 +262,7 @@
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
<copy file="${build.lib}/portal-admin.sar" todir="${jboss.home}/server/${portal.deploy.dir}" overwrite="true"/>
</target>
-
+
<!--
| Undeploy the application
-->
@@ -274,5 +274,15 @@
</target>
<target name="package-tests"/>
-
+
+
+ <!--
+ Some convenience build targets to help deployment during development
+ -->
+ <target name="deploy-ha"
+ description="Deploy."
+ depends="output">
+ <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
+ <copy file="${build.lib}/portal-admin.sar" todir="${jboss.home}/server/${portal-ha.deploy.dir}" overwrite="true"/>
+ </target>
</project>
16 years, 12 months
JBoss Portal SVN: r7362 - in trunk/core: src/main/org/jboss/portal/core/model/portal and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-30 10:15:29 -0400 (Wed, 30 May 2007)
New Revision: 7362
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
Log:
more complete coverage for PortalObjectId test case
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-05-30 13:48:06 UTC (rev 7361)
+++ trunk/core/build.xml 2007-05-30 14:15:29 UTC (rev 7362)
@@ -613,7 +613,6 @@
<parameter name="Config" value="transient-jboss-beans.xml"/>
</zest>
-->
-
<zest todir="${test.reports}" name="org.jboss.portal.test.core.state.ProducerTestCase"
outfile="TEST-ProducerTestCase-WithoutRegistration">
<parameter name="UseRegistration" value="false"/>
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-05-30 13:48:06 UTC (rev 7361)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2007-05-30 14:15:29 UTC (rev 7362)
@@ -37,16 +37,29 @@
public class PortalObjectId implements Comparable, Serializable
{
- /** . */
+ /** The namespace. */
private final String namespace;
- /** . */
+ /** The path. */
private final PortalObjectPath path;
- /** . */
+ /** The cached hash code. */
private Integer hashCode;
- public PortalObjectId(String namespace, PortalObjectPath path)
+ /** The lazy computed to string value for canonical format. */
+ private String toStringCanonicalFormat;
+
+ /** The lazy computed to string value for legacy format. */
+ private String toStringLegacyFormat;
+
+ /**
+ * Build a new portal object id.
+ *
+ * @param namespace the namespace value
+ * @param path the path object
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public PortalObjectId(String namespace, PortalObjectPath path) throws IllegalArgumentException
{
if (namespace == null)
{
@@ -60,11 +73,21 @@
this.path = path;
}
+ /**
+ * Returns the portal object namespace.
+ *
+ * @return the namespace
+ */
public String getNamespace()
{
return namespace;
}
+ /**
+ * Returns the portal object path.
+ *
+ * @return the path
+ */
public PortalObjectPath getPath()
{
return path;
@@ -93,13 +116,20 @@
return false;
}
- public String toString(PortalObjectPath.Format format)
+ /**
+ * Parse a portal object id given its string representation.
+ *
+ * @param idValue the id string value
+ * @param format the format
+ * @throws IllegalArgumentException if any argument is null or not well formed
+ * @return the PortalObjectId
+ */
+ public static PortalObjectId parse(String idValue, PortalObjectPath.Format format) throws IllegalArgumentException
{
- return toString(namespace, path, format);
- }
-
- public static PortalObjectId parse(String idValue, PortalObjectPath.Format format)
- {
+ if (idValue == null)
+ {
+ throw new IllegalArgumentException("No null id value accepted");
+ }
int pos = idValue.indexOf(':');
//
@@ -115,13 +145,86 @@
}
}
- public static PortalObjectId parse(String namespace, String pathValue, PortalObjectPath.Format format)
+ /**
+ * Parse a portal object id given the namespace and the path string representation.
+ *
+ * @param namespace the namespace value
+ * @param pathValue the path value
+ * @param format the path format
+ * @return the PortalObjectId
+ * @throws IllegalArgumentException if any argument is null or not well formed
+ */
+ public static PortalObjectId parse(String namespace, String pathValue, PortalObjectPath.Format format) throws IllegalArgumentException
{
return new PortalObjectId(namespace, PortalObjectPath.parse(pathValue, format));
}
- public static String toString(String namespace, PortalObjectPath path, PortalObjectPath.Format format)
+ /**
+ * Returns the canonical representation.
+ *
+ * @return the string value
+ */
+ public String toString()
{
+ return toString(PortalObjectPath.CANONICAL_FORMAT);
+ }
+
+ /**
+ * Returns the portal object id string value.
+ *
+ * @param format the path format
+ * @return a formated portal object id value
+ * @throws IllegalArgumentException if the format argument is null
+ */
+ public String toString(PortalObjectPath.Format format) throws IllegalArgumentException
+ {
+ if (format == null)
+ {
+ throw new IllegalArgumentException("No null format accepted");
+ }
+
+ //
+ if (format == PortalObjectPath.LEGACY_FORMAT)
+ {
+ if (toStringLegacyFormat == null)
+ {
+ toStringLegacyFormat = toString(namespace, path, format);
+ }
+ return toStringLegacyFormat;
+ }
+ else if (format == PortalObjectPath.CANONICAL_FORMAT)
+ {
+ if (toStringCanonicalFormat == null)
+ {
+ toStringCanonicalFormat = toString(namespace, path, format);
+ }
+ return toStringCanonicalFormat;
+ }
+ else
+ {
+ return toString(namespace, path, format);
+ }
+ }
+
+ /**
+ * Format a portal object id values to a string value.
+ *
+ * @param namespace the id value
+ * @param path the id path
+ * @param format the desired format
+ * @return the formated value
+ * @throws IllegalArgumentException if any argument is null or not well formed
+ */
+ public static String toString(String namespace, PortalObjectPath path, PortalObjectPath.Format format) throws IllegalArgumentException
+ {
+ if (namespace == null)
+ {
+ throw new IllegalArgumentException("No null namespace accepted");
+ }
+ if (path == null)
+ {
+ throw new IllegalArgumentException("No null path accepted");
+ }
if (namespace.length() > 0)
{
return namespace + ":" + path.toString(format);
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-05-30 13:48:06 UTC (rev 7361)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-05-30 14:15:29 UTC (rev 7362)
@@ -66,11 +66,6 @@
/** The lazy created parent that can be useful. */
private PortalObjectPath parent;
- public PortalObjectPath create()
- {
- return null;
- }
-
public PortalObjectPath()
{
this.names = EMPTY_STRINGS;
@@ -268,7 +263,11 @@
return Tools.iterator(names, from, to);
}
- /** Returns the canonical representation of the id. */
+ /**
+ * Returns the canonical representation.
+ *
+ * @return the string value
+ */
public String toString()
{
return toString(CANONICAL_FORMAT);
@@ -412,7 +411,7 @@
}
};
- /** The internal format when it is persisted, smth like a.b.c */
+ /** The internal format when it is persisted, smth like a.b.c . */
public static final PortalObjectPath.Format LEGACY_FORMAT = new PortalObjectPath.LegacyFormat();
public static class LegacyFormat extends PortalObjectPath.Format
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java 2007-05-30 13:48:06 UTC (rev 7361)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java 2007-05-30 14:15:29 UTC (rev 7362)
@@ -34,23 +34,153 @@
*/
public class PortalObjectIdTestCase extends TestCase
{
- public void testCanonicalFormat()
+
+ public void testIAE()
{
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{})), PortalObjectId.parse("/", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), PortalObjectId.parse("/a", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), PortalObjectId.parse("/a/b", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{})), PortalObjectId.parse("ns:/", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a"})), PortalObjectId.parse("ns:/a", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a","b"})), PortalObjectId.parse("ns:/a/b", PortalObjectPath.CANONICAL_FORMAT));
+ try
+ {
+ PortalObjectId.parse("/", null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse(null, PortalObjectPath.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse("", "/", null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse("", null, PortalObjectPath.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse(null, "/", PortalObjectPath.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.toString(null, PortalObjectPath.ROOT_PATH, PortalObjectPath.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.toString("", null, PortalObjectPath.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.toString("", PortalObjectPath.ROOT_PATH, null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ PortalObjectId id = new PortalObjectId("", PortalObjectPath.ROOT_PATH);
+ try
+ {
+ id.toString(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId(null, PortalObjectPath.ROOT_PATH);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId("", null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
}
- public void testLegacyFormat()
+ public void testParseCanonicalFormat()
{
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{})), PortalObjectId.parse("", PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), PortalObjectId.parse("a", PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), PortalObjectId.parse("a.b", PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{})), PortalObjectId.parse("ns:", PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a"})), PortalObjectId.parse("ns:a", PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a","b"})), PortalObjectId.parse("ns:a.b", PortalObjectPath.LEGACY_FORMAT));
+ assertCanonicalFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{})), "/");
+ assertCanonicalFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), "/a");
+ assertCanonicalFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), "/a/b");
+
+ //
+ assertCanonicalFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{})), "ns:/");
+ assertCanonicalFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a"})), "ns:/a");
+ assertCanonicalFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a","b"})), "ns:/a/b");
+
+ //
+ assertCanonicalFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{})), ":/");
+ assertCanonicalFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), ":/a");
+ assertCanonicalFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), ":/a/b");
}
+
+ private void assertCanonicalFormatParse(PortalObjectId id, String string)
+ {
+ assertEquals(id, PortalObjectId.parse(string, PortalObjectPath.CANONICAL_FORMAT));
+ }
+
+ private void assertCanonicalFormatEquals(PortalObjectId id, String string)
+ {
+ assertEquals(id, PortalObjectId.parse(string, PortalObjectPath.CANONICAL_FORMAT));
+ assertEquals(id.toString(PortalObjectPath.CANONICAL_FORMAT), string);
+ }
+
+ public void testParseLegacyFormat()
+ {
+ assertLegacyFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{})), "");
+ assertLegacyFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), "a");
+ assertLegacyFormatEquals(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), "a.b");
+
+ //
+ assertLegacyFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{})), "ns:");
+ assertLegacyFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a"})), "ns:a");
+ assertLegacyFormatEquals(new PortalObjectId("ns", new PortalObjectPath(new String[]{"a","b"})), "ns:a.b");
+
+ //
+ assertLegacyFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{})), ":");
+ assertLegacyFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{"a"})), ":a");
+ assertLegacyFormatParse(new PortalObjectId("", new PortalObjectPath(new String[]{"a","b"})), ":a.b");
+ }
+
+ private void assertLegacyFormatParse(PortalObjectId id, String string)
+ {
+ assertEquals(id, PortalObjectId.parse(string, PortalObjectPath.LEGACY_FORMAT));
+ }
+
+ private void assertLegacyFormatEquals(PortalObjectId id, String string)
+ {
+ assertEquals(id, PortalObjectId.parse(string, PortalObjectPath.LEGACY_FORMAT));
+ assertEquals(id.toString(PortalObjectPath.LEGACY_FORMAT), string);
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-05-30 13:48:06 UTC (rev 7361)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-05-30 14:15:29 UTC (rev 7362)
@@ -141,6 +141,24 @@
assertEquals(new PortalObjectPath(new String[]{}), PortalObjectPath.parse("/", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a"}), PortalObjectPath.parse("/a", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a","b"}), PortalObjectPath.parse("/a/b", PortalObjectPath.CANONICAL_FORMAT));
+
+ //
+ try
+ {
+ PortalObjectPath.parse("", PortalObjectPath.CANONICAL_FORMAT);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ PortalObjectPath.parse("a", PortalObjectPath.CANONICAL_FORMAT);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
}
public void testLegacyFormat()
16 years, 12 months
JBoss Portal SVN: r7361 - trunk/core/src/bin/portal-core-war/themes/phalanx.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-30 09:48:06 -0400 (Wed, 30 May 2007)
New Revision: 7361
Modified:
trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css
Log:
JBPORTAL-1326: Floating "Powered by JBoss" patch by Luca Stancapiano
Modified: trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css 2007-05-30 13:31:45 UTC (rev 7360)
+++ trunk/core/src/bin/portal-core-war/themes/phalanx/portal_style.css 2007-05-30 13:48:06 UTC (rev 7361)
@@ -206,7 +206,7 @@
}
#footer-container {
- position: absolute;
+ position: relative;
bottom: -30px;
text-align: left;
}
16 years, 12 months
JBoss Portal SVN: r7360 - trunk/core.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-30 09:31:45 -0400 (Wed, 30 May 2007)
New Revision: 7360
Modified:
trunk/core/build.xml
Log:
transient instance container tests cannot pass (but this code is not used)
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-05-30 11:40:55 UTC (rev 7359)
+++ trunk/core/build.xml 2007-05-30 13:31:45 UTC (rev 7360)
@@ -604,6 +604,7 @@
<parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>
+<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
outfile="TEST-PersistedLocally-ClonedOnCreate-InstanceContainerTestCase">
<parameter name="PersistLocally" value="true"/>
@@ -611,6 +612,8 @@
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="transient-jboss-beans.xml"/>
</zest>
+-->
+
<zest todir="${test.reports}" name="org.jboss.portal.test.core.state.ProducerTestCase"
outfile="TEST-ProducerTestCase-WithoutRegistration">
<parameter name="UseRegistration" value="false"/>
16 years, 12 months
JBoss Portal SVN: r7359 - trunk/core/src/main/org/jboss/portal/core/ui/content/portlet and 4 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-30 07:40:55 -0400 (Wed, 30 May 2007)
New Revision: 7359
Modified:
docs/trunk/referenceGuide/en/modules/contentIntegration.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
Log:
JBPORTAL-1413: The Portlet Instance list should have a field label describing what it is
Modified: docs/trunk/referenceGuide/en/modules/contentIntegration.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/contentIntegration.xml 2007-05-30 10:58:35 UTC (rev 7358)
+++ docs/trunk/referenceGuide/en/modules/contentIntegration.xml 2007-05-30 11:40:55 UTC (rev 7359)
@@ -61,10 +61,12 @@
<para>Content providers must be able to allow the user or administrator to chose content from the external resource
it integrates in the portal in order to properly configure a portal window. A few interactions between the portal, the content
provider and the portal user are necessary to achieve that goal. Here again it is possible to provide content
- customization using a JSR 168 Portlet. For that purpose a special portlet mode called
- <emphasis>edit_content</emphasis> has been introduced. It signals to the portlet that it is editing the content portion
- of the state of a portlet. The traditional edit mode is not used because the edit mode is more targetted to configure how
- the portlet show content to the end user rather than what content it shows.</para>
+ customization using a JSR 168 Portlet. For that purpose two special portlet modes called
+ <emphasis>edit_content</emphasis> and <emphasis>select_content</emphasis> has been introduced. It signals to the portlet
+ that it is selecting or editing the content portion of the state of a portlet. <emphasis>select_content</emphasis> is
+ used to select a new content to put in a window while <emphasis>edit_content</emphasis> is used to modify the previously
+ defined content, often the two modes will display the same thing. The traditional edit mode is not used because the edit mode
+ is more targetted to configure how the portlet show content to the end user rather than what content it shows.</para>
<imageobject>
<imagedata align="center" fileref="images/content/cms.png" format="png"/>
</imageobject>
@@ -123,6 +125,9 @@
/** The edit_content mode. */
public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
+ /** The select_content mode. */
+ public static final PortletMode SELECT_CONTENT_MODE = new PortletMode("select_content");
+
...
}
@@ -136,7 +141,7 @@
protected void doDispatch(RenderRequest req, RenderResponse resp)
throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT_MODE.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
Modified: trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2007-05-30 10:58:35 UTC (rev 7358)
+++ trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2007-05-30 11:40:55 UTC (rev 7359)
@@ -53,6 +53,8 @@
/** . */
private final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
+ private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
+
/** . */
private InstanceContainer instanceContainer;
@@ -63,7 +65,7 @@
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (req.getPortletMode().equals(EDIT_CONTENT))
+ if ((req.getPortletMode().equals(EDIT_CONTENT)) || (req.getPortletMode().equals(SELECT_CONTENT)))
{
String uri = req.getParameter("content.uri");
if (uri != null)
@@ -79,14 +81,30 @@
{
doEditContent(req, resp);
}
+ else if (SELECT_CONTENT.equals(req.getPortletMode()))
+ {
+ doCreateContent(req, resp);
+ }
+
else
{
super.doDispatch(req, resp);
}
}
+ protected void doCreateContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ getContent(req, resp, true);
+ }
+
+
protected void doEditContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
+ getContent(req, resp, false);
+ }
+
+ protected void getContent(RenderRequest req, RenderResponse resp, boolean newContent) throws PortletException, PortletSecurityException, IOException
+ {
String selectedURI = req.getParameter("content.uri");
//
@@ -112,6 +130,16 @@
Collections.sort(available_instances, simpleComparator);
Instance selectedInstance = null;
+
+ if (!newContent)
+ {
+ writer.print("<span class=\"portlet-font\">Portlet instance associated to this window:</span>");
+ }
+ else
+ {
+ writer.print("<span class=\"portlet-font\">Select a portlet instance to associate to this window:</span>");
+ }
+
writer.print("<form action=\"");
writer.print(actionURL);
writer.print("\" method=\"post\">\n");
@@ -138,7 +166,9 @@
writer.println("</option>\n");
}
writer.println("</select><br />");
- writer.println("<input type=\"submit\" name=\"content.action.select\" value=\"Select\" class=\"portlet-form-button\"/>");
+
+ String buttonText = (newContent) ? "Select" : "Update";
+ writer.println("<input type=\"submit\" name=\"content.action.select\" value=\"" + buttonText + "\" class=\"portlet-form-button\"/>");
writer.println("<input type=\"submit\" value=\"Info\" class=\"portlet-form-button\"/>");
writer.print("</form>");
@@ -168,4 +198,7 @@
//
writer.close();
}
+
+
+
}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-05-30 10:58:35 UTC (rev 7358)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-05-30 11:40:55 UTC (rev 7359)
@@ -140,9 +140,9 @@
portletId="#{pageManager.selectedEditorPortletId}"
portletInvoker="#{pageManager.portletInvoker}"
actionListener="#{pageManager.assignWindow}"
- supportedModes="edit_content"
+ supportedModes="select_content"
supportedWindowStates="normal"
- initialMode="edit_content"
+ initialMode="select_content"
initialWindowState="normal"
onClick="url.setParameter('windowName', document.getElementById('windowForm:windowName').value).setParameter('targetRegion', document.getElementById('regionForm:targetRegion').value);"/>
</div>
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-05-30 10:58:35 UTC (rev 7358)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-05-30 11:40:55 UTC (rev 7359)
@@ -135,6 +135,9 @@
private static final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
/** . */
+ private static final PortletMode SELECT_CONTENT = new PortletMode("select_content");
+
+ /** . */
private CMS CMSService;
/** . */
@@ -304,7 +307,7 @@
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-05-30 10:58:35 UTC (rev 7358)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-05-30 11:40:55 UTC (rev 7359)
@@ -55,13 +55,16 @@
/** The edit_content mode. */
public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
+
+ private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
+
/**
* Additional dispatch that will call the <code>doEditContent(RenderRequest,RenderResponse)</code> method.
*/
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
@@ -194,7 +197,7 @@
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
{
String contentURI = req.getParameter("content.uri");
Modified: trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-05-30 10:58:35 UTC (rev 7358)
+++ trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-05-30 11:40:55 UTC (rev 7359)
@@ -48,6 +48,8 @@
/** . */
private final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
+ private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
+
/** . */
private GGProvider provider = new GGProvider();
@@ -81,7 +83,7 @@
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
16 years, 12 months