Search in sources :

Example 1 with GitRemoveConsumer

use of org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer in project maven-scm by apache.

the class GitRemoveConsumerTest method testLog1Consumer.

public void testLog1Consumer() throws Exception {
    GitRemoveConsumer consumer = new GitRemoveConsumer(new DefaultLog());
    File f = getTestFile("/src/test/resources/git/remove/gitrm.gitlog");
    BufferedReader r = new BufferedReader(new FileReader(f));
    String line;
    while ((line = r.readLine()) != null) {
        consumer.consumeLine(line);
    }
    List<ScmFile> changedFiles = consumer.getRemovedFiles();
    assertEquals(2, changedFiles.size());
    testScmFile((ScmFile) changedFiles.get(0), "src/main/java/Application.java", ScmFileStatus.DELETED);
    testScmFile((ScmFile) changedFiles.get(1), "src/test/java/Test.java", ScmFileStatus.DELETED);
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) GitRemoveConsumer(org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer) ScmFile(org.apache.maven.scm.ScmFile)

Example 2 with GitRemoveConsumer

use of org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer in project maven-scm by apache.

the class GitRemoveConsumerTest method testEmptyLogConsumer.

public void testEmptyLogConsumer() throws Exception {
    GitRemoveConsumer consumer = new GitRemoveConsumer(new DefaultLog());
    File f = getTestFile("/src/test/resources/git/remove/gitrm-empty.gitlog");
    BufferedReader r = new BufferedReader(new FileReader(f));
    String line;
    while ((line = r.readLine()) != null) {
        consumer.consumeLine(line);
    }
    List<ScmFile> changedFiles = consumer.getRemovedFiles();
    assertEquals(0, changedFiles.size());
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) GitRemoveConsumer(org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer) ScmFile(org.apache.maven.scm.ScmFile)

Example 3 with GitRemoveConsumer

use of org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer in project maven-scm by apache.

the class GitRemoveConsumerTest method testConsumerRemovedFile.

public void testConsumerRemovedFile() {
    GitRemoveConsumer consumer = new GitRemoveConsumer(new DefaultLog());
    consumer.consumeLine("rm 'project.xml'");
    List<ScmFile> changedFiles = consumer.getRemovedFiles();
    assertNotNull(changedFiles);
    assertEquals(1, changedFiles.size());
}
Also used : DefaultLog(org.apache.maven.scm.log.DefaultLog) GitRemoveConsumer(org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer) ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

ScmFile (org.apache.maven.scm.ScmFile)3 DefaultLog (org.apache.maven.scm.log.DefaultLog)3 GitRemoveConsumer (org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer)3 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 FileReader (java.io.FileReader)2