1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.equinox.p2.planner.IPlanner;
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.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
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/profileRegistry");
File tempFolder = getTempFolder();
copy("0.2", reporegistry1, tempFolder);
SimpleProfileRegistry registry = new SimpleProfileRegistry(getAgent(), tempFolder, null, false);
profile = registry.getProfile("bootProfile");
assertNotNull(profile);
repo = getMetadataRepositoryManager().loadRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet1/repo").toURI(), null);
assertNotNull(repo);
}
protected void tearDown() throws Exception {
getMetadataRepositoryManager().removeRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet1/repo").toURI());
super.tearDown();
}
public void testInstallFeaturePatch() {
IQueryResult c = repo.query(new InstallableUnitQuery("RPT_ARM_TEST.feature.group"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
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();
IProvisioningPlan 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, queryResultSize(plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.arm"), null)));
//[R]com.ibm.rational.test.lt.armbroker 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.armbroker 7.0.300.200811041300,
assertEquals(1, queryResultSize(plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.armbroker"), null)));
//[R]com.ibm.rational.test.lt.kernel 7.2.151.v200810021605 --> [R]com.ibm.rational.test.lt.kernel 7.2.200.200811041300,
assertEquals(1, queryResultSize(plan.getAdditions().query(new InstallableUnitQuery("com.ibm.rational.test.lt.kernel"), null)));
}
}
|