You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-commits@maven.apache.org by ev...@apache.org on 2003/12/09 22:30:31 UTC
cvs commit: maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/update StarteamUpdateCommandTest.java
evenisse 2003/12/09 13:30:31
Modified: generic-scm-providers/starteam/src/java/org/apache/maven/genericscm/provider/starteam/repository
StarteamRepository.java
generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/repository
StarteamRepositoryTest.java
Added: generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command
AbstractStarteamCommandTest.java
StarteamCommandWrapperTest.java
TestAbstractStarteamCommand.java
generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/checkout
StarteamCheckOutCommandTest.java
generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/update
StarteamUpdateCommandTest.java
Log:
Add more starteam tests
Revision Changes Path
1.2 +5 -1 maven-scm/generic-scm-providers/starteam/src/java/org/apache/maven/genericscm/provider/starteam/repository/StarteamRepository.java
Index: StarteamRepository.java
===================================================================
RCS file: /home/cvs/maven-scm/generic-scm-providers/starteam/src/java/org/apache/maven/genericscm/provider/starteam/repository/StarteamRepository.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StarteamRepository.java 3 Dec 2003 21:23:49 -0000 1.1
+++ StarteamRepository.java 9 Dec 2003 21:30:31 -0000 1.2
@@ -100,6 +100,10 @@
user = userAndPassword.substring(0, userAndPassword.indexOf(":"));
setPassword(userAndPassword.substring(userAndPassword.indexOf(":")+1));
}
+ else
+ {
+ user = userAndPassword;
+ }
}
else
{
1.2 +33 -1 maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/repository/StarteamRepositoryTest.java
Index: StarteamRepositoryTest.java
===================================================================
RCS file: /home/cvs/maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/repository/StarteamRepositoryTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StarteamRepositoryTest.java 3 Dec 2003 21:23:49 -0000 1.1
+++ StarteamRepositoryTest.java 9 Dec 2003 21:30:31 -0000 1.2
@@ -87,4 +87,36 @@
fail(e.getMessage());
}
}
+
+ public void testParseConnection2()
+ {
+ try
+ {
+ StarteamRepository repo = new StarteamRepository();
+ repo.setDelimiter(":");
+ repo.setConnection("myusername@myhost:1234/projecturl");
+ assertEquals("myusername", repo.getUser());
+ assertEquals(null, repo.getPassword());
+ assertEquals("myusername@myhost:1234/projecturl", repo.getUrl());
+ }
+ catch (ScmException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ public void testInvalidConnection()
+ {
+ try
+ {
+ StarteamRepository repo = new StarteamRepository();
+ repo.setDelimiter(":");
+ repo.setConnection("invalidConnectionString");
+ repo.parseConnection();
+ fail();
+ }
+ catch (ScmException e)
+ {
+ }
+ }
}
1.1 maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/AbstractStarteamCommandTest.java
Index: AbstractStarteamCommandTest.java
===================================================================
package org.apache.maven.genericscm.provider.starteam.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.starteam.repository.StarteamRepository;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: AbstractStarteamCommandTest.java,v 1.1 2003/12/09 21:30:31 evenisse Exp $
*/
public class AbstractStarteamCommandTest extends TestCase
{
private TestAbstractStarteamCommand cmd;
public AbstractStarteamCommandTest(String name)
{
super(name);
}
public void setUp() throws Exception
{
cmd = new TestAbstractStarteamCommand();
}
public void testSetValidRepository()
{
try
{
StarteamRepository repo = new StarteamRepository();
repo.setDelimiter(":");
repo.setConnection("myusername:mypassword@myhost:1234/projecturl");
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/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/StarteamCommandWrapperTest.java
Index: StarteamCommandWrapperTest.java
===================================================================
package org.apache.maven.genericscm.provider.starteam.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.starteam.repository.StarteamRepository;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: StarteamCommandWrapperTest.java,v 1.1 2003/12/09 21:30:31 evenisse Exp $
*/
public class StarteamCommandWrapperTest extends TestCase
{
private StarteamCommandWrapper wrapper;
public StarteamCommandWrapperTest(String testName)
{
super(testName);
}
public void setUp() throws Exception
{
wrapper = new StarteamCommandWrapper();
}
public void testSetValidRepository()
{
try
{
StarteamRepository repo = new StarteamRepository();
repo.setDelimiter(":");
repo.setConnection("myusername:mypassword@myhost:1234/projecturl");
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/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/TestAbstractStarteamCommand.java
Index: TestAbstractStarteamCommand.java
===================================================================
package org.apache.maven.genericscm.provider.starteam.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: TestAbstractStarteamCommand.java,v 1.1 2003/12/09 21:30:31 evenisse Exp $
*/
public class TestAbstractStarteamCommand extends AbstractStarteamCommand
{
public Commandline getCommandLine() throws ScmException
{
return null;
}
public String getName() throws Exception
{
return null;
}
public String getDisplayName()
{
return null;
}
}
1.1 maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java
Index: StarteamCheckOutCommandTest.java
===================================================================
package org.apache.maven.genericscm.provider.starteam.command.checkout;
/* ====================================================================
* 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.starteam.repository.StarteamRepository;
import org.apache.maven.genericscm.util.Commandline;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: StarteamCheckOutCommandTest.java,v 1.1 2003/12/09 21:30:31 evenisse Exp $
*/
public class StarteamCheckOutCommandTest extends TestCase
{
private String baseDir;
private StarteamRepository repo;
private StarteamCheckOutCommand cmd;
/**
* @param testName
*/
public StarteamCheckOutCommandTest(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 StarteamRepository();
repo.setDelimiter(":");
repo.setConnection("myusername:mypassword@myhost:1234/projecturl");
cmd = new StarteamCheckOutCommand();
cmd.setRepository(repo);
}
public void testGetDisplayNameName()
{
try
{
assertEquals("Check out", cmd.getDisplayName());
}
catch(Exception e)
{
fail();
}
}
public void testGetName()
{
try
{
assertEquals("checkout", cmd.getName());
}
catch(Exception e)
{
fail();
}
}
public void testGetCommandLineWithWorkingDirectory()
{
try
{
cmd.setWorkingDirectory(baseDir);
cmd.setTag("myTag");
Commandline cl = cmd.getCommandLine();
System.out.println(cl.toString());
assertEquals(
"stcmd co -x -nologo -is -p myusername:mypassword@myhost:1234/projecturl -vl myTag",
cl.toString());
}
catch(ScmException e)
{
fail(e.getMessage());
}
}
public void testGetCommandLineWithoutWorkingDirectory()
{
try
{
Commandline cl = cmd.getCommandLine();
System.out.println(cl.toString());
assertEquals(
"stcmd co -x -nologo -is -p myusername:mypassword@myhost:1234/projecturl",
cl.toString());
}
catch(ScmException e)
{
fail(e.getMessage());
}
}
}
1.1 maven-scm/generic-scm-providers/starteam/src/test/org/apache/maven/genericscm/provider/starteam/command/update/StarteamUpdateCommandTest.java
Index: StarteamUpdateCommandTest.java
===================================================================
package org.apache.maven.genericscm.provider.starteam.command.update;
/* ====================================================================
* 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.starteam.repository.StarteamRepository;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: StarteamUpdateCommandTest.java,v 1.1 2003/12/09 21:30:31 evenisse Exp $
*/
public class StarteamUpdateCommandTest extends TestCase
{
public StarteamUpdateCommandTest(String testName)
{
super(testName);
}
public void testGetDisplayNameName()
{
try
{
StarteamUpdateCommand cmd = new StarteamUpdateCommand();
assertEquals("Update", cmd.getDisplayName());
}
catch(Exception e)
{
fail();
}
}
public void testGetName()
{
try
{
StarteamUpdateCommand cmd = new StarteamUpdateCommand();
assertEquals("update", cmd.getName());
}
catch(Exception e)
{
fail();
}
}
}