public URI computeURI(Path filePath) { // Make sure this is relative URI uri = PathUtils.relativizePath(filePath, jobConfigDirPath).toUri(); if (this.extensionToStrip.isPresent()) { uri = PathUtils.removeExtension(new Path(uri), this.extensionToStrip.get()).toUri(); } return uri; }
private void modifyExtensionAtDestination(CopyableFile file) { if (extensionsToRemove().size() > 0) { file.setDestination(PathUtils.removeExtension(file.getDestination(), extensionsToRemove().toArray(new String[0]))); } } }
@Test public void testRemoveExtension() throws Exception { Path path = PathUtils.removeExtension(new Path("file.txt"), ".txt"); Assert.assertEquals(path, new Path("file")); path = PathUtils.removeExtension(new Path("file.txt"), ".abc"); Assert.assertEquals(path, new Path("file.txt")); path = PathUtils.removeExtension(new Path("file.txt.gpg"), ".txt", ".gpg"); Assert.assertEquals(path, new Path("file")); path = PathUtils.removeExtension(new Path("file.txt.gpg"), ".gpg", ".txt"); Assert.assertEquals(path, new Path("file")); path = PathUtils.removeExtension(new Path("file.txt.gpg"), ".txt"); Assert.assertEquals(path, new Path("file.gpg")); path = PathUtils.removeExtension(new Path("file.txt.gpg"), ".gpg"); Assert.assertEquals(path, new Path("file.txt")); path = PathUtils.removeExtension(new Path("file"), ".txt", ".gpg"); Assert.assertEquals(path, new Path("file")); }
Path newPath = PathUtils.removeExtension(pullFile.getPath(), PullFileLoader.DEFAULT_JAVA_PROPS_PULL_FILE_EXTENSIONS.toArray(new String[]{})); newPath = PathUtils.addExtension(newPath, "conf");
public URI computeURI(Path filePath) { // Make sure this is relative URI uri = PathUtils.relativizePath(filePath, jobConfigDirPath).toUri(); if (this.extensionToStrip.isPresent()) { uri = PathUtils.removeExtension(new Path(uri), this.extensionToStrip.get()).toUri(); } return uri; }
private void modifyExtensionAtDestination(CopyableFile file) { if (extensionsToRemove().size() > 0) { file.setDestination(PathUtils.removeExtension(file.getDestination(), extensionsToRemove().toArray(new String[0]))); } } }
Path newPath = PathUtils.removeExtension(pullFile.getPath(), PullFileLoader.DEFAULT_JAVA_PROPS_PULL_FILE_EXTENSIONS.toArray(new String[]{})); newPath = PathUtils.addExtension(newPath, "conf");