use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevRemoveCommandTest method testAddFailed.
@Test
public void testAddFailed() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(basedir, new File("src/main/java/Foo.java"));
when(accurev.defunct(basedir, testFileSet.getFileList(), "A deleted file")).thenReturn(null);
AccuRevRemoveCommand command = new AccuRevRemoveCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.MESSAGE, "A deleted file");
RemoveScmResult result = command.remove(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevStatusCommandTest method testFailure.
@Test
public void testFailure() throws Exception {
final ScmFileSet testFileSet = getScmFileSet();
when(accurev.stat(basedir, testFileSet.getFileList(), AccuRevStat.MODIFIED)).thenReturn(null);
AccuRevStatusCommand command = new AccuRevStatusCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
StatusScmResult result = command.status(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.CommandParameters 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.CommandParameters in project maven-scm by apache.
the class AccurevUpdateCommandTest method testAccuRevFailure.
@Test
public void testAccuRevFailure() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(new File("/my/workspace/project/dir"));
final File basedir = testFileSet.getBasedir();
info.setWorkSpace("theWorkSpace");
when(accurev.update(eq(basedir), any(String.class))).thenReturn(null);
AccuRevUpdateCommand command = new AccuRevUpdateCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.RUN_CHANGELOG_WITH_UPDATE, Boolean.toString(false));
UpdateScmResult result = command.update(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.
the class AccuRevChangeLogCommandTest method testChangeLogToNow.
@Test
public void testChangeLogToNow() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(new File(basedir, "project/dir"));
// start tran (35)
List<Transaction> startTransaction = Collections.singletonList(new Transaction(35L, new Date(), "sometran", "anyone"));
when(accurev.history("aStream", "12", null, 1, true, true)).thenReturn(startTransaction);
// end tran (42)
List<Transaction> endTransaction = Collections.singletonList(new Transaction(42L, new Date(), "sometran", "anyone"));
when(accurev.history("aStream", "now", null, 1, true, true)).thenReturn(endTransaction);
Stream basisStream = new Stream("aStream", 10, "myDepot", 1, "myDepot", getDate(2008, 1, 1), "normal");
when(accurev.showStream("aStream")).thenReturn(basisStream);
List<FileDifference> emptyList = Collections.emptyList();
when(accurev.diff("myStream", "12", "42")).thenReturn(emptyList);
List<Transaction> noTransactions = Collections.emptyList();
when(accurev.history("aStream", "13", "42", 0, false, false)).thenReturn(noTransactions);
AccuRevChangeLogCommand command = new AccuRevChangeLogCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.START_SCM_VERSION, new ScmRevision("aStream/12"));
assertThat(command.changelog(repo, testFileSet, params), not(nullValue()));
}
Aggregations