Search in sources :

Example 26 with Verifier

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

the class IT_RunOnlyAtExecutionRoot method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("run-only-at-execution-root");
    Verifier verifier;
    verifier = new Verifier(new File(dir, "resource-projects").getAbsolutePath());
    verifier.executeGoal("deploy");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    verifier = new Verifier(dir.getAbsolutePath());
    // I'm not sure what exactly the intention of the test was.
    // Based on the name i assumed to be sure the remote-resources-plugin
    // will be executed only at root level.
    // This will fail, cause if an needed artifact is not there
    // maven will fail. 
    // Might reconsider how to write a better testcase.
    // verifier.deleteArtifacts( "org.apache.maven.plugin.rresource.it.mrr41" );
    verifier.executeGoal("generate-resources");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    String depResource = "target/maven-shared-archive-resources/DEPENDENCIES";
    File output = new File(dir, depResource);
    assertTrue(output.exists());
    assertFalse(new File(dir, "child1/" + depResource).exists());
    assertFalse(new File(dir, "child2/" + depResource).exists());
    String content = FileUtils.fileRead(output);
    assertTrue(content.contains("Dependency Id: org.apache.maven.plugin.rresource.it.mrr41:release:1.0"));
    assertTrue(content.contains("Dependency Id: org.apache.maven.plugin.rresource.it.mrr41:snapshot:1.0-SNAPSHOT"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 27 with Verifier

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

the class IT_SupplementalArtifact method test.

public void test() throws IOException, URISyntaxException, VerificationException {
    File dir = TestUtils.getTestDir("supplemental-artifact");
    File resources = new File(dir, "resource-projects");
    Verifier verifier;
    verifier = new Verifier(resources.getAbsolutePath());
    verifier.deleteArtifacts("org.apache.maven.plugin.rresource.it.mrr43");
    verifier.executeGoal("deploy");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    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("From: 'Deficient Tooling, Inc.' (http://www.deficient-tools.us/)"));
    assertTrue(content.contains("Deficient Dependency (http://www.deficient-tools.us/dep) org.apache.maven.plugin.rresource.it.mrr43:deficient-dep"));
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 28 with Verifier

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

the class BootstrapInstaller method install.

public static void install() throws IOException, URISyntaxException, VerificationException {
    if (!installed) {
        File bootstrapDir = TestUtils.getTestDir("bootstrap");
        Verifier verifier = new Verifier(bootstrapDir.getAbsolutePath());
        verifier.executeGoal("deploy");
        verifier.verifyErrorFreeLog();
        verifier.resetStreams();
        installed = true;
    }
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 29 with Verifier

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

the class BundleCreateIT method createWithSCMInfoMissing.

@SuppressWarnings("unchecked")
@Test
public void createWithSCMInfoMissing() throws IOException, URISyntaxException, VerificationException {
    File dir = getTestDir("bundle-create-no-scm");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    List<String> cliOptions = verifier.getCliOptions();
    cliOptions.add("--settings ../settings.xml");
    String prefix = IntegrationTestUtils.getCliPluginPrefix();
    try {
        verifier.executeGoal(prefix + "bundle-create");
        verifier.verifyErrorFreeLog();
        fail("No SCM Section provided, build should fail.");
    } catch (VerificationException e) {
    // expected, since POM doesn't supply a SCM section.
    } finally {
        verifier.resetStreams();
    }
}
Also used : VerificationException(org.apache.maven.it.VerificationException) Verifier(org.apache.maven.it.Verifier) File(java.io.File) Test(org.junit.Test)

Example 30 with Verifier

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

the class BundleCreateIT method createWithSCMInfoProvided.

@SuppressWarnings("unchecked")
@Test
public void createWithSCMInfoProvided() throws IOException, URISyntaxException, VerificationException {
    File dir = getTestDir("bundle-create");
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.getCliOptions().add("--settings ../settings.xml");
    String prefix = IntegrationTestUtils.getCliPluginPrefix();
    verifier.executeGoal(prefix + "bundle-create");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    File bundleSource = new File(dir, "target/test-1.0-bundle.jar");
    Set<String> requiredEntries = new HashSet<String>();
    requiredEntries.add("pom.xml");
    requiredEntries.add("test-1.0.jar");
    requiredEntries.add("test-1.0-sources.jar");
    assertZipContents(requiredEntries, Assertions.EMPTY_ENTRY_NAMES, bundleSource);
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

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