Search in sources :

Example 6 with IU

use of org.eclipse.tycho.model.IU in project tycho by eclipse.

the class IUXmlTransformerTest method testExpandVersionInCapabilities.

@Test
public void testExpandVersionInCapabilities() throws Exception {
    subject = new IUXmlTransformer();
    IU iu = IU.read(new File(TestUtil.getBasedir("projects/iuXmlValueReplacement/"), "p2iu.xml"));
    subject.replaceQualifierInCapabilities(iu.getProvidedCapabilites(), "CAPABILITY");
    assertThat(iu.getProvidedCapabilites(), hasItem(capability("anotherId", "2.0.0.CAPABILITY")));
    assertThat(iu.getProvidedCapabilites(), hasItem(capability("demo.iu", "1.0.0.CAPABILITY")));
    assertThat(iu.getProvidedCapabilites(), hasItem(capability("demo.iu", "1.1.1.CAPABILITY")));
}
Also used : IU(org.eclipse.tycho.model.IU) File(java.io.File) Test(org.junit.Test)

Example 7 with IU

use of org.eclipse.tycho.model.IU 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

IU (org.eclipse.tycho.model.IU)7 File (java.io.File)6 Test (org.junit.Test)3 Element (de.pdark.decentxml.Element)2 MavenSession (org.apache.maven.execution.MavenSession)2 MavenProject (org.apache.maven.project.MavenProject)2 PackageIUMojo (org.eclipse.tycho.packaging.PackageIUMojo)2 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 TargetPlatform (org.eclipse.tycho.artifacts.TargetPlatform)1 VersionChange (org.eclipse.tycho.versions.engine.VersionChange)1