Search in sources :

Example 1 with PackageIUMojo

use of org.eclipse.tycho.packaging.PackageIUMojo in project tycho by eclipse.

the class PackageIUMojoTest method testThatArtifactPayloadIsCorrect.

public void testThatArtifactPayloadIsCorrect() throws Exception {
    File basedir = getBasedir("projects/iuWithPayload/");
    File platform = new File("src/test/resources/eclipse");
    List<MavenProject> projects = getSortedProjects(basedir, platform);
    MavenProject project = getProject(projects, "iuWithPayload");
    MavenSession session = newMavenSession(project, projects);
    // set build qualifier
    lookupMojoWithDefaultConfiguration(project, session, "build-qualifier").execute();
    PackageIUMojo mojo = (PackageIUMojo) lookupConfiguredMojo(project, "package-iu");
    setVariableValueToObject(mojo, "artifactContentFolder", new File(basedir, "src/main/resources").getAbsolutePath());
    mojo.execute();
    assertThat(getFilesInZip(new File(basedir, "target/iuWithPayload-1.0.0.zip")), hasItem("file.txt"));
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) MavenProject(org.apache.maven.project.MavenProject) PackageIUMojo(org.eclipse.tycho.packaging.PackageIUMojo) File(java.io.File)

Example 2 with PackageIUMojo

use of org.eclipse.tycho.packaging.PackageIUMojo in project tycho by eclipse.

the class PackageIUMojoTest method testArtifactWithoutPayload.

public void testArtifactWithoutPayload() throws Exception {
    File basedir = getBasedir("projects/iuWithoutPayload");
    File platform = new File("src/test/resources/eclipse");
    List<MavenProject> projects = getSortedProjects(basedir, platform);
    MavenProject project = getProject(projects, "iuWithoutPayload");
    MavenSession session = newMavenSession(project, projects);
    // set build qualifier
    lookupMojoWithDefaultConfiguration(project, session, "build-qualifier").execute();
    PackageIUMojo mojo = (PackageIUMojo) lookupConfiguredMojo(project, "package-iu");
    mojo.execute();
    IU iu = IU.loadIU(new File(basedir, "target"));
    Element artifact = iu.getSelfArtifact();
    assertThat(artifact, nullValue());
    assertThat(new File(basedir, "target/iuWithoutPayload-1.0.0.zip").exists(), is(true));
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) MavenProject(org.apache.maven.project.MavenProject) Element(de.pdark.decentxml.Element) PackageIUMojo(org.eclipse.tycho.packaging.PackageIUMojo) IU(org.eclipse.tycho.model.IU) File(java.io.File)

Example 3 with PackageIUMojo

use of org.eclipse.tycho.packaging.PackageIUMojo in project tycho by eclipse.

the class PackageIUMojoTest method testInjectArtifactReference.

public void testInjectArtifactReference() throws Exception {
    File basedir = getBasedir("projects/iuWithPayloadButNoArtifactReference");
    File platform = new File("src/test/resources/eclipse");
    List<MavenProject> projects = getSortedProjects(basedir, platform);
    MavenProject project = getProject(projects, "iuWithPayloadButNoArtifactReference");
    MavenSession session = newMavenSession(project, projects);
    // set build qualifier
    lookupMojoWithDefaultConfiguration(project, session, "build-qualifier").execute();
    PackageIUMojo mojo = (PackageIUMojo) lookupConfiguredMojo(project, "package-iu");
    setVariableValueToObject(mojo, "artifactContentFolder", new File(basedir, "src/main/resources").getAbsolutePath());
    mojo.execute();
    IU iu = IU.loadIU(new File(basedir, "target"));
    Element artifact = iu.getSelfArtifact();
    assertNotNull(artifact);
    assertThat(artifact.getAttributeValue("classifier"), is("binary"));
    assertThat(artifact.getAttributeValue("id"), is("iuWithPayloadButNoArtifactReference"));
    assertThat(artifact.getAttributeValue("version"), is("1.0.0"));
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) MavenProject(org.apache.maven.project.MavenProject) Element(de.pdark.decentxml.Element) PackageIUMojo(org.eclipse.tycho.packaging.PackageIUMojo) IU(org.eclipse.tycho.model.IU) File(java.io.File)

Aggregations

File (java.io.File)3 MavenSession (org.apache.maven.execution.MavenSession)3 MavenProject (org.apache.maven.project.MavenProject)3 PackageIUMojo (org.eclipse.tycho.packaging.PackageIUMojo)3 Element (de.pdark.decentxml.Element)2 IU (org.eclipse.tycho.model.IU)2