Author: chris.laprun(a)jboss.com
Date: 2007-05-06 15:50:29 -0400 (Sun, 06 May 2007)
New Revision: 7202
Added:
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid-type.xml
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
trunk/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-producer_2_6.dtd
Log:
- Updated Producer DTD to reflect the fact that hint and resourceName are optional
- Fixed ProducerConfigurationFactory which should only accept xsd:string property types
for now.
- Added test case.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2007-05-06
17:21:10 UTC (rev 7201)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2007-05-06
19:50:29 UTC (rev 7202)
@@ -131,6 +131,15 @@
catch (Exception expected)
{
}
+
+ try
+ {
+ getProducerConfiguration("invalid-type.xml");
+ fail("Invalid type for property description should fail.");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
}
private ProducerConfiguration getProducerConfiguration(String fileName)
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2007-05-06
17:21:10 UTC (rev 7201)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2007-05-06
19:50:29 UTC (rev 7202)
@@ -23,13 +23,13 @@
package org.jboss.portal.wsrp.producer.config;
-import org.jboss.portal.common.i18n.LocaleFormat;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.producer.config.impl.ProducerConfigurationImpl;
import org.jboss.portal.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.registration.LocalizedString;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
-import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.util.StringPropertyReplacer;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
@@ -156,7 +156,12 @@
else if ("type".equals(localName))
{
value = StringPropertyReplacer.replaceProperties(value);
- desc.setType(new QName(value));
+ if (!"xsd:string".equals(value))
+ {
+ throw new IllegalArgumentException("'" + value + "' is
not a supported type. Currently, only 'xsd:string' is supported.");
+ }
+
+ desc.setType(WSRPConstants.XSD_STRING);
}
}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-producer_2_6.dtd
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-producer_2_6.dtd 2007-05-06
17:21:10 UTC (rev 7201)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/dtd/jboss-wsrp-producer_2_6.dtd 2007-05-06
19:50:29 UTC (rev 7202)
@@ -60,16 +60,16 @@
<registration-property-description>
<name>name1</name>
<type>xsd:string</type>
+ <label xml:lang="en"
resourceName="resource.label1">label1</label>
<hint xml:lang="en"
resourceName="resource.hint1">hint1</hint>
- <label xml:lang="en"
resourceName="resource.label1">label1</label>
</registration-property-description>
-->
-<!ELEMENT registration-property-description ( name, type, hint, label )>
+<!ELEMENT registration-property-description ( name, type, label, hint? )>
<!-- The name of the registration property -->
<!ELEMENT name ( #PCDATA )>
-<!-- The qualified name of the type of the registration property. As of Portal 2.6,
only xml:string is supported. -->
+<!-- The qualified name of the type of the registration property. As of Portal 2.6,
only xsd:string is supported. -->
<!ELEMENT type ( #PCDATA )>
<!-- A description of the registration property and its usage targeted at end users.
-->
@@ -77,11 +77,11 @@
<!-- The language in which the hint is written. -->
<!ATTLIST hint xml:lang CDATA #REQUIRED>
<!-- A resource name identifying the hint in localization bundles (currently
unsupported in Portal 2.6). -->
-<!ATTLIST hint resourceName CDATA #REQUIRED>
+<!ATTLIST hint resourceName CDATA #IMPLIED>
<!-- A short, human readable name for the property, intended for consumer-generated
administration interface. -->
<!ELEMENT label ( #PCDATA )>
<!-- The language in which the label is written. -->
<!ATTLIST label xml:lang CDATA #REQUIRED>
<!-- A resource name identifying the label in localization bundles (currently
unsupported in Portal 2.6). -->
-<!ATTLIST label resourceName CDATA #REQUIRED>
+<!ATTLIST label resourceName CDATA #IMPLIED>
Added:
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid-type.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid-type.xml
(rev 0)
+++
trunk/wsrp/src/resources/tests/test-producer-configuration-lib-jar/invalid-type.xml 2007-05-06
19:50:29 UTC (rev 7202)
@@ -0,0 +1,34 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE producer-configuration PUBLIC "-//JBoss Portal//DTD WSRP Local Producer
Configuration 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-wsrp-producer_2_6.dtd">
+
+<producer-configuration>
+ <registration-configuration>
+ <registration-property-description>
+ <name>name</name>
+ <type>unknown type</type>
+ <label xml:lang="en">label</label>
+ </registration-property-description>
+ </registration-configuration>
+</producer-configuration>