Search in sources :

Example 61 with Commandline

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

the class JazzCheckInCommandTest method testCreateCheckInCommandCheckingInLocalChanges.

public void testCreateCheckInCommandCheckingInLocalChanges() throws Exception {
    JazzScmProviderRepository repo = getScmProviderRepository();
    Commandline cmd = new JazzCheckInCommand().createCheckInCommand(repo, new ScmFileSet(getWorkingDirectory())).getCommandline();
    String expected = "scm checkin --username myUserName --password myPassword .";
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) Commandline(org.codehaus.plexus.util.cli.Commandline) JazzScmProviderRepository(org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)

Example 62 with Commandline

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

the class JazzCheckInCommandTest method testCreateChangesetAssociateCommand.

public void testCreateChangesetAssociateCommand() throws Exception {
    JazzScmProviderRepository repo = getScmProviderRepository();
    // Populate the values that are normally parsed and set by the StatusConsumer.
    repo.setWorkItem("215762");
    Commandline cmd = new JazzCheckInCommand().createChangesetAssociateCommand(repo, new Integer(1234)).getCommandline();
    // Because we do not use a ScmFileSet, the working dir is not set, so the test fails.
    cmd.setWorkingDirectory(getWorkingDirectory());
    String expected = "scm changeset associate --username myUserName --password myPassword 1234 215762";
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) JazzScmProviderRepository(org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)

Example 63 with Commandline

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

the class ClearCaseTagCommandTest method testCommand.

public void testCommand() throws Exception {
    ScmFileSet scmFileSet = new ScmFileSet(getWorkingDirectory(), new File("test.java"));
    Commandline commandLine = ClearCaseTagCommand.createCommandLine(scmFileSet, "TEST_LABEL_V1.0");
    assertCommandLine("cleartool mklabel TEST_LABEL_V1.0 test.java", getWorkingDirectory(), commandLine);
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File)

Example 64 with Commandline

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

the class ClearCaseUpdateCommandTest method testCommand.

public void testCommand() throws Exception {
    ScmFileSet scmFileSet = new ScmFileSet(getWorkingDirectory());
    Commandline commandLine = ClearCaseUpdateCommand.createCommandLine(scmFileSet);
    assertCommandLine("cleartool update -f", getWorkingDirectory(), commandLine);
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) Commandline(org.codehaus.plexus.util.cli.Commandline)

Example 65 with Commandline

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

the class ClearCaseAddCommand method createCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
public static Commandline createCommandLine(ScmFileSet scmFileSet) {
    Commandline command = new Commandline();
    File workingDirectory = scmFileSet.getBasedir();
    command.setWorkingDirectory(workingDirectory.getAbsolutePath());
    command.setExecutable("cleartool");
    command.createArg().setValue("mkelem");
    command.createArg().setValue("-c");
    command.createArg().setValue("new file");
    command.createArg().setValue("-nco");
    for (File file : scmFileSet.getFileList()) {
        command.createArg().setValue(file.getName());
    }
    return command;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File)

Aggregations

Commandline (org.codehaus.plexus.util.cli.Commandline)446 File (java.io.File)133 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)117 ScmException (org.apache.maven.scm.ScmException)84 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)70 ScmRepository (org.apache.maven.scm.repository.ScmRepository)51 IOException (java.io.IOException)48 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 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)18 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 ScmFile (org.apache.maven.scm.ScmFile)13 CvsScmProviderRepository (org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository)13