avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test InfoAssert.java InfoBuilderTestCase.java
Date Thu, 14 Nov 2002 07:44:48 GMT
donaldp     2002/11/13 23:44:48

  Modified:    info/src/java/org/apache/avalon/framework/tools/infobuilder
                        InfoBuilder.java InfoReader.java InfoWriter.java
                        LegacyBlockInfoReader.java
                        SerializedInfoReader.java SerializedInfoWriter.java
                        XMLInfoReader.java XMLInfoWriter.java
               info/src/test/org/apache/avalon/framework/tools/infobuilder/test
                        InfoAssert.java InfoBuilderTestCase.java
  Removed:     info/src/java/org/apache/avalon/framework/info
                        MethodDescriptor.java ParameterDescriptor.java
                        ServiceInfo.java
  Log:
  Remove references to ServiceInfo, MethodDescriptor and ParameterDescriptor until such a
time when a generic mechanism can be devised. Preferrably this will be provided by work on
MetaClass or some other runtime attribute retrieval mechanism.
  
  Revision  Changes    Path
  1.4       +1 -122    jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoBuilder.java
  
  Index: InfoBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InfoBuilder.java	12 Nov 2002 00:12:22 -0000	1.3
  +++ InfoBuilder.java	14 Nov 2002 07:44:30 -0000	1.4
  @@ -12,7 +12,6 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   
  @@ -95,49 +94,6 @@
       }
   
       /**
  -     * Create a {@link ServiceInfo} object for specified Class.
  -     *
  -     * @param clazz The class of ServiceInfo
  -     * @return the created ServiceInfo
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    public ServiceInfo buildServiceInfo( final Class clazz )
  -        throws Exception
  -    {
  -        return buildServiceInfo( clazz.getName(), clazz.getClassLoader() );
  -    }
  -
  -    /**
  -     * Create a {@link ServiceInfo} object for specified
  -     * classname, in specified ClassLoader.
  -     *
  -     * @param classname The classname of Component
  -     * @param classLoader the ClassLoader to load info from
  -     * @return the created ServiceInfo
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    public ServiceInfo buildServiceInfo( final String classname,
  -                                         final ClassLoader classLoader )
  -        throws Exception
  -    {
  -        ServiceInfo info = buildServiceFromSer( classname, classLoader );
  -        if( null != info )
  -        {
  -            return info;
  -        }
  -
  -        info = buildServiceFromLegacy( classname, classLoader );
  -        if( null != info )
  -        {
  -            return info;
  -        }
  -        else
  -        {
  -            return buildServiceFromXML( classname, classLoader );
  -        }
  -    }
  -
  -    /**
        * Build {@link ComponentInfo} from the XML descriptor format.
        *
        * @param classname The classname of Component
  @@ -212,83 +168,6 @@
   
           final InfoReader xmlInfoCreator = getXMLInfoCreator( classname );
           return xmlInfoCreator.createComponentInfo( classname, inputStream );
  -    }
  -
  -    /**
  -     * Build {@link ServiceInfo} from the XML descriptor format.
  -     *
  -     * @param classname The classname of Component
  -     * @param classLoader the ClassLoader to load info from
  -     * @return the created {@link ServiceInfo}
  -     * @throws Exception if an error occurs
  -     */
  -    private ServiceInfo buildServiceFromSer( final String classname,
  -                                             final ClassLoader classLoader )
  -        throws Exception
  -    {
  -        final String xinfo = deriveResourceName( classname, "-info.ser" );
  -        final InputStream inputStream = classLoader.getResourceAsStream( xinfo );
  -        if( null == inputStream )
  -        {
  -            return null;
  -        }
  -
  -        return m_serialInfoCreator.createServiceInfo( classname, inputStream );
  -    }
  -
  -    /**
  -     * Build {@link ServiceInfo} from the legacy XML descriptor format.
  -     *
  -     * @param classname The classname of Component
  -     * @param classLoader the ClassLoader to load info from
  -     * @return the created {@link ServiceInfo}
  -     * @throws Exception if an error occurs
  -     */
  -    private ServiceInfo buildServiceFromLegacy( final String classname,
  -                                                final ClassLoader classLoader )
  -        throws Exception
  -    {
  -        final String xinfo = deriveResourceName( classname, ".xinfo" );
  -        final InputStream inputStream = classLoader.getResourceAsStream( xinfo );
  -        if( null == inputStream )
  -        {
  -            return null;
  -        }
  -
  -        if( null != m_legacyInfoCreator )
  -        {
  -            return m_legacyInfoCreator.createServiceInfo( classname, inputStream );
  -        }
  -        else
  -        {
  -            return null;
  -        }
  -    }
  -
  -    /**
  -     * Build ServiceInfo from the XML descriptor format.
  -     *
  -     * @param classname The classname of Component
  -     * @param classLoader the ClassLoader to load info from
  -     * @return the created ServiceInfo
  -     * @throws Exception if an error occurs
  -     */
  -    private ServiceInfo buildServiceFromXML( final String classname,
  -                                             final ClassLoader classLoader )
  -        throws Exception
  -    {
  -        final String xinfo = deriveResourceName( classname, "-info.xml" );
  -        final InputStream inputStream = classLoader.getResourceAsStream( xinfo );
  -        if( null == inputStream )
  -        {
  -            final String message =
  -                REZ.getString( "builder.missing-info.error",
  -                               classname );
  -            throw new Exception( message );
  -        }
  -
  -        final InfoReader xmlInfoCreator = getXMLInfoCreator( classname );
  -        return xmlInfoCreator.createServiceInfo( classname, inputStream );
       }
   
       /**
  
  
  
  1.2       +4 -18     jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoReader.java
  
  Index: InfoReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InfoReader.java	12 Nov 2002 00:12:22 -0000	1.1
  +++ InfoReader.java	14 Nov 2002 07:44:31 -0000	1.2
  @@ -9,14 +9,12 @@
   
   import java.io.InputStream;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   
   /**
    * Simple interface used to create {@link ComponentInfo}
  - * or {@link ServiceInfo} objects from a stream. This
  - * abstraction was primarily created so that the Info objesct
  - * could be built from non-XML sources and no XML classes need
  - * be in the classpath.
  + * objects from a stream. This abstraction was primarily created
  + * so that the Info objesct could be built from non-XML sources
  + * and no XML classes need be in the classpath.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  @@ -33,17 +31,5 @@
        */
       ComponentInfo createComponentInfo( String implementationKey,
                                          InputStream inputStream )
  -        throws Exception;
  -
  -    /**
  -     * Create a {@link ServiceInfo} from stream
  -     *
  -     * @param implementationKey the name of service type that we are looking up
  -     * @param inputStream the stream that the resource is loaded from
  -     * @return the newly created {@link ServiceInfo}
  -     * @throws Exception if unable to create info
  -     */
  -    ServiceInfo createServiceInfo( String implementationKey,
  -                                   InputStream inputStream )
           throws Exception;
   }
  
  
  
  1.2       +3 -15     jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoWriter.java
  
  Index: InfoWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/InfoWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InfoWriter.java	12 Nov 2002 00:23:00 -0000	1.1
  +++ InfoWriter.java	14 Nov 2002 07:44:32 -0000	1.2
  @@ -9,12 +9,11 @@
   
   import java.io.OutputStream;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   
   /**
    * Simple interface used to write {@link ComponentInfo}
  - * or {@link ServiceInfo} objects to a stream. Different
  - * implementations will write to different output formats.
  + * objects to a stream. Different implementations will write to
  + * different output formats.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  @@ -30,16 +29,5 @@
        */
       void writeComponentInfo( ComponentInfo info,
                                OutputStream outputStream )
  -        throws Exception;
  -
  -    /**
  -     * Write a {@link ServiceInfo} to a stream
  -     *
  -     * @param info the Info to write out
  -     * @param outputStream the stream to write info to
  -     * @throws Exception if unable to write info
  -     */
  -    void writeServiceInfo( ServiceInfo info,
  -                            OutputStream outputStream )
           throws Exception;
   }
  
  
  
  1.2       +1 -20     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LegacyBlockInfoReader.java	12 Nov 2002 00:12:22 -0000	1.1
  +++ LegacyBlockInfoReader.java	14 Nov 2002 07:44:32 -0000	1.2
  @@ -22,7 +22,6 @@
   import org.apache.avalon.framework.info.EntryDescriptor;
   import org.apache.avalon.framework.info.LoggerDescriptor;
   import org.apache.avalon.framework.info.ServiceDescriptor;
  -import org.apache.avalon.framework.info.ServiceInfo;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.xml.sax.InputSource;
   
  @@ -58,24 +57,6 @@
           final InputSource input = new InputSource( inputStream );
           final Configuration configuration = ConfigurationBuilder.build( input );
           return build( implementationKey, configuration );
  -    }
  -
  -    /**
  -     * Create a {@link ServiceInfo} from stream
  -     *
  -     * @param implementationKey the name of service type that we are looking up
  -     * @param inputStream the stream that the resource is loaded from
  -     * @return the newly created {@link ServiceInfo}
  -     * @throws Exception if unable to create info
  -     * @todo Implement me!
  -     */
  -    public ServiceInfo createServiceInfo( final String implementationKey,
  -                                          final InputStream inputStream )
  -        throws Exception
  -    {
  -        final String message =
  -            "Currently unsupported. Should process mxinfo files here...";
  -        throw new Exception( message );
       }
   
       /**
  
  
  
  1.2       +3 -12     jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/SerializedInfoReader.java
  
  Index: SerializedInfoReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/SerializedInfoReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializedInfoReader.java	12 Nov 2002 00:12:22 -0000	1.1
  +++ SerializedInfoReader.java	14 Nov 2002 07:44:32 -0000	1.2
  @@ -10,11 +10,10 @@
   import java.io.InputStream;
   import java.io.ObjectInputStream;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   
   /**
  - * Create {@link ComponentInfo} and {@link ServiceInfo} objects
  - * from stream made up of serialized object.
  + * Create {@link ComponentInfo} objects from stream made up of
  + * serialized object.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  @@ -28,13 +27,5 @@
       {
           final ObjectInputStream ois = new ObjectInputStream( inputStream );
           return (ComponentInfo)ois.readObject();
  -    }
  -
  -    public ServiceInfo createServiceInfo( String implementationKey,
  -                                          InputStream inputStream )
  -        throws Exception
  -    {
  -        final ObjectInputStream ois = new ObjectInputStream( inputStream );
  -        return (ServiceInfo)ois.readObject();
       }
   }
  
  
  
  1.4       +2 -13     jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/SerializedInfoWriter.java
  
  Index: SerializedInfoWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/infobuilder/SerializedInfoWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SerializedInfoWriter.java	12 Nov 2002 00:23:00 -0000	1.3
  +++ SerializedInfoWriter.java	14 Nov 2002 07:44:32 -0000	1.4
  @@ -10,11 +10,9 @@
   import java.io.ObjectOutputStream;
   import java.io.OutputStream;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   
   /**
  - * Write {@link ComponentInfo} and {@link ServiceInfo} objects
  - * to a stream as serialized objects.
  + * Write {@link ComponentInfo} objects to a stream as serialized objects.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  @@ -24,15 +22,6 @@
   {
       public void writeComponentInfo( final ComponentInfo info,
                                       final OutputStream outputStream )
  -        throws Exception
  -    {
  -        final ObjectOutputStream oos = new ObjectOutputStream( outputStream );
  -        oos.writeObject( info );
  -        oos.flush();
  -    }
  -
  -    public void writeServiceInfo( final ServiceInfo info,
  -                                  final OutputStream outputStream )
           throws Exception
       {
           final ObjectOutputStream oos = new ObjectOutputStream( outputStream );
  
  
  
  1.2       +1 -155    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLInfoReader.java	12 Nov 2002 00:12:22 -0000	1.1
  +++ XMLInfoReader.java	14 Nov 2002 07:44:32 -0000	1.2
  @@ -22,10 +22,7 @@
   import org.apache.avalon.framework.info.DependencyDescriptor;
   import org.apache.avalon.framework.info.EntryDescriptor;
   import org.apache.avalon.framework.info.LoggerDescriptor;
  -import org.apache.avalon.framework.info.MethodDescriptor;
  -import org.apache.avalon.framework.info.ParameterDescriptor;
   import org.apache.avalon.framework.info.ServiceDescriptor;
  -import org.apache.avalon.framework.info.ServiceInfo;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.xml.sax.InputSource;
   
  @@ -63,23 +60,6 @@
       }
   
       /**
  -     * Create a {@link ServiceInfo} from stream
  -     *
  -     * @param implementationKey the name of service type that we are looking up
  -     * @param inputStream the stream that the resource is loaded from
  -     * @return the newly created {@link ServiceInfo}
  -     * @throws Exception if unable to create info
  -     */
  -    public ServiceInfo createServiceInfo( String implementationKey,
  -                                          InputStream inputStream )
  -        throws Exception
  -    {
  -        final InputSource input = new InputSource( inputStream );
  -        final Configuration configuration = ConfigurationBuilder.build( input );
  -        return buildServiceInfo( implementationKey, configuration );
  -    }
  -
  -    /**
        * Create a {@link ComponentInfo} object for specified classname from
        * specified configuration data.
        *
  @@ -141,140 +121,6 @@
           }
   
           return new ComponentInfo( descriptor, loggers, context, services, dependencies
);
  -    }
  -
  -    /**
  -     * Create a {@link ServiceInfo} object for specified classname from
  -     * specified configuration data.
  -     *
  -     * @param classname The classname of Service
  -     * @param info the ServiceInfo configuration
  -     * @return the created ServiceInfo
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private ServiceInfo buildServiceInfo( final String classname,
  -                                          final Configuration info )
  -        throws Exception
  -    {
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message =
  -                REZ.getString( "builder.creating-service-info.notice",
  -                               classname );
  -            getLogger().debug( message );
  -        }
  -
  -        final String topLevelName = info.getName();
  -        if( !topLevelName.equals( "service-info" ) )
  -        {
  -            final String message =
  -                REZ.getString( "builder.bad-toplevel-element.error",
  -                               classname,
  -                               topLevelName );
  -            throw new ConfigurationException( message );
  -        }
  -
  -        Configuration configuration = null;
  -        configuration = info.getChild( "service" );
  -        final ServiceDescriptor descriptor = buildService( configuration );
  -        final String implementationKey = descriptor.getImplementationKey();
  -
  -        configuration = info.getChild( "methods" );
  -        final MethodDescriptor[] methods = buildMethods( configuration );
  -
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message =
  -                REZ.getString( "builder.created-info.notice",
  -                               implementationKey,
  -                               new Integer( methods.length ) );
  -            getLogger().debug( message );
  -        }
  -
  -        return new ServiceInfo( descriptor, methods );
  -    }
  -
  -    /**
  -     * A utility method to build an array of {@link MethodDescriptor} objects
  -     * from specified configuraiton.
  -     *
  -     * @param configuration the loggers configuration
  -     * @return the created MethodDescriptors
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private MethodDescriptor[] buildMethods( final Configuration configuration )
  -        throws ConfigurationException
  -    {
  -        final Configuration[] elements = configuration.getChildren( "method" );
  -        final ArrayList methods = new ArrayList();
  -
  -        for( int i = 0; i < elements.length; i++ )
  -        {
  -            final MethodDescriptor method = buildMethod( elements[ i ] );
  -            methods.add( method );
  -        }
  -
  -        return (MethodDescriptor[])methods.toArray( new MethodDescriptor[ methods.size()
] );
  -    }
  -
  -    /**
  -     * A utility method to build a {@link MethodDescriptor}
  -     * object from specified configuraiton.
  -     *
  -     * @param method the Method configuration
  -     * @return the created MethodDescriptor
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private MethodDescriptor buildMethod( Configuration method )
  -        throws ConfigurationException
  -    {
  -        final String name = method.getAttribute( "name" );
  -        final String type = method.getAttribute( "return-type" );
  -
  -        final ParameterDescriptor[] parameters = buildMethodParameters( method );
  -
  -        final Attribute[] attributes = buildAttributes( method );
  -        return new MethodDescriptor( name, type, parameters, attributes );
  -    }
  -
  -    /**
  -     * A utility method to build an array of {@link ParameterDescriptor} objects
  -     * from specified configuraiton.
  -     *
  -     * @param configuration the methods configuration
  -     * @return the created ParameterDescriptors
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private ParameterDescriptor[] buildMethodParameters( final Configuration configuration
)
  -        throws ConfigurationException
  -    {
  -        final Configuration[] elements = configuration.getChildren( "parameter" );
  -        final ArrayList params = new ArrayList();
  -
  -        for( int i = 0; i < elements.length; i++ )
  -        {
  -            final ParameterDescriptor param =
  -                buildMethodParameter( elements[ i ] );
  -            params.add( param );
  -        }
  -
  -        return (ParameterDescriptor[])params.toArray( new ParameterDescriptor[ params.size()
] );
  -    }
  -
  -    /**
  -     * A utility method to build a {@link ParameterDescriptor}
  -     * object from specified configuraiton.
  -     *
  -     * @param param the Parameter configuration
  -     * @return the created ParameterDescriptor
  -     * @throws ConfigurationException if an error occurs
  -     */
  -    private ParameterDescriptor buildMethodParameter( Configuration param )
  -        throws ConfigurationException
  -    {
  -        final String type = param.getAttribute( "type" );
  -        final Attribute[] attributes = buildAttributes( param );
  -        return new ParameterDescriptor( type, attributes );
       }
   
       /**
  
  
  
  1.3       +2 -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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLInfoWriter.java	12 Nov 2002 03:02:08 -0000	1.2
  +++ XMLInfoWriter.java	14 Nov 2002 07:44:32 -0000	1.3
  @@ -12,7 +12,6 @@
   import java.io.Writer;
   import java.io.OutputStreamWriter;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   import org.apache.avalon.framework.info.ComponentDescriptor;
   import org.apache.avalon.framework.info.Attribute;
   import org.apache.avalon.framework.info.LoggerDescriptor;
  @@ -22,8 +21,7 @@
   import org.apache.avalon.framework.info.DependencyDescriptor;
   
   /**
  - * Write {@link ComponentInfo} and {@link ServiceInfo} objects
  - * to a stream as xml documents.
  + * Write {@link ComponentInfo} objects to a stream as xml documents.
    *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
  @@ -32,20 +30,6 @@
       implements InfoWriter
   {
       private static final String CONTEXT_CLASS = "org.apache.avalon.framework.context.Context";
  -
  -    /**
  -     * Write out info representation to xml.
  -     *
  -     * @param info the info object
  -     * @param outputStream the stream to write to
  -     * @throws IOException if unable to write xml
  -     */
  -    public void writeServiceInfo( final ServiceInfo info,
  -                                  final OutputStream outputStream )
  -        throws Exception
  -    {
  -        throw new UnsupportedOperationException();
  -    }
   
       /**
        * Write out info representation to xml.
  
  
  
  1.4       +5 -75     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InfoAssert.java	12 Nov 2002 01:34:08 -0000	1.3
  +++ InfoAssert.java	14 Nov 2002 07:44:48 -0000	1.4
  @@ -7,18 +7,15 @@
    */
   package org.apache.avalon.framework.tools.infobuilder.test;
   
  +import junit.framework.Assert;
   import org.apache.avalon.framework.info.Attribute;
  -import org.apache.avalon.framework.info.ComponentInfo;
   import org.apache.avalon.framework.info.ComponentDescriptor;
  -import org.apache.avalon.framework.info.LoggerDescriptor;
  +import org.apache.avalon.framework.info.ComponentInfo;
   import org.apache.avalon.framework.info.ContextDescriptor;
  -import org.apache.avalon.framework.info.ServiceDescriptor;
   import org.apache.avalon.framework.info.DependencyDescriptor;
   import org.apache.avalon.framework.info.EntryDescriptor;
  -import org.apache.avalon.framework.info.ServiceInfo;
  -import org.apache.avalon.framework.info.MethodDescriptor;
  -import org.apache.avalon.framework.info.ParameterDescriptor;
  -import junit.framework.Assert;
  +import org.apache.avalon.framework.info.LoggerDescriptor;
  +import org.apache.avalon.framework.info.ServiceDescriptor;
   
   /**
    * A set of utilities for asserting  facts about info objects.
  @@ -41,73 +38,6 @@
                                  actualComponent.getAttributes() );
   
           assertEqualFeatures( message, expected, actual );
  -    }
  -
  -    public static void assertEqualInfos( final String message,
  -                                         final ServiceInfo expected,
  -                                         final ServiceInfo actual )
  -    {
  -        final ServiceDescriptor expectedService = expected.getServiceDescriptor();
  -        final ServiceDescriptor actualService = actual.getServiceDescriptor();
  -        assertEqualService( message + "Service", expectedService, actualService );
  -
  -        final MethodDescriptor[] expectedMethods = expected.getMethods();
  -        final MethodDescriptor[] actualMethods = actual.getMethods();
  -        assertEqualMethods( message + "Methods", expectedMethods, actualMethods );
  -    }
  -
  -    private static void assertEqualMethods( final String message,
  -                                            final MethodDescriptor[] expected,
  -                                            final MethodDescriptor[] actual )
  -    {
  -        Assert.assertEquals( message + ": Methods.length", expected.length, actual.length
);
  -        for( int i = 0; i < expected.length; i++ )
  -        {
  -            assertEqualMethods( message + ": Dependencys[ " + i + "].",
  -                                expected[ i ], actual[ i ] );
  -        }
  -    }
  -
  -    private static void assertEqualMethods( final String message,
  -                                            final MethodDescriptor expected,
  -                                            final MethodDescriptor actual )
  -    {
  -        Assert.assertEquals( message + "name",
  -                             expected.getName(),
  -                             actual.getName() );
  -        Assert.assertEquals( message + "returnType",
  -                             expected.getReturnType(),
  -                             actual.getReturnType() );
  -        assertEqualMethodParameters( message + "parameters",
  -                                     expected.getParameters(),
  -                                     actual.getParameters() );
  -        assertEqualAttributes( message + "attributes",
  -                               expected.getAttributes(),
  -                               actual.getAttributes() );
  -    }
  -
  -    private static void assertEqualMethodParameters( final String message,
  -                                                     final ParameterDescriptor[] expected,
  -                                                     final ParameterDescriptor[] actual
)
  -    {
  -        Assert.assertEquals( message + ": Parameters.length", expected.length, actual.length
);
  -        for( int i = 0; i < expected.length; i++ )
  -        {
  -            assertMethodParameter( message + ": Parameter[ " + i + "].",
  -                                   expected[ i ], actual[ i ] );
  -        }
  -    }
  -
  -    private static void assertMethodParameter( final String message,
  -                                               final ParameterDescriptor expected,
  -                                               final ParameterDescriptor actual )
  -    {
  -        Assert.assertEquals( message + "type",
  -                             expected.getType(),
  -                             actual.getType() );
  -        assertEqualAttributes( message + ".attributes",
  -                               expected.getAttributes(),
  -                               actual.getAttributes() );
       }
   
       public static void assertEqualInfos( final String message,
  
  
  
  1.11      +1 -88     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- InfoBuilderTestCase.java	12 Nov 2002 06:55:42 -0000	1.10
  +++ InfoBuilderTestCase.java	14 Nov 2002 07:44:48 -0000	1.11
  @@ -9,7 +9,6 @@
   
   import junit.framework.TestCase;
   import org.apache.avalon.framework.info.ComponentInfo;
  -import org.apache.avalon.framework.info.ServiceInfo;
   import org.apache.avalon.framework.info.DependencyDescriptor;
   import org.apache.avalon.framework.info.Attribute;
   import org.apache.avalon.framework.info.LoggerDescriptor;
  @@ -17,8 +16,6 @@
   import org.apache.avalon.framework.info.EntryDescriptor;
   import org.apache.avalon.framework.info.ContextDescriptor;
   import org.apache.avalon.framework.info.ServiceDescriptor;
  -import org.apache.avalon.framework.info.MethodDescriptor;
  -import org.apache.avalon.framework.info.ParameterDescriptor;
   import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.avalon.framework.tools.infobuilder.InfoBuilder;
   import org.apache.avalon.framework.tools.infobuilder.SerializedInfoWriter;
  @@ -59,8 +56,6 @@
       private static final String COMPONENT2 = BASE_PACKAGE + "component2";
       private static final String COMPONENT3 = BASE_PACKAGE + "component3";
   
  -    private static final String SERVICE1 = BASE_PACKAGE + "service1";
  -
       private static final String SOURCE1 = BASE_DIR + "QDoxComponent1.java";
       private static final String SOURCE1_INFO = BASE_PACKAGE + "QDoxComponent1";
   
  @@ -91,42 +86,6 @@
                                            actual );
       }
   
  -    public void testLoadXMLService1()
  -        throws Exception
  -    {
  -        final ServiceInfo actual = loadServiceInfo( SERVICE1 );
  -        final ServiceInfo expected = createDummyServiceInfo();
  -
  -        InfoAssert.assertEqualInfos( SERVICE1 + " should be equal to constructed actual",
  -                                     expected,
  -                                     actual );
  -    }
  -
  -    public void testWriteSerService1()
  -        throws Exception
  -    {
  -        final ServiceInfo expected = createDummyServiceInfo();
  -        final InfoWriter writer = new SerializedInfoWriter();
  -        ContainerUtil.enableLogging( writer, new ConsoleLogger() );
  -        final File output = File.createTempFile( "info-test", ".ser" );
  -        final FileOutputStream outputStream = new FileOutputStream( output );
  -        writer.writeServiceInfo( expected, outputStream );
  -        outputStream.close();
  -
  -        final InfoReader reader = new SerializedInfoReader();
  -        ContainerUtil.enableLogging( reader, new ConsoleLogger() );
  -        final String implementationKey = expected.getServiceDescriptor().getImplementationKey();
  -        final FileInputStream inputStream = new FileInputStream( output );
  -        final ServiceInfo actual = reader.createServiceInfo( implementationKey, inputStream
);
  -        inputStream.close();
  -        output.deleteOnExit();
  -        output.delete();
  -
  -        InfoAssert.assertEqualInfos( " Dummy service written out and read back " +
  -                                     "in again should be equal",
  -                                     expected,
  -                                     actual );
  -    }
   
       public void testWriteSerComponent1()
           throws Exception
  @@ -195,45 +154,6 @@
                                        actual );
       }
   
  -    private ServiceInfo createDummyServiceInfo()
  -    {
  -        final ServiceDescriptor service = createServiceDescriptor();
  -
  -        final Properties params1 = new Properties();
  -        params1.setProperty( "display-name", "Do Magic Method" );
  -        params1.setProperty( "description-key", "doMagic.desc" );
  -        final Attribute attribute1 = new Attribute( "doc", params1 );
  -        final Attribute[] attributes1 = new Attribute[]{attribute1};
  -
  -        final MethodDescriptor method1 =
  -            new MethodDescriptor( "doMagic",
  -                                  "void",
  -                                  new ParameterDescriptor[ 0 ],
  -                                  attributes1 );
  -
  -        final ParameterDescriptor parameter1 =
  -            new ParameterDescriptor( "java.lang.String", InfoAssert.EMPTY_ATTRIBUTES );
  -
  -        final Properties params2 = new Properties();
  -        params2.setProperty( "display-name", "The secret Parameter" );
  -        params2.setProperty( "description-key", "doMagic.desc" );
  -        final Attribute attribute2 = new Attribute( "doc", params2 );
  -        final Attribute[] attributes2 = new Attribute[]{attribute2};
  -        final ParameterDescriptor parameter2 =
  -            new ParameterDescriptor( "int", attributes2 );
  -
  -        final ParameterDescriptor[] parameters =
  -            new ParameterDescriptor[]{parameter1, parameter2};
  -        final MethodDescriptor method2 =
  -            new MethodDescriptor( "doMoreMagic",
  -                                  "int",
  -                                  parameters,
  -                                  InfoAssert.EMPTY_ATTRIBUTES );
  -        final MethodDescriptor[] methods = new MethodDescriptor[]{method1, method2};
  -
  -        return new ServiceInfo( service, methods );
  -    }
  -
       private ComponentInfo createDummyComponentInfo()
       {
           final ComponentDescriptor component =
  @@ -289,13 +209,6 @@
       {
           final ClassLoader classLoader = getClass().getClassLoader();
           return createInfoBuilder().buildComponentInfo( classname, classLoader );
  -    }
  -
  -    protected ServiceInfo loadServiceInfo( final String classname )
  -        throws Exception
  -    {
  -        final ClassLoader classLoader = getClass().getClassLoader();
  -        return createInfoBuilder().buildServiceInfo( classname, classLoader );
       }
   
       private InfoBuilder createInfoBuilder()
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message