use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class AccuRevTagCommand method executeAccurevCommand.
@Override
protected ScmResult executeAccurevCommand(AccuRevScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException, AccuRevException {
AccuRev accuRev = repository.getAccuRev();
String snapshotName = parameters.getString(CommandParameter.TAG_NAME);
snapshotName = repository.getSnapshotName(snapshotName);
File basedir = fileSet.getBasedir();
boolean success = true;
AccuRevInfo info = accuRev.info(basedir);
List<File> taggedFiles = null;
success = accuRev.mksnap(snapshotName, info.getBasis());
if (success) {
taggedFiles = accuRev.statTag(snapshotName);
}
if (success && taggedFiles != null) {
return new TagScmResult(accuRev.getCommandLines(), getScmFiles(taggedFiles, ScmFileStatus.TAGGED));
} else {
return new TagScmResult(accuRev.getCommandLines(), "AccuRev error", accuRev.getErrorOutput(), false);
}
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo 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.AccuRevInfo in project maven-scm by apache.
the class AbstractAccuRevCommandTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
logger = AccuRevJUnitUtil.getLogger(getContainer());
basedir = getWorkingCopy();
sequence = inOrder(accurev);
info = new AccuRevInfo(basedir);
info.setUser("me");
when(accurev.getCommandLines()).thenReturn("accurev mock");
when(accurev.getErrorOutput()).thenReturn("accurev mock error output");
when(accurev.getClientVersion()).thenReturn("4.9.0");
when(accurev.showStream("myStream")).thenReturn(new Stream("myStream", 10L, "myDepot", 1L, "myDepot", new Date(), "normal"));
when(accurev.info(null)).thenReturn(info);
when(accurev.info(basedir)).thenReturn(info);
repo.setLogger(getLogger());
repo.setStreamName("myStream");
repo.setAccuRev(accurev);
repo.setProjectPath("/project/dir");
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class AccuRevCheckInCommandTest method testCheckInRecursive.
@Test
public void testCheckInRecursive() throws Exception {
// Setup test data so that the checkin area is the repo's project path.
final ScmFileSet testFileSet = new ScmFileSet(new File(basedir, "project/dir"));
final File basedir = testFileSet.getBasedir();
final AccuRevInfo info = new AccuRevInfo(basedir);
info.setTop(basedir.getAbsolutePath());
when(accurev.info(basedir)).thenReturn(info);
List<File> promotedFiles = Arrays.asList(new File("kept/file"), new File("promoted/file"));
when(accurev.promoteAll(basedir, "A commit message")).thenReturn(promotedFiles);
AccuRevCheckInCommand command = new AccuRevCheckInCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.MESSAGE, "A commit message");
CheckInScmResult result = command.checkIn(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(true));
assertThat(result.getCheckedInFiles().size(), is(2));
assertHasScmFile(result.getCheckedInFiles(), "kept/file", ScmFileStatus.CHECKED_IN);
assertHasScmFile(result.getCheckedInFiles(), "promoted/file", ScmFileStatus.CHECKED_IN);
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class AccuRevCheckInCommandTest method testCheckinRecursiveSubDirectoryNotSupported.
@Test(expected = ScmException.class)
public void testCheckinRecursiveSubDirectoryNotSupported() throws AccuRevException, ScmException {
final ScmFileSet testFileSet = new ScmFileSet(basedir);
final AccuRevInfo info = new AccuRevInfo(basedir);
info.setTop(basedir.getParent());
// TODO test basedir is top + project path. is OK.
when(accurev.info(basedir)).thenReturn(info);
AccuRevCheckInCommand command = new AccuRevCheckInCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.MESSAGE, "Commit message");
command.checkIn(repo, testFileSet, commandParameters);
fail("Expected ScmException");
}
Aggregations