@Test public void testGetResourceViaFileWithPrefix() throws Exception { // on windows the correct syntax is file:///c:/path (note the extra /); // however our routines also accept file://c:/path so the following is portable InputStream stream = utils.getResourceFromUrl("file://" + tempFile.getAbsolutePath()); assertEquals(ResourceUtils.readFullyString(stream), tempFileContents); }
@Test(groups = "Integration") public void testGetResourceViaSftpWithUsername() throws Exception { String user = System.getProperty("user.name"); InputStream stream = utils.getResourceFromUrl("sftp://" + user + "@localhost:" + tempFile.getAbsolutePath()); assertEquals(ResourceUtils.readFullyString(stream), tempFileContents); }
@Test public void testGetResourceViaFileWithoutPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl(tempFile.getAbsolutePath()); assertEquals(ResourceUtils.readFullyString(stream), tempFileContents); }
@Test public void testGetResourceViaClasspathWithoutPrefix() throws Exception { InputStream stream = utils.getResourceFromUrl("/brooklyn/config/sample.properties"); assertNotNull(stream); }
@Test(groups = "Integration") public void testGetResourceViaSftp() throws Exception { InputStream stream = utils.getResourceFromUrl("sftp://localhost:" + tempFile.getAbsolutePath()); assertEquals(ResourceUtils.readFullyString(stream), tempFileContents); }