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/svn/src/test/org/apache/maven/genericscm/provider/svn/command AbstractSvnCommandTest.java SvnCommandWrapperTest.java TestAbstractSvnCommand.java
Date Wed, 10 Dec 2003 20:56:43 GMT
evenisse    2003/12/10 12:56:43

  Modified:    generic-scm-providers/svn/src/java/org/apache/maven/genericscm/provider/svn/command/changelog
                        SvnChangeLogCommand.java
               generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/changelog
                        SvnChangeLogCommandTest.java
               generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/checkout
                        SvnCheckOutCommandTest.java
               generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/update
                        SvnUpdateCommandTest.java
               generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/repository
                        SvnRepositoryTest.java
  Added:       generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command
                        AbstractSvnCommandTest.java
                        SvnCommandWrapperTest.java
                        TestAbstractSvnCommand.java
  Log:
  Add more svn test. Actually, coverage is 98.7%
  
  Revision  Changes    Path
  1.3       +2 -2      maven-scm/generic-scm-providers/svn/src/java/org/apache/maven/genericscm/provider/svn/command/changelog/SvnChangeLogCommand.java
  
  Index: SvnChangeLogCommand.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/svn/src/java/org/apache/maven/genericscm/provider/svn/command/changelog/SvnChangeLogCommand.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SvnChangeLogCommand.java	5 Dec 2003 18:10:36 -0000	1.2
  +++ SvnChangeLogCommand.java	10 Dec 2003 20:56:42 -0000	1.3
  @@ -153,7 +153,7 @@
        */
       public String getDisplayName() throws Exception
       {
  -        return "Check Out";
  +        return "Changelog";
       }
   
       public Commandline getCommandLine() throws ScmException
  
  
  
  1.2       +78 -3     maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
  
  Index: SvnChangeLogCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/changelog/SvnChangeLogCommandTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnChangeLogCommandTest.java	2 Dec 2003 20:14:02 -0000	1.1
  +++ SvnChangeLogCommandTest.java	10 Dec 2003 20:56:42 -0000	1.2
  @@ -99,6 +99,7 @@
               repo.setDelimiter(":");
               repo.setConnection("http://foo.com/svn/trunk");
               instance.setRepository(repo);
  +            instance.setRange(30);
               Calendar cal = Calendar.getInstance();
               cal.set(2003, 8, 10);
               Date startDate = cal.getTime();
  @@ -148,18 +149,92 @@
           {
               SvnRepository repo = new SvnRepository();
               repo.setDelimiter(":");
  -            repo.setConnection("http://foo.com/svn/trunk");
  +            repo.setConnection("anonymous@http://foo.com/svn/trunk");
  +            repo.setPassword("passwd");
               instance.setRepository(repo);
               instance.setBranch("3");
  +            instance.setWorkingDirectory(baseDir);
               Commandline cl = instance.getCommandLine();
               System.out.println(cl.toString());
               assertEquals(
  -                "svn log --non-interactive -v -r 3 http://foo.com/svn/trunk",
  +                "svn log --non-interactive -v -r 3 --username anonymous --password passwd
http://foo.com/svn/trunk",
                   cl.toString());
           }
           catch (Exception e)
           {
               fail(e.getMessage());
  +        }
  +    }
  +    
  +    public void testGetCommandWithoutBranchOrTag()
  +    {
  +        try
  +        {
  +            SvnRepository repo = new SvnRepository();
  +            repo.setDelimiter(":");
  +            repo.setConnection("anonymous@http://foo.com/svn/trunk");
  +            repo.setPassword("passwd");
  +            instance.setRepository(repo);
  +            instance.setWorkingDirectory(baseDir);
  +            Commandline cl = instance.getCommandLine();
  +            System.out.println(cl.toString());
  +            assertEquals(
  +                "svn log --non-interactive -v --username anonymous --password passwd http://foo.com/svn/trunk",
  +                cl.toString());
  +        }
  +        catch (Exception e)
  +        {
  +            fail(e.getMessage());
  +        }
  +    }
  +    
  +    public void testGetDisplayNameName()
  +    {
  +        try
  +        {
  +            assertEquals("Changelog", instance.getDisplayName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
  +    
  +    public void testGetName()
  +    {
  +        try
  +        {
  +            assertEquals("changelog", instance.getName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
  +    
  +    public void testConsumer()
  +    {
  +        try
  +        {
  +            SvnChangeLogConsumer cons = new SvnChangeLogConsumer();
  +            instance.setConsumer(cons);
  +            assertEquals(cons, instance.getConsumer());
  +        }
  +        catch(Exception e)
  +        {
  +            fail(e.getMessage());
  +        }
  +    }
  +    
  +    public void testWrongConsumer()
  +    {
  +        try
  +        {
  +            instance.setConsumer(null);
  +            fail();
  +        }
  +        catch(Exception e)
  +        {
           }
       }
   }
  
  
  
  1.2       +46 -1     maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/checkout/SvnCheckOutCommandTest.java
  
  Index: SvnCheckOutCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/checkout/SvnCheckOutCommandTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnCheckOutCommandTest.java	2 Dec 2003 20:14:02 -0000	1.1
  +++ SvnCheckOutCommandTest.java	10 Dec 2003 20:56:42 -0000	1.2
  @@ -109,4 +109,49 @@
               fail(e.getMessage());
           }
       }
  +    
  +    public void testGetCommand2()
  +    {
  +        try
  +        {
  +            SvnRepository repo = new SvnRepository();
  +            repo.setDelimiter(":");
  +            repo.setConnection("http://foo.com/svn/trunk");
  +            instance.setRepository(repo);
  +            instance.setWorkingDirectory(baseDir);
  +            Commandline cl = instance.getCommandLine();
  +            System.out.println(cl.toString());
  +            assertEquals(
  +                "svn checkout --non-interactive -v http://foo.com/svn/trunk",
  +                cl.toString());
  +        }
  +        catch (Exception e)
  +        {
  +            fail(e.getMessage());
  +        }
  +    }
  +    
  +    public void testGetDisplayNameName()
  +    {
  +        try
  +        {
  +            assertEquals("Check out", instance.getDisplayName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
  +    
  +    public void testGetName()
  +    {
  +        try
  +        {
  +            assertEquals("checkout", instance.getName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
   }
  
  
  
  1.2       +46 -1     maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/update/SvnUpdateCommandTest.java
  
  Index: SvnUpdateCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/update/SvnUpdateCommandTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnUpdateCommandTest.java	2 Dec 2003 20:14:02 -0000	1.1
  +++ SvnUpdateCommandTest.java	10 Dec 2003 20:56:42 -0000	1.2
  @@ -109,4 +109,49 @@
               fail(e.getMessage());
           }
       }
  +    
  +    public void testGetCommand2()
  +    {
  +        try
  +        {
  +            SvnRepository repo = new SvnRepository();
  +            repo.setDelimiter(":");
  +            repo.setConnection("http://foo.com/svn/trunk");
  +            instance.setRepository(repo);
  +            instance.setWorkingDirectory(baseDir);
  +            Commandline cl = instance.getCommandLine();
  +            System.out.println(cl.toString());
  +            assertEquals(
  +                "svn update --non-interactive -v http://foo.com/svn/trunk",
  +                cl.toString());
  +        }
  +        catch (Exception e)
  +        {
  +            fail(e.getMessage());
  +        }
  +    }
  +    
  +    public void testGetDisplayNameName()
  +    {
  +        try
  +        {
  +            assertEquals("Update", instance.getDisplayName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
  +    
  +    public void testGetName()
  +    {
  +        try
  +        {
  +            assertEquals("update", instance.getName());
  +        }
  +        catch(Exception e)
  +        {
  +            fail();
  +        }
  +    }
   }
  
  
  
  1.2       +15 -1     maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/repository/SvnRepositoryTest.java
  
  Index: SvnRepositoryTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/repository/SvnRepositoryTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnRepositoryTest.java	2 Dec 2003 20:14:02 -0000	1.1
  +++ SvnRepositoryTest.java	10 Dec 2003 20:56:42 -0000	1.2
  @@ -86,4 +86,18 @@
               fail(e.getMessage());
           }
       }
  +    
  +    public void testParseConnectionWithBadURL()
  +    {
  +        try
  +        {
  +            SvnRepository repo = new SvnRepository();
  +            repo.setDelimiter(":");
  +            repo.setConnection("wrongURL");
  +            fail();
  +        }
  +        catch(ScmException e)
  +        {
  +        }
  +    }
   }
  
  
  
  1.1                  maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/AbstractSvnCommandTest.java
  
  Index: AbstractSvnCommandTest.java
  ===================================================================
  package org.apache.maven.genericscm.provider.svn.command;
  
  /* ====================================================================
   * 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 junit.framework.TestCase;
  
  import org.apache.maven.genericscm.ScmException;
  import org.apache.maven.genericscm.provider.svn.repository.SvnRepository;
  
  /**
   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
   * @version $Id: AbstractSvnCommandTest.java,v 1.1 2003/12/10 20:56:42 evenisse Exp $
   */
  public class AbstractSvnCommandTest extends TestCase
  {
      private TestAbstractSvnCommand cmd;
      
      public AbstractSvnCommandTest(String name)
      {
          super(name);
      }
      
      public void setUp() throws Exception
      {
          cmd = new TestAbstractSvnCommand();
      }
      
      public void testSetValidRepository()
      {
          try
          {
              SvnRepository repo = new SvnRepository();
              repo.setDelimiter(":");
              repo.setConnection("http://anUrl");
              cmd.setRepository(repo);
              assertEquals(repo, cmd.getRepository());
          }
          catch(ScmException e)
          {
              fail();
          }
      }
      
      public void testSetInvalidRepository()
      {
          try
          {
              cmd.setRepository(null);
              fail();
          }
          catch(ScmException e)
          {
              
          }
      }
      
      public void testSetBranch()
      {
          cmd.setBranch("aBranch");
          assertEquals("aBranch", cmd.getBranch());
      }
  
      public void testSetTag()
      {
          cmd.setBranch("aTag");
          assertEquals("aTag", cmd.getTag());
      }
  }
  
  
  1.1                  maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/SvnCommandWrapperTest.java
  
  Index: SvnCommandWrapperTest.java
  ===================================================================
  package org.apache.maven.genericscm.provider.svn.command;
  
  /* ====================================================================
   * 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 junit.framework.TestCase;
  
  import org.apache.maven.genericscm.ScmException;
  import org.apache.maven.genericscm.provider.svn.repository.SvnRepository;
  
  /**
   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
   * @version $Id: SvnCommandWrapperTest.java,v 1.1 2003/12/10 20:56:42 evenisse Exp $
   */
  public class SvnCommandWrapperTest extends TestCase
  {
      private SvnCommandWrapper wrapper;
      
      public SvnCommandWrapperTest(String testName)
      {
          super(testName);
      }
      
      public void setUp() throws Exception
      {
          wrapper = new SvnCommandWrapper();
      }
      
      public void testSetValidRepository()
      {
          try
          {
              SvnRepository repo = new SvnRepository();
              repo.setDelimiter(":");
              repo.setConnection("http://anUrl");
              wrapper.setRepository(repo);
              assertEquals(repo, wrapper.getRepository());
          }
          catch(ScmException e)
          {
              fail(e.getMessage());
          }
      }
      
      public void testSetInvalidRepository()
      {
          try
          {
              wrapper.setRepository(null);
              fail();
          }
          catch(ScmException e)
          {
          }
      }
  }
  
  
  1.1                  maven-scm/generic-scm-providers/svn/src/test/org/apache/maven/genericscm/provider/svn/command/TestAbstractSvnCommand.java
  
  Index: TestAbstractSvnCommand.java
  ===================================================================
  package org.apache.maven.genericscm.provider.svn.command;
  
  /* ====================================================================
   * 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 junit.framework.TestCase;
  
  import org.apache.maven.genericscm.ScmException;
  import org.apache.maven.genericscm.util.Commandline;
  
  /**
   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
   * @version $Id: TestAbstractSvnCommand.java,v 1.1 2003/12/10 20:56:42 evenisse Exp $
   */
  public class TestAbstractSvnCommand extends AbstractSvnCommand
  {
      public Commandline getCommandLine() throws ScmException
      {
          return null;
      }
      
      public String getName() throws Exception
      {
          return null;
      }
      
      public String getDisplayName()
      {
          return null;
      }
  }
  
  

Mime
View raw message