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);
}
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);
}
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));
}
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"));
}
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());
}
Aggregations