ResourceUtils { public InputStream getResourceFromUrl(String url, @Nullable org.apache.brooklyn.util.http.auth.Credentials credentials) { if (credentials != null) { return getResourceFromUrl(url, credentials.getUser(), credentials.getPassword()); } return getResourceFromUrl(url, null, null); } ResourceUtils(ClassLoader loader, Object contextObject, String contextMessage);  ResourceUtils(BrooklynClassLoadingContext loader, Object contextObject, String contextMessage);  ResourceUtils(Object contextObject, String contextMessage);  ResourceUtils(Object contextObject); static final ResourceUtils create(ClassLoader loader, Object contextObject, String contextMessage); static final ResourceUtils create(BrooklynClassLoadingContext loader, Object contextObject, String contextMessage); static final ResourceUtils create(Object contextObject, String contextMessage); static final ResourceUtils create(Object contextObject); static final ResourceUtils create(); static void addClassLoaderProvider(Function<Object,BrooklynClassLoadingContext> provider); Iterable<URL> getResources(String name); InputStream getResourceFromUrl(String url,
            @Nullable org.apache.brooklyn.util.http.auth.Credentials credentials); InputStream getResourceFromUrl(String url); static URL tidy(URL url); static String tidyFileUrl(String url); String getResourceAsString(String url); String checkUrlExists(String url); String checkUrlExists(String url, String message); boolean doesUrlExist(String url); Optional<String> firstAvailableUrl(String ...urls); String getClassLoaderDir(); String getClassLoaderDir(String resourceInThatDir); static URL getContainerUrl(URL url, String resourceInThatDir);  }
@Test public void testGetResourceViaClasspathWithPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl("classpath: assertNotNull(stream); }
@Test public void testGetResourceViaClasspathWithoutPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl("/brooklyn/config/sample.properties"); assertNotNull(stream); }
@Test public void testGetResourceViaFileWithPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl(tempFile.toURI().toURL().toString()); assertEquals(Streams.readFullyStringAndClose(stream), tempFileContents); }
@Test public void testGetResourceViaFileWithoutPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl(tempFile.getAbsolutePath()); assertEquals(Streams.readFullyStringAndClose(stream), tempFileContents); }
@Test(groups="Integration") public void testGetResourceViaSftpWithUsername() throws Exception { String user = System.getProperty("user.name"); InputStream stream = utils.getResourceFromUrl("sftp: assertEquals(Streams.readFullyStringAndClose(stream), tempFileContents); }