JBoss Portal SVN: r6054 - trunk/identity.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-01-19 16:45:47 -0500 (Fri, 19 Jan 2007)
New Revision: 6054
Modified:
trunk/identity/build.xml
Log:
- another change to try having testsuite behave well in CC env
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-01-19 21:38:38 UTC (rev 6053)
+++ trunk/identity/build.xml 2007-01-19 21:45:47 UTC (rev 6054)
@@ -314,8 +314,8 @@
<!-- Undeployment of agent -->
<target name="undeploy-ldap" depends="init" if="HAVE_JDK_1.5">
- <delete file="${jboss.home}/server/${portal.deploy.dir}/test-identity.sar" failonerror="false"/>
- <delete dir="${jboss.home}/server/default/conf/opends" failonerror="false"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/test-identity.sar" failonerror="false" deleteonexit="true"/>
+ <delete dir="${jboss.home}/server/default/conf/opends" failonerror="false" deleteonexit="true"/>
</target>
<target name="tests" depends="init, tests15">
17 years, 5 months
JBoss Portal SVN: r6053 - trunk/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 16:38:38 -0500 (Fri, 19 Jan 2007)
New Revision: 6053
Modified:
trunk/common/build.xml
Log:
oops uncomment the test cases
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-01-19 21:37:47 UTC (rev 6052)
+++ trunk/common/build.xml 2007-01-19 21:38:38 UTC (rev 6053)
@@ -201,7 +201,6 @@
-->
<x-test>
-<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.InfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
@@ -226,7 +225,6 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.Application_XWWWFormURLEncodedFormatTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CharBufferTestCase"/>
--->
<test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
</x-test>
<x-classpath>
17 years, 5 months
JBoss Portal SVN: r6051 - in trunk/common/src/main/org/jboss/portal: test/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 16:37:46 -0500 (Fri, 19 Jan 2007)
New Revision: 6051
Modified:
trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
Log:
CopyOnWriteRegistry javadoc update + test the non modifiability of the returned collections
Modified: trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-01-19 21:32:07 UTC (rev 6050)
+++ trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-01-19 21:37:46 UTC (rev 6051)
@@ -29,6 +29,8 @@
import java.util.Collection;
/**
+ * Implementation of a registry that implements copy on write semantics.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -95,7 +97,7 @@
}
/**
- * Return the known keys.
+ * Return an unmodifiable set containing the keys.
*
* @return the keys
*/
@@ -105,7 +107,7 @@
}
/**
- * Return the registrations.
+ * Return an unmodifable collection containing the registrations.
*
* @return the registrations
*/
@@ -115,6 +117,7 @@
}
/**
+ * Return a registration or null if it does not exist.
*
* @param key the registration key
* @return the registeted object
Modified: trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java 2007-01-19 21:32:07 UTC (rev 6050)
+++ trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java 2007-01-19 21:37:46 UTC (rev 6051)
@@ -158,4 +158,30 @@
assertEquals(Collections.EMPTY_SET, keys);
assertEquals(Collections.EMPTY_LIST, registrations);
}
+
+ public void testKeysAreNotModifiable()
+ {
+ registry.register(key, registered1);
+ try
+ {
+ registry.getKeys().clear();
+ fail("Was expecting UnsupportedOperationException");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testRegistrationsAreNotModifiable()
+ {
+ registry.register(key, registered1);
+ try
+ {
+ registry.getRegistrations().clear();
+ fail("Was expecting UnsupportedOperationException");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
}
17 years, 5 months
JBoss Portal SVN: r6052 - in trunk/identity: src/main/org/jboss/portal/identity and 2 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-01-19 16:37:47 -0500 (Fri, 19 Jan 2007)
New Revision: 6052
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
Log:
- correct broken IdentityContextImpl because of tests were failing
- small corrections in build scripts to hopefully make them working in CC
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-01-19 21:37:46 UTC (rev 6051)
+++ trunk/identity/build.xml 2007-01-19 21:37:47 UTC (rev 6052)
@@ -303,19 +303,19 @@
<target name="help" depends="_default:help"/>
- <target name="deploy-ldap" depends="init" if="HAVE_JDK_1.5">
+ <target name="deploy-ldap" depends="init" if="HAVE_JDK_1.5" >
<mkdir dir="${jboss.home}/server/default/conf/opends"/>
- <copy todir="${jboss.home}/server/default/conf/opends" overwrite="true">
+ <copy todir="${jboss.home}/server/default/conf/opends" overwrite="true" failonerror="false">
<fileset dir="../test/output/etc/opends"/>
</copy>
- <copy file="${build.lib}/test-identity.sar" todir="${jboss.home}/server/${portal.deploy.dir}"/>
+ <copy file="${build.lib}/test-identity.sar" todir="${jboss.home}/server/${portal.deploy.dir}" failonerror="false"/>
<sleep seconds="25"/>
</target>
<!-- Undeployment of agent -->
<target name="undeploy-ldap" depends="init" if="HAVE_JDK_1.5">
- <delete file="${jboss.home}/server/${portal.deploy.dir}/test-identity.sar"/>
- <delete dir="${jboss.home}/server/default/conf/opends"/>
+ <delete file="${jboss.home}/server/${portal.deploy.dir}/test-identity.sar" failonerror="false"/>
+ <delete dir="${jboss.home}/server/default/conf/opends" failonerror="false"/>
</target>
<target name="tests" depends="init, tests15">
@@ -450,13 +450,13 @@
<x-test>
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db_old.DBUserTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.UserProtoTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ConfigurationTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
</x-test>
<x-classpath>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-19 21:37:46 UTC (rev 6051)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-19 21:37:47 UTC (rev 6052)
@@ -24,6 +24,8 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.common.util.CopyOnWriteRegistry;
+import java.util.Collection;
+
/**
* Keeps references to all identity related modules to enable them interactions
*
@@ -42,13 +44,19 @@
public void register(Object object, String name) throws IdentityException
{
- registry.register(object, name);
+ if (!registry.register(name, object))
+ {
+ throw new IdentityException("Cannot register object in IdentityContext with name: " + name);
+ }
if (log.isDebugEnabled()) log.debug("registering object: " + name + " ; " + object.getClass());
}
public void unregister(String name)
{
- registry.unregister(name);
+ if (!registry.unregister(name))
+ {
+ log.error("Cannot unregister object from IdentityContext with name: " + name);
+ }
if (log.isDebugEnabled()) log.debug("unregistering object: " + name);
}
@@ -61,4 +69,14 @@
}
return o;
}
+
+ public Collection getKeys()
+ {
+ return registry.getKeys();
+ }
+
+ public Collection getValues()
+ {
+ return registry.getRegistrations();
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-01-19 21:37:46 UTC (rev 6051)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-01-19 21:37:47 UTC (rev 6052)
@@ -21,11 +21,8 @@
*/
package org.jboss.portal.test.identity.db;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
-import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.db.HibernateUserImpl;
-import org.jboss.portal.identity.ProfileMap;
-import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.*;
import org.jboss.portal.identity.service.UserModuleService;
import org.jboss.portal.identity.service.UserProfileModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
@@ -35,6 +32,8 @@
import junit.framework.TestSuite;
import java.util.Date;
+import java.util.Collection;
+import java.util.Iterator;
import java.text.SimpleDateFormat;
/**
@@ -43,6 +42,7 @@
*/
public class DBIdentityTestCase extends DBTestCase
{
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(DBTestCase.class);
public static TestSuite suite() throws Exception
{
@@ -75,6 +75,7 @@
controller.setRegisterMBeans(false);
controller.start();
identityContext = controller.getIdentityContext();
+
this.userModule = (UserModuleService)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
this.roleModule = (RoleModuleService)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
this.membershipModule = (MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-01-19 21:37:46 UTC (rev 6051)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-01-19 21:37:47 UTC (rev 6052)
@@ -56,7 +56,7 @@
Logger.getRoot().addAppender(appender);
Logger.getRoot().setLevel(Level.DEBUG);
Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
- Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
}
public static TestSuite createTestSuite(Class clazz) throws Exception
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-01-19 21:37:46 UTC (rev 6051)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-01-19 21:37:47 UTC (rev 6052)
@@ -66,7 +66,7 @@
Appender appender = new ConsoleAppender(new SimpleLayout());
Logger.getRoot().addAppender(appender);
Logger.getRoot().setLevel(Level.INFO);
- Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
}
public static TestSuite createTestSuite(Class clazz) throws Exception
17 years, 5 months
JBoss Portal SVN: r6050 - in trunk/common: src/main/org/jboss/portal/test/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 16:32:07 -0500 (Fri, 19 Jan 2007)
New Revision: 6050
Added:
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
Modified:
trunk/common/build.xml
Log:
CopyOnWriteRegistry test case
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-01-19 15:33:39 UTC (rev 6049)
+++ trunk/common/build.xml 2007-01-19 21:32:07 UTC (rev 6050)
@@ -201,6 +201,7 @@
-->
<x-test>
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.InfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
@@ -225,6 +226,8 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.Application_XWWWFormURLEncodedFormatTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CharBufferTestCase"/>
+-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Added: trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java 2007-01-19 21:32:07 UTC (rev 6050)
@@ -0,0 +1,161 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CopyOnWriteRegistryTestCase extends TestCase
+{
+
+ private CopyOnWriteRegistry registry;
+ Object key;
+ Object registered1;
+ Object registered2;
+
+
+ protected void setUp() throws Exception
+ {
+ registry = new CopyOnWriteRegistry();
+ key = new Object();
+ registered1 = new Object();
+ registered2 = new Object();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ registry = null;
+ key = null;
+ registered1 = null;
+ registered2 = null;
+ }
+
+ public void testRegisterThrowsIAE()
+ {
+ try
+ {
+ registry.register(null, registered1);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ registry.register(registered1, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ registry.register(null, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testUnregisterThrowsIAE()
+ {
+ try
+ {
+ registry.unregister(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testGetThrowsIAE()
+ {
+ try
+ {
+ registry.get(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testDualRegistration()
+ {
+ assertTrue(registry.register(key, registered1));
+ assertFalse(registry.register(key, registered2));
+ assertEquals(registered1, registry.get(key));
+ }
+
+ public void testUnregisterNonRegistered()
+ {
+ assertFalse(registry.unregister(key));
+ }
+
+ public void testNormal()
+ {
+ assertEquals(Collections.EMPTY_SET, registry.getKeys());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(registry.getRegistrations()));
+ assertTrue(registry.register(key, registered1));
+ assertEquals(Collections.singleton(key), registry.getKeys());
+ assertEquals(Collections.singletonList(registered1), new ArrayList(registry.getRegistrations()));
+ assertEquals(registered1, registry.get(key));
+ assertTrue(registry.unregister(key));
+ assertEquals(null, registry.get(key));
+ assertEquals(Collections.EMPTY_SET, registry.getKeys());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(registry.getRegistrations()));
+ }
+
+ public void testCopyOnWrite()
+ {
+ Set keys = registry.getKeys();
+ List registrations = new ArrayList(registry.getRegistrations());
+ assertEquals(Collections.EMPTY_SET, keys);
+ assertEquals(Collections.EMPTY_LIST, registrations);
+ assertTrue(registry.register(key, registered1));
+ assertEquals(Collections.EMPTY_SET, keys);
+ assertEquals(Collections.EMPTY_LIST, registrations);
+ keys = registry.getKeys();
+ registrations = new ArrayList(registry.getRegistrations());
+ assertEquals(Collections.singleton(key), keys);
+ assertEquals(Collections.singletonList(registered1), registrations);
+ assertTrue(registry.unregister(key));
+ assertEquals(Collections.singleton(key), keys);
+ assertEquals(Collections.singletonList(registered1), registrations);
+ keys = registry.getKeys();
+ registrations = new ArrayList(registry.getRegistrations());
+ assertEquals(Collections.EMPTY_SET, keys);
+ assertEquals(Collections.EMPTY_LIST, registrations);
+ }
+}
17 years, 5 months
JBoss Portal SVN: r6049 - in branches/JBoss_Portal_Branch_2_2: server/src/main/org/jboss/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 10:33:39 -0500 (Fri, 19 Jan 2007)
New Revision: 6049
Modified:
branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/PortletMode.java
branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/WindowState.java
branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/Mode.java
branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/WindowState.java
Log:
JBPORTAL-1209 : PortletMode and WindowState should use the correct to lower case conversion
Modified: branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/PortletMode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/PortletMode.java 2007-01-19 15:30:24 UTC (rev 6048)
+++ branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/PortletMode.java 2007-01-19 15:33:39 UTC (rev 6049)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>PortletMode</CODE> class represents
* the possible modes that a portlet can assume.
@@ -48,42 +50,37 @@
{
/**
- * Within the <code>EDIT</code> portlet mode, a portlet should provide
- * content and logic that lets a user customize the behavior of the portlet.
- * The EDIT portlet mode may include one or more screens among which
- * users can navigate to enter their customization data.
- * <p>
- * Typically, portlets in <code>EDIT</code> portlet mode will
- * set or update portlet preferences.
- * <P>
+ * Within the <code>EDIT</code> portlet mode, a portlet should provide content and logic that lets a user customize
+ * the behavior of the portlet. The EDIT portlet mode may include one or more screens among which users can navigate
+ * to enter their customization data.
+ * <p/>
+ * Typically, portlets in <code>EDIT</code> portlet mode will set or update portlet preferences.
+ * <p/>
* This mode is optional.
- * <p>
+ * <p/>
* The string value for this mode is <code>"edit"</code>.
*/
public static final PortletMode EDIT = new PortletMode("edit");
/**
- * When in <code>HELP</code> portlet mode, a portlet should provide help
- * information about the portlet. This help information could be
- * a simple help screen explaining the entire portlet in
- * coherent text or it could be context-sensitive help.
- * <P>
+ * When in <code>HELP</code> portlet mode, a portlet should provide help information about the portlet. This help
+ * information could be a simple help screen explaining the entire portlet in coherent text or it could be
+ * context-sensitive help.
+ * <p/>
* This mode is optional.
- * <p>
+ * <p/>
* The string value for this mode is <code>"help"</code>.
*/
public static final PortletMode HELP = new PortletMode("help");
/**
- * The expected functionality for a portlet in <code>VIEW</code> portlet mode
- * is to generate markup reflecting the current state of the portlet.
- * For example, the <code>VIEW</code> portlet mode of a portlet may
- * include one or more screens that the user can navigate and interact
- * with, or it may consist of static content that does not require any
- * user interaction.
- * <P>
+ * The expected functionality for a portlet in <code>VIEW</code> portlet mode is to generate markup reflecting the
+ * current state of the portlet. For example, the <code>VIEW</code> portlet mode of a portlet may include one or more
+ * screens that the user can navigate and interact with, or it may consist of static content that does not require
+ * any user interaction.
+ * <p/>
* This mode must be supported by the portlet.
- * <p>
+ * <p/>
* The string value for this mode is <code>"view"</code>.
*/
public static final PortletMode VIEW = new PortletMode("view");
@@ -92,9 +89,8 @@
/**
* Creates a new portlet mode with the given name.
- * <p>
- * Upper case letters in the name are converted to
- * lower case letters.
+ * <p/>
+ * Upper case letters in the name are converted to lower case letters.
*
* @param name The name of the portlet mode
*/
@@ -104,34 +100,35 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
- * Compares the specified object with this portlet mode
- * for equality. Returns <code>true</code> if the
- * Strings <code>equals</code> method for the String
- * representing the two portlet modes returns <code>true</code>.
+ * Compares the specified object with this portlet mode for equality. Returns <code>true</code> if the Strings
+ * <code>equals</code> method for the String representing the two portlet modes returns <code>true</code>.
*
- * @param o portlet mode to compare this portlet mode with
- *
- * @return true, if the specified object is equal with this portlet mode
+ * @param o portlet mode to compare this portlet mode with
+ * @return true, if the specified object is equal with this portlet mode
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof PortletMode)
{
- return o == this || name.equals(((PortletMode)o).name);
+ PortletMode that = (PortletMode)o;
+ return name.equals(that.name);
}
return false;
}
/**
- * Returns the hash code value for this portlet mode.
- * The hash code is constructed by producing the
- * hash value of the String value of this mode.
+ * Returns the hash code value for this portlet mode. The hash code is constructed by producing the hash value of the
+ * String value of this mode.
*
- * @return hash code value for this portlet mode
+ * @return hash code value for this portlet mode
*/
public int hashCode()
{
@@ -139,14 +136,12 @@
}
/**
- * Returns a String representation of this portlet mode.
- * Portlet mode names are always lower case names.
+ * Returns a String representation of this portlet mode. Portlet mode names are always lower case names.
*
- * @return String representation of this portlet mode
+ * @return String representation of this portlet mode
*/
public String toString()
{
return name;
}
-
}
Modified: branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/WindowState.java 2007-01-19 15:30:24 UTC (rev 6048)
+++ branches/JBoss_Portal_Branch_2_2/api/src/main/javax/portlet/WindowState.java 2007-01-19 15:33:39 UTC (rev 6049)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>WindowState</CODE> class represents
* the possible window states that a portlet window can assume.
@@ -39,31 +41,27 @@
{
/**
- * The <code>NORMAL</code> window state indicates that a portlet
- * may be sharing the page with other portlets. It may also
- * indicate that the target device has limited display capabilities.
- * Therefore, a portlet should restrict the size of its rendered
- * output in this window state.
- * <p>
+ * The <code>NORMAL</code> window state indicates that a portlet may be sharing the page with other portlets. It may
+ * also indicate that the target device has limited display capabilities. Therefore, a portlet should restrict the
+ * size of its rendered output in this window state.
+ * <p/>
* The string value for this state is <code>"normal"</code>.
*/
public static final WindowState NORMAL = new WindowState("normal");
/**
- * When a portlet is in <code>MINIMIZED</code> window state,
- * the portlet should only render minimal output or no output at all.
- * <p>
+ * When a portlet is in <code>MINIMIZED</code> window state, the portlet should only render minimal output or no
+ * output at all.
+ * <p/>
* The string value for this state is <code>"minimized"</code>.
*/
public static final WindowState MINIMIZED = new WindowState("minimized");
/**
- * The <code>MAXIMIZED</code> window state is an indication
- * that a portlet may be the only portlet being rendered in the
- * portal page, or that the portlet has more space compared to other portlets
- * in the portal page. A portlet may generate richer content
- * when its window state is <code>MAXIMIZED</code>.
- * <p>
+ * The <code>MAXIMIZED</code> window state is an indication that a portlet may be the only portlet being rendered in
+ * the portal page, or that the portlet has more space compared to other portlets in the portal page. A portlet may
+ * generate richer content when its window state is <code>MAXIMIZED</code>.
+ * <p/>
* The string value for this state is <code>"maximized"</code>.
*/
public static final WindowState MAXIMIZED = new WindowState("maximized");
@@ -72,9 +70,8 @@
/**
* Creates a new window state with the given name.
- * <p>
- * Upper case letters in the name are converted to
- * lower case letters.
+ * <p/>
+ * Upper case letters in the name are converted to lower case letters.
*
* @param name The name of the portlet mode
*/
@@ -84,34 +81,35 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
- * Compares the specified object with this window state
- * for equality. Returns <code>true</code> if the
- * Strings <code>equals</code> method for the String
- * representing the two window states returns <code>true</code>.
+ * Compares the specified object with this window state for equality. Returns <code>true</code> if the Strings
+ * <code>equals</code> method for the String representing the two window states returns <code>true</code>.
*
- * @param the window state to compare this window state with.
- *
- * @return true, if the specified object is equal with this window state.
+ * @param o the window state to compare this window state with.
+ * @return true, if the specified object is equal with this window state.
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equals(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
/**
- * Returns the hash code value for this window state.
- * The hash code is constructed by producing the
- * hash value of the String value of this window state.
+ * Returns the hash code value for this window state. The hash code is constructed by producing the hash value of the
+ * String value of this window state.
*
- * @return hash code value for this window state
+ * @return hash code value for this window state
*/
public int hashCode()
{
@@ -119,14 +117,12 @@
}
/**
- * Returns a String representation of this window state.
- * Window state names are always lower case names.
+ * Returns a String representation of this window state. Window state names are always lower case names.
*
- * @return String representation of this window state.
+ * @return String representation of this window state.
*/
public String toString()
{
return name;
}
-
}
Modified: branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/Mode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/Mode.java 2007-01-19 15:30:24 UTC (rev 6048)
+++ branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/Mode.java 2007-01-19 15:33:39 UTC (rev 6049)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -31,26 +32,43 @@
public class Mode implements Serializable
{
+ /** The serialVersionUID. */
+ private static final long serialVersionUID = 6033765240710422050L;
+
+ /** . */
public static final Mode EDIT = new Mode("edit");
+
+ /** . */
public static final Mode HELP = new Mode("help");
+
+ /** . */
public static final Mode VIEW = new Mode("view");
+ /** . */
+ public static final Mode EDIT_DEFAULTS = new Mode("edit_defaults");
+
+ /** . */
private String name;
public Mode(String name)
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("Mode cannot be null");
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof Mode)
{
- return o == this || name.equals(((Mode)o).name);
+ Mode that = (Mode)o;
+ return name.equals(that.name);
}
return false;
}
@@ -79,6 +97,10 @@
{
return HELP;
}
+ else if (EDIT_DEFAULTS.name.equals(name))
+ {
+ return EDIT_DEFAULTS;
+ }
else
{
return this;
@@ -87,15 +109,19 @@
public static Mode create(String s)
{
- if (Mode.EDIT.toString().equalsIgnoreCase(s))
+ if (Mode.VIEW.name.equals(s))
{
+ return Mode.VIEW;
+ }
+ else if (Mode.EDIT.name.equals(s))
+ {
return Mode.EDIT;
}
- else if (Mode.HELP.toString().equalsIgnoreCase(s))
+ else if (Mode.HELP.name.equals(s))
{
return Mode.HELP;
}
- else if (Mode.VIEW.toString().equalsIgnoreCase(s))
+ else if (Mode.EDIT_DEFAULTS.name.equals(s))
{
return Mode.VIEW;
}
Modified: branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/WindowState.java 2007-01-19 15:30:24 UTC (rev 6048)
+++ branches/JBoss_Portal_Branch_2_2/server/src/main/org/jboss/portal/WindowState.java 2007-01-19 15:33:39 UTC (rev 6049)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -31,26 +32,40 @@
public class WindowState implements Serializable
{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -6305311518934458562L;
+
+ /** . */
public static final WindowState NORMAL = new WindowState("normal");
+
+ /** . */
public static final WindowState MINIMIZED = new WindowState("minimized");
+
+ /** . */
public static final WindowState MAXIMIZED = new WindowState("maximized");
+ /** . */
private String name;
public WindowState(String name)
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("Window state name cannot be null");
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equals(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
@@ -87,15 +102,15 @@
public static WindowState create(String s)
{
- if (WindowState.NORMAL.toString().equalsIgnoreCase(s))
+ if (WindowState.NORMAL.name.equals(s))
{
return WindowState.NORMAL;
}
- else if (WindowState.MINIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MINIMIZED.name.equals(s))
{
return WindowState.MINIMIZED;
}
- else if (WindowState.MAXIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MAXIMIZED.name.equals(s))
{
return WindowState.MAXIMIZED;
}
17 years, 5 months
JBoss Portal SVN: r6048 - in branches/JBoss_Portal_Branch_2_4: api/src/main/org/jboss/portal and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 10:30:24 -0500 (Fri, 19 Jan 2007)
New Revision: 6048
Modified:
branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java
branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java
branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java
branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java
branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml
Log:
JBPORTAL-1209 : PortletMode and WindowState should use the correct to lower case conversion
Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/PortletMode.java 2007-01-19 15:30:24 UTC (rev 6048)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>PortletMode</CODE> class represents the possible modes that a portlet can assume.
* <p/>
@@ -93,7 +95,7 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
@@ -105,9 +107,14 @@
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof PortletMode)
{
- return o == this || name.equals(((PortletMode)o).name);
+ PortletMode that = (PortletMode)o;
+ return name.equals(that.name);
}
return false;
}
@@ -132,5 +139,4 @@
{
return name;
}
-
}
Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/javax/portlet/WindowState.java 2007-01-19 15:30:24 UTC (rev 6048)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>WindowState</CODE> class represents the possible window states that a portlet window can assume.
* <p/>
@@ -77,21 +79,26 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
* Compares the specified object with this window state for equality. Returns <code>true</code> if the Strings
* <code>equals</code> method for the String representing the two window states returns <code>true</code>.
*
- * @param the window state to compare this window state with.
+ * @param o the window state to compare this window state with.
* @return true, if the specified object is equal with this window state.
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equals(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
@@ -116,5 +123,4 @@
{
return name;
}
-
}
Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/Mode.java 2007-01-19 15:30:24 UTC (rev 6048)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,16 +54,21 @@
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("Mode cannot be null");
}
- this.name = name;
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof Mode)
{
- return o == this || name.equalsIgnoreCase(((Mode)o).name);
+ Mode that = (Mode)o;
+ return name.equals(that.name);
}
return false;
}
@@ -79,19 +85,19 @@
private Object readResolve()
{
- if (VIEW.name.equalsIgnoreCase(name))
+ if (VIEW.name.equals(name))
{
return VIEW;
}
- else if (EDIT.name.equalsIgnoreCase(name))
+ else if (EDIT.name.equals(name))
{
return EDIT;
}
- else if (HELP.name.equalsIgnoreCase(name))
+ else if (HELP.name.equals(name))
{
return HELP;
}
- else if (EDIT_DEFAULTS.name.equalsIgnoreCase(name))
+ else if (EDIT_DEFAULTS.name.equals(name))
{
return EDIT_DEFAULTS;
}
@@ -103,19 +109,19 @@
public static Mode create(String s)
{
- if (Mode.VIEW.name.equalsIgnoreCase(s))
+ if (Mode.VIEW.name.equals(s))
{
return Mode.VIEW;
}
- else if (Mode.EDIT.name.equalsIgnoreCase(s))
+ else if (Mode.EDIT.name.equals(s))
{
return Mode.EDIT;
}
- else if (Mode.HELP.name.equalsIgnoreCase(s))
+ else if (Mode.HELP.name.equals(s))
{
return Mode.HELP;
}
- else if (Mode.EDIT_DEFAULTS.name.equalsIgnoreCase(s))
+ else if (Mode.EDIT_DEFAULTS.name.equals(s))
{
return Mode.VIEW;
}
Modified: branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/api/src/main/org/jboss/portal/WindowState.java 2007-01-19 15:30:24 UTC (rev 6048)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -33,26 +34,38 @@
/** The serialVersionUID */
private static final long serialVersionUID = -6305311518934458562L;
+
+ /** . */
public static final WindowState NORMAL = new WindowState("normal");
+
+ /** . */
public static final WindowState MINIMIZED = new WindowState("minimized");
+
+ /** . */
public static final WindowState MAXIMIZED = new WindowState("maximized");
+ /** . */
private String name;
public WindowState(String name)
{
if (name == null)
{
- throw new IllegalArgumentException("Window state name cannot be null.");
+ throw new IllegalArgumentException("Window state name cannot be null");
}
- this.name = name;
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equalsIgnoreCase(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
@@ -69,15 +82,15 @@
private Object readResolve()
{
- if (NORMAL.name.equalsIgnoreCase(name))
+ if (NORMAL.name.equals(name))
{
return NORMAL;
}
- else if (MAXIMIZED.name.equalsIgnoreCase(name))
+ else if (MAXIMIZED.name.equals(name))
{
return MAXIMIZED;
}
- else if (MINIMIZED.name.equalsIgnoreCase(name))
+ else if (MINIMIZED.name.equals(name))
{
return MINIMIZED;
}
@@ -89,15 +102,15 @@
public static WindowState create(String s)
{
- if (WindowState.NORMAL.toString().equalsIgnoreCase(s))
+ if (WindowState.NORMAL.name.equals(s))
{
return WindowState.NORMAL;
}
- else if (WindowState.MINIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MINIMIZED.name.equals(s))
{
return WindowState.MINIMIZED;
}
- else if (WindowState.MAXIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MAXIMIZED.name.equals(s))
{
return WindowState.MAXIMIZED;
}
Modified: branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/WEB-INF/jboss-web.xml 2007-01-19 15:30:24 UTC (rev 6048)
@@ -26,7 +26,7 @@
<security-domain>java:jaas/portal</security-domain>
<context-root>@portal.web.context-root@</context-root>
<replication-config>
- <replication-trigger>SET_AND_GET</replication-trigger>
+ <replication-trigger>SET</replication-trigger>
</replication-config>
<resource-ref>
<res-ref-name>jdbc/PortalDS</res-ref-name>
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml 2007-01-19 15:26:43 UTC (rev 6047)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/resources/test-war/WEB-INF/jboss-web.xml 2007-01-19 15:30:24 UTC (rev 6048)
@@ -26,6 +26,5 @@
<security-domain>java:/jaas/other</security-domain>
<replication-config>
<replication-trigger>SET</replication-trigger>
- <replication-type>SYNC</replication-type>
</replication-config>
</jboss-web>
17 years, 5 months
JBoss Portal SVN: r6047 - in trunk/api/src/main: org/jboss/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-19 10:26:43 -0500 (Fri, 19 Jan 2007)
New Revision: 6047
Modified:
trunk/api/src/main/javax/portlet/PortletMode.java
trunk/api/src/main/javax/portlet/WindowState.java
trunk/api/src/main/org/jboss/portal/Mode.java
trunk/api/src/main/org/jboss/portal/WindowState.java
Log:
JBPORTAL-1209 : PortletMode and WindowState should use the correct to lower case conversion
Modified: trunk/api/src/main/javax/portlet/PortletMode.java
===================================================================
--- trunk/api/src/main/javax/portlet/PortletMode.java 2007-01-19 06:34:20 UTC (rev 6046)
+++ trunk/api/src/main/javax/portlet/PortletMode.java 2007-01-19 15:26:43 UTC (rev 6047)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>PortletMode</CODE> class represents the possible modes that a portlet can assume.
* <p/>
@@ -93,7 +95,7 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
@@ -105,9 +107,14 @@
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof PortletMode)
{
- return o == this || name.equals(((PortletMode)o).name);
+ PortletMode that = (PortletMode)o;
+ return name.equals(that.name);
}
return false;
}
@@ -132,5 +139,4 @@
{
return name;
}
-
}
Modified: trunk/api/src/main/javax/portlet/WindowState.java
===================================================================
--- trunk/api/src/main/javax/portlet/WindowState.java 2007-01-19 06:34:20 UTC (rev 6046)
+++ trunk/api/src/main/javax/portlet/WindowState.java 2007-01-19 15:26:43 UTC (rev 6047)
@@ -22,6 +22,8 @@
******************************************************************************/
package javax.portlet;
+import java.util.Locale;
+
/**
* The <CODE>WindowState</CODE> class represents the possible window states that a portlet window can assume.
* <p/>
@@ -77,21 +79,26 @@
{
throw new NullPointerException();
}
- this.name = name.toLowerCase();
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
/**
* Compares the specified object with this window state for equality. Returns <code>true</code> if the Strings
* <code>equals</code> method for the String representing the two window states returns <code>true</code>.
*
- * @param the window state to compare this window state with.
+ * @param o the window state to compare this window state with.
* @return true, if the specified object is equal with this window state.
*/
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equals(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
@@ -116,5 +123,4 @@
{
return name;
}
-
}
Modified: trunk/api/src/main/org/jboss/portal/Mode.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/Mode.java 2007-01-19 06:34:20 UTC (rev 6046)
+++ trunk/api/src/main/org/jboss/portal/Mode.java 2007-01-19 15:26:43 UTC (rev 6047)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -53,16 +54,21 @@
{
if (name == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("Mode cannot be null");
}
- this.name = name;
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof Mode)
{
- return o == this || name.equalsIgnoreCase(((Mode)o).name);
+ Mode that = (Mode)o;
+ return name.equals(that.name);
}
return false;
}
@@ -79,19 +85,19 @@
private Object readResolve()
{
- if (VIEW.name.equalsIgnoreCase(name))
+ if (VIEW.name.equals(name))
{
return VIEW;
}
- else if (EDIT.name.equalsIgnoreCase(name))
+ else if (EDIT.name.equals(name))
{
return EDIT;
}
- else if (HELP.name.equalsIgnoreCase(name))
+ else if (HELP.name.equals(name))
{
return HELP;
}
- else if (EDIT_DEFAULTS.name.equalsIgnoreCase(name))
+ else if (EDIT_DEFAULTS.name.equals(name))
{
return EDIT_DEFAULTS;
}
@@ -103,19 +109,19 @@
public static Mode create(String s)
{
- if (Mode.VIEW.name.equalsIgnoreCase(s))
+ if (Mode.VIEW.name.equals(s))
{
return Mode.VIEW;
}
- else if (Mode.EDIT.name.equalsIgnoreCase(s))
+ else if (Mode.EDIT.name.equals(s))
{
return Mode.EDIT;
}
- else if (Mode.HELP.name.equalsIgnoreCase(s))
+ else if (Mode.HELP.name.equals(s))
{
return Mode.HELP;
}
- else if (Mode.EDIT_DEFAULTS.name.equalsIgnoreCase(s))
+ else if (Mode.EDIT_DEFAULTS.name.equals(s))
{
return Mode.VIEW;
}
Modified: trunk/api/src/main/org/jboss/portal/WindowState.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/WindowState.java 2007-01-19 06:34:20 UTC (rev 6046)
+++ trunk/api/src/main/org/jboss/portal/WindowState.java 2007-01-19 15:26:43 UTC (rev 6047)
@@ -23,6 +23,7 @@
package org.jboss.portal;
import java.io.Serializable;
+import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -33,26 +34,38 @@
/** The serialVersionUID */
private static final long serialVersionUID = -6305311518934458562L;
+
+ /** . */
public static final WindowState NORMAL = new WindowState("normal");
+
+ /** . */
public static final WindowState MINIMIZED = new WindowState("minimized");
+
+ /** . */
public static final WindowState MAXIMIZED = new WindowState("maximized");
+ /** . */
private String name;
public WindowState(String name)
{
if (name == null)
{
- throw new IllegalArgumentException("Window state name cannot be null.");
+ throw new IllegalArgumentException("Window state name cannot be null");
}
- this.name = name;
+ this.name = name.toLowerCase(Locale.ENGLISH);
}
public boolean equals(Object o)
{
+ if (o == this)
+ {
+ return true;
+ }
if (o instanceof WindowState)
{
- return o == this || name.equalsIgnoreCase(((WindowState)o).name);
+ WindowState that = (WindowState)o;
+ return name.equals(that.name);
}
return false;
}
@@ -69,15 +82,15 @@
private Object readResolve()
{
- if (NORMAL.name.equalsIgnoreCase(name))
+ if (NORMAL.name.equals(name))
{
return NORMAL;
}
- else if (MAXIMIZED.name.equalsIgnoreCase(name))
+ else if (MAXIMIZED.name.equals(name))
{
return MAXIMIZED;
}
- else if (MINIMIZED.name.equalsIgnoreCase(name))
+ else if (MINIMIZED.name.equals(name))
{
return MINIMIZED;
}
@@ -89,15 +102,15 @@
public static WindowState create(String s)
{
- if (WindowState.NORMAL.toString().equalsIgnoreCase(s))
+ if (WindowState.NORMAL.name.equals(s))
{
return WindowState.NORMAL;
}
- else if (WindowState.MINIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MINIMIZED.name.equals(s))
{
return WindowState.MINIMIZED;
}
- else if (WindowState.MAXIMIZED.toString().equalsIgnoreCase(s))
+ else if (WindowState.MAXIMIZED.name.equals(s))
{
return WindowState.MAXIMIZED;
}
17 years, 5 months
JBoss Portal SVN: r6046 - trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-01-19 01:34:20 -0500 (Fri, 19 Jan 2007)
New Revision: 6046
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
Log:
- Changed suffix to correctly reverse prefix (doesn't matter but I like it better that way ^_^)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-19 06:29:40 UTC (rev 6045)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-19 06:34:20 UTC (rev 6046)
@@ -38,7 +38,7 @@
public class PortletUtils
{
public static final String PREFIX = "jbpns";
- public static final String SUFFIX = "snjbp";
+ public static final String SUFFIX = "snpbj";
public static void checkRenderParameterMap(Map map)
{
17 years, 5 months
JBoss Portal SVN: r6045 - in trunk: common/src/main/org/jboss/portal/test/common and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-01-19 01:29:40 -0500 (Fri, 19 Jan 2007)
New Revision: 6045
Modified:
trunk/common/src/main/org/jboss/portal/common/util/Tools.java
trunk/common/src/main/org/jboss/portal/test/common/StringTestCase.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/MarkupPortlet.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
Log:
- JBPORTAL-1041: Re-activated fragment processing. Replace only namespaces in markup. This should be enough and doesn't require html parsing.
- Tools.replaceBoundedString does all the work and allows to replace occurences of Strings bounded by a prefix and suffix by a replacement String.
- Added suffix to namespace generation so that it can be detected and replaced in fragment processing.
- Updated test cases.
Modified: trunk/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2007-01-18 23:55:48 UTC (rev 6044)
+++ trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -998,4 +998,37 @@
return o1.equals(o2);
}
}
+
+ public static String replaceBoundedString(String initial, String prefix, String suffix, String replacement)
+ {
+ if (initial == null || initial.length() == 0)
+ {
+ return initial;
+ }
+
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(prefix, "prefix", "Tools.replaceBoundedString");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(suffix, "suffix", "Tools.replaceBoundedString");
+ ParameterValidation.throwIllegalArgExceptionIfNull(replacement, "replacement");
+
+ StringBuffer tmp = new StringBuffer(initial);
+ int prefixIndex = tmp.indexOf(prefix);
+ int suffixLength = suffix.length();
+ int prefixLength = prefix.length();
+
+ while (prefixIndex != -1)
+ {
+ int suffixIndex = tmp.indexOf(suffix, prefixIndex);
+
+ if (suffixIndex != -1)
+ {
+ tmp.delete(prefixIndex, suffixIndex + suffixLength);
+ tmp.insert(prefixIndex, replacement);
+ }
+
+ prefixIndex = tmp.indexOf(prefix, prefixIndex + prefixLength);
+ }
+
+ return tmp.toString();
+
+ }
}
\ No newline at end of file
Modified: trunk/common/src/main/org/jboss/portal/test/common/StringTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/StringTestCase.java 2007-01-18 23:55:48 UTC (rev 6044)
+++ trunk/common/src/main/org/jboss/portal/test/common/StringTestCase.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -46,4 +46,13 @@
assertEquals("_defg_defg_", Tools.replace("_abc_abc_", "abc", "defg"));
}
+ public void testReplaceBoundedString()
+ {
+ assertEquals("", Tools.replaceBoundedString("", "PREFIX", "SUFFIX", "REPLACEMENT"));
+ assertEquals("REPLACEMENT", Tools.replaceBoundedString("PREFIXSUFFIX", "PREFIX", "SUFFIX", "REPLACEMENT"));
+ assertEquals("aaaaREPLACEMENTccccc", Tools.replaceBoundedString("aaaaPREFIXbbbbbSUFFIXccccc", "PREFIX", "SUFFIX", "REPLACEMENT"));
+ assertEquals("aaaPREFIXbbbbSUFF", Tools.replaceBoundedString("aaaPREFIXbbbbSUFF", "PREFIX", "SUFFIX", "REPLACEMENT"));
+ assertEquals("aRcccReeeR", Tools.replaceBoundedString("aPbbScccPdSeeePS", "P", "S", "R"));
+ }
+
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-18 23:55:48 UTC (rev 6044)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -37,7 +37,8 @@
*/
public class PortletUtils
{
- private static final String PREFIX = "jbp";
+ public static final String PREFIX = "jbpns";
+ public static final String SUFFIX = "snjbp";
public static void checkRenderParameterMap(Map map)
{
@@ -169,7 +170,7 @@
{
StringBuffer tmp = new StringBuffer(PREFIX.length() + windowId.length() * 2);
tmp.append(PREFIX);
- for (int i = 0;i < windowId.length();i++)
+ for (int i = 0; i < windowId.length(); i++)
{
char c = windowId.charAt(i);
if (Character.isLetterOrDigit(c))
@@ -183,6 +184,7 @@
tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
}
}
+ tmp.append(SUFFIX);
return tmp.toString();
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/MarkupPortlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/MarkupPortlet.java 2007-01-18 23:55:48 UTC (rev 6044)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/MarkupPortlet.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -106,7 +106,8 @@
StringBuffer sb = new StringBuffer(256);
sb.append("<form method='post' action='")
.append(response.createActionURL())
- .append("' id='portfolioManager'><table><tr><td>Stock symbol</td><td><input name='").append(SYMBOL)
+ .append("' id='").append(response.getNamespace())
+ .append("portfolioManager'><table><tr><td>Stock symbol</td><td><input name='").append(SYMBOL)
.append("'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
writer.write(sb.toString());
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-01-18 23:55:48 UTC (rev 6044)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -112,12 +112,8 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
- // commented out because fails with fragment processing de-activation
-// checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
-// "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
-// "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='portfolioManager'><table><tr><td>Stock symbol</t" +
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
"d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-01-18 23:55:48 UTC (rev 6044)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-01-19 06:29:40 UTC (rev 6045)
@@ -23,7 +23,9 @@
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
@@ -36,6 +38,7 @@
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPRewritingConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetMarkup;
@@ -132,7 +135,7 @@
switch (fragment.getType())
{
case FragmentResponse.TYPE_CHARS:
- markupString = fragment.getChars().toString();
+ markupString = processFragmentString(fragment.getChars().toString());
break;
case FragmentResponse.TYPE_BYTES:
markupBinary = fragment.getBytes().toByteArray(); // fix-me: might need to convert to Base64?
@@ -170,4 +173,17 @@
return new MarkupResponse(markupContext, null, null);
}
+
+ /**
+ * Process String returned from RenderResult to add rewriting token if necessary, replacing namespaces by the WSRP
+ * rewrite token. fix-me: need to check for producer rewriting
+ *
+ * @param renderString the String to be processed for rewriting marking
+ * @return a String processed to add rewriting tokens as necessary
+ */
+ private String processFragmentString(String renderString)
+ {
+ return Tools.replaceBoundedString(renderString, PortletUtils.PREFIX, PortletUtils.SUFFIX,
+ WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
+ }
}
17 years, 5 months