Search in sources :

Example 1 with CommandParameters

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");
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmTag(org.apache.maven.scm.ScmTag) CommandParameters(org.apache.maven.scm.CommandParameters) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 2 with CommandParameters

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"));
}
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) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 3 with CommandParameters

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));
}
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 4 with CommandParameters

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());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmTag(org.apache.maven.scm.ScmTag) ExportScmResult(org.apache.maven.scm.command.export.ExportScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) File(java.io.File) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 5 with CommandParameters

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" ) );
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmTag(org.apache.maven.scm.ScmTag) ExportScmResult(org.apache.maven.scm.command.export.ExportScmResult) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) File(java.io.File) 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