Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2009-03-08 03:43:59 +0000
committerPascal Rapicault2009-03-08 03:43:59 +0000
commitc45ee29e9703cd8fdaf4c83dbe23e450fa53692a (patch)
tree05c141bb6c4b05fc577e1f53ba731aecbe16d1f4
parent17daddf16cc8fa35c60c7fa33234fd27bafaa9b8 (diff)
downloadrt.equinox.p2-c45ee29e9703cd8fdaf4c83dbe23e450fa53692a.tar.gz
rt.equinox.p2-c45ee29e9703cd8fdaf4c83dbe23e450fa53692a.tar.xz
rt.equinox.p2-c45ee29e9703cd8fdaf4c83dbe23e450fa53692a.zip
Backport tests
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java48
4 files changed, 106 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index 39359162c..f3c2a0f10 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -765,4 +765,8 @@ public abstract class AbstractProvisioningTest extends TestCase {
ProvisioningPlan plan = planner.getProvisioningPlan(req, null, null);
return engine.perform(profile, new DefaultPhaseSet(), plan.getOperands(), null, null);
}
+
+ protected static IMetadataRepositoryManager getMetadataRepositoryManager() {
+ return (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
index 71d4799db..8acd460b0 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
@@ -24,6 +24,8 @@ public class AllTests extends TestCase {
suite.addTestSuite(AllOrbit.class);
suite.addTestSuite(AnotherSingleton.class);
suite.addTestSuite(Bug207319.class);
+ suite.addTestSuite(Bug254481dataSet1.class);
+ suite.addTestSuite(Bug254481dataSet2.class);
suite.addTestSuite(DependencyOnSelf.class);
suite.addTestSuite(DropinsScenario.class);
suite.addTestSuite(GreedyRequirement.class);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java
new file mode 100644
index 000000000..ad298d677
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java
@@ -0,0 +1,52 @@
+package org.eclipse.equinox.p2.tests.planner;
+
+import java.io.File;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
+import org.eclipse.equinox.internal.provisional.p2.director.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.internal.provisional.p2.query.Collector;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+public class Bug254481dataSet1 extends AbstractProvisioningTest {
+ IProfile profile = null;
+ IMetadataRepository repo = null;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ File reporegistry1 = getTestData("test data bug 254481", "testData/bug254481/dataSet1/p2/org.eclipse.equinox.p2.engine/profileRegistry");
+ File tempFolder = getTempFolder();
+ copy("0.2", reporegistry1, tempFolder);
+ SimpleProfileRegistry registry = new SimpleProfileRegistry(tempFolder, null, false);
+ profile = registry.getProfile("bootProfile");
+ assertNotNull(profile);
+ repo = getMetadataRepositoryManager().loadRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet1/repo").toURL(), null);
+ assertNotNull(repo);
+ }
+
+ protected void tearDown() throws Exception {
+ getMetadataRepositoryManager().removeRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet1/repo").toURL());
+ super.tearDown();
+ }
+
+ public void testInstallFeaturePatch() {
+ Collector c = repo.query(new InstallableUnitQuery("RPT_ARM_TEST.feature.group"), new Collector(), new NullProgressMonitor());
+ assertEquals(1, c.size());
+ IInstallableUnit patch = (IInstallableUnit) c.iterator().next();
+ ProfileChangeRequest request = new ProfileChangeRequest(profile);
+ request.addInstallableUnits(new IInstallableUnit[] {patch});
+ request.setInstallableUnitInclusionRules(patch, PlannerHelper.createOptionalInclusionRule(patch));
+ IPlanner planner = createPlanner();
+ ProvisioningPlan plan = planner.getProvisioningPlan(request, null, new NullProgressMonitor());
+ assertInstallOperand(plan, patch);
+ //[[R]com.ibm.rational.test.lt.arm 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.arm 7.0.300.200811041300,
+ // assertEquals(1, plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.arm"), new Collector(), null).size());
+ //[R]com.ibm.rational.test.lt.armbroker 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.armbroker 7.0.300.200811041300,
+ // assertEquals(1, plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.armbroker"), new Collector(), null).size());
+ //[R]com.ibm.rational.test.lt.kernel 7.2.151.v200810021605 --> [R]com.ibm.rational.test.lt.kernel 7.2.200.200811041300,
+ // assertEquals(1, plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.kernel"), new Collector(), null).size());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java
new file mode 100644
index 000000000..4388c7716
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java
@@ -0,0 +1,48 @@
+package org.eclipse.equinox.p2.tests.planner;
+
+import java.io.File;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
+import org.eclipse.equinox.internal.provisional.p2.director.*;
+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.internal.provisional.p2.query.Collector;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+public class Bug254481dataSet2 extends AbstractProvisioningTest {
+ IProfile profile = null;
+ IMetadataRepository repo = null;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ File reporegistry1 = getTestData("test data bug 254481", "testData/bug254481/dataSet2/p2/org.eclipse.equinox.p2.engine/profileRegistry");
+ File tempFolder = getTempFolder();
+ copy("0.2", reporegistry1, tempFolder);
+ SimpleProfileRegistry registry = new SimpleProfileRegistry(tempFolder, null, false);
+ profile = registry.getProfile("bootProfile");
+ assertNotNull(profile);
+ repo = getMetadataRepositoryManager().loadRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet2/repo").toURL(), null);
+ assertNotNull(repo);
+ }
+
+ protected void tearDown() throws Exception {
+ getMetadataRepositoryManager().removeRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet2/repo").toURL());
+ super.tearDown();
+ }
+
+ public void testInstallFeaturePatch() {
+ Collector c = repo.query(new InstallableUnitQuery("org.eclipse.jdt.feature.patch.feature.group"), new Collector(), new NullProgressMonitor());
+ assertEquals(1, c.size());
+ IInstallableUnit patch = (IInstallableUnit) c.iterator().next();
+ ProfileChangeRequest request = new ProfileChangeRequest(profile);
+ request.addInstallableUnits(new IInstallableUnit[] {patch});
+ request.setInstallableUnitInclusionRules(patch, PlannerHelper.createOptionalInclusionRule(patch));
+ IPlanner planner = createPlanner();
+ ProvisioningPlan plan = planner.getProvisioningPlan(request, null, new NullProgressMonitor());
+ assertInstallOperand(plan, patch);
+ // assertEquals(1, plan.getAdditions().query(new InstallableUnitQuery("org.eclipse.jdt.core"), new Collector(), null).size());
+ // assertEquals(1, plan.getAdditions().query(new InstallableUnitQuery("org.eclipse.jdt.core.manipulation"), new Collector(), null).size());
+ }
+}

Back to the top