You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by je...@apache.org on 2002/11/24 13:15:27 UTC
cvs commit: jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data QDoxComponent1-info.xml QDoxLegacyComponent1-info.xml component1-info.xml component3-info.xml
jefft 2002/11/24 04:15:27
Modified: info/src/java/org/apache/avalon/framework/info
ComponentInfo.java SchemaDescriptor.java
info/src/java/org/apache/avalon/framework/tools/infobuilder
LegacyBlockInfoReader.java XMLInfoReader.java
XMLInfoWriter.java componentinfo.dtd
info/src/java/org/apache/avalon/framework/tools/qdox
DefaultInfoBuilder.java LegacyInfoBuilder.java
info/src/java/org/apache/avalon/framework/tools/verifier
InfoVerifier.java
info/src/test/org/apache/avalon/framework/tools/infobuilder/test
InfoAssert.java InfoBuilderTestCase.java
info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data
QDoxComponent1-info.xml
QDoxLegacyComponent1-info.xml component1-info.xml
component3-info.xml
Log:
"Cleaned up schema stuff so that the schemas for parameters and configuration
are in different variables." -- Peter Donald
Revision Changes Path
1.8 +27 -14 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentInfo.java
Index: ComponentInfo.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/ComponentInfo.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ComponentInfo.java 16 Nov 2002 04:34:50 -0000 1.7
+++ ComponentInfo.java 24 Nov 2002 12:15:26 -0000 1.8
@@ -49,9 +49,14 @@
private final ContextDescriptor m_context;
/**
- * Descriptor for the schema of components configuration/parameters.
+ * Descriptor for the schema of components parameters.
*/
- private final SchemaDescriptor m_schema;
+ private final SchemaDescriptor m_configurationSchema;
+
+ /**
+ * Descriptor for the schema of components parameters.
+ */
+ private final SchemaDescriptor m_parametersSchema;
/**
* Descriptor for the service dependencies of component.
@@ -65,8 +70,9 @@
final ServiceDescriptor[] services,
final LoggerDescriptor[] loggers,
final ContextDescriptor context,
- final DependencyDescriptor[] dependencies, final SchemaDescriptor schema
- )
+ final DependencyDescriptor[] dependencies,
+ final SchemaDescriptor configurationSchema,
+ final SchemaDescriptor parametersSchema )
{
if( null == descriptor )
{
@@ -84,10 +90,6 @@
{
throw new NullPointerException( "context" );
}
- if( null == schema )
- {
- throw new NullPointerException( "schema" );
- }
if( null == dependencies )
{
throw new NullPointerException( "dependencies" );
@@ -96,8 +98,9 @@
m_services = services;
m_loggers = loggers;
m_context = context;
- m_schema = schema;
m_dependencies = dependencies;
+ m_configurationSchema = configurationSchema;
+ m_parametersSchema = parametersSchema;
}
/**
@@ -142,13 +145,23 @@
}
/**
- * Return the schema for the configuration/parameters.
+ * Return the schema for the configuration.
+ *
+ * @return the schema for the configuration.
+ */
+ public SchemaDescriptor getConfigurationSchema()
+ {
+ return m_configurationSchema;
+ }
+
+ /**
+ * Return the schema for the parameters.
*
- * @return the schema for the configuration/parameters.
+ * @return the schema for the parameters.
*/
- public SchemaDescriptor getSchema()
+ public SchemaDescriptor getParametersSchema()
{
- return m_schema;
+ return m_parametersSchema;
}
/**
1.3 +2 -36 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/SchemaDescriptor.java
Index: SchemaDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/info/SchemaDescriptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SchemaDescriptor.java 15 Nov 2002 22:19:51 -0000 1.2
+++ SchemaDescriptor.java 24 Nov 2002 12:15:26 -0000 1.3
@@ -28,13 +28,6 @@
extends FeatureDescriptor
{
/**
- * The category of input data that this descriptor is for.
- * Currently must be one of eeither "parameters" or
- * "configuration".
- */
- private final String m_category;
-
- /**
* The location of schema relative to component.
*/
private final String m_location;
@@ -47,21 +40,15 @@
/**
* Create a Schema descriptor.
*
- * @param category the category of the schema.
* @param location the location of schema relative to component
* @param type the type of the schema
* @param attributes the attributes associated with schema
*/
- public SchemaDescriptor( final String category,
- final String location,
+ public SchemaDescriptor( final String location,
final String type,
final Attribute[] attributes )
{
super( attributes );
- if( null == category )
- {
- throw new NullPointerException( "category" );
- }
if( null == location )
{
throw new NullPointerException( "location" );
@@ -71,29 +58,8 @@
throw new NullPointerException( "type" );
}
- if( !"parameters".equals( category ) &&
- !"configuration".equals( category ) &&
- !"".equals( category ) )
- {
- final String message = "category = " + category + ". Should be" +
- "parameters or configuration or empty";
- throw new IllegalArgumentException( message );
- }
-
- m_category = category;
m_location = location;
m_type = type;
- }
-
- /**
- * Return the category of the schema. ie What it is used for.
- * Usually one of "configuration" or "parameters".
- *
- * @return the category of the schema
- */
- public String getCategory()
- {
- return m_category;
}
/**
1.6 +12 -10 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoReader.java
Index: LegacyBlockInfoReader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/LegacyBlockInfoReader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LegacyBlockInfoReader.java 16 Nov 2002 04:34:50 -0000 1.5
+++ LegacyBlockInfoReader.java 24 Nov 2002 12:15:26 -0000 1.6
@@ -115,14 +115,13 @@
}
configuration = info.getChild( "block" );
- final SchemaDescriptor schema = buildSchema( configuration );
+ final SchemaDescriptor schema = buildConfigurationSchema( configuration );
return new ComponentInfo( descriptor,
services,
new LoggerDescriptor[ 0 ],
buildPhoenixContext(),
- dependencies, schema
- );
+ dependencies, schema, null );
}
/**
@@ -130,18 +129,21 @@
*
* @return the a descriptor for the SchemaDescriptor,
*/
- private SchemaDescriptor buildSchema( Configuration configuration )
+ private SchemaDescriptor buildConfigurationSchema( Configuration configuration )
{
- String category = "";
- String schemaType =
+ final String schemaType =
configuration.getChild( "schema-type" ).getValue( "" );
- if( !"".equals( schemaType ) )
+ if( "".equals( schemaType ) )
+ {
+ return null;
+ }
+ else
{
//TODO: Map phoenix type to uri space when figured out
- category = "configuration";
+ return new SchemaDescriptor( "",
+ schemaType, new Attribute[ 0 ] );
}
- return new SchemaDescriptor( category, "", schemaType, new Attribute[ 0 ] );
}
/**
1.5 +14 -7 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoReader.java
Index: XMLInfoReader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoReader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLInfoReader.java 16 Nov 2002 04:34:50 -0000 1.4
+++ XMLInfoReader.java 24 Nov 2002 12:15:26 -0000 1.5
@@ -109,9 +109,12 @@
final DependencyDescriptor[] dependencies =
buildDependencies( implementationKey, configuration );
- configuration = info.getChild( "schema" );
- final SchemaDescriptor schema = buildSchema( configuration );
+ configuration = info.getChild( "configuration-schema", false );
+ final SchemaDescriptor configurationSchema = buildSchema( configuration );
+ configuration = info.getChild( "parameters-schema", false );
+ final SchemaDescriptor parametersSchema = buildSchema( configuration );
+
if( getLogger().isDebugEnabled() )
{
final String message =
@@ -124,8 +127,9 @@
getLogger().debug( message );
}
- return new ComponentInfo( descriptor, services, loggers,
- context, dependencies, schema );
+ return new ComponentInfo( descriptor, services,
+ loggers, context, dependencies,
+ configurationSchema, parametersSchema );
}
/**
@@ -139,11 +143,14 @@
private SchemaDescriptor buildSchema( final Configuration configuration )
throws ConfigurationException
{
- final String category = configuration.getAttribute( "category", "" );
+ if( null == configuration )
+ {
+ return null;
+ }
final String location = configuration.getAttribute( "location", "" );
final String type = configuration.getAttribute( "type", "" );
final Attribute[] attributes = buildAttributes( configuration );
- return new SchemaDescriptor( category, location, type, attributes );
+ return new SchemaDescriptor( location, type, attributes );
}
/**
1.8 +23 -18 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoWriter.java
Index: XMLInfoWriter.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/XMLInfoWriter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLInfoWriter.java 16 Nov 2002 08:00:07 -0000 1.7
+++ XMLInfoWriter.java 24 Nov 2002 12:15:26 -0000 1.8
@@ -52,7 +52,8 @@
writeContext( writer, info.getContext() );
writeServices( writer, info.getServices() );
writeDependencies( writer, info.getDependencies() );
- writeSchema( writer, info.getSchema() );
+ writeSchema( writer, "configuration", info.getConfigurationSchema() );
+ writeSchema( writer, "parameters", info.getParametersSchema() );
writer.write( "</component-info>" );
writer.flush();
}
@@ -65,27 +66,31 @@
* @throws IOException if unable to write xml
*/
private void writeSchema( final Writer writer,
+ final String category,
final SchemaDescriptor schema )
throws IOException
{
- if( !"".equals( schema.getCategory() ) )
+ if( null == schema )
{
- writer.write( "<schema category=\"" );
- writer.write( schema.getCategory() );
- final String location = schema.getLocation();
- if( !"".equals( location ) )
- {
- writer.write( "\" location=\"" );
- writer.write( location );
- }
- final String type = schema.getType();
- if( !"".equals( type ) )
- {
- writer.write( "\" type=\"" );
- writer.write( type );
- }
- writer.write( "\"/>" );
+ return;
}
+
+ writer.write( "<" + category + "-schema" );
+ final String location = schema.getLocation();
+ if( !"".equals( location ) )
+ {
+ writer.write( " location=\"" );
+ writer.write( location );
+ writer.write( "\"" );
+ }
+ final String type = schema.getType();
+ if( !"".equals( type ) )
+ {
+ writer.write( " type=\"" );
+ writer.write( type );
+ writer.write( "\"" );
+ }
+ writer.write( "/>" );
}
private void writeHeader( final Writer writer )
1.18 +14 -8 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/componentinfo.dtd
Index: componentinfo.dtd
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/componentinfo.dtd,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- componentinfo.dtd 15 Nov 2002 22:20:26 -0000 1.17
+++ componentinfo.dtd 24 Nov 2002 12:15:26 -0000 1.18
@@ -29,7 +29,7 @@
schema the configuration/parameters schema that this component
validates against
-->
-<!ELEMENT component-info (component, loggers?, context?, services?, dependencies?, schema?)>
+<!ELEMENT component-info (component, loggers?, context?, services?, dependencies?, configuration-schema?, parameters-schema?)>
<!ATTLIST component-info id ID #IMPLIED
xmlns CDATA #FIXED "http://jakarta.apache.org/avalon/dtds/info/componentinfo_1_0.dtd">
@@ -52,16 +52,22 @@
<!ATTLIST component type CDATA #REQUIRED >
<!--
-The schema element defines the schema for the component, it defines:
+The schema element defines the configuration schema for the component, it defines:
-category either "configuration" or "parameters" depending on what
- the schema is being used to validate against.
location the location of the schema relative the the component
-->
-<!ELEMENT schema (attribute*)>
- <!ATTLIST schema category CDATA #REQUIRED >
- <!ATTLIST schema location CDATA #IMPLIED >
- <!ATTLIST schema type CDATA #IMPLIED >
+<!ELEMENT configuration-schema (attribute*)>
+ <!ATTLIST configuration-schema location CDATA #IMPLIED >
+ <!ATTLIST configuration-schema type CDATA #IMPLIED >
+
+<!--
+The schema element defines the parameters schema for the component, it defines:
+
+location the location of the schema relative the the component
+-->
+<!ELEMENT parameters-schema (attribute*)>
+ <!ATTLIST parameters-schema location CDATA #IMPLIED >
+ <!ATTLIST parameters-schema type CDATA #IMPLIED >
<!--
The logger element defines the loggers that are available to component.
1.3 +42 -22 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/qdox/DefaultInfoBuilder.java
Index: DefaultInfoBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/qdox/DefaultInfoBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultInfoBuilder.java 16 Nov 2002 07:46:41 -0000 1.2
+++ DefaultInfoBuilder.java 24 Nov 2002 12:15:26 -0000 1.3
@@ -31,8 +31,6 @@
public class DefaultInfoBuilder
extends AbstractInfoBuilder
{
- private static final SchemaDescriptor NULL_SCHEMA_DESCRIPTOR = new SchemaDescriptor( "", "", "", EMPTY_ATTRIBUTES );
-
/**
* Build a ComponentInfo object for specified class.
*
@@ -45,10 +43,15 @@
final ServiceDescriptor[] services = buildServices( javaClass );
final ContextDescriptor context = buildContext( javaClass );
final LoggerDescriptor[] loggers = buildLoggers( javaClass );
- final SchemaDescriptor schema = buildSchema( javaClass );
+ final SchemaDescriptor configurationSchema = buildConfigurationSchema( javaClass );
+ final SchemaDescriptor parametersSchema = buildParametersSchema( javaClass );
+
final DependencyDescriptor[] dependencies = buildDependencies( javaClass );
- return new ComponentInfo( component, services, loggers, context, dependencies, schema );
+ return new ComponentInfo( component, services, loggers,
+ context, dependencies,
+ configurationSchema,
+ parametersSchema );
}
/**
@@ -160,43 +163,60 @@
}
/**
- * Build the schema descriptor for specified class.
+ * Build the configuration schema descriptor for specified class.
*
* @param javaClass the class
* @return the schema descriptor
*/
- private SchemaDescriptor buildSchema( final JavaClass javaClass )
+ private SchemaDescriptor buildConfigurationSchema( final JavaClass javaClass )
{
- String category = "configuration";
- JavaMethod method =
+ final JavaMethod method =
getLifecycleMethod( javaClass, "configure", CONFIGURATION_CLASS );
- DocletTag tag = null;
- if( null != method )
+ if( null == method )
{
- tag = method.getTagByName( "avalon.configuration" );
+ return null;
+ }
+
+ final DocletTag tag = method.getTagByName( "avalon.configuration" );
+ if( null == tag )
+ {
+ return null;
}
else
{
- method =
- getLifecycleMethod( javaClass, "parameterize", PARAMETERS_CLASS );
- category = "parameters";
- if( null == method )
- {
- return NULL_SCHEMA_DESCRIPTOR;
- }
- tag = method.getTagByName( "avalon.parameters" );
+ final String location = getNamedParameter( tag, "location", "" );
+ final String type = getNamedParameter( tag, "type", "" );
+
+ return new SchemaDescriptor( location, type, EMPTY_ATTRIBUTES );
+ }
+ }
+
+ /**
+ * Build the parameters schema descriptor for specified class.
+ *
+ * @param javaClass the class
+ * @return the schema descriptor
+ */
+ private SchemaDescriptor buildParametersSchema( final JavaClass javaClass )
+ {
+ final JavaMethod method =
+ getLifecycleMethod( javaClass, "parameterize", PARAMETERS_CLASS );
+ if( null == method )
+ {
+ return null;
}
+ final DocletTag tag = method.getTagByName( "avalon.parameters" );
if( null == tag )
{
- return NULL_SCHEMA_DESCRIPTOR;
+ return null;
}
else
{
final String location = getNamedParameter( tag, "location", "" );
final String type = getNamedParameter( tag, "type", "" );
- return new SchemaDescriptor( category, location, type, EMPTY_ATTRIBUTES );
+ return new SchemaDescriptor( location, type, EMPTY_ATTRIBUTES );
}
}
1.2 +16 -15 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/qdox/LegacyInfoBuilder.java
Index: LegacyInfoBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/qdox/LegacyInfoBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LegacyInfoBuilder.java 16 Nov 2002 05:49:49 -0000 1.1
+++ LegacyInfoBuilder.java 24 Nov 2002 12:15:26 -0000 1.2
@@ -44,10 +44,10 @@
final ServiceDescriptor[] services = buildServices( javaClass );
final ContextDescriptor context = buildPhoenixContext();
final LoggerDescriptor[] loggers = new LoggerDescriptor[ 0 ];
- final SchemaDescriptor schema = buildSchema( javaClass );
+ final SchemaDescriptor schema = buildConfigurationSchema( javaClass );
final DependencyDescriptor[] dependencies = buildDependencies( javaClass );
- return new ComponentInfo( component, services, loggers, context, dependencies, schema );
+ return new ComponentInfo( component, services, loggers, context, dependencies, schema, null );
}
/**
@@ -100,24 +100,25 @@
* @param javaClass the class
* @return the schema descriptor
*/
- private SchemaDescriptor buildSchema( final JavaClass javaClass )
+ private SchemaDescriptor buildConfigurationSchema( final JavaClass javaClass )
{
final JavaMethod method =
getLifecycleMethod( javaClass, "configure", CONFIGURATION_CLASS );
- if( null != method )
+ if( null == method )
{
- final DocletTag tag =
- method.getTagByName( "phoenix:configuration-schema" );
- if( null != tag )
- {
- final String type = getNamedParameter( tag, "type", "" );
- //TODO: Translate type into a uri type string
- return new SchemaDescriptor( "configuration",
- "", type, EMPTY_ATTRIBUTES );
- }
+ return null;
}
- return new SchemaDescriptor( "", "", "", new Attribute[ 0 ] );
+ final DocletTag tag =
+ method.getTagByName( "phoenix:configuration-schema" );
+ if( null == tag )
+ {
+ return null;
+ }
+ final String type = getNamedParameter( tag, "type", "" );
+ //TODO: Translate type into a uri type string
+ return new SchemaDescriptor(
+ "", type, EMPTY_ATTRIBUTES );
}
/**
1.5 +34 -13 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/InfoVerifier.java
Index: InfoVerifier.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/InfoVerifier.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InfoVerifier.java 16 Nov 2002 08:53:37 -0000 1.4
+++ InfoVerifier.java 24 Nov 2002 12:15:26 -0000 1.5
@@ -124,32 +124,31 @@
verifyDependencyPresence( name, implementationKey, info, implementation );
verifyContextPresence( name, implementationKey, info, implementation );
- verifySchemaPresence( name, implementationKey, info, implementation );
+ verifyConfigurationSchemaPresence( name, implementationKey, info, implementation );
+ verifyParametersSchemaPresence( name, implementationKey, info, implementation );
}
/**
* Verify that the if the component is not
- * Configurable/Parameterizable that it does not declare schema
- * of that type.
+ * Configurable that it does not declare configuraiton schema.
*
* @param name the name of component
* @param implementationKey the implementationKey of component
* @param implementation the class implementing component
* @throws VerifyException if fails verification check
*/
- protected void verifySchemaPresence( final String name,
- final String implementationKey,
- final ComponentInfo info,
- final Class implementation )
+ protected void verifyConfigurationSchemaPresence( final String name,
+ final String implementationKey,
+ final ComponentInfo info,
+ final Class implementation )
throws VerifyException
{
- final SchemaDescriptor schema = info.getSchema();
- final String category = schema.getCategory();
- if( "".equals( category ) )
+ final SchemaDescriptor schema = info.getConfigurationSchema();
+ if( null == schema )
{
return;
}
- else if( "configuration".equals( category ) )
+ else
{
if( !Configurable.class.isAssignableFrom( implementation ) )
{
@@ -160,7 +159,29 @@
throw new VerifyException( message );
}
}
- else if( "parameters".equals( category ) )
+ }
+
+ /**
+ * Verify that the if the component is not
+ * Parameterizable that it does not declare parameters schema.
+ *
+ * @param name the name of component
+ * @param implementationKey the implementationKey of component
+ * @param implementation the class implementing component
+ * @throws VerifyException if fails verification check
+ */
+ protected void verifyParametersSchemaPresence( final String name,
+ final String implementationKey,
+ final ComponentInfo info,
+ final Class implementation )
+ throws VerifyException
+ {
+ final SchemaDescriptor schema = info.getParametersSchema();
+ if( null == schema )
+ {
+ return;
+ }
+ else
{
if( !Parameterizable.class.isAssignableFrom( implementation ) )
{
1.7 +25 -7 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoAssert.java
Index: InfoAssert.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoAssert.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InfoAssert.java 16 Nov 2002 07:53:01 -0000 1.6
+++ InfoAssert.java 24 Nov 2002 12:15:26 -0000 1.7
@@ -60,9 +60,13 @@
final LoggerDescriptor[] actualLoggers = actual.getLoggers();
assertEqualLoggers( message, expectedLoggers, actualLoggers );
- final SchemaDescriptor expectedSchema = expected.getSchema();
- final SchemaDescriptor actualSchema = actual.getSchema();
- assertEqualSchema( message, expectedSchema, actualSchema );
+ final SchemaDescriptor expectedSchema = expected.getConfigurationSchema();
+ final SchemaDescriptor actualSchema = actual.getConfigurationSchema();
+ assertEqualSchema( message + "/Configuration", expectedSchema, actualSchema );
+
+ final SchemaDescriptor expectedPSchema = expected.getParametersSchema();
+ final SchemaDescriptor actualPSchema = actual.getParametersSchema();
+ assertEqualSchema( message + "/Parameters", expectedPSchema, actualPSchema );
final ContextDescriptor expectedContext = expected.getContext();
final ContextDescriptor actualContext = actual.getContext();
@@ -81,12 +85,26 @@
final SchemaDescriptor expected,
final SchemaDescriptor actual )
{
+ if( null == expected && null == actual )
+ {
+ return;
+ }
+ else if( null == expected )
+ {
+ Assert.fail( "Null expected but non-null actual" );
+ }
+ else if( null == actual )
+ {
+ Assert.fail( "Null actual but non-null expected" );
+ }
+
+ Assert.assertEquals( message + ": Schema.type",
+ expected.getType(),
+ actual.getType() );
+
Assert.assertEquals( message + ": Schema.type",
expected.getType(),
actual.getType() );
- Assert.assertEquals( message + ": Schema.category",
- expected.getCategory(),
- actual.getCategory() );
Assert.assertEquals( message + ": Schema.location",
expected.getLocation(),
actual.getLocation() );
1.17 +39 -4 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoBuilderTestCase.java
Index: InfoBuilderTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoBuilderTestCase.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- InfoBuilderTestCase.java 16 Nov 2002 07:04:31 -0000 1.16
+++ InfoBuilderTestCase.java 24 Nov 2002 12:15:26 -0000 1.17
@@ -56,6 +56,7 @@
private static final String COMPONENT1 = BASE_PACKAGE + "component1";
private static final String COMPONENT2 = BASE_PACKAGE + "component2";
private static final String COMPONENT3 = BASE_PACKAGE + "component3";
+ private static final String COMPONENT4 = BASE_PACKAGE + "component4";
private static final String SOURCE1 = BASE_DIR + "QDoxComponent1.java";
private static final String SOURCE1_INFO = BASE_PACKAGE + "QDoxComponent1";
@@ -90,6 +91,41 @@
actual );
}
+ public void testLoadParametersComponent()
+ throws Exception
+ {
+ final ComponentInfo actual = loadComponentInfo( COMPONENT4 );
+ final ComponentInfo expected = createComponentInfoWithParameters();
+
+ InfoAssert.assertEqualStructure( COMPONENT4 + " should be identical to " + COMPONENT4,
+ expected,
+ actual );
+ }
+
+ private ComponentInfo createComponentInfoWithParameters()
+ {
+ final ComponentDescriptor component =
+ new ComponentDescriptor( "org.realityforge.Component1", InfoAssert.EMPTY_ATTRIBUTES );
+
+ final ContextDescriptor context =
+ new ContextDescriptor( "org.apache.avalon.framework.context.Context",
+ new EntryDescriptor[ 0 ],
+ InfoAssert.EMPTY_ATTRIBUTES );
+
+ final SchemaDescriptor schema =
+ new SchemaDescriptor( "",
+ "",
+ InfoAssert.EMPTY_ATTRIBUTES );
+
+ return new ComponentInfo( component,
+ new ServiceDescriptor[0],
+ new LoggerDescriptor[ 0 ],
+ context,
+ new DependencyDescriptor[0],
+ null,
+ schema );
+ }
+
public void testWriteSerComponent1()
throws Exception
{
@@ -210,13 +246,12 @@
new DependencyDescriptor[]{dependency1, dependency2};
final SchemaDescriptor schema =
- new SchemaDescriptor( "configuration",
- "",
+ new SchemaDescriptor( "",
"http://relaxng.org/ns/structure/1.0",
InfoAssert.EMPTY_ATTRIBUTES );
return new ComponentInfo( component, services, loggers,
- context, deps, schema );
+ context, deps, schema, null );
}
private ServiceDescriptor createServiceDescriptor()
1.4 +1 -1 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/QDoxComponent1-info.xml
Index: QDoxComponent1-info.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/QDoxComponent1-info.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- QDoxComponent1-info.xml 16 Nov 2002 05:47:57 -0000 1.3
+++ QDoxComponent1-info.xml 24 Nov 2002 12:15:27 -0000 1.4
@@ -29,6 +29,6 @@
<dependency type="org.apache.avalon.framework.tools.infobuilder.test.data.otherpkg.Service2" optional="true"/>
</dependencies>
- <schema category="configuration" type="http://relaxng.org/ns/structure/1.0"/>
+ <configuration-schema type="http://relaxng.org/ns/structure/1.0"/>
</component-info>
1.2 +1 -1 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/QDoxLegacyComponent1-info.xml
Index: QDoxLegacyComponent1-info.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/QDoxLegacyComponent1-info.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QDoxLegacyComponent1-info.xml 16 Nov 2002 05:49:49 -0000 1.1
+++ QDoxLegacyComponent1-info.xml 24 Nov 2002 12:15:27 -0000 1.2
@@ -20,6 +20,6 @@
<dependency type="org.apache.avalon.framework.tools.infobuilder.test.data.otherpkg.Service2"/>
</dependencies>
- <schema category="configuration" type="rlng"/>
+ <configuration-schema type="rlng"/>
</component-info>
1.4 +2 -2 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component1-info.xml
Index: component1-info.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component1-info.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- component1-info.xml 15 Nov 2002 22:31:14 -0000 1.3
+++ component1-info.xml 24 Nov 2002 12:15:27 -0000 1.4
@@ -29,5 +29,5 @@
<dependency key="foo" type="org.realityforge.Service3"/>
</dependencies>
- <schema category="configuration" type="http://relaxng.org/ns/structure/1.0"/>
-</component-info>
\ No newline at end of file
+ <configuration-schema type="http://relaxng.org/ns/structure/1.0"/>
+</component-info>
1.3 +1 -1 jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component3-info.xml
Index: component3-info.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component3-info.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- component3-info.xml 15 Nov 2002 22:41:26 -0000 1.2
+++ component3-info.xml 24 Nov 2002 12:15:27 -0000 1.3
@@ -27,6 +27,6 @@
<dependency type="org.apache.avalon.cornerstone.services.threads.ThreadManager"/>
</dependencies>
- <schema category="configuration" type="rlng"/>
+ <configuration-schema type="rlng"/>
</component-info>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>