use of org.eclipse.osgi.container.ModuleContainer 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.container.ModuleContainer in project rt.equinox.framework by eclipse.
the class PlatformAdminImpl method createSystemState.
private State createSystemState() {
State state = factory.createState(true);
StateConverter converter = new StateConverter(state);
ModuleDatabase database = equinoxContainer.getStorage().getModuleDatabase();
database.readLock();
try {
ModuleContainer container = equinoxContainer.getStorage().getModuleContainer();
List<Module> modules = equinoxContainer.getStorage().getModuleContainer().getModules();
for (Module module : modules) {
ModuleRevision current = module.getCurrentRevision();
BundleDescription description = converter.createDescription(current);
state.addBundle(description);
}
state.setPlatformProperties(asDictionary(equinoxContainer.getConfiguration().getInitialConfig()));
synchronizer = new PlatformBundleListener(state, converter, database, container);
state.setResolverHookFactory(synchronizer);
bc.addBundleListener(synchronizer);
bc.addFrameworkListener(synchronizer);
state.resolve();
state.setTimeStamp(database.getRevisionsTimestamp());
} finally {
database.readUnlock();
}
return state;
}
use of org.eclipse.osgi.container.ModuleContainer 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.container.ModuleContainer 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());
}
use of org.eclipse.osgi.container.ModuleContainer in project rt.equinox.framework by eclipse.
the class ResolutionReportTest method testResolutionReportEntryMissingCapability.
@Test
public void testResolutionReportEntryMissingCapability() throws Exception {
DummyResolverHook hook = new DummyResolverHook();
DummyContainerAdaptor adaptor = createDummyAdaptor(hook);
ModuleContainer container = adaptor.getContainer();
Module resolutionReportB = installDummyModule("resolution.report.b.MF", "resolution.report.b", container);
assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReportB));
ResolutionReport report = hook.getResolutionReports().get(0);
Map<Resource, List<ResolutionReport.Entry>> resourceToEntries = report.getEntries();
assertResolutionReportEntriesSize(resourceToEntries, 1);
List<ResolutionReport.Entry> entries = resourceToEntries.get(resolutionReportB.getCurrentRevision());
assertResolutionReportEntriesSize(entries, 1);
ResolutionReport.Entry entry = entries.get(0);
assertResolutionReportEntryTypeMissingCapability(entry.getType());
assertResolutionReportEntryDataMissingCapability(entry.getData(), "osgi.wiring.package", "resolution.report.a");
}
Aggregations