Search in sources :

Example 1 with IntegrityEditCommand

use of org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand in project maven-scm by apache.

the class IntegrityScmProvider method edit.

/**
 * Maps to si makewritable
 */
@Override
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
    IntegrityEditCommand command = new IntegrityEditCommand();
    command.setLogger(getLogger());
    return (EditScmResult) command.execute(repository, fileSet, params);
}
Also used : UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) IntegrityEditCommand(org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand)

Example 2 with IntegrityEditCommand

use of org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand in project maven-scm by apache.

the class IntegrityCheckInCommandTest method testCheckInCommandTest.

/**
 * Executes the IntegrityCheckInCommand and validates the result
 *
 * @throws Exception
 */
public void testCheckInCommandTest() throws Exception {
    // First we need to make the workspace writable
    IntegrityEditCommand edit = new IntegrityEditCommand();
    edit.setLogger(logger);
    assertResultIsSuccess(edit.execute(iRepo, fileSet, parameters));
    // Now lets add something to the file we added in the add test
    String nl = System.getProperty("line.separator");
    BufferedWriter bw = new BufferedWriter(new FileWriter(fileSet.getBasedir() + File.separator + fileName, true));
    bw.write(nl + nl + "A new change appended to file by the check-in command test" + nl);
    bw.flush();
    bw.close();
    // Set the message parameter required for the check-in command to work
    parameters.setString(CommandParameter.MESSAGE, "Attempting change to an existing file " + fileName);
    // Now execute the check-in command and validate the results
    IntegrityCheckInCommand checkin = new IntegrityCheckInCommand();
    checkin.setLogger(logger);
    assertResultIsSuccess(checkin.execute(iRepo, fileSet, parameters));
}
Also used : FileWriter(java.io.FileWriter) IntegrityEditCommand(org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand) BufferedWriter(java.io.BufferedWriter)

Aggregations

IntegrityEditCommand (org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand)2 BufferedWriter (java.io.BufferedWriter)1 FileWriter (java.io.FileWriter)1 EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)1 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)1