jvanzyl     2002/07/14 20:25:19

  Modified:    src/plugins-build/reactor project.xml
  Added:       src/plugins-build/reactor/src/test/java/org/apache/maven
                        TestConstantsTest.java
               src/plugins-build/reactor/src/test/java/org/apache/maven/project
                        WorkspaceMapperTest.java
  Log:
  o tests now work in plugin
  
  Revision  Changes    Path
  1.3       +45 -3     jakarta-turbine-maven/src/plugins-build/reactor/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/reactor/project.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.xml       14 Jul 2002 22:57:02 -0000      1.2
  +++ project.xml       15 Jul 2002 03:25:19 -0000      1.3
  @@ -57,8 +57,47 @@
       </dependency>
   
       <dependency>
  -      <id>velocity</id>
  -      <version>1.3</version>
  +      <id>junit</id>
  +      <version>3.7</version>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-betwixt</id>
  +      <version>1.0-dev</version>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-digester</id>
  +      <version>1.2</version>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-lang</id>
  +      <version>1.0-dev</version>
  +      <url>http://jakarta.apache.org/commons/</url>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-collections</id>
  +      <version>2.0</version>
  +      <url>http://jakarta.apache.org/commons/</url>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-beanutils</id>
  +      <version>1.4-dev</version>
  +      <url>http://jakarta.apache.org/commons/</url>
  +    </dependency>
  +
  +    <dependency>
  +      <id>commons-logging</id>
  +      <version>1.0</version>
  +    </dependency>
  +
  +    <dependency>
  +      <id>maven</id>
  +      <version>b5</version>
  +      <jar>maven.jar</jar>
       </dependency>
   
     </dependencies>
  @@ -69,7 +108,7 @@
   
       <sourceDirectory>src/java</sourceDirectory>
   
  -    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
  +    <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
       <integrationUnitTestSourceDirectory/>
   
       <aspectSourceDirectory></aspectSourceDirectory>
  @@ -79,6 +118,9 @@
         <includes>
           <include>**/*Test.java</include>
         </includes>
  +      <excludes>
  +        <exclude>**/TestConstantsTest.java</exclude>
  +      </excludes>
       </unitTest>
       
       <!-- J A R  R E S O U R C E S -->
  
  
  
  1.1                  
jakarta-turbine-maven/src/plugins-build/reactor/src/test/java/org/apache/maven/TestConstantsTest.java
  
  Index: TestConstantsTest.java
  ===================================================================
  package org.apache.maven;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import junit.framework.TestCase;
  
  /**
   * A class used to hold static commonly used data needed when running
   * tests. This is also a test to make sure that
   * System.getProperty("file.separator") returns not null.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]>Peter Lynch</a>
   */
  public class TestConstantsTest extends TestCase
  {
      private static final String fs  = System.getProperty("file.separator");
  
      /**
       * A reference to the source path from the project root
       * where all the test sources can be found.
       * Contains a leading file separator
       */
      public static final String TEST_DIR = fs + "src" + fs + "test";
  
      /**
       * A reference to the source path from the project root
       * where test resources for the build package can be found.
       * The value ends in a file seperator.
       */
      public static final String BUILD_DIR = TEST_DIR + fs + "build" + fs;
  
  
      /**
       * A reference to the source path from the project root
       * where test resources for the cvslib package can be found.
       * The value ends in a file seperator.
       */
      public static final String CVSLIB_DIR = TEST_DIR + fs + "cvslib" + fs;
  
      /**
       * A reference to the source path from the project root
       * where test resources for the build package can be found.
       * The value ends in a file seperator.
       */
      public static final String DEPENDENCY_DIR = TEST_DIR + fs + "dependency" + fs;
  
      /**
       * A reference to the source path from the project root
       * where test resources for the importscrubber package can be found.
       * The value ends in a file seperator.
       */
      public static final String IMPORTSCRUBBER_DIR = TEST_DIR + fs
          + "importscrubber" + fs;
  
      /**
       * A reference to the source path from the project root
       * where j2ee test resurces can be found.
       * The value ends in a file seperator.
       */
      public static final String J2EE_DIR = TEST_DIR + fs + "j2ee" + fs;
  
      /**
       * A reference to the source path from the project root
       * where java test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String JAVA_DIR = TEST_DIR + fs + "java" + fs;
  
      /**
       * A reference to the source path from the project root
       * where java-parser test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String JAVA_PARSER_DIR = TEST_DIR + fs + "java-parser"
                                                    + fs;
  
      /**
       * A reference to the source path from the project root
       * where reactor test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String REACTOR_DIR = TEST_DIR + fs + "reactor" + fs;
  
      /**
       * A reference to the source path from the project root
       * where struts test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String STRUTS_DIR = TEST_DIR + fs + "struts" + fs;
  
      /**
       * A reference to the source path from the project root
       * where transformer test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String TRANSFORMER_DIR = TEST_DIR + fs + "transformer"
                                                      + fs;
  
      /**
       * A reference to the source path from the project root
       * where xslt test resources can be found.
       * The value ends in a file seperator.
       */
      public static final String XSLT_DIR = TEST_DIR + fs + "xslt" + fs;
  
      /**
       * Creates a new instance of the test case
       *
       * @param testName the name of the test
       */
      public TestConstantsTest(String testName)
      {
          super(testName);
      }
  
      /**
       * test that the constants hold valid values
       */
      public void testConstants()
      {
          assertNotNull("System.getProperty('file.separator') can't be null.", fs);
      }
  
  }
  
  
  
  
  1.1                  
jakarta-turbine-maven/src/plugins-build/reactor/src/test/java/org/apache/maven/project/WorkspaceMapperTest.java
  
  Index: WorkspaceMapperTest.java
  ===================================================================
  package org.apache.maven.project;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.maven.MavenUtils;
  import org.apache.maven.TestConstantsTest;
  public class WorkspaceMapperTest
      extends TestCase
  {
      private String WORKSPACE = null;
      private String PROFILE = null;
      private String MAVEN_LOCAL_REPO = null;
  
      public WorkspaceMapperTest(String testName)
      {
          super(testName);
      }
  
      public static Test suite()
      {
          return new TestSuite(WorkspaceMapperTest.class);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
          String baseDir = System.getProperty("basedir");
          assertNotNull("The system property basedir was not defined.", baseDir);
          WORKSPACE = baseDir + TestConstantsTest.REACTOR_DIR + "workspace.xml";
          PROFILE = baseDir + TestConstantsTest.REACTOR_DIR + "profile.xml";
          // This will simulate our grand collection of project aritifacts.
          MAVEN_LOCAL_REPO = baseDir + TestConstantsTest.REACTOR_DIR;
      }
  
      public void testWorkspaceMapping()
          throws Exception
      {
          Workspace w = MavenUtils.getWorkspace(WORKSPACE,
                                                PROFILE,
                                                MAVEN_LOCAL_REPO);
  
          // Look at our basic workspace properties
          assertEquals("1", w.getWorkspaceVersion());
          assertEquals("/tmp/reactor/base", w.getBaseDirectory());
          assertEquals("/home/jvanzyl/js/dists", w.getDistributionDirectory());
          assertEquals("/home/jvanzyl/jdk/j2sdk1.4.0", w.getJavaHome());
          assertEquals("/tmp/reactor/descriptors", w.getDescriptorDirectory());
  
          // Look at our basic profile properties
          Profile profile = w.getProfile();
          assertEquals("turbine", profile.getName());
  
          // Look at our projects within the profile
          Project p0 = profile.getProject(0);
          assertEquals("stratum", p0.getId());
  
          Project p1 = profile.getProject(1);
          assertEquals("torque", p1.getId());
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to