use of org.apache.maven.scm.provider.accurev.AccuRevInfo 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.AccuRevInfo in project maven-scm by apache.
the class AccuRevCheckInCommandTest method testCheckInFailure.
@Test
public void testCheckInFailure() 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);
when(accurev.promoteAll(basedir, "A commit message")).thenReturn(null);
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(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class AccuRevTckUtil method removeWorkSpace.
public void removeWorkSpace(File basedir) throws Exception {
try {
assertLoggedInOK();
} catch (AssertionError e) {
return;
}
if (basedir.exists()) {
AccuRevInfo bdInfo = accurevCL.info(basedir);
if (bdInfo.isWorkSpaceTop()) {
accurevCL.promoteAll(basedir, "clear default group");
accurevCL.rmws(bdInfo.getWorkSpace());
}
}
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class AccuRevCheckOutCommand method extractSource.
@Override
protected List<File> extractSource(AccuRevScmProviderRepository repository, File basedir, AccuRevVersion version) throws AccuRevException {
AccuRev accuRev = repository.getAccuRev();
AccuRevInfo info = accuRev.info(basedir);
List<File> extractedFiles = new ArrayList<File>();
String basisStream = version.getBasisStream();
String transactionId = version.getTimeSpec();
boolean success = true;
if (info.isWorkSpace()) {
if (!repository.isWorkSpaceTop(info)) {
throw new AccuRevException(String.format("Can't checkout to %s, " + "a subdirectory of existing workspace %s", basedir, info.getWorkSpace()));
}
// workspace exists at this basedir already.
if (!basisStream.equals(info.getBasis())) {
// different basis, reparent.
success = accuRev.chws(basedir, info.getWorkSpace(), basisStream);
}
if (success) {
// repopulate everything in the workspace.
// note we do NOT want -t here, we just fill in any missing files
// to the current transaction watermark...
// the update later on will get the extra files
List<File> poppedFiles = accuRev.pop(basedir, null);
if (poppedFiles != null) {
extractedFiles.addAll(poppedFiles);
} else {
success = false;
}
}
} else {
// not a workspace, make one...
// TODO set incl rules to only include the projectPath
// TODO somehow set provider message (via throw exception?
// if basisStream is null
String workSpaceName = getWorkSpaceName(basedir, basisStream);
success = accuRev.mkws(basisStream, workSpaceName, basedir);
// Even though a new workspace starts with "0" as the high water mark
// it can't be updated to anything less than its own mkstream transaction
// now is close enough since even if something does sneak inbetween we
// were just lucky that it didn't happen before...
transactionId = "now";
if (success) {
getLogger().info("Created workspace " + workSpaceName);
}
}
if (success) {
List<File> updatedFiles = accuRev.update(basedir, transactionId);
if (updatedFiles != null) {
extractedFiles.addAll(updatedFiles);
} else {
success = false;
}
}
return success ? extractedFiles : null;
}
use of org.apache.maven.scm.provider.accurev.AccuRevInfo in project maven-scm by apache.
the class InfoConsumerTest method consume.
private AccuRevInfo consume(String resource) throws IOException {
AccuRevInfo info = new AccuRevInfo(new File("/my/project/dir"));
StreamConsumer consumer = new InfoConsumer(info);
BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(resource)));
String line = reader.readLine();
while (line != null) {
consumer.consumeLine(line);
line = reader.readLine();
}
return info;
}
Aggregations