Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2010-04-24 04:22:25 +0000
committerIan Bull2010-04-24 04:22:25 +0000
commitbcde189cc17726636e028561c235fdad914ce74e (patch)
tree844f8b99e912019f5c6fce6079e9cc476e1418dc /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite
parentfbd1aa35b5a1d31e2b2f62c7fd91c4e90dd8afaf (diff)
downloadrt.equinox.p2-bcde189cc17726636e028561c235fdad914ce74e.tar.gz
rt.equinox.p2-bcde189cc17726636e028561c235fdad914ce74e.tar.xz
rt.equinox.p2-bcde189cc17726636e028561c235fdad914ce74e.zip
bug 277340: [publisher] Category publishing only publishes one version of a featurev20100424-0100
https://bugs.eclipse.org/bugs/show_bug.cgi?id=277340
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java50
1 files changed, 46 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
index c3688a124..887a72610 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
@@ -16,8 +16,7 @@ import org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
-import org.eclipse.equinox.p2.query.IQueryResult;
-import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.*;
/**
@@ -33,8 +32,11 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
protected void setUp() throws Exception {
super.setUp();
actionResult = new PublisherResult();
- PublisherInfo info = new PublisherInfo();
metadataRepository = new TestMetadataRepository(getAgent(), new IInstallableUnit[0]);
+ }
+
+ public void testCategoryCreation() throws Exception {
+ PublisherInfo info = new PublisherInfo();
info.setMetadataRepository(metadataRepository);
siteLocation = TestData.getFile("updatesite", "CategoryXMLActionTest/category.xml").toURI();
FeaturesAction featuresAction = new FeaturesAction(new File[] {TestData.getFile("updatesite", "CategoryXMLActionTest")});
@@ -42,12 +44,52 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
+
+ IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ assertEquals("1.0", 1, queryResultSize(result));
+ IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
}
- public void testCategoryCreation() throws Exception {
+ public void testCategoryCreationMultiFeature() throws Exception {
+ PublisherInfo info = new PublisherInfo();
+
+ info.setMetadataRepository(metadataRepository);
+ siteLocation = TestData.getFile("updatesite", "CategoryXMLActionTest/category01.xml").toURI();
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {TestData.getFile("updatesite", "CategoryXMLActionTest")});
+ featuresAction.perform(info, actionResult, new NullProgressMonitor());
+
+ CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
+ action.perform(info, actionResult, getMonitor());
+
+ IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ assertEquals("1.0", 1, queryResultSize(result));
+ IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
+
+ IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
+ IQueryResult<IInstallableUnit> categoryMembers = actionResult.query(memberQuery, new NullProgressMonitor());
+ assertEquals("2.0", 3, categoryMembers.toUnmodifiableSet().size());
+ }
+
+ public void testCategoryCreationMultiFeatureQualifier() throws Exception {
+ PublisherInfo info = new PublisherInfo();
+
+ info.setMetadataRepository(metadataRepository);
+ siteLocation = TestData.getFile("updatesite", "CategoryXMLActionTest/category02.xml").toURI();
+ FeaturesAction featuresAction = new FeaturesAction(new File[] {TestData.getFile("updatesite", "CategoryXMLActionTest")});
+ featuresAction.perform(info, actionResult, new NullProgressMonitor());
+
+ CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
+ action.perform(info, actionResult, getMonitor());
+
IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
+
+ IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
+ IQueryResult<IInstallableUnit> categoryMembers = actionResult.query(memberQuery, new NullProgressMonitor());
+ assertEquals("2.0", 2, categoryMembers.toUnmodifiableSet().size());
}
}

Back to the top