You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by kn...@apache.org on 2004/09/12 21:55:12 UTC
cvs commit: jakarta-hivemind/src/documentation/content/xdocs descriptor.xml
knut 2004/09/12 12:55:12
Modified: framework/src/test/hivemind/test/parse
TestDescriptorParser.java
framework/src/test/hivemind/test FrameworkTestCase.java
framework/src/java/org/apache/hivemind/parse
ParseStrings.properties ParseMessages.java
DescriptorParser.java
src/documentation/content/xdocs descriptor.xml
Added: framework/src/test/hivemind/test/parse
DuplicateParametersSchema.xml
Log:
added check (and error message) for <service-point>s specifying both the parameters-schema-id and a nested <parameters-schema>. the latter takes precendence.
Revision Changes Path
1.21 +18 -0 jakarta-hivemind/framework/src/test/hivemind/test/parse/TestDescriptorParser.java
Index: TestDescriptorParser.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/parse/TestDescriptorParser.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TestDescriptorParser.java 12 Sep 2004 18:30:56 -0000 1.20
+++ TestDescriptorParser.java 12 Sep 2004 19:55:11 -0000 1.21
@@ -306,6 +306,24 @@
assertEquals("myParameter", em.getElementName());
}
+ public void testDuplicateParametersSchema() throws Exception
+ {
+ interceptLogging();
+
+ ModuleDescriptor md = parse("DuplicateParametersSchema.xml");
+
+ assertLoggedMessagePattern("Multiple parameters schemas specified for service MyServiceFactory. Using locally defined schema \\(at ");
+
+ ServicePointDescriptor spd = (ServicePointDescriptor) md.getServicePoints().get(0);
+ Schema nestedSchema = spd.getParametersSchema();
+
+ assertNotNull(nestedSchema);
+
+ ElementModel em = (ElementModel) nestedSchema.getElementModel().get(0);
+
+ assertEquals("myParameter", em.getElementName());
+ }
+
public void testDependency() throws Exception
{
ModuleDescriptor md = parse("GenericModule.xml");
1.1 jakarta-hivemind/framework/src/test/hivemind/test/parse/DuplicateParametersSchema.xml
Index: DuplicateParametersSchema.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<module id="hivemind.test.parse" version="1.0.0">
<schema id="Parameters">
<element name="aParameter"/>
</schema>
<service-point id="MyServiceFactory"
interface="org.apache.hivemind.ServiceImplementationFactory"
parameters-schema-id="Parameters">
<parameters-schema>
<element name="myParameter"/>
</parameters-schema>
</service-point>
</module>
1.12 +3 -2 jakarta-hivemind/framework/src/test/hivemind/test/FrameworkTestCase.java
Index: FrameworkTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/FrameworkTestCase.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FrameworkTestCase.java 12 Sep 2004 18:30:55 -0000 1.11
+++ FrameworkTestCase.java 12 Sep 2004 19:55:11 -0000 1.12
@@ -24,6 +24,7 @@
import org.apache.hivemind.parse.DescriptorParser;
import org.apache.hivemind.parse.ModuleDescriptor;
import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.util.FileResource;
/**
* Base class for framework tests.
@@ -71,7 +72,7 @@
result.setModuleId(moduleId);
result.setVersion(version);
- result.setLocation(new LocationImpl(null));
+ result.setLocation(new LocationImpl(new FileResource(null)));
return result;
}
@@ -85,7 +86,7 @@
result.setModuleId(moduleId);
result.setVersion(version);
- result.setLocation(new LocationImpl(null));
+ result.setLocation(new LocationImpl(new FileResource(null)));
return result;
}
1.8 +1 -0 jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseStrings.properties
Index: ParseStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseStrings.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ParseStrings.properties 6 Sep 2004 09:19:47 -0000 1.7
+++ ParseStrings.properties 12 Sep 2004 19:55:11 -0000 1.8
@@ -16,6 +16,7 @@
dupe-attribute-mapping=Mapping for attribute {0} conflicts with a previous mapping (at {1}) and has been ignored.
extra-mappings=Mappings for unknown attribute(s) {0} (for element {1}) have been ignored.
unable-to-resolve-schema=Unable to resolve reference to schema ''{0}''.
+multiple-parameters-schemas=Multiple parameters schemas specified for service {0}. Using locally defined schema (at {1}).
not-module=Document element should be module not {0} (at {1}).
required-attribute=Missing required attribute ''{0}'' in element {1} (at {2}).
unknown-attribute=Unknown attribute ''{0}'' in element {1}.
1.10 +5 -0 jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseMessages.java
Index: ParseMessages.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ParseMessages.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ParseMessages.java 6 Sep 2004 09:19:47 -0000 1.9
+++ ParseMessages.java 12 Sep 2004 19:55:11 -0000 1.10
@@ -51,6 +51,11 @@
return _formatter.format("unable-to-resolve-schema", schemaId);
}
+ public static String multipleParametersSchemas(String serviceId, Location location)
+ {
+ return _formatter.format("multiple-parameters-schemas", serviceId, location);
+ }
+
public static String notModule(String elementName, Location location)
{
return _formatter.format("not-module", elementName, location);
1.34 +12 -2 jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
Index: DescriptorParser.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- DescriptorParser.java 9 Sep 2004 16:06:45 -0000 1.33
+++ DescriptorParser.java 12 Sep 2004 19:55:11 -0000 1.34
@@ -892,9 +892,19 @@
push(elementName, schema, STATE_SCHEMA);
- spd.setParametersSchema(schema);
-
checkAttributes();
+
+ if (spd.getParametersSchema() != null)
+ {
+ spd.setParametersSchema(schema);
+ _errorHandler.error(
+ LOG,
+ ParseMessages.multipleParametersSchemas(spd.getId(), schema.getLocation()),
+ schema.getLocation(),
+ null);
+ }
+ else
+ spd.setParametersSchema(schema);
}
private void enterImplementation(String elementName)
1.12 +2 -0 jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml
Index: descriptor.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- descriptor.xml 9 Sep 2004 16:06:46 -0000 1.11
+++ descriptor.xml 12 Sep 2004 19:55:12 -0000 1.12
@@ -457,6 +457,8 @@
<p>The &_parameters-schema; element is identical to the &schema; element, but only appears
inside &service-point;, to define the schema for the parameters for a service implementation factory or service interceptor factory.
</p>
+ <note>This element and the owning &service-point; element's <code>parameters-schema-id</code>
+ attribute are mutually exclusive.</note>
</section>
<section>
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org