JBoss Portal SVN: r11967 - in branches/JBoss_Portal_Branch_2_7: wsrp/src/main/org/jboss/portal/test/wsrp/consumer and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-09-24 10:02:12 -0400 (Wed, 24 Sep 2008)
New Revision: 11967
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
Log:
- JBPORTAL-2083: more improvements on registration properties handling, more testing needed.
- Improved message as modify registration can also be required via a change on the producer side.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-09-24 14:02:12 UTC (rev 11967)
@@ -155,7 +155,7 @@
bean_consumermanager_refresh_success = Refresh was successful.
bean_consumermanager_refresh_failure = Refresh failed (probably because the registration information was not valid).
bean_consumermanager_refresh_exception = An unexpected error occurred.
-bean_consumermanager_refresh_modify = The local information has been changed, you should modify your registration with the remote producer.
+bean_consumermanager_refresh_modify = Either local or remote information has been changed, you should modify your registration with the remote producer.
# ProducerBean
bean_producer_regpolicy_unset = RegistrationPolicy unset
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-09-24 14:02:12 UTC (rev 11967)
@@ -133,7 +133,7 @@
bean_consumermanager_refresh_success=Le rafra\u00eechissement a r\u00e9ussi.
bean_producer_cancel_success=Toutes les modifications faites \u00e0 la configuration du producteur ont \u00e9t\u00e9 annull\u00e9es!
bean_producer_save_success=La configuration du producteur a bien \u00e9t\u00e9 sauvegard\u00e9e!
-bean_consumermanager_refresh_modify=Les informations locales ont chang\u00e9, vous devriez modifier votre enregistrement avec le producteur.
+bean_consumermanager_refresh_modify=Les informations locales ou distantes ont chang\u00e9, vous devriez modifier votre enregistrement avec le producteur.
bean_consumer_update_success=Consommateur mis \u00e0 jour!
registration_property_status_inexistent=Inexistant sur le producteur
registration_property_status_invalid_value=Invalide valeur
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -257,6 +257,35 @@
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
}
+ public void testRefreshRegistrationRegistrationNoLocalInfoWhileRegistered()
+ {
+ // producer requests 2 registration properties
+ ServiceDescription sd = createServiceDescription(true, 2);
+
+ // simulate registration
+ info.setRegistrationHandle("blah");
+
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
+ assertNotNull(result);
+ assertTrue(result.hasIssues());
+ assertEquals(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED, result.getStatus());
+ assertEquals(0, info.getRegistrationProperties().size());
+ assertEquals(2, result.getRegistrationProperties().size());
+ assertTrue(info.isModifyRegistrationNeeded());
+
+ Map regProps = result.getRegistrationProperties();
+ assertNotNull(regProps);
+
+ RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
+ prop = (RegistrationProperty)regProps.get("prop1");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
+ }
+
public void testRefreshRegistrationRegistrationMergeWithLocalInfo()
{
info.setRegistrationPropertyValue("foo", "bar");
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -250,7 +250,7 @@
public boolean isModifyRegistrationRequired()
{
- return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModifiedSinceLastRefresh());
+ return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModifyRegistrationNeeded());
}
// FIX-ME: remove when a better dirty management is in place at property level
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-09-24 13:43:55 UTC (rev 11966)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-09-24 14:02:12 UTC (rev 11967)
@@ -295,6 +295,8 @@
// todo: deal with language more appropriately
prop = new RegistrationProperty(name, value, WSRPUtils.toString(Locale.getDefault()), this);
getOrCreateRegistrationPropertiesMap(false).put(name, prop);
+ setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
}
return prop;
@@ -309,6 +311,7 @@
throw new IllegalArgumentException("Cannot remove inexistent registration property '" + name + "'");
}
setModifiedSinceLastRefresh(true);
+ modifyRegistrationNeeded = true;
}
private Map<String, RegistrationProperty> getOrCreateRegistrationPropertiesMap(boolean forceCreate)
@@ -662,7 +665,7 @@
public boolean isModifyRegistrationNeeded()
{
- return modifyRegistrationNeeded;
+ return modifyRegistrationNeeded || isModifiedSinceLastRefresh();
}
public boolean isModifiedSinceLastRefresh()
17 years, 7 months
JBoss Portal SVN: r11966 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/model/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-09-24 09:43:55 -0400 (Wed, 24 Sep 2008)
New Revision: 11966
Modified:
branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
Log:
JBPORTAL-2165: Portal objects with a name longer than 57 cause javascript error in the admin portlet
Modified: branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-09-24 13:33:43 UTC (rev 11965)
+++ branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-09-24 13:43:55 UTC (rev 11966)
@@ -41,7 +41,7 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.2.1"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/web" version="1.2.1"/>
<componentref name="jboss-portal/modules/test" version="1.0.3"/>
<componentref name="jboss-portal/modules/portlet" version="2.0.3"/>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2008-09-24 13:33:43 UTC (rev 11965)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2008-09-24 13:43:55 UTC (rev 11966)
@@ -553,7 +553,7 @@
try
{
byte[] bytes = name.getBytes("UTF-8");
- name = Base64.encodeBytes(bytes);
+ name = Base64.encodeBytes(bytes, Base64.EncodingOption.NOCARRIAGERETURN);
return name;
}
catch (UnsupportedEncodingException e)
17 years, 7 months
JBoss Portal SVN: r11965 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/model/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-09-24 09:33:43 -0400 (Wed, 24 Sep 2008)
New Revision: 11965
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
Log:
JBPORTAL-2165: Portal objects with a name longer than 57 cause javascript error in the admin portlet
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-09-24 13:24:15 UTC (rev 11964)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2008-09-24 13:33:43 UTC (rev 11965)
@@ -47,7 +47,7 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.1.2"/>
+ <componentref name="jboss-portal/modules/common" version="1.1-SNAPSHOT"/>
<componentref name="jboss-portal/modules/web" version="1.1.0"/>
<componentref name="jboss-portal/modules/test" version="1.0.1.SP1"/>
<componentref name="jboss-portal/modules/portlet" version="1.0.3"/>
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2008-09-24 13:24:15 UTC (rev 11964)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2008-09-24 13:33:43 UTC (rev 11965)
@@ -539,7 +539,7 @@
{
try
{
- byte[] bytes = Base64.decode(name);
+ byte[] bytes = Base64.decode(name, Base64.EncodingOption.NOCARRIAGERETURN);
return new String(bytes, "UTF-8");
}
catch (UnsupportedEncodingException e)
@@ -553,7 +553,7 @@
try
{
byte[] bytes = name.getBytes("UTF-8");
- name = Base64.encodeBytes(bytes);
+ name = Base64.encodeBytes(bytes, Base64.EncodingOption.NOCARRIAGERETURN);
return name;
}
catch (UnsupportedEncodingException e)
17 years, 7 months
JBoss Portal SVN: r11964 - branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/netvibes.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-09-24 09:24:15 -0400 (Wed, 24 Sep 2008)
New Revision: 11964
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/netvibes/NetvibesQueryTestCase.java
Log:
Forgot to fix widget test in 2.6
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/netvibes/NetvibesQueryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/netvibes/NetvibesQueryTestCase.java 2008-09-24 12:32:56 UTC (rev 11963)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/netvibes/NetvibesQueryTestCase.java 2008-09-24 13:24:15 UTC (rev 11964)
@@ -36,14 +36,14 @@
public void test01() throws Exception
{
NetvibesQuery q = new NetvibesQuery(0, 10, "14", "top", "foo");
- assertEquals("http://eco.netvibes.com/rss-partner.php?synd=jboss&type=uwa&count=10&cat=...", q.buildQueryURL().toString());
+ assertEquals("http://api.eco.netvibes.com/search/?type=uwa&limit=10&category=14&sort=to...", q.buildQueryURL().toString());
}
public void test02() throws Exception
{
NetvibesQuery q = new NetvibesQuery(1, 11, "5", "foo", "bar");
- assertEquals("http://eco.netvibes.com/rss-partner.php?synd=jboss&type=uwa&start=1&count...", q.buildQueryURL().toString());
+ assertEquals("http://api.eco.netvibes.com/search/?type=uwa&page=1&limit=11&category=5&s...", q.buildQueryURL().toString());
}
public void test03()
17 years, 7 months
JBoss Portal SVN: r11963 - branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-09-24 08:32:56 -0400 (Wed, 24 Sep 2008)
New Revision: 11963
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
Log:
build.xml update
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 12:15:39 UTC (rev 11962)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 12:32:56 UTC (rev 11963)
@@ -42,7 +42,7 @@
</path>
<taskdef name="testng" classpathref="libraries.cp" classname="org.testng.TestNGAntTask" />
-
+<!--
<taskdef name="config" classname="org.jboss.ant.taskdefs.server.ConfigManagerTask" uri="http://jboss.org/ns/test/ant/server" loaderref="server.loader">
<classpath id="server.taskdef.classpath">
<path refid="jboss.test.classpath" />
@@ -54,7 +54,7 @@
<taskdef name="stop" classname="org.jboss.ant.taskdefs.server.StopServerTask" uri="http://jboss.org/ns/test/ant/server" loaderref="server.loader">
<classpath refid="server.taskdef.classpath" />
</taskdef>
-
+-->
<target name="init">
<echo message="Browser : ${browser}" />
<echo message="Workspace : ${workspace}" />
@@ -66,7 +66,7 @@
<!--
<server:config javaHome="${java.home}" jbossHome="${jboss.test.home}/${jboss.portal.dir}/">
<server name="${portal.instance}" host="${node0}">
- <!-- jvmarg value="${jpda.cmdline}" / -->
+ --> <!-- jvmarg value="${jpda.cmdline}" / --> <!--
<jvmarg value="-Xmx512m" />
<sysproperty key="java.endorsed.dirs" value="${jboss.test.home}/${jboss.portal.dir}/lib/endorsed" />
</server>
17 years, 7 months
JBoss Portal SVN: r11962 - modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/util.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-09-24 08:15:39 -0400 (Wed, 24 Sep 2008)
New Revision: 11962
Modified:
modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/util/Base64.java
Log:
Add option to not add a carriage return
Modified: modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/util/Base64.java
===================================================================
--- modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/util/Base64.java 2008-09-24 12:11:35 UTC (rev 11961)
+++ modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/util/Base64.java 2008-09-24 12:15:39 UTC (rev 11962)
@@ -49,7 +49,6 @@
/** Maximum line length (76) of Base64 output. */
private final static int MAX_LINE_LENGTH = 76;
-
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte)'=';
@@ -59,14 +58,13 @@
/** The character to be used as a padding character in the encoded Strings. */
private byte PADDING_CHAR;
-
/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte)'\n';
-
/** Preferred encoding. */
private final static String PREFERRED_ENCODING = "UTF-8";
+ public static enum EncodingOption { USEURLSAFEENCODING, NOCARRIAGERETURN, STANDARD};
/** The 64 valid Base64 values. */
private byte[] ALPHABET;
@@ -212,9 +210,9 @@
initAlphabets(useURLSafeEncoding);
}
- private static Base64 getBase64(boolean useURLSafeEncoding)
+ private static Base64 getBase64(EncodingOption option)
{
- return useURLSafeEncoding ? URL_SAFE_BASE64 : STANDARD_BASE64;
+ return EncodingOption.USEURLSAFEENCODING.equals(option) ? URL_SAFE_BASE64 : STANDARD_BASE64;
}
/* ******** E N C O D I N G M E T H O D S ******** */
@@ -293,41 +291,38 @@
*/
public static String encodeBytes(byte[] source)
{
- return encodeBytes(source, 0, source.length, false);
+ return encodeBytes(source, EncodingOption.STANDARD);
} // end encodeBytes
-
+
/**
* Encodes a byte array into Base64 notation.
*
* @param source The data to convert
- * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
- * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
- * your encoding non-compliant.</i>
+ * @param option Encoding option
*/
- public static String encodeBytes(byte[] source, boolean useURLSafeEncoding)
+ public static String encodeBytes(byte[] source, EncodingOption option)
{
- return encodeBytes(source, 0, source.length, useURLSafeEncoding);
+ return encodeBytes(source, 0, source.length, option);
} // end encodeBytes
+
/**
* Encodes a byte array into Base64 notation.
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
- * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
- * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
- * your encoding non-compliant.</i>
+ * @param option Encoding option
*/
- public static String encodeBytes(byte[] source, int off, int len, boolean useURLSafeEncoding)
+ public static String encodeBytes(byte[] source, int off, int len, EncodingOption option)
{
- Base64 b64 = getBase64(useURLSafeEncoding);
+ Base64 b64 = getBase64(option);
int len43 = len * 4 / 3;
byte[] outBuff = new byte[(len43) // Main 4:3
+ ((len % 3) > 0 ? 4 : 0) // Account for padding
- + ((!useURLSafeEncoding) ? (len43 / MAX_LINE_LENGTH) : 0)]; // New lines
+ + ((EncodingOption.STANDARD.equals(option)) ? (len43 / MAX_LINE_LENGTH) : 0)]; // New lines
int d = 0;
int e = 0;
int len2 = len - 2;
@@ -337,7 +332,7 @@
b64.encode3to4(source, d + off, 3, outBuff, e);
lineLength += 4;
- if (!useURLSafeEncoding && lineLength == MAX_LINE_LENGTH)
+ if (EncodingOption.STANDARD.equals(option) && lineLength == MAX_LINE_LENGTH)
{
outBuff[e + 4] = NEW_LINE;
e++;
@@ -513,12 +508,12 @@
* @param source The Base64 encoded data
* @param off The offset of where to begin decoding
* @param len The length of characters to decode
- * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @param optionThatWasUsed EncodingOption used during the encoding
* @return decoded data
*/
- public static byte[] decode(byte[] source, int off, int len, boolean urlSafeEncodingWasUsed)
+ public static byte[] decode(byte[] source, int off, int len, EncodingOption optionThatWasUsed)
{
- return getBase64(urlSafeEncodingWasUsed).decode(len, off, source);
+ return getBase64(optionThatWasUsed).decode(len, off, source);
} // end decode
/**
@@ -526,9 +521,10 @@
*
* @param s the string to decode
* @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @param optionThatWasUsed EncodingOption used during the encoding
* @return the decoded data
*/
- public static byte[] decode(String s, boolean urlSafeEncodingWasUsed)
+ public static byte[] decode(String s, EncodingOption optionThatWasUsed)
{
byte[] bytes;
try
@@ -541,7 +537,7 @@
} // end catch
// Decode
- bytes = decode(bytes, 0, bytes.length, urlSafeEncodingWasUsed);
+ bytes = decode(bytes, 0, bytes.length, optionThatWasUsed);
return bytes;
} // end decode
@@ -554,7 +550,85 @@
*/
public static byte[] decode(String s)
{
- return decode(s, false);
+ return decode(s, EncodingOption.STANDARD);
} // end decode
+ // Deprecated methods
+
+ /**
+ * Encodes a byte array into Base64 notation using the standard Base64 encoding.
+ *
+ * @deprecated
+ * @param source The data to convert
+ * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
+ * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
+ * your encoding non-compliant.</i>
+ */
+ public static String encodeBytes(byte[] source, boolean useURLSafeEncoding)
+ {
+ if (useURLSafeEncoding)
+ {
+ return encodeBytes(source, EncodingOption.USEURLSAFEENCODING);
+ }
+ else
+ {
+ return encodeBytes(source, EncodingOption.STANDARD);
+ }
+ } // end encodeBytes
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ *
+ * @deprecated
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
+ * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
+ * your encoding non-compliant.</i>
+ */
+ public static String encodeBytes(byte[] source, int off, int len, boolean useURLSafeEncoding)
+ {
+ return (useURLSafeEncoding) ? encodeBytes(source, off, len, EncodingOption.USEURLSAFEENCODING) : encodeBytes(source, off, len, EncodingOption.STANDARD);
+ }
+
+ /**
+ * Very low-level access to decoding ASCII characters in
+ * the form of a byte array.
+ *
+ * @deprecated
+ * @param source The Base64 encoded data
+ * @param off The offset of where to begin decoding
+ * @param len The length of characters to decode
+ * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @return decoded data
+ */
+ public static byte[] decode(byte[] source, int off, int len, boolean urlSafeEncodingWasUsed)
+ {
+ EncodingOption option = EncodingOption.STANDARD;
+ if (urlSafeEncodingWasUsed)
+ {
+ option = EncodingOption.USEURLSAFEENCODING;
+ }
+ return decode(source, off, len, option);
+ } // end decode
+
+ /**
+ * Decodes data from Base64 notation
+ *
+ * @deprecated
+ * @param s the string to decode
+ * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @return the decoded data
+ */
+ public static byte[] decode(String s, boolean urlSafeEncodingWasUsed)
+ {
+ EncodingOption option = EncodingOption.STANDARD;
+ if (urlSafeEncodingWasUsed)
+ {
+ option = EncodingOption.USEURLSAFEENCODING;
+ }
+ return decode(s, option);
+ } // end decode
+
} // end class Base64
17 years, 7 months
JBoss Portal SVN: r11961 - branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-09-24 08:11:35 -0400 (Wed, 24 Sep 2008)
New Revision: 11961
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
Log:
build.xml third fix
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 10:08:21 UTC (rev 11960)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 12:11:35 UTC (rev 11961)
@@ -63,13 +63,16 @@
</target>
<!--target name="server-config" depends="unpack-portal"-->
- <server:config javaHome="${java.home}" jbossHome="${jboss.test.home}/${jboss.portal.dir}/">
+<!--
+<server:config javaHome="${java.home}" jbossHome="${jboss.test.home}/${jboss.portal.dir}/">
<server name="${portal.instance}" host="${node0}">
<!-- jvmarg value="${jpda.cmdline}" / -->
<jvmarg value="-Xmx512m" />
<sysproperty key="java.endorsed.dirs" value="${jboss.test.home}/${jboss.portal.dir}/lib/endorsed" />
</server>
</server:config>
+
+-->
<!--/target-->
<target name="compile" depends="">
17 years, 7 months
JBoss Portal SVN: r11960 - branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-09-24 06:08:21 -0400 (Wed, 24 Sep 2008)
New Revision: 11960
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
Log:
build.xml second fix
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 09:46:05 UTC (rev 11959)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 10:08:21 UTC (rev 11960)
@@ -136,8 +136,9 @@
</target>
<target name="selenium-test" depends="init, compile, run-src">
+<!--
<antcall target="copyApps" />
-<!--
+
<echo message="Starting portal instance : ${portal.instance}" />
<server:start name="${portal.instance}" />
-->
17 years, 7 months
JBoss Portal SVN: r11959 - modules/common/trunk/common/src/main/java/org/jboss/portal/common/util.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-09-24 05:46:05 -0400 (Wed, 24 Sep 2008)
New Revision: 11959
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/Base64.java
Log:
Add option to not add a carriage return
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/Base64.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/Base64.java 2008-09-24 08:50:49 UTC (rev 11958)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/Base64.java 2008-09-24 09:46:05 UTC (rev 11959)
@@ -49,7 +49,6 @@
/** Maximum line length (76) of Base64 output. */
private final static int MAX_LINE_LENGTH = 76;
-
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte)'=';
@@ -59,14 +58,13 @@
/** The character to be used as a padding character in the encoded Strings. */
private byte PADDING_CHAR;
-
/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte)'\n';
-
/** Preferred encoding. */
private final static String PREFERRED_ENCODING = "UTF-8";
+ public static enum EncodingOption { USEURLSAFEENCODING, NOCARRIAGERETURN, STANDARD};
/** The 64 valid Base64 values. */
private byte[] ALPHABET;
@@ -212,9 +210,9 @@
initAlphabets(useURLSafeEncoding);
}
- private static Base64 getBase64(boolean useURLSafeEncoding)
+ private static Base64 getBase64(EncodingOption option)
{
- return useURLSafeEncoding ? URL_SAFE_BASE64 : STANDARD_BASE64;
+ return EncodingOption.USEURLSAFEENCODING.equals(option) ? URL_SAFE_BASE64 : STANDARD_BASE64;
}
/* ******** E N C O D I N G M E T H O D S ******** */
@@ -293,41 +291,38 @@
*/
public static String encodeBytes(byte[] source)
{
- return encodeBytes(source, 0, source.length, false);
+ return encodeBytes(source, EncodingOption.STANDARD);
} // end encodeBytes
-
+
/**
* Encodes a byte array into Base64 notation.
*
* @param source The data to convert
- * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
- * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
- * your encoding non-compliant.</i>
+ * @param option Encoding option
*/
- public static String encodeBytes(byte[] source, boolean useURLSafeEncoding)
+ public static String encodeBytes(byte[] source, EncodingOption option)
{
- return encodeBytes(source, 0, source.length, useURLSafeEncoding);
+ return encodeBytes(source, 0, source.length, option);
} // end encodeBytes
+
/**
* Encodes a byte array into Base64 notation.
*
* @param source The data to convert
* @param off Offset in array where conversion should begin
* @param len Length of data to convert
- * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
- * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
- * your encoding non-compliant.</i>
+ * @param option Encoding option
*/
- public static String encodeBytes(byte[] source, int off, int len, boolean useURLSafeEncoding)
+ public static String encodeBytes(byte[] source, int off, int len, EncodingOption option)
{
- Base64 b64 = getBase64(useURLSafeEncoding);
+ Base64 b64 = getBase64(option);
int len43 = len * 4 / 3;
byte[] outBuff = new byte[(len43) // Main 4:3
+ ((len % 3) > 0 ? 4 : 0) // Account for padding
- + ((!useURLSafeEncoding) ? (len43 / MAX_LINE_LENGTH) : 0)]; // New lines
+ + ((EncodingOption.STANDARD.equals(option)) ? (len43 / MAX_LINE_LENGTH) : 0)]; // New lines
int d = 0;
int e = 0;
int len2 = len - 2;
@@ -337,7 +332,7 @@
b64.encode3to4(source, d + off, 3, outBuff, e);
lineLength += 4;
- if (!useURLSafeEncoding && lineLength == MAX_LINE_LENGTH)
+ if (EncodingOption.STANDARD.equals(option) && lineLength == MAX_LINE_LENGTH)
{
outBuff[e + 4] = NEW_LINE;
e++;
@@ -513,12 +508,12 @@
* @param source The Base64 encoded data
* @param off The offset of where to begin decoding
* @param len The length of characters to decode
- * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @param optionThatWasUsed EncodingOption used during the encoding
* @return decoded data
*/
- public static byte[] decode(byte[] source, int off, int len, boolean urlSafeEncodingWasUsed)
+ public static byte[] decode(byte[] source, int off, int len, EncodingOption optionThatWasUsed)
{
- return getBase64(urlSafeEncodingWasUsed).decode(len, off, source);
+ return getBase64(optionThatWasUsed).decode(len, off, source);
} // end decode
/**
@@ -526,9 +521,10 @@
*
* @param s the string to decode
* @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @param optionThatWasUsed EncodingOption used during the encoding
* @return the decoded data
*/
- public static byte[] decode(String s, boolean urlSafeEncodingWasUsed)
+ public static byte[] decode(String s, EncodingOption optionThatWasUsed)
{
byte[] bytes;
try
@@ -541,7 +537,7 @@
} // end catch
// Decode
- bytes = decode(bytes, 0, bytes.length, urlSafeEncodingWasUsed);
+ bytes = decode(bytes, 0, bytes.length, optionThatWasUsed);
return bytes;
} // end decode
@@ -554,7 +550,85 @@
*/
public static byte[] decode(String s)
{
- return decode(s, false);
+ return decode(s, EncodingOption.STANDARD);
} // end decode
+ // Deprecated methods
+
+ /**
+ * Encodes a byte array into Base64 notation using the standard Base64 encoding.
+ *
+ * @deprecated
+ * @param source The data to convert
+ * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
+ * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
+ * your encoding non-compliant.</i>
+ */
+ public static String encodeBytes(byte[] source, boolean useURLSafeEncoding)
+ {
+ if (useURLSafeEncoding)
+ {
+ return encodeBytes(source, EncodingOption.USEURLSAFEENCODING);
+ }
+ else
+ {
+ return encodeBytes(source, EncodingOption.STANDARD);
+ }
+ } // end encodeBytes
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ *
+ * @deprecated
+ * @param source The data to convert
+ * @param off Offset in array where conversion should begin
+ * @param len Length of data to convert
+ * @param useURLSafeEncoding <code>true</code> to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
+ * of '=' for padding to generate a URL-safe encoding. <i>Note: Technically, this makes
+ * your encoding non-compliant.</i>
+ */
+ public static String encodeBytes(byte[] source, int off, int len, boolean useURLSafeEncoding)
+ {
+ return (useURLSafeEncoding) ? encodeBytes(source, off, len, EncodingOption.USEURLSAFEENCODING) : encodeBytes(source, off, len, EncodingOption.STANDARD);
+ }
+
+ /**
+ * Very low-level access to decoding ASCII characters in
+ * the form of a byte array.
+ *
+ * @deprecated
+ * @param source The Base64 encoded data
+ * @param off The offset of where to begin decoding
+ * @param len The length of characters to decode
+ * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @return decoded data
+ */
+ public static byte[] decode(byte[] source, int off, int len, boolean urlSafeEncodingWasUsed)
+ {
+ EncodingOption option = EncodingOption.STANDARD;
+ if (urlSafeEncodingWasUsed)
+ {
+ option = EncodingOption.USEURLSAFEENCODING;
+ }
+ return decode(source, off, len, option);
+ } // end decode
+
+ /**
+ * Decodes data from Base64 notation
+ *
+ * @deprecated
+ * @param s the string to decode
+ * @param urlSafeEncodingWasUsed <code>true</code> if the URL-safe was used to encode the data to be decoded
+ * @return the decoded data
+ */
+ public static byte[] decode(String s, boolean urlSafeEncodingWasUsed)
+ {
+ EncodingOption option = EncodingOption.STANDARD;
+ if (urlSafeEncodingWasUsed)
+ {
+ option = EncodingOption.USEURLSAFEENCODING;
+ }
+ return decode(s, option);
+ } // end decode
+
} // end class Base64
17 years, 7 months
JBoss Portal SVN: r11958 - branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-09-24 04:50:49 -0400 (Wed, 24 Sep 2008)
New Revision: 11958
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
Log:
ant script fix
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 07:54:40 UTC (rev 11957)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-24 08:50:49 UTC (rev 11958)
@@ -120,7 +120,7 @@
<target name="cleanup">
<echo message="Cleaning up..." />
<antcall target="stop-src" />
- <antcall target="delete-portal" />
+<!-- <antcall target="delete-portal" /> -->
</target>
@@ -135,11 +135,12 @@
</junitreport>
</target>
- <target name="selenium-test" depends="init, compile, unpack-portal, run-src">
+ <target name="selenium-test" depends="init, compile, run-src">
<antcall target="copyApps" />
+<!--
<echo message="Starting portal instance : ${portal.instance}" />
<server:start name="${portal.instance}" />
-
+-->
<echo message="Runing TestNG" />
<mkdir dir="test-output" />
<testng classpathref="test.cp" sourcedir="${test.src.dir}" outputdir="test-output"
@@ -155,8 +156,10 @@
<jvmarg value="-ea" />
</testng>
+<!--
<echo message="Stoping portal instance : ${portal.instance}" />
<server:stop name="${portal.instance}" />
+-->
<antcall target="cleanup" />
</target>
17 years, 7 months