Search in sources :

Example 21 with Verifier

use of org.apache.maven.it.Verifier in project maven-plugins by apache.

the class IT_CustomFilterDelimiter method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("custom-filter-delim");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.getCliOptions().add("-X");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    File output = new File(dir, "target/maven-shared-archive-resources/DEPENDENCIES");
    String content = FileUtils.fileRead(output);
    assertTrue(content.contains("Override: custom-filter-delim"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 22 with Verifier

use of org.apache.maven.it.Verifier in project maven-plugins by apache.

the class IT_FilterLocalOverride method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("filter-local-override");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.executeGoal("generate-resources");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    File output = new File(dir, "target/maven-shared-archive-resources/DEPENDENCIES");
    String content = FileUtils.fileRead(output);
    assertTrue(content.contains("Override: filter-local-override"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 23 with Verifier

use of org.apache.maven.it.Verifier in project maven-plugins by apache.

the class IT_GenerateFromBundleWithTypeAndClassifier method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("generate-from-bundle-with-type-and-classifier");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.executeGoal("generate-resources");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    File output = new File(dir, "target/maven-shared-archive-resources/DEPENDENCIES");
    String content = FileUtils.fileRead(output);
    assertTrue(content.contains("Built-In:"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 24 with Verifier

use of org.apache.maven.it.Verifier in project maven-plugins by apache.

the class IT_GenerateFromOverride method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("generate-from-override");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.executeGoal("generate-resources");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    File output = new File(dir, "target/maven-shared-archive-resources/DEPENDENCIES");
    String content = FileUtils.fileRead(output);
    assertTrue(content.contains("Override:"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 25 with Verifier

use of org.apache.maven.it.Verifier in project maven-plugins by apache.

the class IT_GetDependencyProjects method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("get-dependency-projects");
    Verifier verifier;
    verifier = new Verifier(dir.getAbsolutePath());
    verifier.executeGoal("deploy");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    verifier = new Verifier(new File(dir, "project").getAbsolutePath());
    verifier.deleteArtifacts("org.apache.maven.plugin.rresource.it.gdp");
    try {
        verifier.executeGoal("generate-resources");
    } catch (VerificationException e) {
        verifier.resetStreams();
        // We will get an exception from harness in case
        // of execution failure (return code non zero).
        // This is the case if we have missing artifacts
        // as in this test case.
        // This means we can't test the created file which will never
        // contain the appropriate data we wan't to check for. 
        // So the only reliable way is to check the log output 
        // from maven which will print out message according to
        // the missing artifacts.
        File output = new File(verifier.getBasedir(), "log.txt");
        String content = FileUtils.fileRead(output);
        assertTrue(content.contains("mvn install:install-file -DgroupId=org.apache.maven.plugin.rresource.it.gdp -DartifactId=release -Dversion=1.0 -Dpackaging=jar"));
        assertTrue(content.contains("mvn install:install-file -DgroupId=org.apache.maven.plugin.rresource.it.gdp -DartifactId=snapshot -Dversion=1.0-SNAPSHOT -Dpackaging=jar"));
    }
}
Also used : VerificationException(org.apache.maven.it.VerificationException) Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Aggregations

Verifier (org.apache.maven.it.Verifier)39 Test (org.junit.Test)21 File (java.io.File)20 VerificationException (org.apache.maven.it.VerificationException)5 HashSet (java.util.HashSet)4 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 BeforeClass (org.junit.BeforeClass)1