Search in sources :

Example 41 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class AbstractScmProvider method branch.

public BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName, ScmBranchParameters scmBranchParameters) throws ScmException {
    login(repository, fileSet);
    CommandParameters parameters = new CommandParameters();
    parameters.setString(CommandParameter.BRANCH_NAME, branchName);
    parameters.setScmBranchParameters(CommandParameter.SCM_BRANCH_PARAMETERS, scmBranchParameters);
    return branch(repository.getProviderRepository(), fileSet, parameters);
}
Also used : CommandParameters(org.apache.maven.scm.CommandParameters)

Example 42 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class AccuRevCheckOutCommandTest method testCheckout.

@Test
public void testCheckout() throws Exception {
    when(accurev.mkws("myStream", AccuRevCheckOutCommand.getWorkSpaceName(basedir, "myStream"), basedir)).thenReturn(true);
    List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
    when(accurev.update(basedir, "now")).thenReturn(updatedFiles);
    AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
    CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), new CommandParameters());
    assertThat(result.isSuccess(), is(true));
    assertThat(result.getRelativePathProjectDirectory(), is("/project/dir"));
    List<ScmFile> checkedOutFiles = result.getCheckedOutFiles();
    assertThat(checkedOutFiles.size(), is(1));
    assertHasScmFile(checkedOutFiles, "updated/file", ScmFileStatus.CHECKED_OUT);
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) ScmFile(org.apache.maven.scm.ScmFile) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 43 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class AccuRevCheckOutCommandTest method testCheckoutToVersionNewWorkspace.

@Test
public void testCheckoutToVersionNewWorkspace() throws Exception {
    when(accurev.mkws("anotherStream", AccuRevCheckOutCommand.getWorkSpaceName(basedir, "anotherStream"), basedir)).thenReturn(true);
    List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
    when(accurev.update(basedir, "now")).thenReturn(updatedFiles);
    AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
    CommandParameters parameters = new CommandParameters();
    parameters.setScmVersion(CommandParameter.SCM_VERSION, new ScmRevision("anotherStream/12"));
    CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), parameters);
    assertThat(result.isSuccess(), is(true));
    assertThat(result.getCheckedOutFiles().size(), is(1));
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmRevision(org.apache.maven.scm.ScmRevision) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 44 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class AccuRevCheckOutCommandTest method testReCheckoutExistingWorkspaceDifferentBasis.

@Test
public void testReCheckoutExistingWorkspaceDifferentBasis() throws Exception {
    // Set the info result to return a workspace that already exists
    info.setWorkSpace("someOldStream_someUser");
    info.setBasis("myStream");
    info.setTop(basedir.getAbsolutePath());
    when(accurev.chws(basedir, "someOldStream_someUser", "mySnapShot")).thenReturn(true);
    List<File> emptyPop = Collections.emptyList();
    when(accurev.popExternal(basedir, null, null, null)).thenReturn(emptyPop);
    List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
    when(accurev.update(basedir, null)).thenReturn(updatedFiles);
    AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
    CommandParameters params = new CommandParameters();
    params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot"));
    CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), params);
    verify(accurev).chws(basedir, "someOldStream_someUser", "mySnapShot");
    assertThat(result.isSuccess(), is(true));
    assertThat(result.getRelativePathProjectDirectory(), is("/project/dir"));
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmTag(org.apache.maven.scm.ScmTag) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 45 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class AccuRevCheckOutCommandTest method testCheckoutFailure.

@Test
public void testCheckoutFailure() throws Exception {
    when(accurev.mkws("myStream", AccuRevCheckOutCommand.getWorkSpaceName(basedir, "myStream"), basedir)).thenReturn(true);
    when(accurev.update(basedir, "now")).thenReturn(null);
    AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
    CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), new CommandParameters());
    assertThat(result.isSuccess(), is(false));
    assertThat(result.getProviderMessage(), notNullValue());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Aggregations

CommandParameters (org.apache.maven.scm.CommandParameters)68 ScmFileSet (org.apache.maven.scm.ScmFileSet)44 File (java.io.File)39 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)38 Test (org.junit.Test)38 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)23 ScmFile (org.apache.maven.scm.ScmFile)8 ScmTag (org.apache.maven.scm.ScmTag)7 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)7 Date (java.util.Date)6 ChangeFile (org.apache.maven.scm.ChangeFile)5 ChangeFileMatcher.changeFile (org.apache.maven.scm.ChangeFileMatcher.changeFile)5 ScmRevision (org.apache.maven.scm.ScmRevision)5 ExportScmResult (org.apache.maven.scm.command.export.ExportScmResult)5 InfoScmResult (org.apache.maven.scm.command.info.InfoScmResult)5 LoginScmResult (org.apache.maven.scm.command.login.LoginScmResult)5 AccuRevInfo (org.apache.maven.scm.provider.accurev.AccuRevInfo)5 Transaction (org.apache.maven.scm.provider.accurev.Transaction)5 ArrayList (java.util.ArrayList)4 ScmException (org.apache.maven.scm.ScmException)4