private static File getDirectory(String propertyName, String beamRelDefaultPath) { String filePath = System.getProperty(propertyName); if (filePath != null) { return new File(filePath); } return new File(SystemUtils.getBeamHomeDir(), SystemUtils.convertToLocalPath(beamRelDefaultPath)); } }
public static File getBeamTestDataOutputFile(String relPath) { return new File(getBeamTestDataOutputDirectory(), SystemUtils.convertToLocalPath(relPath)); }
public static File getBeamTestDataInputFile(String relPath) { return new File(getBeamTestDataInputDirectory(), SystemUtils.convertToLocalPath(relPath)); }
DimapProductConstants.ATTRIB_HREF); if (tiePointGridFilePath != null && tiePointGridFilePath.length() > 0) { return SystemUtils.convertToLocalPath(tiePointGridFilePath);
file = SystemUtils.convertToLocalPath(location.getPath() + "/" + mapFileName); mapFileURL = new URL(location.getProtocol(), location.getHost(), file); } catch (MalformedURLException e) {
final String bandHeaderFilePath = filePathElement.getAttributeValue(DimapProductConstants.ATTRIB_HREF); if (bandHeaderFilePath != null && bandHeaderFilePath.length() > 0) { final String localHeaderFilePath = SystemUtils.convertToLocalPath(bandHeaderFilePath); final String bandDataFilePath = FileUtils.exchangeExtension(localHeaderFilePath, DimapProductConstants.IMAGE_FILE_EXTENSION);
@Test public void testConvertPath() { String s = File.separator; String expected = s + "a" + s + "b" + s + "cdef" + s + "g"; assertEquals(expected, SystemUtils.convertToLocalPath("/a/b/cdef/g")); }
public void testGetEnvisatTestDataDir() { File file = null; try { file = GlobalTestConfig.getBeamTestDataInputDirectory(); } catch (SecurityException e) { fail("SecurityException not expected"); } assertNotNull(file); System.setProperty(GlobalTestConfig.BEAM_TEST_DATA_INPUT_DIR_PROPERTY_NAME, SystemUtils.convertToLocalPath("C:/envi/test/data/")); try { file = GlobalTestConfig.getBeamTestDataInputDirectory(); } catch (SecurityException e) { fail("SecurityException not expected"); } assertEquals(new File(SystemUtils.convertToLocalPath("C:/envi/test/data/")), file); System.getProperties().remove(GlobalTestConfig.BEAM_TEST_DATA_INPUT_DIR_PROPERTY_NAME); try { file = GlobalTestConfig.getBeamTestDataInputDirectory(); } catch (SecurityException e) { fail("SecurityException not expected"); } final File defaultFile = new File(SystemUtils.getBeamHomeDir(), SystemUtils.convertToLocalPath( GlobalTestConfig.BEAM_TEST_DATA_INPUT_DIR_DEFAULT_PATH)); assertEquals(defaultFile, file); }