@Test public void testGetResourceURL_fromJar() throws IOException { System.clearProperty(ResourceHandler.SMOS_DDDB_DIR_PROPERTY_NAME); final String resourcePath = "bands/AUX_/DGGFLO/DBL_SM_XXXX_AUX_DGGFLO_0400.csv"; final URL resourceUrl = resourceHandler.getResourceUrl(resourcePath); assertNotNull(resourceUrl); assertThat(resourceUrl.getPath(), containsString(resourcePath)); assertEquals("file", resourceUrl.getProtocol()); }
URL getResourceUrl(String path) throws MalformedURLException { final String dddbDirFromProperty = System.getProperty(SMOS_DDDB_DIR_PROPERTY_NAME); if (StringUtils.isNotNullAndNotEmpty(dddbDirFromProperty)) { final File resourceFile = new File(dddbDirFromProperty, path); if (resourceFile.isFile()) { return new URL("file", "", 0, resourceFile.getAbsolutePath()); } } return getClass().getResource(path); }
ResourceHandler { URL getResourceUrl(String path) throws MalformedURLException { final String dddbDirFromProperty = System.getProperty(SMOS_DDDB_DIR_PROPERTY_NAME); if (StringUtils.isNotNullAndNotEmpty(dddbDirFromProperty)) { final File resourceFile = new File(dddbDirFromProperty, path); if (resourceFile.isFile()) { return new URL("file", "", 0, resourceFile.getAbsolutePath()); } } return getClass().getResource(path); } }
ResourceHandler { URL getResourceUrl(String path) throws MalformedURLException { final String dddbDirFromProperty = System.getProperty(SMOS_DDDB_DIR_PROPERTY_NAME); if (StringUtils.isNotNullAndNotEmpty(dddbDirFromProperty)) { final File resourceFile = new File(dddbDirFromProperty, path); if (resourceFile.isFile()) { return new URL("file", "", 0, resourceFile.getAbsolutePath()); } } return getClass().getResource(path); }  }
ResourceHandler { URL getResourceUrl(String path) throws MalformedURLException { final String dddbDirFromProperty = System.getProperty(SMOS_DDDB_DIR_PROPERTY_NAME); if (StringUtils.isNotNullAndNotEmpty(dddbDirFromProperty)) { final File resourceFile = new File(dddbDirFromProperty, path); if (resourceFile.isFile()) { return new URL("file", "", 0, resourceFile.getAbsolutePath()); } } return getClass().getResource(path); }   }
ResourceHandler { URL getResourceUrl(String path) throws MalformedURLException { final String dddbDirFromProperty = System.getProperty(SMOS_DDDB_DIR_PROPERTY_NAME); if (StringUtils.isNotNullAndNotEmpty(dddbDirFromProperty)) { final File resourceFile = new File(dddbDirFromProperty, path); if (resourceFile.isFile()) { return new URL("file", "", 0, resourceFile.getAbsolutePath()); } } return getClass().getResource(path); }    }