Search in sources :

Example 1 with SingleSourcePackage

use of org.eclipse.osgi.internal.loader.sources.SingleSourcePackage in project rt.equinox.framework by eclipse.

the class MiscTests method testBug251427.

public void testBug251427() {
    Bundle testsBundle = OSGiTestsActivator.getContext().getBundle();
    // $NON-NLS-1$
    assertNotNull("tests bundle is null", testsBundle);
    // $NON-NLS-1$
    Bundle harnessBundle = Platform.getBundle("org.eclipse.core.tests.harness");
    // $NON-NLS-1$
    assertNotNull("harness bundle is null", harnessBundle);
    ModuleWiring testsWiring = (ModuleWiring) testsBundle.adapt(BundleWiring.class);
    ModuleWiring harnessWiring = (ModuleWiring) harnessBundle.adapt(BundleWiring.class);
    // $NON-NLS-1$
    SingleSourcePackage p111 = new SingleSourcePackage("pkg1", (BundleLoader) testsWiring.getModuleLoader());
    // $NON-NLS-1$
    SingleSourcePackage p121 = new SingleSourcePackage("pkg1", (BundleLoader) testsWiring.getModuleLoader());
    // $NON-NLS-1$
    SingleSourcePackage p112 = new SingleSourcePackage("pkg1", (BundleLoader) harnessWiring.getModuleLoader());
    // $NON-NLS-1$
    SingleSourcePackage p212 = new SingleSourcePackage("pkg2", (BundleLoader) harnessWiring.getModuleLoader());
    // $NON-NLS-1$
    SingleSourcePackage p222 = new SingleSourcePackage("pkg2", (BundleLoader) harnessWiring.getModuleLoader());
    // $NON-NLS-1$
    SingleSourcePackage p211 = new SingleSourcePackage("pkg2", (BundleLoader) testsWiring.getModuleLoader());
    // $NON-NLS-1$
    assertEquals("sources not equal", p111, p121);
    // $NON-NLS-1$
    assertEquals("sources hashCode not equal", p111.hashCode(), p121.hashCode());
    // $NON-NLS-1$
    assertEquals("sources not equal", p212, p222);
    // $NON-NLS-1$
    assertEquals("sources hashCode not equal", p212.hashCode(), p222.hashCode());
    // $NON-NLS-1$
    assertFalse("sources are equal", p111.equals(p112));
    // $NON-NLS-1$
    assertFalse("sources are equal", p212.equals(p211));
}
Also used : Bundle(org.osgi.framework.Bundle) BundleWiring(org.osgi.framework.wiring.BundleWiring) ModuleWiring(org.eclipse.osgi.container.ModuleWiring) SingleSourcePackage(org.eclipse.osgi.internal.loader.sources.SingleSourcePackage)

Aggregations

ModuleWiring (org.eclipse.osgi.container.ModuleWiring)1 SingleSourcePackage (org.eclipse.osgi.internal.loader.sources.SingleSourcePackage)1 Bundle (org.osgi.framework.Bundle)1 BundleWiring (org.osgi.framework.wiring.BundleWiring)1