Search in sources :

Example 6 with MkdirScmResult

use of org.apache.maven.scm.command.mkdir.MkdirScmResult in project maven-scm by apache.

the class MkdirCommandTckTest method testMkdirCommandMkdirLocal.

public void testMkdirCommandMkdirLocal() throws Exception {
    ScmFileSet fileSet = new ScmFileSet(getWorkingCopy(), new File(getMissingDirectory()));
    MkdirScmResult result = getScmManager().mkdir(getScmRepository(), fileSet, null, true);
    assertResultIsSuccess(result);
    assertNotNull(result.getCreatedDirs());
    assertTrue("Directory should have been added.", 1 == result.getCreatedDirs().size());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) File(java.io.File)

Example 7 with MkdirScmResult

use of org.apache.maven.scm.command.mkdir.MkdirScmResult in project maven-scm by apache.

the class SvnMkdirCommandTckTest method testMkdirCommandDirAlreadyAdded.

public void testMkdirCommandDirAlreadyAdded() throws Exception {
    ScmFileSet fileSet = new ScmFileSet(getWorkingCopy(), new File(getMissingDirectory()));
    MkdirScmResult result = getScmManager().mkdir(getScmRepository(), fileSet, null, false);
    assertResultIsSuccess(result);
    assertNotNull(result.getRevision());
    ListScmResult listResult = getScmManager().list(getScmRepository(), fileSet, true, null);
    assertTrue("Directory should have been found.", listResult.isSuccess());
    // add the directory again
    result = getScmManager().mkdir(getScmRepository(), fileSet, null, false);
    printOutputError(result);
    assertFalse(result.isSuccess());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) File(java.io.File)

Example 8 with MkdirScmResult

use of org.apache.maven.scm.command.mkdir.MkdirScmResult in project maven-scm by apache.

the class SvnMkdirCommandTckTest method testMkdirCommandMkdirUrl.

public void testMkdirCommandMkdirUrl() throws Exception {
    ScmFileSet fileSet = new ScmFileSet(getWorkingCopy(), new File(getMissingDirectory()));
    MkdirScmResult result = getScmManager().mkdir(getScmRepository(), fileSet, "Mkdir message", false);
    assertResultIsSuccess(result);
    assertNotNull(result.getRevision());
    ListScmResult listResult = getScmManager().list(getScmRepository(), fileSet, true, null);
    assertTrue("Directory should have been found.", listResult.isSuccess());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) File(java.io.File)

Example 9 with MkdirScmResult

use of org.apache.maven.scm.command.mkdir.MkdirScmResult in project maven-scm by apache.

the class IntegrityScmProvider method mkdir.

/**
 * Maps to si createsubproject
 */
@Override
protected MkdirScmResult mkdir(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
    IntegrityMkdirCommand command = new IntegrityMkdirCommand();
    command.setLogger(getLogger());
    return (MkdirScmResult) command.execute(repository, fileSet, params);
}
Also used : IntegrityMkdirCommand(org.apache.maven.scm.provider.integrity.command.mkdir.IntegrityMkdirCommand) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult)

Example 10 with MkdirScmResult

use of org.apache.maven.scm.command.mkdir.MkdirScmResult in project maven-scm by apache.

the class AbstractCvsMkdirCommand method executeMkdirCommand.

/**
 * {@inheritDoc}
 */
protected MkdirScmResult executeMkdirCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean createInLocal) throws ScmException {
    CommandParameters parameters = new CommandParameters();
    parameters.setString(CommandParameter.MESSAGE, message == null ? "" : message);
    parameters.setString(CommandParameter.BINARY, "false");
    // just invoke add command
    Command cmd = getAddCommand();
    cmd.setLogger(getLogger());
    ScmResult addResult = cmd.execute(repository, fileSet, parameters);
    if (!addResult.isSuccess()) {
        return new MkdirScmResult(addResult.getCommandLine().toString(), "The cvs command failed.", addResult.getCommandOutput(), false);
    }
    List<ScmFile> addedFiles = new ArrayList<ScmFile>();
    for (File file : fileSet.getFileList()) {
        ScmFile scmFile = new ScmFile(file.getPath(), ScmFileStatus.ADDED);
        addedFiles.add(scmFile);
    }
    return new MkdirScmResult(addResult.getCommandLine().toString(), addedFiles);
}
Also used : MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ScmResult(org.apache.maven.scm.ScmResult) AbstractMkdirCommand(org.apache.maven.scm.command.mkdir.AbstractMkdirCommand) Command(org.apache.maven.scm.command.Command) MkdirScmResult(org.apache.maven.scm.command.mkdir.MkdirScmResult) ArrayList(java.util.ArrayList) CommandParameters(org.apache.maven.scm.CommandParameters) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

MkdirScmResult (org.apache.maven.scm.command.mkdir.MkdirScmResult)11 File (java.io.File)9 ScmFileSet (org.apache.maven.scm.ScmFileSet)5 ListScmResult (org.apache.maven.scm.command.list.ListScmResult)4 ArrayList (java.util.ArrayList)3 ScmFile (org.apache.maven.scm.ScmFile)3 CommandParameters (org.apache.maven.scm.CommandParameters)2 ScmException (org.apache.maven.scm.ScmException)2 ScmResult (org.apache.maven.scm.ScmResult)2 APIException (com.mks.api.response.APIException)1 Response (com.mks.api.response.Response)1 IOException (java.io.IOException)1 Command (org.apache.maven.scm.command.Command)1 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)1 AbstractMkdirCommand (org.apache.maven.scm.command.mkdir.AbstractMkdirCommand)1 ExceptionHandler (org.apache.maven.scm.provider.integrity.ExceptionHandler)1 IntegrityMkdirCommand (org.apache.maven.scm.provider.integrity.command.mkdir.IntegrityMkdirCommand)1 IntegrityScmProviderRepository (org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository)1 LocalAddCommand (org.apache.maven.scm.provider.local.command.add.LocalAddCommand)1 LocalMkdirCommand (org.apache.maven.scm.provider.local.command.mkdir.LocalMkdirCommand)1