use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevCheckOutCommandTest method testReCheckoutSubdirectoryOfExistingWorkspaceThrowsException.
@Test(expected = ScmException.class)
public void testReCheckoutSubdirectoryOfExistingWorkspaceThrowsException() throws Exception {
// Set the info result to return a workspace that already exists
info.setWorkSpace("someOldStream_someUser");
info.setBasis("myStream");
info.setTop(basedir.getParentFile().getAbsolutePath());
AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot"));
command.checkout(repo, new ScmFileSet(basedir), params);
fail("Expected exception");
}
use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevCheckOutCommandTest method testReCheckoutExistingWorkspaceSameBasis.
@Test
public void testReCheckoutExistingWorkspaceSameBasis() throws Exception {
// Set the info result to return a workspace that already exists
info.setWorkSpace("someOldStream_someUser");
info.setBasis("myStream");
info.setTop(basedir.getAbsolutePath());
List<File> emptyList = Collections.emptyList();
when(accurev.pop(basedir, null)).thenReturn(emptyList);
List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
when(accurev.update(basedir, null)).thenReturn(updatedFiles);
AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), new CommandParameters());
verify(accurev).pop(basedir, null);
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 testCheckoutToVersionExistingWorkspace.
@Test
public void testCheckoutToVersionExistingWorkspace() throws Exception {
// Set the info result to return a workspace that already exists
info.setWorkSpace("someOldStream_someUser");
info.setBasis("myStream");
info.setTop(basedir.getAbsolutePath());
List<File> emptyList = Collections.emptyList();
when(accurev.pop(basedir, null)).thenReturn(emptyList);
List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
when(accurev.update(basedir, "12")).thenReturn(updatedFiles);
AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
CommandParameters parameters = new CommandParameters();
parameters.setScmVersion(CommandParameter.SCM_VERSION, new ScmRevision("myStream/12"));
CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), parameters);
verify(accurev).pop(basedir, null);
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 AccuRevExportCommandTest method testExportFailure.
@Test
public void testExportFailure() throws Exception {
// info defaults to no workspace...
info.setWorkSpace(null);
when(accurev.info(basedir)).thenReturn(info);
when(accurev.getClientVersion()).thenReturn("4.9.0");
when(accurev.popExternal(eq(basedir), eq("mySnapShot"), eq("544"), (Collection<File>) argThat(hasItem(new File("/./project/dir"))))).thenReturn(null);
AccuRevExportCommand command = new AccuRevExportCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot/544"));
ExportScmResult result = command.export(repo, new ScmFileSet(basedir), params);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevExportCommandTest method testNonPersistentWithinExistingWorkspace.
@Test
public void testNonPersistentWithinExistingWorkspace() throws Exception {
// Setup info to return a stream rooted somewhere around here...
info.setWorkSpace("myStream_me");
info.setBasis("someStream");
info.setTop(basedir.getParent());
when(accurev.info(basedir)).thenReturn(info);
when(accurev.stat(basedir)).thenReturn(null);
when(accurev.rmws("myStream_me")).thenReturn(Boolean.TRUE);
List<File> poppedFiles = Collections.singletonList(new File("exported/file"));
when(accurev.popExternal(eq(basedir), eq("mySnapShot"), eq("now"), (Collection<File>) argThat(hasItem(new File("/./project/dir"))))).thenReturn(poppedFiles);
when(accurev.reactivate("myStream_me")).thenReturn(Boolean.TRUE);
repo.setPersistCheckout(true);
AccuRevExportCommand command = new AccuRevExportCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot"));
ExportScmResult result = command.export(repo, new ScmFileSet(basedir), params);
verify(accurev).rmws("myStream_me");
verify(accurev).reactivate("myStream_me");
assertTrue(result.isSuccess());
// TODO - raise JIRA to move relative path dir to repository rather than checkout result
// dassertThat( result.getRelativePathProjectDirectory(), is( "/project/dir" ) );
}
Aggregations