Search in sources :

Example 6 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AccuRevCommandLineTest method testRemove.

@SuppressWarnings("unchecked")
@Test
public void testRemove() throws Exception {
    AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester();
    List<File> files = new ArrayList<File>();
    File testFile = new File("my/test/file");
    files.add(testFile);
    File workspaceFile = new File("/workspace");
    assertThat(accuRevCL.defunct(workspaceFile, files, "my commit message"), not(nullValue()));
    Commandline lastCL = accuRevCL.getCommandline();
    assertThat(lastCL.getWorkingDirectory(), is(workspaceFile.getCanonicalFile()));
    assertThat(lastCL.getArguments(), is(new String[] { "defunct", "-c", "my commit message", testFile.getPath() }));
    assertThat(accuRevCL.defunct(workspaceFile, files, ""), not(nullValue()));
    assertThat(lastCL.getArguments(), is(new String[] { "defunct", "-c", AccuRev.DEFAULT_REMOVE_MESSAGE, testFile.getPath() }));
    assertThat(accuRevCL.defunct(workspaceFile, Collections.EMPTY_LIST, ""), not(nullValue()));
    assertThat(lastCL.getArguments(), is(new String[] { "defunct", "-c", AccuRev.DEFAULT_REMOVE_MESSAGE, "." }));
    assertThat(accuRevCL.defunct(workspaceFile, null, ""), not(nullValue()));
    assertThat(lastCL.getArguments(), is(new String[] { "defunct", "-c", AccuRev.DEFAULT_REMOVE_MESSAGE, "." }));
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ArrayList(java.util.ArrayList) File(java.io.File) Test(org.junit.Test)

Example 7 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AccuRevCommandLineTest method testAdd.

@Test
public void testAdd() throws Exception {
    AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester();
    List<File> files = new ArrayList<File>();
    File testFile = new File("my/test/file");
    files.add(testFile);
    assertThat(accuRevCL.add(new File("/workspace"), files, "my commit message"), not(nullValue()));
    Commandline lastCL = accuRevCL.getCommandline();
    assertThat(lastCL.getWorkingDirectory(), is(new File("/workspace").getCanonicalFile()));
    assertThat(lastCL.getArguments(), is(new String[] { "add", "-c", "my commit message", testFile.getPath() }));
    assertThat(accuRevCL.add(new File("/workspace"), files, ""), not(nullValue()));
    assertThat(lastCL.getArguments(), is(new String[] { "add", "-c", AccuRev.DEFAULT_ADD_MESSAGE, testFile.getPath() }));
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ArrayList(java.util.ArrayList) File(java.io.File) Test(org.junit.Test)

Example 8 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AccuRevCommandLineTest method testPromoteAll.

@Test
public void testPromoteAll() throws Exception {
    AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester();
    assertThat(accuRevCL.promoteAll(new File("/my/workspace"), "cmt msg"), not(nullValue()));
    Commandline lastCL = accuRevCL.getCommandline();
    assertThat(lastCL.getWorkingDirectory(), is(new File("/my/workspace").getCanonicalFile()));
    assertThat(lastCL.getArguments(), is(new String[] { "promote", "-p", "-K", "-c", "cmt msg" }));
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Test(org.junit.Test)

Example 9 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AccuRevCommandLineTest method testMkws.

@Test
public void testMkws() throws Exception {
    AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester();
    accuRevCL.setExecutable("accurev2.exe");
    File workspaceFile = new File("/my/workspace/location");
    accuRevCL.mkws("myStream", "myWorkSpaceName", workspaceFile);
    Commandline lastCL = accuRevCL.getCommandline();
    assertThat(lastCL.getExecutable(), is("accurev2.exe"));
    assertThat(lastCL.getWorkingDirectory(), is(workspaceFile.getCanonicalFile()));
    assertThat(lastCL.getArguments(), is(new String[] { "mkws", "-b", "myStream", "-w", "myWorkSpaceName", "-l", workspaceFile.getAbsolutePath() }));
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Test(org.junit.Test)

Example 10 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AccuRevCommandLineTest method testInfo.

@Test
public void testInfo() throws Exception {
    AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester();
    accuRevCL.info(new File("/my/base/dir"));
    Commandline lastCL = accuRevCL.getCommandline();
    assertThat(lastCL.getWorkingDirectory(), is(new File("/my/base/dir").getCanonicalFile()));
    assertThat(lastCL.getArguments(), is(new String[] { "info" }));
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Test(org.junit.Test)

Aggregations

Commandline (org.codehaus.plexus.util.cli.Commandline)443 File (java.io.File)131 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)116 ScmException (org.apache.maven.scm.ScmException)84 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)67 ScmRepository (org.apache.maven.scm.repository.ScmRepository)51 IOException (java.io.IOException)45 ScmFileSet (org.apache.maven.scm.ScmFileSet)34 Test (org.junit.Test)28 StringStreamConsumer (org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer)26 ArrayList (java.util.ArrayList)22 StarteamScmProviderRepository (org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)22 PerforceScmProviderRepository (org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository)19 SvnCommandLineUtils (org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils)17 GitCommandLineUtils (org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils)16 GitScmProviderRepository (org.apache.maven.scm.provider.git.repository.GitScmProviderRepository)16 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)16 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)15 ScmFile (org.apache.maven.scm.ScmFile)13 CvsScmProviderRepository (org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository)13