maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject cvs commit: maven-scm/generic-scm-providers/clearcase/src/test/org/apache/maven/genericscm/provider/clearcase/command/changelog ClearcaseChangeLogCommandTest.java
Date Sat, 13 Dec 2003 22:39:31 GMT
evenisse    2003/12/13 14:39:31

  Modified:    generic-scm-providers/clearcase/src/java/org/apache/maven/genericscm/provider/clearcase/command/changelog
                        ClearcaseChangeLogCommand.java
  Added:       generic-scm-providers/clearcase/src/test/org/apache/maven/genericscm/provider/clearcase/command/changelog
                        ClearcaseChangeLogCommandTest.java
  Log:
  Add some tests. Clearcase provider is at 63.7%
  I can't make more test because I don't have for the moment any changelog test file.
  
  Revision  Changes    Path
  1.2       +10 -7     maven-scm/generic-scm-providers/clearcase/src/java/org/apache/maven/genericscm/provider/clearcase/command/changelog/ClearcaseChangeLogCommand.java
  
  Index: ClearcaseChangeLogCommand.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/clearcase/src/java/org/apache/maven/genericscm/provider/clearcase/command/changelog/ClearcaseChangeLogCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClearcaseChangeLogCommand.java	5 Dec 2003 18:00:39 -0000	1.1
  +++ ClearcaseChangeLogCommand.java	13 Dec 2003 22:39:30 -0000	1.2
  @@ -117,7 +117,7 @@
        */
       public Date getEndDate()
       {
  -        return endDate;
  +        return null;
       }
   
       /* (non-Javadoc)
  @@ -169,11 +169,14 @@
           command.createArgument().setValue("-recurse");
           command.createArgument().setValue("-nco");
   
  -        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
  -        String start = sdf.format(startDate);
  -        
  -        command.createArgument().setValue("-since");
  -        command.createArgument().setValue(start);
  +        if (getStartDate() != null)
  +        {
  +            SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
  +            String start = sdf.format(startDate);
  +            
  +            command.createArgument().setValue("-since");
  +            command.createArgument().setValue(start);
  +        }
   
           if (getBranch() != null)
           {
  
  
  
  1.1                  maven-scm/generic-scm-providers/clearcase/src/test/org/apache/maven/genericscm/provider/clearcase/command/changelog/ClearcaseChangeLogCommandTest.java
  
  Index: ClearcaseChangeLogCommandTest.java
  ===================================================================
  package org.apache.maven.genericscm.provider.clearcase.command.changelog;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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-userName 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 apache@apache.org.
   *
   * 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 java.util.Calendar;
  import java.util.Date;
  
  import junit.framework.TestCase;
  
  import org.apache.maven.genericscm.ScmException;
  import org.apache.maven.genericscm.provider.clearcase.repository.ClearcaseRepository;
  import org.apache.maven.genericscm.util.Commandline;
  
  /**
   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
   * @version $Id: ClearcaseChangeLogCommandTest.java,v 1.1 2003/12/13 22:39:30 evenisse Exp
$
   */
  public class ClearcaseChangeLogCommandTest extends TestCase
  {
      private ClearcaseChangeLogCommand instance;
      private ClearcaseRepository repo;
      private String baseDir;
  
      public ClearcaseChangeLogCommandTest(String testName)
      {
          super(testName);
      }
  
      /**
       * Initialize per test data
       * @throws Exception when there is an unexpected problem
       */
      public void setUp() throws Exception
      {
          baseDir = System.getProperty("basedir");
          assertNotNull("The system property basedir was not defined.", baseDir);
          repo = new ClearcaseRepository();
          repo.setDelimiter(":");
          repo.setConnection("");
          instance = new ClearcaseChangeLogCommand();
          instance.setRepository(repo);
      }
      
      public void testGetCommandLine()
      {
          try
          {
              instance.setWorkingDirectory(baseDir);
              Commandline cl = instance.getCommandLine();
              System.out.println(cl.toString());
              assertEquals(
                  "cleartool lshistory -fmt \"NAME:%En\\nDATE:%Nd\\nCOMM:%-12.12o - %o - %c
- Activity: %[activity]p\\nUSER:%-8.8u\\n\" -recurse -nco",
                  cl.toString());
          }
          catch(Exception e)
          {
              e.printStackTrace();
              fail(e.getMessage());
          }
      }
      
      public void testGetCommandLineWithTag()
      {
          try
          {
              instance.setBranch("myBranch");
              Commandline cl = instance.getCommandLine();
              System.out.println(cl.toString());
              assertEquals(
                  "cleartool lshistory -fmt \"NAME:%En\\nDATE:%Nd\\nCOMM:%-12.12o - %o - %c
- Activity: %[activity]p\\nUSER:%-8.8u\\n\" -recurse -nco -branch myBranch",
                  cl.toString());
          }
          catch(Exception e)
          {
              e.printStackTrace();
              fail(e.getMessage());
          }
      }
      
      public void testSetDateRange()
      {
          instance.setRange(30);
          assertNotNull(instance.getStartDate());
          assertNull(instance.getEndDate());
      }
      
      public void testSetStartDate()
      {
          Calendar cal = Calendar.getInstance();
  		cal.set(2003, 11, 13);
          Date startDate = cal.getTime();
          instance.setStartDate(startDate);
          assertEquals(startDate, instance.getStartDate());
      }
      
      public void testSetEndDate()
      {
          Calendar cal = Calendar.getInstance();
  		cal.set(2003, 11, 13);
          Date endDate = cal.getTime();
          instance.setEndDate(endDate);
          assertNull(instance.getEndDate());
      }
      
      public void testGetName()
      {
          assertEquals("changelog", instance.getName());
      }
      
      public void testGetDisplayName()
      {
          try
          {
              assertEquals("ChangeLog", instance.getDisplayName());
          }
          catch(Exception e)
          {
              fail(e.getMessage());
          }
      }
      
      public void testSetValidConsumer()
      {
          try
          {
              ClearcaseChangeLogConsumer cons = new ClearcaseChangeLogConsumer();
              instance.setConsumer(cons);
              assertEquals(cons, instance.getConsumer());
          }
          catch(ScmException e)
          {
              fail(e.getMessage());
          }
      }
      
      public void testSetInvalidConsumer()
      {
          try
          {
              instance.setConsumer(null);
              fail();
          }
          catch(ScmException e)
          {
          }
      }
  }
  
  

Mime
View raw message