Search in sources :

Example 1 with AccuRevScmProviderRepository

use of org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository in project maven-scm by apache.

the class AccuRevTagCommandTest method testAccuRevError.

@Test
public void testAccuRevError() throws Exception {
    final ScmFileSet testFileSet = new ScmFileSet(new File("/my/workspace/project/dir"));
    final File basedir = testFileSet.getBasedir();
    final String basisStream = "basisStream";
    final AccuRevInfo info = new AccuRevInfo(basedir);
    info.setBasis(basisStream);
    AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository();
    repo.setStreamName("myStream");
    repo.setAccuRev(accurev);
    repo.setProjectPath("/project/dir");
    when(accurev.info(basedir)).thenReturn(info);
    when(accurev.mksnap("theTagName", basisStream)).thenReturn(Boolean.FALSE);
    AccuRevTagCommand command = new AccuRevTagCommand(getLogger());
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString(CommandParameter.TAG_NAME, "theTagName");
    TagScmResult result = command.tag(repo, testFileSet, commandParameters);
    assertThat(result.isSuccess(), is(false));
    assertThat(result.getProviderMessage(), notNullValue());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) AccuRevScmProviderRepository(org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository) CommandParameters(org.apache.maven.scm.CommandParameters) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) AccuRevInfo(org.apache.maven.scm.provider.accurev.AccuRevInfo) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 2 with AccuRevScmProviderRepository

use of org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository in project maven-scm by apache.

the class AbstractAccuRevCommand method executeCommand.

protected final ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    if (!(repository instanceof AccuRevScmProviderRepository)) {
        throw new ScmException("Not an AccuRev repository " + repository);
    }
    AccuRevScmProviderRepository accuRevRepository = (AccuRevScmProviderRepository) repository;
    accuRevRepository.getAccuRev().reset();
    try {
        return executeAccurevCommand(accuRevRepository, fileSet, parameters);
    } catch (AccuRevException e) {
        throw new ScmException("Error invoking AccuRev command", e);
    }
}
Also used : ScmException(org.apache.maven.scm.ScmException) AccuRevException(org.apache.maven.scm.provider.accurev.AccuRevException) AccuRevScmProviderRepository(org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository)

Example 3 with AccuRevScmProviderRepository

use of org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository in project maven-scm by apache.

the class AccuRevTagCommandTest method testTag.

@Test
public void testTag() throws Exception {
    final ScmFileSet testFileSet = new ScmFileSet(new File("/my/workspace/project/dir"));
    final File basedir = testFileSet.getBasedir();
    final String basisStream = "basisStream";
    final AccuRevInfo info = new AccuRevInfo(basedir);
    info.setBasis(basisStream);
    AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository();
    repo.setStreamName("myStream");
    repo.setAccuRev(accurev);
    repo.setProjectPath("/project/dir");
    when(accurev.info(basedir)).thenReturn(info);
    when(accurev.mksnap("theTagName", basisStream)).thenReturn(Boolean.TRUE);
    List<File> taggedFiles = Collections.singletonList(new File("tagged/file"));
    when(accurev.statTag("theTagName")).thenReturn(taggedFiles);
    AccuRevTagCommand command = new AccuRevTagCommand(getLogger());
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString(CommandParameter.TAG_NAME, "theTagName");
    TagScmResult result = command.tag(repo, testFileSet, commandParameters);
    assertThat(result.isSuccess(), is(true));
    assertThat(result.getTaggedFiles().size(), is(1));
    assertHasScmFile(result.getTaggedFiles(), "tagged/file", ScmFileStatus.TAGGED);
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) AccuRevScmProviderRepository(org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository) CommandParameters(org.apache.maven.scm.CommandParameters) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult) File(java.io.File) ScmFileMatcher.assertHasScmFile(org.apache.maven.scm.ScmFileMatcher.assertHasScmFile) AccuRevInfo(org.apache.maven.scm.provider.accurev.AccuRevInfo) Test(org.junit.Test) AbstractAccuRevCommandTest(org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)

Example 4 with AccuRevScmProviderRepository

use of org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository in project maven-scm by apache.

the class AccuRevTckUtil method getAccuRevCL.

public AccuRevCommandLine getAccuRevCL() throws Exception {
    if (accurevCL == null) {
        AccuRevScmProvider provider = new AccuRevScmProvider();
        provider.addListener(getLogger());
        AccuRevScmProviderRepository repo = (AccuRevScmProviderRepository) provider.makeProviderScmRepository(getScmUrl(), ':');
        getLogger().debug(repo.toString());
        accurevCL = (AccuRevCommandLine) repo.getAccuRev();
        if (!StringUtils.isEmpty(repo.getUser())) {
            accurevCL.login(repo.getUser(), repo.getPassword());
        }
    }
    return accurevCL;
}
Also used : AccuRevScmProvider(org.apache.maven.scm.provider.accurev.AccuRevScmProvider) AccuRevScmProviderRepository(org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository)

Aggregations

AccuRevScmProviderRepository (org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository)4 File (java.io.File)2 CommandParameters (org.apache.maven.scm.CommandParameters)2 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)2 ScmFileSet (org.apache.maven.scm.ScmFileSet)2 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)2 AccuRevInfo (org.apache.maven.scm.provider.accurev.AccuRevInfo)2 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)2 Test (org.junit.Test)2 ScmException (org.apache.maven.scm.ScmException)1 AccuRevException (org.apache.maven.scm.provider.accurev.AccuRevException)1 AccuRevScmProvider (org.apache.maven.scm.provider.accurev.AccuRevScmProvider)1