forked from eclipse-tycho/tycho
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
- Loading branch information
Showing
6 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
tycho-its/projects/feature.restrictions/repository/artifacts.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<?artifactRepository version='1.1.0'?> | ||
<repository name='artifacts' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'> | ||
</repository> |
118 changes: 118 additions & 0 deletions
118
tycho-its/projects/feature.restrictions/repository/content.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<?metadataRepository version='1.2.0'?> | ||
<repository name='metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> | ||
<properties size='2'> | ||
<property name='p2.timestamp' value='1648817439023'/> | ||
<property name='p2.compressed' value='false'/> | ||
</properties> | ||
<units size='5'> | ||
<unit id='org.apache.activemq.activemq-core' version='5.2.0' singleton='false'> | ||
<update id='org.apache.activemq.activemq-core' range='[0.0.0,5.2.0)' severity='0'/> | ||
<properties size='4'> | ||
<property name='org.eclipse.equinox.p2.name' value='activemq-core'/> | ||
<property name='org.eclipse.equinox.p2.description' value='The ActiveMQ Message Broker and Client implementations'/> | ||
<property name='org.eclipse.equinox.p2.provider' value='The Apache Software Foundation'/> | ||
<property name='org.eclipse.equinox.p2.doc.url' value='http://www.apache.org/'/> | ||
</properties> | ||
<provides size='79'> | ||
<provided namespace='org.eclipse.equinox.p2.iu' name='org.apache.activemq.activemq-core' version='5.2.0'/> | ||
<provided namespace='osgi.bundle' name='org.apache.activemq.activemq-core' version='5.2.0'/> | ||
<provided namespace='osgi.identity' name='org.apache.activemq.activemq-core' version='5.2.0'> | ||
<properties size='1'> | ||
<property name='type' value='osgi.bundle'/> | ||
</properties> | ||
</provided> | ||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> | ||
</provides> | ||
<artifacts size='1'> | ||
<artifact classifier='osgi.bundle' id='org.apache.activemq.activemq-core' version='5.2.0'/> | ||
</artifacts> | ||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> | ||
<touchpointData size='1'> | ||
<instructions size='1'> | ||
<instruction key='manifest'> | ||
Bundle-SymbolicName: org.apache.activemq.activemq-core
Bundle-Version: 5.2.0
 | ||
</instruction> | ||
</instructions> | ||
</touchpointData> | ||
</unit> | ||
<unit id='com.test.base.feature.feature.group' version='1.0.0' singleton='false'> | ||
<update id='com.test.base.feature.feature.group' range='[0.0.0,1.0.0)' severity='0'/> | ||
<properties size='1'> | ||
<property name='org.eclipse.equinox.p2.type.group' value='true'/> | ||
</properties> | ||
<provides size='1'> | ||
<provided namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.group' version='1.0.0'/> | ||
</provides> | ||
<requires size='2'> | ||
<required namespace='org.eclipse.equinox.p2.iu' name='org.apache.activemq.activemq-core' range='[5.2.0,5.2.0]'/> | ||
<required namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.jar' range='[1.0.0,1.0.0]'> | ||
<filter> | ||
(org.eclipse.update.install.features=true) | ||
</filter> | ||
</required> | ||
</requires> | ||
<touchpoint id='null' version='0.0.0'/> | ||
</unit> | ||
<unit id='com.test.base.feature.feature.group' version='2.0.0' singleton='false'> | ||
<update id='com.test.base.feature.feature.group' range='[0.0.0,2.0.0)' severity='0'/> | ||
<properties size='1'> | ||
<property name='org.eclipse.equinox.p2.type.group' value='true'/> | ||
</properties> | ||
<provides size='1'> | ||
<provided namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.group' version='2.0.0'/> | ||
</provides> | ||
<requires size='2'> | ||
<required namespace='org.eclipse.equinox.p2.iu' name='org.apache.activemq.activemq-core' range='[5.4.0,5.4.0]'/> | ||
<required namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.jar' range='[2.0.0,2.0.0]'> | ||
<filter> | ||
(org.eclipse.update.install.features=true) | ||
</filter> | ||
</required> | ||
</requires> | ||
<touchpoint id='null' version='0.0.0'/> | ||
</unit> | ||
<unit id='com.test.base.feature.feature.jar' version='1.0.0'> | ||
<provides size='3'> | ||
<provided namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.jar' version='1.0.0'/> | ||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='feature' version='1.0.0'/> | ||
<provided namespace='org.eclipse.update.feature' name='com.test.base.feature' version='1.0.0'/> | ||
</provides> | ||
<filter> | ||
(org.eclipse.update.install.features=true) | ||
</filter> | ||
<artifacts size='1'> | ||
<artifact classifier='org.eclipse.update.feature' id='com.test.base.feature' version='1.0.0'/> | ||
</artifacts> | ||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> | ||
<touchpointData size='1'> | ||
<instructions size='1'> | ||
<instruction key='zipped'> | ||
true | ||
</instruction> | ||
</instructions> | ||
</touchpointData> | ||
</unit> | ||
<unit id='com.test.base.feature.feature.jar' version='2.0.0'> | ||
<provides size='3'> | ||
<provided namespace='org.eclipse.equinox.p2.iu' name='com.test.base.feature.feature.jar' version='2.0.0'/> | ||
<provided namespace='org.eclipse.equinox.p2.eclipse.type' name='feature' version='1.0.0'/> | ||
<provided namespace='org.eclipse.update.feature' name='com.test.base.feature' version='2.0.0'/> | ||
</provides> | ||
<filter> | ||
(org.eclipse.update.install.features=true) | ||
</filter> | ||
<artifacts size='1'> | ||
<artifact classifier='org.eclipse.update.feature' id='com.test.base.feature' version='2.0.0'/> | ||
</artifacts> | ||
<touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> | ||
<touchpointData size='1'> | ||
<instructions size='1'> | ||
<instruction key='zipped'> | ||
true | ||
</instruction> | ||
</instructions> | ||
</touchpointData> | ||
</unit> | ||
</units> | ||
</repository> |
1 change: 1 addition & 0 deletions
1
tycho-its/projects/feature.restrictions/sample.feature/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin.includes = feature.xml |
10 changes: 10 additions & 0 deletions
10
tycho-its/projects/feature.restrictions/sample.feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<feature | ||
id="com.test.sample.feature" | ||
version="1.0.0"> | ||
<includes id="com.test.base.feature" version="0.0.0"/> | ||
<requires> | ||
<import feature="com.test.base.feature" match="compatible" version="1.0.0"/> | ||
</requires> | ||
|
||
</feature> |
34 changes: 34 additions & 0 deletions
34
tycho-its/projects/feature.restrictions/sample.feature/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.test</groupId> | ||
<version>1.0.0</version> | ||
<artifactId>com.test.sample.feature</artifactId> | ||
<packaging>eclipse-feature</packaging> | ||
<properties> | ||
<tycho-version>2.7.0</tycho-version> | ||
<repo-url>file:/${project.basedir}/../repository</repo-url> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>featureRepo</id> | ||
<layout>p2</layout> | ||
<url>${repo-url}</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-maven-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
tycho-its/src/test/java/org/eclipse/tycho/test/feature/FeatureWithRestrictionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.test.feature; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.apache.maven.it.Verifier; | ||
import org.eclipse.tycho.test.AbstractTychoIntegrationTest; | ||
import org.eclipse.tycho.test.util.ResourceUtil; | ||
import org.junit.Test; | ||
|
||
import de.pdark.decentxml.Document; | ||
import de.pdark.decentxml.Element; | ||
import de.pdark.decentxml.XMLParser; | ||
|
||
public class FeatureWithRestrictionsTest extends AbstractTychoIntegrationTest { | ||
|
||
@Test | ||
public void testFeatureRestriction() throws Exception { | ||
Verifier verifier = getVerifier("feature.restrictions/sample.feature", false, true); | ||
verifier.setSystemProperty("repo-url", "file:" | ||
+ ResourceUtil.resolveTestResource("projects/feature.restrictions/repository").getAbsolutePath()); | ||
verifier.executeGoals(List.of("clean", "package")); | ||
verifier.verifyErrorFreeLog(); | ||
File contentXml = new File(verifier.getBasedir(), "target/p2content.xml"); | ||
Document artifactsDocument = XMLParser.parse(contentXml); | ||
String unitId = "com.test.sample.feature.feature.group"; | ||
Optional<Element> unit = artifactsDocument.getChild("units").getChildren("unit").stream().filter(elem -> { | ||
return unitId.equals(elem.getAttributeValue("id")); | ||
}).findFirst(); | ||
assertTrue("Unit with id " + unitId + " not found", unit.isPresent()); | ||
assertFalse("Version 2 was required by unit", | ||
unit.stream().flatMap(elem -> elem.getChild("requires").getChildren("required").stream()) | ||
.anyMatch(elem -> "[2.0.0,2.0.0]".equals(elem.getAttributeValue("range")))); | ||
} | ||
} |