/** * The default implementation checks that the given bundle's name is included in the list of * bundle name include patterns and that its name is not excluded by the bundle name exclude * patterns. * * @return Returns <code>true</code> if the given bundle meets the requirements to be scanned for * JUnit tests. <code>false</code> otherwise. * @see #setBundleNameIncludePatterns(Pattern[]) * @see #setBundleNameExcludePatterns(Pattern[]) */ protected boolean acceptBundle(Bundle bundle) { return !Platform.isFragment(bundle) && accept( bundle.getSymbolicName(), getBundleNameIncludePatterns(), getBundleNameExcludePatterns()); }
/** * @param bundle * @param className * @return */ private static Class<?> loadClassFromBundle(Bundle bundle, String className) throws ClassNotFoundException { Class<?> klazz = null; if (Platform.isFragment(bundle)) { // Need to use the bundle's host for loading the class Bundle[] hosts = Platform.getHosts(bundle); if (hosts == null) { TestDesignerPlugin.logWarning("Cannot test fragment as NO host!"); // $NON-NLS-1$ return klazz; } for (Bundle host : hosts) { klazz = host.loadClass(className); if (klazz != null) { break; } } } else { klazz = bundle.loadClass(className); } return klazz; }