[jboss-svn-commits] JBoss Portal SVN: r5565 - in trunk: common/src/main/org/jboss/portal/common/util wsrp/src/main/org/jboss/portal/test/wsrp/deployment wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer wsrp/src/main/org/jboss/portal/wsrp wsrp/src/main/org/jboss/portal/wsrp/deployment
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 2 17:28:43 EST 2006
Author: chris.laprun at jboss.com
Date: 2006-11-02 17:28:40 -0500 (Thu, 02 Nov 2006)
New Revision: 5565
Modified:
trunk/common/src/main/org/jboss/portal/common/util/Version.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
Log:
- Consumer agent is not hardcoded anymore.
- Updated test case.
- Added creation methods to WSRPTypeFactory.
- Re-activated test cases in build file.
- Minor other improvements.
Modified: trunk/common/src/main/org/jboss/portal/common/util/Version.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Version.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/common/src/main/org/jboss/portal/common/util/Version.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -23,8 +23,8 @@
package org.jboss.portal.common.util;
/**
- * Version class conforming to JBoss Product Version Conventions post 2006-03-01.
- * See http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProductVersioning.
+ * Version class conforming to JBoss Product Version Conventions post 2006-03-01. See
+ * http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProductVersioning.
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision$
@@ -88,41 +88,31 @@
return codeName;
}
- /**
- * Return the name;
- */
+ /** Return the name; */
public String getName()
{
return name;
}
- /**
- * Return the major.
- */
+ /** Return the major. */
public int getMajor()
{
return major;
}
- /**
- * Return the minor.
- */
+ /** Return the minor. */
public int getMinor()
{
return minor;
}
- /**
- * Return the pacht.
- */
+ /** Return the patch. */
public int getPatch()
{
return patch;
}
- /**
- * Return the intermediate major.
- */
+ /** Return the intermediate major. */
public Qualifier getQualifier()
{
return qualifier;
@@ -135,17 +125,16 @@
private String buildToString()
{
- StringBuffer buffer = new StringBuffer("JBoss Portal ");
- buffer.append(getMajor()).append('.');
- buffer.append(getMinor()).append('.');
- buffer.append(getPatch()).append('-');
- buffer.append(getQualifier());
+ StringBuffer buffer = new StringBuffer(getName());
+ buffer.append(" ")
+ .append(getMajor()).append('.')
+ .append(getMinor()).append('.')
+ .append(getPatch()).append('-')
+ .append(getQualifier());
return buffer.toString();
}
- /**
- * Type safe enum for intermediate major.
- */
+ /** Type safe enum for intermediate major. */
public static class Qualifier
{
@@ -169,18 +158,22 @@
this.suffixable = suffixable;
this.description = description;
}
+
public String getName()
{
return name;
}
+
public boolean isSuffixable()
{
return suffixable;
}
+
public String getDescription()
{
return description;
}
+
public String toString()
{
return name;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -20,10 +20,10 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
-
package org.jboss.portal.test.wsrp.deployment;
import junit.framework.TestCase;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.core.Property;
import org.jboss.portal.wsrp.core.RegistrationData;
@@ -105,7 +105,7 @@
RegistrationData registrationData = consumer3.getRegistrationData();
assertNotNull(registrationData);
assertEquals("JBoss Portal 2.4 Test", registrationData.getConsumerName());
- assertEquals("JBoss Portal.2.4", registrationData.getConsumerAgent());
+ assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
Property[] registrationProperties = registrationData.getRegistrationProperties();
assertNotNull(registrationProperties);
assertEquals(2, registrationProperties.length);
@@ -121,9 +121,10 @@
service3 = (WSRPConsumerService)service;
assertEquals("producer2", service3.getId());
consumer3 = service3.getConsumer();
- assertNotNull(consumer3.getRegistrationData());
- assertEquals("JBoss Portal 2.4 Test", registrationData.getConsumerName());
- assertEquals("JBoss Portal.2.4", registrationData.getConsumerAgent());
+ registrationData = consumer3.getRegistrationData();
+ assertNotNull(registrationData);
+ assertNotNull(registrationData.getConsumerName());
+ assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.wsrp.v1.producer;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.test.wsrp.WSRPProducerBaseTest;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -39,7 +40,6 @@
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
-import org.jboss.portal.common.junit.ExtendedAssert;
import javax.xml.namespace.QName;
@@ -145,8 +145,9 @@
protected RegistrationData createBaseRegData()
{
- return new RegistrationData("JBoss", "JBoss Portal 2.4", false, null, null, null, null,
- new Property[]{new Property("regProp", null, "regValue", null)}, null);
+ RegistrationData regData = WSRPTypeFactory.createDefaultRegistrationData();
+ regData.setRegistrationProperties(new Property[]{new Property("regProp", null, "regValue", null)});
+ return regData;
}
protected PropertyDescription initRegistrationInfo()
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConstants.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp;
+import org.jboss.portal.server.PortalConstants;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Random;
@@ -124,29 +126,16 @@
/** Default consumer name if none has been provided in the WSRP descriptor (*-wsrp.xml) */
public static final String DEFAULT_CONSUMER_NAME;
/** The String identifying the portal consumer agent */
- public static final String CONSUMER_AGENT = "JBoss Portal.2.4";
+ public static final String CONSUMER_AGENT = PortalConstants.VERSION.getName() + "."
+ + PortalConstants.VERSION.getMajor() + "." + PortalConstants.VERSION.getMinor() + "."
+ + PortalConstants.VERSION.getQualifier();
- // User scopes
-
- /**
- * The markup is specific to the userContext for which it was generated. Changes to the data of the UserContext MUST
- * invalidate the cached markup.
- */
- public static final String CACHE_PER_USER = "wsrp:perUser";
-
- /** The markup is not specific to the UserContext and therefore may be supplied to all users of the Consumer. */
- public static final String CACHE_FOR_ALL = "wsrp:forAll";
-
- /** The value of SessionContext.expires if the session will never expire. */
- public static final int SESSION_NEVER_EXPIRES = -1;
-
static
{
InetAddress localhost = null;
try
{
- localhost = InetAddress.getByAddress(InetAddress.getLocalHost().getAddress());
-
+ localhost = InetAddress.getLocalHost();
}
catch (UnknownHostException e)
{
@@ -159,11 +148,25 @@
else
{
Random random = new Random(System.currentTimeMillis());
- DEFAULT_CONSUMER_NAME = "JBoss Portal Unconfigured " + random.nextInt();
+ DEFAULT_CONSUMER_NAME = CONSUMER_AGENT + " Unconfigured " + random.nextInt();
}
}
+ // User scopes
+ /**
+ * The markup is specific to the userContext for which it was generated. Changes to the data of the UserContext MUST
+ * invalidate the cached markup.
+ */
+ public static final String CACHE_PER_USER = "wsrp:perUser";
+
+ /** The markup is not specific to the UserContext and therefore may be supplied to all users of the Consumer. */
+ public static final String CACHE_FOR_ALL = "wsrp:forAll";
+
+ /** The value of SessionContext.expires if the session will never expire. */
+ public static final int SESSION_NEVER_EXPIRES = -1;
+
+
private WSRPConstants()
{
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -71,7 +71,6 @@
public class WSRPTypeFactory
{
/** ====== WSRP request objects ====== **/
-
/**
* registrationContext(RegistrationContext)?, desiredLocales(xsd:string)*
*
@@ -168,7 +167,7 @@
* @param registrationContext
* @param portletHandle
* @return
- * @since 2.6
+ * @since 2.4.1
*/
public static GetPortletProperties createGetPortletProperties(RegistrationContext registrationContext, String portletHandle)
{
@@ -470,26 +469,35 @@
*
* @param consumerName A name (preferably unique) that identifies the Consumer [R355] An example of such a name
* would be the Consumer's URL.
- * @param consumerAgent Name and version of the Consumer's vendor [R356]. The consumerAgent value MUST start
- * with "productName.majorVersion.minorVersion" where "productName" identifies the product
- * the Consumer installed for its deployment, and majorVersion and minorVersion are
- * vendor-defined indications of the version of its product. This string can then contain
- * any additional characters/words the product or Consumer wish to supply.
* @param methodGetSupported A flag that tells the Producer whether the Consumer has implemented portlet URLs
* (regardless of whether they are written through Consumer URL rewriting or Producer URL
* writing, see [Section 10.2]) in a manner that supports HTML markup containing forms with
* method="get".
* @return
*/
- public static RegistrationData createRegistrationData(String consumerName, String consumerAgent, boolean methodGetSupported)
+ public static RegistrationData createRegistrationData(String consumerName, boolean methodGetSupported)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "consumer name", "RegistrationData");
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent, "consumer agent", "RegistrationData");
- // todo: check consumerAgent format...
- return new RegistrationData(consumerName, consumerAgent, methodGetSupported, null, null, null, null, null, null);
+ RegistrationData regData = createDefaultRegistrationData();
+ regData.setConsumerName(consumerName);
+ regData.setMethodGetSupported(methodGetSupported);
+ return regData;
}
/**
+ * Same as createRegistrationData({@link WSRPConstants#DEFAULT_CONSUMER_NAME}, false) using {@link
+ * WSRPConstants#CONSUMER_AGENT} for the consumer agent.
+ *
+ * @return
+ * @since 2.4.1
+ */
+ public static RegistrationData createDefaultRegistrationData()
+ {
+ return new RegistrationData(WSRPConstants.DEFAULT_CONSUMER_NAME, WSRPConstants.CONSUMER_AGENT, false, null, null,
+ null, null, null, null);
+ }
+
+ /**
* ( stringValue(xsd:string) | any* ), @name(xsd:string), @xml:lang
*
* @return
@@ -613,6 +621,7 @@
*
* @param registrationHandle
* @return
+ * @since 2.4.1
*/
public static RegistrationContext createRegistrationContext(String registrationHandle)
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-02 22:25:39 UTC (rev 5564)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-02 22:28:40 UTC (rev 5565)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.wsrp.deployment;
-import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.consumer.WSRPConsumerImpl;
import org.jboss.portal.wsrp.core.Property;
@@ -114,8 +113,7 @@
}
else if ("registration-data".equals(localName))
{
- registrationData = WSRPTypeFactory.createRegistrationData(WSRPConstants.DEFAULT_CONSUMER_NAME,
- WSRPConstants.CONSUMER_AGENT, false);
+ registrationData = WSRPTypeFactory.createDefaultRegistrationData();
}
if (serviceFactory != null)
More information about the jboss-svn-commits
mailing list