diff options
author | Thomas Watson | 2016-03-21 17:55:21 +0000 |
---|---|---|
committer | Thomas Watson | 2016-03-21 17:55:53 +0000 |
commit | 7a81308ee3a0d5786d1b6b173310fe12c8c4cc24 (patch) | |
tree | abcb759d5322c87ccfbfb71cd63886d564384068 /bundles/org.eclipse.osgi.tests/src | |
parent | 91137155f1734258aaeb27aea7c557dd95fd65de (diff) | |
download | rt.equinox.framework-7a81308ee3a0d5786d1b6b173310fe12c8c4cc24.tar.gz rt.equinox.framework-7a81308ee3a0d5786d1b6b173310fe12c8c4cc24.tar.xz rt.equinox.framework-7a81308ee3a0d5786d1b6b173310fe12c8c4cc24.zip |
Bug 489675 - ContextFinder.getResources() searches resources in
different order with getResource
Change-Id: I39d2d32b03ce92bc2879ec88ad60d59591291867
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src')
2 files changed, 17 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java index 1f623a1fe..b984c2c8b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java @@ -1666,6 +1666,23 @@ public class ClassLoadingBundleTests extends AbstractBundleTests { global.loadClass("test.bug438904.frag.Test2"); } + public void testContextFinderGetResource() throws IOException, InvalidSyntaxException { + // get the context finder explicitly to test incase the thread context class loader has changed + ClassLoader contextFinder = getContext().getService(getContext().getServiceReferences(ClassLoader.class, "(equinox.classloader.type=contextClassLoader)").iterator().next()); + // Using a resource we know is in java 8. + String resource = "META-INF/services/javax.print.PrintServiceLookup"; + URL systemURL = ClassLoader.getSystemClassLoader().getResource("META-INF/services/javax.print.PrintServiceLookup"); + assertNotNull("Did not find a parent resource: " + resource, systemURL); + //should return the file defined in test bundle. + URL url = contextFinder.getResource(resource); + //the first element should be the file define in this bundle. + List<URL> urls = Collections.list(contextFinder.getResources(resource)); + // make sure we have a resource located in the parent + assertTrue("Did not find a parent resource: " + urls, urls.size() > 1); + //assert failed as it return the one defined in parent class. + assertEquals(url.toExternalForm(), urls.get(0).toExternalForm()); + } + public void testBundleReference01() throws Exception { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ Class clazz = test.loadClass("test1.Activator"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java index 5c64f8fbe..5c64f8fbe 100644..100755 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java |