use of org.eclipse.osgi.report.resolution.ResolutionReport in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method testResolutionReportEntrySingletonSelectionHighestVersionResolved.
@Test
public void testResolutionReportEntrySingletonSelectionHighestVersionResolved() throws Exception {
DummyResolverHook hook = new DummyResolverHook();
DummyContainerAdaptor adaptor = createDummyAdaptor(hook);
ModuleContainer container = adaptor.getContainer();
Module resolutionReporta = installDummyModule("resolution.report.a.MF", "resolution.report.a", container);
Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", container);
container.resolve(Arrays.asList(resolutionReportaV1), true);
clearResolutionReports(hook);
assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReporta));
ResolutionReport report = hook.getResolutionReports().get(0);
Map<Resource, List<ResolutionReport.Entry>> resourceToEntries = report.getEntries();
assertResolutionReportEntriesSize(resourceToEntries, 1);
List<ResolutionReport.Entry> entries = resourceToEntries.get(resolutionReporta.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
ResolutionReport.Entry entry = entries.get(0);
assertResolutionReportEntryTypeSingletonSelection(entry.getType());
assertResolutionReportEntryDataNotNull(entry.getData());
}
use of org.eclipse.osgi.report.resolution.ResolutionReport in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method testResolutionReportEntryUnresolvedProvider01.
@Test
public void testResolutionReportEntryUnresolvedProvider01() throws Exception {
DummyResolverHook hook = new DummyResolverHook();
DummyContainerAdaptor adaptor = createDummyAdaptor(hook);
ModuleContainer container = adaptor.getContainer();
Module resolutionReportC = installDummyModule("resolution.report.c.MF", "resolution.report.c", container);
Module resolutionReportD = installDummyModule("resolution.report.d.MF", "resolution.report.d", container);
assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReportC, resolutionReportD));
ResolutionReport report = hook.getResolutionReports().get(0);
Map<Resource, List<ResolutionReport.Entry>> resourceToEntries = report.getEntries();
assertResolutionReportEntriesSize(resourceToEntries, 2);
List<ResolutionReport.Entry> entries = resourceToEntries.get(resolutionReportC.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
ResolutionReport.Entry entry = entries.get(0);
assertResolutionReportEntryTypeUnresolvedProvider(entry.getType());
assertResolutionReportEntryDataUnresolvedProvider(entry.getData(), new UnresolvedProviderEntryBuilder().requirement(resolutionReportC.getCurrentRevision().getRequirements("resolution.report.d").get(0)).capability(resolutionReportD.getCurrentRevision().getCapabilities("resolution.report.d").get(0)).build());
entries = resourceToEntries.get(resolutionReportD.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
entry = entries.get(0);
assertResolutionReportEntryTypeMissingCapability(entry.getType());
assertResolutionReportEntryDataMissingCapability(entry.getData(), "does.not.exist", null);
}
use of org.eclipse.osgi.report.resolution.ResolutionReport in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method testResolutionReportEntryFilteredByResolverHook.
@Test
public void testResolutionReportEntryFilteredByResolverHook() throws Exception {
DummyResolverHook hook = new DummyResolverHook() {
@Override
public void filterResolvable(Collection<BundleRevision> candidates) {
candidates.clear();
}
};
DummyContainerAdaptor adaptor = createDummyAdaptor(hook);
ModuleContainer container = adaptor.getContainer();
Module module = installDummyModule("resolution.report.a.MF", "resolution.report.a", container);
assertResolutionDoesNotSucceed(container, Arrays.asList(module));
ResolutionReport report = hook.getResolutionReports().get(0);
Map<Resource, List<ResolutionReport.Entry>> resourceToEntries = report.getEntries();
assertResolutionReportEntriesSize(resourceToEntries, 1);
List<ResolutionReport.Entry> entries = resourceToEntries.get(module.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
ResolutionReport.Entry entry = entries.get(0);
assertResolutionReportEntryTypeFilteredByResolverHook(entry.getType());
assertResolutionReportEntryDataNull(entry.getData());
}
use of org.eclipse.osgi.report.resolution.ResolutionReport in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method assertResolutionDoesNotSucceed.
// TODO Need to test both mandatory and optional triggers.
private void assertResolutionDoesNotSucceed(ModuleContainer container, Collection<Module> modules) {
ResolutionReport report = container.resolve(modules, true);
assertNotNull("Resolution should not have succeeded", report.getResolutionException());
}
use of org.eclipse.osgi.report.resolution.ResolutionReport in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method testResolutionReportEntrySingletonSelectionLowestVersionResolved.
@Test
public void testResolutionReportEntrySingletonSelectionLowestVersionResolved() throws Exception {
DummyResolverHook hook = new DummyResolverHook();
DummyContainerAdaptor adaptor = createDummyAdaptor(hook);
ModuleContainer container = adaptor.getContainer();
Module resolutionReporta = installDummyModule("resolution.report.a.MF", "resolution.report.a", container);
container.resolve(Arrays.asList(resolutionReporta), true);
clearResolutionReports(hook);
Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", container);
assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReportaV1));
ResolutionReport report = hook.getResolutionReports().get(0);
Map<Resource, List<ResolutionReport.Entry>> resourceToEntries = report.getEntries();
assertResolutionReportEntriesSize(resourceToEntries, 1);
List<ResolutionReport.Entry> entries = resourceToEntries.get(resolutionReportaV1.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
ResolutionReport.Entry entry = entries.get(0);
assertResolutionReportEntryTypeSingletonSelection(entry.getType());
assertResolutionReportEntryDataNotNull(entry.getData());
}
Aggregations