use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingGroupInTargetDefinition.
@Test
public void testAddTargetWithMissingGroupInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration(null, "myArtifactId", "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
try {
configurationReader.addTargetArtifact(configuration, session, null, dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
}
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingArtifactIdInTargetDefinition.
@Test
public void testAddTargetWithMissingArtifactIdInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", null, "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
try {
configurationReader.addTargetArtifact(configuration, session, null, dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
}
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.
the class TargetPlatformFilterConfigurationReaderTest method getTargetFilters.
private Xpp3Dom getTargetFilters(String pomFile) throws IOException, Exception, ProjectBuildingException {
File pom = ResourceUtil.resourceFile(pomFile);
Xpp3Dom config = getTargetPlatformConfiguration(pom);
return config.getChild("filters");
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.
the class TargetPlatformFilterConfigurationReaderTest method testValidRemoveAllFilters.
public void testValidRemoveAllFilters() throws Exception {
Xpp3Dom filterConfig = getTargetFilters("targetfilter/valid_removeAll/pom.xml");
List<TargetPlatformFilter> filters = subject.parseFilterConfiguration(filterConfig);
for (TargetPlatformFilter filter : filters) {
assertThat(filter.getAction(), is(FilterAction.REMOVE_ALL));
}
assertThat(filters.get(0).getScopePattern(), is(patternWithoutVersion(CapabilityType.OSGI_BUNDLE, "org.eclipse.equinox.servletbridge.extensionbundle")));
assertThat(filters.get(1).getScopePattern(), is(patternWithVersionRange(CapabilityType.OSGI_BUNDLE, "org.eclipse.equinox.app", "[3.6.0,3.6.1)")));
assertThat(filters.get(2).getScopePattern(), is(patternWithVersion(CapabilityType.P2_INSTALLABLE_UNIT, "a.jre.javase", "1.7.0")));
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project tycho by eclipse.
the class TargetPlatformFilterConfigurationReaderTest method testValidRestrictToFilters.
public void testValidRestrictToFilters() throws Exception {
Xpp3Dom filterConfig = getTargetFilters("targetfilter/valid_restrictTo/pom.xml");
List<TargetPlatformFilter> filters = subject.parseFilterConfiguration(filterConfig);
for (TargetPlatformFilter filter : filters) {
assertThat(filter.getAction(), is(FilterAction.RESTRICT));
}
assertThat(filters.get(0).getScopePattern(), is(patternWithoutVersion(CapabilityType.OSGI_BUNDLE, "org.eclipse.osgi")));
assertThat(filters.get(0).getActionPattern(), is(patternWithVersionRange(null, null, "[3.6,3.7)")));
assertThat(filters.get(1).getScopePattern(), is(patternWithoutVersion(CapabilityType.OSGI_BUNDLE, "org.eclipse.osgi")));
assertThat(filters.get(1).getActionPattern(), is(patternWithVersionRange(CapabilityType.OSGI_BUNDLE, "org.eclipse.osgi", "[3.6,3.7)")));
assertThat(filters.get(2).getScopePattern(), is(patternWithoutVersion(CapabilityType.JAVA_PACKAGE, "javax.persistence")));
assertThat(filters.get(2).getActionPattern(), is(patternWithVersionRange(CapabilityType.OSGI_BUNDLE, "javax.persistence", "2.0")));
assertThat(filters.get(3).getScopePattern(), is(patternWithVersionRange(CapabilityType.OSGI_BUNDLE, "org.eclipse.equinox.app", "[3.6.0,3.7.0)")));
assertThat(filters.get(3).getActionPattern(), is(patternWithVersion(null, null, "3.6.2.v00000000")));
assertThat(filters.get(4).getScopePattern(), is(patternWithoutVersion(CapabilityType.P2_INSTALLABLE_UNIT, "a.jre.javase")));
assertThat(filters.get(4).getActionPattern(), is(patternWithVersion(null, null, "1.5.0")));
}
Aggregations