BundleResourceFactory extends FileResourceFactory implements IExtensionInitializer { protected String getNBRBundleName(URI uri) { String ret = null; String host = uri.getHost(); String authority; if (host != null) { ret = host; } else if ((authority = uri.getAuthority()) != null) { ret = authority; } else { String path = uri.getPath(); if (path.startsWith("/")) path = path.substring(1); ret = path.substring(0, path.indexOf('/')); } return ret; } BundleResourceFactory(); protected  BundleResourceFactory(ClassLoader classLoader); @Override IResource newResource(URI uri); @Override void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionRegistrar registrar); @Override boolean handles(URI uri);  }
@Test public void getNBRBundleName() { URI uri = URI.create("namedbundleresource: assertEquals("Bundle matches.", "bundle", factory.getNBRBundleName(uri)); }
@Test public void getNBRBundleNameUnderscore() { URI uri = URI.create("namedbundleresource: assertEquals("Bundle matches.", "bundle_name", factory.getNBRBundleName(uri)); }
@Test public void getNBRBundleNameBackCompat() { URI uri = URI.create("namedbundleresource: assertEquals("Bundle matches.", "bundle", factory.getNBRBundleName(uri)); }
@Test public void getNBRBundleNameBackCompatUnderscore() { URI uri = URI.create("namedbundleresource: assertEquals("Bundle matches.", "bundle_name", factory.getNBRBundleName(uri)); }