List of usage examples for org.apache.commons.io FilenameUtils concat
public static String concat(String basePath, String fullFilenameToAdd)
From source file:com.seagate.kinetic.ForkedTestTarget.java
public ForkedTestTarget(boolean clearExistingDatabase, String serverRunnerPath, int port, int tlsPort) throws IOException, InterruptedException, KineticException { super("localhost", port, tlsPort); FinalizedProcessBuilder finalizedProcessBuilder = new FinalizedProcessBuilder("killall", "-9", "kineticd"); finalizedProcessBuilder.start().waitFor(10 * 1000); Thread.sleep(500);/*from ww w .j av a 2 s. c om*/ // Since the cluster version is checked before performing an ISE we need to manually remove // the file used to store the cluster version if (clearExistingDatabase) { final String workingDirectory = FilenameUtils.getFullPath(serverRunnerPath); final String clusterStorePath = FilenameUtils.concat(workingDirectory, "cluster_version"); FileUtils.deleteQuietly(new File(clusterStorePath)); } finalizedProcessBuilder = new FinalizedProcessBuilder(serverRunnerPath); finalizedProcessBuilder.directory(new File(".")); finalizedProcessBuilder.gobbleStreamsWithLogging(true); externalKineticServer = finalizedProcessBuilder.start(); waitForServerReady(); // The ForkedTestTarget only runs on x86. The x86 implementations' ISE is almost instant with small DBs so // it's OK to issue a kinetic ISE instead of using SSH if (clearExistingDatabase) { performISE(); } }
From source file:net.leegorous.jsc.JavaScriptDocument.java
protected static Set configClasspath(File file, String content) throws FileNotFoundException { if (!file.isDirectory()) { file = file.getParentFile();/* w w w. j av a 2 s . c om*/ } Matcher m = CLASSPATH_PATTERN.matcher(content); Set cp = null; if (m.find()) { cp = new HashSet(); do { String str = m.group(1); String path = FilenameUtils.concat(file.getAbsolutePath(), str); File p = new File(path); if (p.exists() && p.isDirectory()) { cp.add(p); } else { throw new FileNotFoundException(path + " from " + file.getAbsolutePath() + " + " + str); } } while (m.find()); } return cp; }
From source file:au.org.ala.delta.confor.ToNatTest.java
protected void runAndTest(String resultFileName) throws Exception, IOException { runConfor();/*w w w . ja va 2 s. c o m*/ File expectedFile = new File(FilenameUtils.concat(_samplePath, "expected_results/" + resultFileName)); String expected = FileUtils.readFileToString(expectedFile, "cp1252"); System.out.println(expected); File actualFile = new File(FilenameUtils.concat(_samplePath, resultFileName)); String actual = FileUtils.readFileToString(actualFile, "cp1252"); System.out.print(actual); boolean dosEol = expected.contains("\r\n"); String expectedLineSeparator = "\n"; if (dosEol) { expectedLineSeparator = "\r\n"; } if (!System.getProperty("line.separator").equals(expectedLineSeparator)) { expected = expected.replaceAll(expectedLineSeparator, System.getProperty("line.separator")); } // The heading contains the date so will be different. String heading = "Grass Genera 13:32 12-OCT-11"; // <Date>, eg. 11:32 05-OCT-11 actual = actual.replaceAll("Grass Genera.*[0-9]{2}-[a-zA-Z]{3}-[0-9]{4}", heading); for (int i = 0; i < expected.length(); i++) { if (expected.charAt(i) != actual.charAt(i)) { System.out.println("Difference @ char: " + i + " Expected: " + expected.charAt(i) + (int) expected.charAt(i) + ", Actual: " + actual.charAt(i) + (int) actual.charAt(i)); break; } } assertEquals(expected.trim(), actual.trim()); }
From source file:net.sf.jvifm.control.CommandParser.java
public Command parseCommand(String cmd, String[] args) throws Exception { CommandLineParser parser = new BasicParser(); CommandLine cmdLine;//from w w w .j ava 2s. c om FileLister activeLister = Main.fileManager.getActivePanel(); ShortcutsManager scm = ShortcutsManager.getInstance(); String[] selectedFiles = activeLister.getSelectionFiles(); Command command = null; if (cmd.equals("ls")) { cmdLine = parser.parse(ListFileCommand.options, args); command = new ListFileCommand(cmdLine); } else if (cmd.equals("compress")) { String dstFile = FilenameUtils.concat(activeLister.getPwd(), args[0]); command = new CompressCommand(dstFile, selectedFiles); } else if (cmd.equals("find")) { cmdLine = parser.parse(FindCommand.options, args); command = new FindCommand(cmdLine); } else if (cmd.equals("rename")) { cmdLine = parser.parse(RenameCommand.options, args); command = new RenameCommand(cmdLine); } else if (cmd.equals("touch")) { cmdLine = parser.parse(TouchCommand.options, args); command = new TouchCommand(cmdLine, selectedFiles); } else if (cmd.equals("mkdir")) { cmdLine = parser.parse(new Options(), args); command = new MkdirCommand(cmdLine); } else if (MetaCommand.isMetaCommand(cmd)) { command = new MetaCommand(cmd); } else if (scm.isShortCut(cmd)) { Shortcut cc = scm.findByName(cmd); command = new SystemCommand(cc.getText(), args, true); } else if (cmd.startsWith("!")) { command = new SystemCommand(cmd.substring(1), args, false); } else { cmdLine = parser.parse(new Options(), args); command = new MiscFileCommand(activeLister.getPwd(), cmd, cmdLine.getArgs(), selectedFiles); } command.setFileLister(activeLister); command.setInActiveFileLister(Main.fileManager.getInActivePanel()); command.setPwd(activeLister.getPwd()); return command; }
From source file:au.org.ala.delta.dist.DISTTest.java
/** * Still uses the sample data as input, but tests the PHYLIP FORMAT, * MATCH OVERLAP and EXCLUDE ITEMS directives. *//*ww w . ja v a 2 s . c o m*/ @Test public void testDISTPhylipFormatMatchOverlap() throws Exception { String path = FilenameUtils.concat(_path, "sample"); runDIST(FilenameUtils.concat(path, "dist2")); checkResults(path, "grass2.dis", false); }
From source file:au.org.ala.delta.directives.InputDeltaFile.java
private File lookInDELTADirectory(String fileName) { String deltaDir = System.getenv(DELTA_ENV_VARIABLE); if (StringUtils.isBlank(deltaDir)) { deltaDir = "DELTA"; }// www . j av a2 s . co m return new File(FilenameUtils.concat(deltaDir, fileName)); }
From source file:com.github.technosf.posterer.models.base.AbstractPropertiesModel.java
/** * Default constructor - create the properties directory *///from w w w.ja v a 2 s . c o m protected AbstractPropertiesModel(String prefix) { PROPERTIES_DIR = FilenameUtils.concat(getProperty(PROP_USER_HOME), PROPERTIES_SUBDIR); propsDir = new File(PROPERTIES_DIR); if (!propsDir.exists()) { propsDir.mkdir(); } String fileName = PROPERTIES_FILENAME; if (!isWhitespace(prefix)) { fileName = prefix + fileName; } PROPERTIES_FILE = FilenameUtils.concat(PROPERTIES_DIR, fileName); propsFile = new File(PROPERTIES_FILE); }
From source file:com.quinsoft.zeidon.config.ZeidonIniPreferences.java
public ZeidonIniPreferences(HomeDirectory homeDirectory, String jmxAppName) { iniFileName = FilenameUtils.concat(homeDirectory.getHomeDirectory(), "zeidon.ini"); loadZeidonIni();/*from w w w . java 2 s.c o m*/ new JmxZeidonPreferences(this, "com.quinsoft.zeidon:type=ZeidonIniPreferences", jmxAppName, iniFileName); }
From source file:au.org.ala.delta.delfor.DelforTest.java
@Test public void testNewLinesForAttributes() throws Exception { String path = FilenameUtils.concat(_path, "sample"); runDELFOR(FilenameUtils.concat(path, "newlineattr")); checkResults(path, "newlitems"); }
From source file:edu.cornell.med.icb.goby.stats.TestStatsWriter.java
@Test public void testTSV() throws IOException { final String file = FilenameUtils.concat(BASE_TEST_DIR, "1.tsv"); TSVWriter writer = new TSVWriter(new PrintWriter(new FileWriter(new File(file)))); writer.defineColumn("c1"); writer.defineColumnAttributes("C", 1, ColumnType.String, "something about c1", "c1"); writer.defineColumn("C2"); writer.defineColumnAttributes("D", 1, ColumnType.Flag, "something about c2", "C2"); writer.writeHeader();//from ww w . j a va2s. com writer.close(); assertEquals(new File("test-data/stats-writer/1.tsv"), new File("test-results/stats-writer/1.tsv")); }