blob: 5e3dad312e3fd38db8ef07cc59fa38a3169cff74 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 Sonatype, Inc 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:
* Sonatype, Inc. - initial API and implementation
* IBM Corporation - ongoing development
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class Bug309717 extends AbstractProvisioningTest {
public void testUpdate() throws ProvisionException, OperationCanceledException, URISyntaxException {
IProvisioningAgent agent = getAgentProvider().createAgent(getTestData("test data bug309717", "testData/bug309717/p2").toURI());
IMetadataRepository repo1 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/releases/helios"), null);
// assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty());
assertNotNull(repo1);
URI jazz = getTestData("repo for bug309717", "testData/bug309717/repo/jazz").toURI();
IMetadataRepository repo2 = agent.getService(IMetadataRepositoryManager.class).loadRepository(jazz, null);
assertNotNull(repo2);
URI jdojo = getTestData("repo for bug309717", "testData/bug309717/repo/jdojo").toURI();
IMetadataRepository repo3 = agent.getService(IMetadataRepositoryManager.class).loadRepository(jdojo, null);
assertNotNull(repo3);
IMetadataRepository repo4 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/eclipse/updates/3.6"), null);
// assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty());
assertNotNull(repo4);
IPlanner planner = getPlanner(agent);
IProfile profile = agent.getService(IProfileRegistry.class).getProfile("PlatformProfile");
IProfileChangeRequest request = planner.createChangeRequest(profile);
assertNotNull(request);
// Set<IInstallableUnit> ius = repo2.query(QueryUtil.createIUQuery("org.eclipse.riena.toolbox.feature.feature.group", Version.create("2.0.0.201003181312")), new NullProgressMonitor()).toUnmodifiableSet();
// request.addAll(ius);
// ProvisioningContext ctx = new ProvisioningContext(getAgent());
// ctx.setMetadataRepositories(new URI[] {new URI("http://download.eclipse.org/releases/helios"), rienaRepo});
// IProvisioningPlan plan = planner.getProvisioningPlan(request, ctx, new NullProgressMonitor());
//
// assertOK("resolution failed", plan.getStatus());
// assertEquals(0, plan.getAdditions().query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).toUnmodifiableSet().size());
// System.out.println(plan);
}
}