ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test DefaultProjectBuilderTestCase.java
Date Tue, 11 Jun 2002 05:47:00 GMT
donaldp     2002/06/10 22:47:00

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        DefaultProject.java DefaultProjectBuilder.java
               container/src/test/org/apache/myrmidon/components/builder/test
                        DefaultProjectBuilderTestCase.java
  Log:
  Make DefaultProject extend AbstractUnit and add javadoc to all the methods.
  
  Revision  Changes    Path
  1.32      +56 -20    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java
  
  Index: DefaultProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- DefaultProject.java	11 Jun 2002 04:56:07 -0000	1.31
  +++ DefaultProject.java	11 Jun 2002 05:47:00 -0000	1.32
  @@ -13,27 +13,24 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.oldmodel.Target;
  +import org.apache.myrmidon.interfaces.oldmodel.AbstractUnit;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
   
   /**
  - * Default project implementation.
  + * Abstraction used to interact with projects.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
    */
   public class DefaultProject
  +    extends AbstractUnit
       implements Project
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultProject.class );
   
       /**
  -     * The project name
  -     */
  -    private final String m_name;
  -
  -    /**
        * The name of the default target
        */
       private final String m_defaultTarget;
  @@ -43,6 +40,9 @@
        */
       private final File m_baseDirectory;
   
  +    /**
  +     * The descriptor for project.
  +     */
       private final ProjectDescriptor m_descriptor;
   
       /**
  @@ -55,19 +55,45 @@
        */
       private final Target[] m_targets;
   
  +    /**
  +     * Create a project object specifying all parameters.
  +     */
       public DefaultProject( final String name,
  +                           final String description,
                              final ProjectDescriptor descriptor,
                              final File baseDirectory,
                              final String defaultTarget,
                              final ProjectRef[] projectRefs,
                              final Target[] targets )
       {
  +        super( name, description );
  +
           if( null == defaultTarget )
           {
               throw new NullPointerException( "defaultTarget" );
           }
   
  -        m_name = name;
  +        if( null == defaultTarget )
  +        {
  +            throw new NullPointerException( "defaultTarget" );
  +        }
  +        if( null == descriptor )
  +        {
  +            throw new NullPointerException( "descriptor" );
  +        }
  +        if( null == baseDirectory )
  +        {
  +            throw new NullPointerException( "baseDirectory" );
  +        }
  +        if( null == projectRefs )
  +        {
  +            throw new NullPointerException( "projectRefs" );
  +        }
  +        if( null == targets )
  +        {
  +            throw new NullPointerException( "targets" );
  +        }
  +
           m_descriptor = descriptor;
           m_baseDirectory = baseDirectory;
           m_defaultTarget = defaultTarget;
  @@ -75,11 +101,21 @@
           m_targets = targets;
       }
   
  -    public ProjectRef[] getProjectRefs()
  +    /**
  +     * Return the name of the project.
  +     *
  +     * @return the name of the project.
  +     */
  +    public String getProjectName()
       {
  -        return m_projectRefs;
  +        return getName();
       }
   
  +    /**
  +     * Returns the descriptor for this project.
  +     *
  +     * @return the descriptor for this project.
  +     */
       public ProjectDescriptor getProjectDescriptor()
       {
           return m_descriptor;
  @@ -106,6 +142,16 @@
       }
   
       /**
  +     * Return the array of all the {@link ProjectRef} objects in project.
  +     *
  +     * @return the array of all the {@link ProjectRef} objects in project.
  +     */
  +    public ProjectRef[] getProjectRefs()
  +    {
  +        return m_projectRefs;
  +    }
  +
  +    /**
        * Retrieve a target by name.
        */
       public final Target getTarget( final String targetName )
  @@ -122,15 +168,5 @@
   
           final String message = REZ.getString( "project.unknown-target.error", targetName
);
           throw new TaskException( message );
  -    }
  -
  -    /**
  -     * Return the name of the project.
  -     *
  -     * @return the name of the project.
  -     */
  -    public String getProjectName()
  -    {
  -        return m_name;
       }
   }
  
  
  
  1.76      +3 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- DefaultProjectBuilder.java	11 Jun 2002 05:30:47 -0000	1.75
  +++ DefaultProjectBuilder.java	11 Jun 2002 05:47:00 -0000	1.76
  @@ -131,6 +131,7 @@
               final File baseDirectory = calcBaseDir( file, model.getAttribute( "basedir"
) );
               final String defaultTarget = model.getAttribute( "default", "main" );
               final Version version = getVersion( model );
  +            final String description = "";
   
               verifyVersion( version );
   
  @@ -145,6 +146,7 @@
   
               final DefaultProject project =
                   new DefaultProject( projectName,
  +                                    description,
                                       descriptor,
                                       baseDirectory,
                                       defaultTarget,
  
  
  
  1.20      +5 -1      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
  
  Index: DefaultProjectBuilderTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultProjectBuilderTestCase.java	11 Jun 2002 04:47:10 -0000	1.19
  +++ DefaultProjectBuilderTestCase.java	11 Jun 2002 05:47:00 -0000	1.20
  @@ -138,6 +138,7 @@
           final String uri = getURIFor( projFile );
           final DefaultProject expected =
               new DefaultProject( getNameFor( projFile ),
  +                                "",
                                   new ProjectDescriptor( uri ),
                                   getTestDirectory(),
                                   "main",
  @@ -188,6 +189,7 @@
   
           final DefaultProject expected =
               new DefaultProject( "some-project",
  +                                "",
                                   new ProjectDescriptor( uri ),
                                   getTestDirectory(),
                                   "main",
  @@ -221,6 +223,7 @@
   
           final DefaultProject expected =
               new DefaultProject( getNameFor( projFile ),
  +                                "",
                                   new ProjectDescriptor( uri ),
                                   baseDir,
                                   "main",
  @@ -248,6 +251,7 @@
   
           DefaultProject expected =
               new DefaultProject( getNameFor( projFile ),
  +                                "",
                                   new ProjectDescriptor( uri ),
                                   getTestDirectory(),
                                   "some-target",
  
  
  

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


Mime
View raw message