Search in sources :

Example 6 with Verifier

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

the class BundlePackIT method packWithSCMInfoMissing.

@SuppressWarnings("unchecked")
@Test
public void packWithSCMInfoMissing() throws IOException, URISyntaxException, VerificationException {
    File dir = getTestDir("bundle-pack");
    String prefix = getCliPluginPrefix();
    String artifactId = "bundle-pack-target-no-scm";
    String groupId = "org.apache.maven.its.repository";
    String version = "1.0";
    File bundleSource = new File(dir, artifactId + "-" + version + "-bundle.jar");
    if (bundleSource.exists()) {
        bundleSource.delete();
    }
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.setAutoclean(false);
    List<String> cliOptions = verifier.getCliOptions();
    cliOptions.add("-DgroupId=" + groupId);
    cliOptions.add("-DartifactId=" + artifactId);
    cliOptions.add("-Dversion=" + version);
    cliOptions.add("-DscmUrl=http://foo/");
    cliOptions.add("-DscmConnection=scm:svn:http://foo/");
    verifier.executeGoal(prefix + "bundle-pack");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    Set<String> requiredEntries = new HashSet<String>();
    requiredEntries.add("pom.xml");
    requiredEntries.add(artifactId + "-" + version + ".jar");
    if (!verifier.isMavenDebug()) {
        bundleSource.deleteOnExit();
    }
    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)

Example 7 with Verifier

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

the class BundlePackIT method packWithSCMInfoProvided.

@SuppressWarnings("unchecked")
@Test
public void packWithSCMInfoProvided() throws IOException, URISyntaxException, VerificationException {
    File dir = getTestDir("bundle-pack");
    String prefix = getCliPluginPrefix();
    String artifactId = "bundle-pack-target";
    String groupId = "org.apache.maven.its.repository";
    String version = "1.0";
    File bundleSource = new File(dir, artifactId + "-" + version + "-bundle.jar");
    if (bundleSource.exists()) {
        bundleSource.delete();
    }
    Verifier verifier = new Verifier(dir.getAbsolutePath());
    verifier.setAutoclean(false);
    List<String> cliOptions = verifier.getCliOptions();
    cliOptions.add("-DgroupId=" + groupId);
    cliOptions.add("-DartifactId=" + artifactId);
    cliOptions.add("-Dversion=" + version);
    verifier.executeGoal(prefix + "bundle-pack");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();
    Set<String> requiredEntries = new HashSet<String>();
    requiredEntries.add("pom.xml");
    requiredEntries.add(artifactId + "-" + version + ".jar");
    if (!verifier.isMavenDebug()) {
        bundleSource.deleteOnExit();
    }
    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)

Example 8 with Verifier

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

the class IntegrationTestUtils method bootstrap.

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

Example 9 with Verifier

use of org.apache.maven.it.Verifier in project xtext-xtend by eclipse.

the class MavenVerifierUtil method newVerifier.

public static Verifier newVerifier(String pathToTestProject) throws IOException, VerificationException {
    File testDir = ResourceExtractor.simpleExtractResources(MavenVerifierUtil.class, pathToTestProject);
    Verifier verifier = new Verifier(testDir.getAbsolutePath());
    String localRepo = Paths.get("../.m2/repository/").toAbsolutePath().normalize().toString();
    System.out.println("gradle: " + System.getProperty("gradleMavenRepo"));
    for (Object iterable_element : System.getProperties().keySet()) {
        System.out.println(iterable_element + "=" + System.getProperty(iterable_element.toString()));
    }
    ;
    verifier.setSystemProperty("gradleMavenRepo", System.getProperty("gradleMavenRepo"));
    verifier.setLocalRepo(localRepo);
    verifier.setDebug(true);
    // verifier.setForkJvm(false);
    return verifier;
}
Also used : Verifier(org.apache.maven.it.Verifier) File(java.io.File)

Example 10 with Verifier

use of org.apache.maven.it.Verifier in project xtext-xtend by eclipse.

the class XtendCompilerMojoIT method aggregation.

@Test
public void aggregation() throws Exception {
    Verifier verifier = MavenVerifierUtil.newVerifier(ROOT + "/aggregation");
    verifier.setDebug(true);
    verifier.executeGoal("test");
    verifier.verifyErrorFreeLog();
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=409759
    String outputdir = verifier.getBasedir() + "/relativeoutput-module/";
    verifier.assertFilePresent(outputdir + "src/main/generated-sources/xtend/test/XtendA.java");
    verifier.assertFilePresent(outputdir + "src/main/generated-sources/xtend/test/XtendC.java");
    verifier.assertFilePresent(outputdir + "src/test/generated-sources/xtend/tests/XtendA.java");
    verifier.assertFilePresent(outputdir + "src/test/generated-sources/xtend/tests/XtendC.java");
}
Also used : Verifier(org.apache.maven.it.Verifier) 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