Search in sources :

Example 26 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ClearCaseEditConsumerTest method testConsumer.

public void testConsumer() throws IOException {
    InputStream inputStream = getResourceAsStream("/clearcase/edit/edit.txt");
    BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
    String s = in.readLine();
    ClearCaseEditConsumer consumer = new ClearCaseEditConsumer(new DefaultLog());
    while (s != null) {
        consumer.consumeLine(s);
        s = in.readLine();
    }
    Collection<ScmFile> entries = consumer.getEditFiles();
    assertEquals("Wrong number of entries returned", 1, entries.size());
    ScmFile scmFile = (ScmFile) entries.iterator().next();
    assertEquals("test.java", scmFile.getPath());
    assertEquals(ScmFileStatus.EDITED, scmFile.getStatus());
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader) ScmFile(org.apache.maven.scm.ScmFile)

Example 27 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ClearCaseStatusConsumerTest method testConsumer.

public void testConsumer() throws IOException {
    InputStream inputStream = getResourceAsStream("/clearcase/status/status.txt");
    BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
    String s = in.readLine();
    ClearCaseStatusConsumer consumer = new ClearCaseStatusConsumer(new DefaultLog(), getWorkingDirectory());
    while (s != null) {
        consumer.consumeLine(s);
        s = in.readLine();
    }
    Collection<ScmFile> entries = consumer.getCheckedOutFiles();
    assertEquals("Wrong number of entries returned", 1, entries.size());
    ScmFile scmFile = entries.iterator().next();
    String scmFilePath = StringUtils.replace(scmFile.getPath(), "\\", File.separator);
    assertEquals(new File(getWorkingDirectory(), "test.java").getAbsolutePath(), scmFilePath);
    assertEquals(ScmFileStatus.CHECKED_OUT, scmFile.getStatus());
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) ScmFile(org.apache.maven.scm.ScmFile)

Example 28 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ClearCaseTagConsumerTest method testConsumer.

public void testConsumer() throws IOException {
    InputStream inputStream = getResourceAsStream("/clearcase/tag/tag.txt");
    BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
    String s = in.readLine();
    ClearCaseTagConsumer consumer = new ClearCaseTagConsumer(new DefaultLog());
    while (s != null) {
        consumer.consumeLine(s);
        s = in.readLine();
    }
    Collection<ScmFile> entries = consumer.getTaggedFiles();
    assertEquals("Wrong number of entries returned", 1, entries.size());
    ScmFile scmFile = entries.iterator().next();
    assertEquals("test.java", scmFile.getPath());
    assertEquals(ScmFileStatus.TAGGED, scmFile.getStatus());
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader) ScmFile(org.apache.maven.scm.ScmFile)

Example 29 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ClearCaseUnEditConsumer method consumeLine.

// ----------------------------------------------------------------------
// Stream Consumer Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
public void consumeLine(String line) {
    if (logger.isDebugEnabled()) {
        logger.debug(line);
    }
    if (line.indexOf("Checkout cancelled") > -1) {
        int beginIndex = line.indexOf('"');
        if (beginIndex != -1) {
            String fileName = line.substring(beginIndex + 1, line.indexOf('"', beginIndex + 1));
            unEditFiles.add(new ScmFile(fileName, ScmFileStatus.UNKNOWN));
        }
    }
}
Also used : ScmFile(org.apache.maven.scm.ScmFile)

Example 30 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ClearCaseEditConsumer method consumeLine.

// ----------------------------------------------------------------------
// Stream Consumer Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
public void consumeLine(String line) {
    if (logger.isDebugEnabled()) {
        logger.debug(line);
    }
    int beginIndex = line.indexOf('"');
    if (beginIndex != -1) {
        String fileName = line.substring(beginIndex + 1, line.indexOf('"', beginIndex + 1));
        editFiles.add(new ScmFile(fileName, ScmFileStatus.EDITED));
    }
}
Also used : ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

ScmFile (org.apache.maven.scm.ScmFile)198 File (java.io.File)102 ArrayList (java.util.ArrayList)51 ScmException (org.apache.maven.scm.ScmException)34 BufferedReader (java.io.BufferedReader)21 DefaultLog (org.apache.maven.scm.log.DefaultLog)20 ScmFileStatus (org.apache.maven.scm.ScmFileStatus)19 ScmFileSet (org.apache.maven.scm.ScmFileSet)17 InputStreamReader (java.io.InputStreamReader)16 ScmResult (org.apache.maven.scm.ScmResult)15 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)15 IOException (java.io.IOException)14 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)13 Matcher (java.util.regex.Matcher)11 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)11 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)10 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)10 Commandline (org.codehaus.plexus.util.cli.Commandline)10 SynergyScmProviderRepository (org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository)9 FileInputStream (java.io.FileInputStream)8