use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class AccuRevAddCommandTest method testAddFailed.
@Test
public void testAddFailed() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(basedir, new File("src/main/java/Foo.java"));
final List<File> files = testFileSet.getFileList();
when(accurev.add(basedir, files, "A new file")).thenReturn(null);
AccuRevAddCommand command = new AccuRevAddCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.MESSAGE, "A new file");
AddScmResult result = command.add(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class BazaarAddCommand method executeAddCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeAddCommand(ScmProviderRepository repo, ScmFileSet fileSet, String message, boolean binary) throws ScmException {
String[] addCmd = new String[] { BazaarConstants.ADD_CMD, BazaarConstants.NO_RECURSE_OPTION };
addCmd = BazaarUtils.expandCommandLine(addCmd, fileSet);
File workingDir = fileSet.getBasedir();
BazaarAddConsumer consumer = new BazaarAddConsumer(getLogger(), workingDir);
ScmResult result = BazaarUtils.execute(consumer, getLogger(), workingDir, addCmd);
return new AddScmResult(consumer.getAddedFiles(), result);
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class BazaarScmProvider method add.
/**
* {@inheritDoc}
*/
public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
BazaarAddCommand command = new BazaarAddCommand();
command.setLogger(getLogger());
return (AddScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class TfsScmProvider method add.
public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsAddCommand command = new TfsAddCommand();
command.setLogger(getLogger());
return (AddScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class TfsAddCommand method executeAddCommand.
protected ScmResult executeAddCommand(ScmProviderRepository r, ScmFileSet f, String m, boolean b) throws ScmException {
TfsCommand command = createCommand(r, f);
FileListConsumer fileConsumer = new FileListConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(fileConsumer, err);
if (status != 0 || err.hasBeenFed()) {
return new AddScmResult(command.getCommandString(), "Error code for TFS add command - " + status, err.getOutput(), false);
}
return new AddScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Aggregations