Author: chris.laprun(a)jboss.com
Date: 2007-11-20 15:45:50 -0500 (Tue, 20 Nov 2007)
New Revision: 9048
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/P3PConstantsTestCase.java
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/p3p/P3PConstants.java
Log:
- Revert constants so that only public ones are exposed but added methods to retrieve keys
instead.
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/p3p/P3PConstants.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/p3p/P3PConstants.java 2007-11-20
18:25:24 UTC (rev 9047)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/p3p/P3PConstants.java 2007-11-20
20:45:50 UTC (rev 9048)
@@ -29,34 +29,116 @@
*/
public final class P3PConstants
{
+ public enum TelecomType
+ {
+ TELEPHONE(TELECOM_TELEPHONE),
+ FAX(TELECOM_FAX),
+ MOBILE(TELECOM_MOBILE),
+ PAGER(TELECOM_PAGER);
+ private final String prefix;
+
+ TelecomType(String prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public String getPrefix()
+ {
+ return prefix;
+ }
+ }
+
+ public enum TelecomInfo
+ {
+ INTCODE(TELECOM_INTCODE),
+ LOCCODE(TELECOM_LOCCODE),
+ NUMBER(TELECOM_NUMBER),
+ EXT(TELECOM_EXT),
+ COMMENT(TELECOM_COMMENT);
+
+ private final String name;
+
+ TelecomInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ public enum PostalInfo
+ {
+ NAME(POSTAL_NAME),
+ STREET(POSTAL_STREET),
+ CITY(POSTAL_CITY),
+ STATEPROV(POSTAL_STATEPROV),
+ POSTALCODE(POSTAL_POSTALCODE),
+ COUNTRY(POSTAL_COUNTRY),
+ ORGANIZATION(POSTAL_ORGANIZATION);
+
+ private final String name;
+
+ PostalInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ public enum OnlineInfo
+ {
+ EMAIL(ONLINE_EMAIL),
+ URI(ONLINE_URI);
+
+ private final String name;
+
+ OnlineInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+
// Postal
- public static final String POSTAL_NAME = "postal.name";
- public static final String POSTAL_STREET = "postal.street";
- public static final String POSTAL_CITY = "postal.city";
- public static final String POSTAL_STATEPROV = "postal.stateprov";
- public static final String POSTAL_POSTALCODE = "postal.postalcode";
- public static final String POSTAL_COUNTRY = "postal.country";
- public static final String POSTAL_ORGANIZATION = "postal.organization";
+ private static final String POSTAL_NAME = "postal.name";
+ private static final String POSTAL_STREET = "postal.street";
+ private static final String POSTAL_CITY = "postal.city";
+ private static final String POSTAL_STATEPROV = "postal.stateprov";
+ private static final String POSTAL_POSTALCODE = "postal.postalcode";
+ private static final String POSTAL_COUNTRY = "postal.country";
+ private static final String POSTAL_ORGANIZATION = "postal.organization";
// Telecom
- public static final String TELECOM_TELEPHONE = "telecom.telephone.";
- public static final String TELECOM_FAX = "telecom.fax.";
- public static final String TELECOM_MOBILE = "telecom.mobile.";
- public static final String TELECOM_PAGER = "telecom.pager.";
- public static final String INTCODE = "intcode";
- public static final String LOCCODE = "loccode";
- public static final String NUMBER = "number";
- public static final String EXT = "ext";
- public static final String COMMENT = "comment";
+ private static final String TELECOM_TELEPHONE = "telecom.telephone.";
+ private static final String TELECOM_FAX = "telecom.fax.";
+ private static final String TELECOM_MOBILE = "telecom.mobile.";
+ private static final String TELECOM_PAGER = "telecom.pager.";
+ private static final String TELECOM_INTCODE = "intcode";
+ private static final String TELECOM_LOCCODE = "loccode";
+ private static final String TELECOM_NUMBER = "number";
+ private static final String TELECOM_EXT = "ext";
+ private static final String TELECOM_COMMENT = "comment";
// Online
- public static final String ONLINE_URI = "online.uri";
- public static final String ONLINE_EMAIL = "online.email";
+ private static final String ONLINE_URI = "online.uri";
+ private static final String ONLINE_EMAIL = "online.email";
/*
- * User information attribute names (PLT.D in the portlet spec) that are defined in
P3P spec.
- */
+ * User information attribute names (PLT.D in the portlet spec) that are defined in P3P
spec.
+ */
//
public static final String INFO_USER_BDATE = "user.bdate";
@@ -72,7 +154,7 @@
public static final String INFO_USER_NAME_NICKNAME = "user.name.nickName";
// User home
- public static final String INFO_USER_HOME_PREFIX = "user.home-info.";
+ private static final String INFO_USER_HOME_PREFIX = "user.home-info.";
public static final String INFO_USER_HOME_INFO_POSTAL_NAME = INFO_USER_HOME_PREFIX +
POSTAL_NAME;
public static final String INFO_USER_HOME_INFO_POSTAL_STREET = INFO_USER_HOME_PREFIX +
POSTAL_STREET;
public static final String INFO_USER_HOME_INFO_POSTAL_CITY = INFO_USER_HOME_PREFIX +
POSTAL_CITY;
@@ -80,31 +162,31 @@
public static final String INFO_USER_HOME_INFO_POSTAL_POSTALCODE =
INFO_USER_HOME_PREFIX + POSTAL_POSTALCODE;
public static final String INFO_USER_HOME_INFO_POSTAL_COUNTRY = INFO_USER_HOME_PREFIX
+ POSTAL_COUNTRY;
public static final String INFO_USER_HOME_INFO_POSTAL_ORGANIZATION =
INFO_USER_HOME_PREFIX + POSTAL_ORGANIZATION;
- public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + INTCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + LOCCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + NUMBER;
- public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_EXT =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + EXT;
- public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + COMMENT;
- public static final String INFO_USER_HOME_INFO_TELECOM_FAX_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_FAX + INTCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_FAX_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_FAX + LOCCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_FAX_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_FAX + NUMBER;
- public static final String INFO_USER_HOME_INFO_TELECOM_FAX_EXT = INFO_USER_HOME_PREFIX
+ TELECOM_FAX + EXT;
- public static final String INFO_USER_HOME_INFO_TELECOM_FAX_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_FAX + COMMENT;
- public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + INTCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + LOCCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + NUMBER;
- public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_EXT =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + EXT;
- public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + COMMENT;
- public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + INTCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + LOCCODE;
- public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + NUMBER;
- public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_EXT =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + EXT;
- public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_EXT =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_EXT = INFO_USER_HOME_PREFIX
+ TELECOM_FAX + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_EXT =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_INTCODE =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_LOCCODE =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_NUMBER =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_EXT =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_COMMENT =
INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_COMMENT;
public static final String INFO_USER_HOME_INFO_ONLINE_EMAIL = INFO_USER_HOME_PREFIX +
ONLINE_EMAIL;
public static final String INFO_USER_HOME_INFO_ONLINE_URI = INFO_USER_HOME_PREFIX +
ONLINE_URI;
// User Business
- public static final String INFO_USER_BUSINESS_PREFIX =
"user.business-info.";
+ private static final String INFO_USER_BUSINESS_PREFIX =
"user.business-info.";
public static final String INFO_USER_BUSINESS_INFO_POSTAL_NAME =
INFO_USER_BUSINESS_PREFIX + POSTAL_NAME;
public static final String INFO_USER_BUSINESS_INFO_POSTAL_STREET =
INFO_USER_BUSINESS_PREFIX + POSTAL_STREET;
public static final String INFO_USER_BUSINESS_INFO_POSTAL_CITY =
INFO_USER_BUSINESS_PREFIX + POSTAL_CITY;
@@ -112,30 +194,50 @@
public static final String INFO_USER_BUSINESS_INFO_POSTAL_POSTALCODE =
INFO_USER_BUSINESS_PREFIX + POSTAL_POSTALCODE;
public static final String INFO_USER_BUSINESS_INFO_POSTAL_COUNTRY =
INFO_USER_BUSINESS_PREFIX + POSTAL_COUNTRY;
public static final String INFO_USER_BUSINESS_INFO_POSTAL_ORGANIZATION =
INFO_USER_BUSINESS_PREFIX + POSTAL_ORGANIZATION;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + INTCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + LOCCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + NUMBER;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + EXT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + COMMENT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + INTCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + LOCCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + NUMBER;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + EXT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + COMMENT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + INTCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + LOCCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + NUMBER;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + EXT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + COMMENT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + INTCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + LOCCODE;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + NUMBER;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + EXT;
- public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_EXT =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT =
INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_COMMENT;
public static final String INFO_USER_BUSINESS_INFO_ONLINE_EMAIL =
INFO_USER_BUSINESS_PREFIX + ONLINE_EMAIL;
public static final String INFO_USER_BUSINESS_INFO_ONLINE_URI =
INFO_USER_BUSINESS_PREFIX + ONLINE_URI;
private P3PConstants()
{
}
-}
+
+ public static String getHomeOrBusinessPrefix(boolean isBusiness)
+ {
+ return isBusiness ? P3PConstants.INFO_USER_BUSINESS_PREFIX :
P3PConstants.INFO_USER_HOME_PREFIX;
+ }
+
+ public static String getPostalUserInfoKey(PostalInfo info, boolean isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + info.getName();
+ }
+
+ public static String getTelecomInfoKey(TelecomType type, TelecomInfo info, boolean
isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + type.getPrefix() + info.getName();
+ }
+
+ public static String getOnlineUserInfoKey(OnlineInfo info, boolean isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + info.getName();
+ }
+}
\ No newline at end of file
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/P3PConstantsTestCase.java
===================================================================
---
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/P3PConstantsTestCase.java
(rev 0)
+++
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/P3PConstantsTestCase.java 2007-11-20
20:45:50 UTC (rev 9048)
@@ -0,0 +1,121 @@
+/*
+* 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 static org.jboss.portal.common.p3p.P3PConstants.*;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class P3PConstantsTestCase extends TestCase
+{
+ public void testGetPostalUserInfoKey()
+ {
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_CITY,
getPostalUserInfoKey(PostalInfo.CITY, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_COUNTRY,
getPostalUserInfoKey(PostalInfo.COUNTRY, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_NAME,
getPostalUserInfoKey(PostalInfo.NAME, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_ORGANIZATION,
getPostalUserInfoKey(PostalInfo.ORGANIZATION, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_POSTALCODE,
getPostalUserInfoKey(PostalInfo.POSTALCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_STATEPROV,
getPostalUserInfoKey(PostalInfo.STATEPROV, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_POSTAL_STREET,
getPostalUserInfoKey(PostalInfo.STREET, true));
+
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_CITY, getPostalUserInfoKey(PostalInfo.CITY,
false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_COUNTRY,
getPostalUserInfoKey(PostalInfo.COUNTRY, false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_NAME, getPostalUserInfoKey(PostalInfo.NAME,
false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_ORGANIZATION,
getPostalUserInfoKey(PostalInfo.ORGANIZATION, false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_POSTALCODE,
getPostalUserInfoKey(PostalInfo.POSTALCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_STATEPROV,
getPostalUserInfoKey(PostalInfo.STATEPROV, false));
+ assertEquals(INFO_USER_HOME_INFO_POSTAL_STREET,
getPostalUserInfoKey(PostalInfo.STREET, false));
+ }
+
+ public void testGetOnlineInfoKey()
+ {
+ assertEquals(INFO_USER_BUSINESS_INFO_ONLINE_EMAIL,
getOnlineUserInfoKey(OnlineInfo.EMAIL, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_ONLINE_URI,
getOnlineUserInfoKey(OnlineInfo.URI, true));
+
+ assertEquals(INFO_USER_HOME_INFO_ONLINE_EMAIL,
getOnlineUserInfoKey(OnlineInfo.EMAIL, false));
+ assertEquals(INFO_USER_HOME_INFO_ONLINE_URI, getOnlineUserInfoKey(OnlineInfo.URI,
false));
+ }
+
+
+ public void testGetTelecomInfoKey()
+ {
+ // business fax
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_FAX_COMMENT,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.COMMENT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_FAX_EXT,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.EXT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_FAX_INTCODE,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.INTCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.LOCCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_FAX_NUMBER,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.NUMBER, true));
+
+ // home fax
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_FAX_COMMENT,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.COMMENT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_FAX_EXT,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.EXT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_FAX_INTCODE,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.INTCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_FAX_LOCCODE,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.LOCCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_FAX_NUMBER,
getTelecomInfoKey(TelecomType.FAX, TelecomInfo.NUMBER, false));
+
+ // business mobile
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.COMMENT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_EXT,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.EXT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.INTCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.LOCCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.NUMBER, true));
+
+ // home mobile
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_MOBILE_COMMENT,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.COMMENT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_MOBILE_EXT,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.EXT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_MOBILE_INTCODE,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.INTCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_MOBILE_LOCCODE,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.LOCCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_MOBILE_NUMBER,
getTelecomInfoKey(TelecomType.MOBILE, TelecomInfo.NUMBER, false));
+
+ // business pager
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.COMMENT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_PAGER_EXT,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.EXT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.INTCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.LOCCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.NUMBER, true));
+
+ // home pager
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_PAGER_COMMENT,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.COMMENT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_PAGER_EXT,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.EXT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_PAGER_INTCODE,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.INTCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_PAGER_LOCCODE,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.LOCCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_PAGER_NUMBER,
getTelecomInfoKey(TelecomType.PAGER, TelecomInfo.NUMBER, false));
+
+ // business telephone
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.COMMENT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.EXT, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.INTCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.LOCCODE, true));
+ assertEquals(INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.NUMBER, true));
+
+ // home telephone
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.COMMENT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_TELEPHONE_EXT,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.EXT, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.INTCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.LOCCODE, false));
+ assertEquals(INFO_USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER,
getTelecomInfoKey(TelecomType.TELEPHONE, TelecomInfo.NUMBER, false));
+ }
+}
Property changes on:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/P3PConstantsTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native