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