protected void setUp() { fileUtil = new FileUtil(); }
public MysqldResource() { this(new FileUtil().nullFile()); }
public CommandLineOptionsParser(List args) { this.params = new HashMap(); this.fileUtil = new FileUtil(); for (int i = 0; i < args.size(); i++) { String arg = (String) args.get(i); if (arg.startsWith("--")) { arg = arg.substring(2); } int equalsPos = arg.indexOf("="); if (equalsPos == -1) { equalsPos = arg.length(); } String key = arg.substring(0, equalsPos).trim(); String value = null; if (arg.length() > equalsPos) { value = arg.substring(equalsPos + 1, arg.length()).trim(); } params.put(key, value); } }
protected void setUp() { super.setUp(); fileUtil = new FileUtil(); shellFactory = new Shell.Factory(); }
private void ensureMysqlStarted(final String mapKey, int port, Properties props) { if (getStartedMysqlds().containsKey(mapKey)) { return; } Map serverOpts = new HashMap(); for (Enumeration enums = props.propertyNames(); enums.hasMoreElements();) { String key = enums.nextElement().toString(); if (key.startsWith(SERVER_DOT)) { serverOpts.put(key.substring(SERVER_DOT.length()), props .getProperty(key)); } } serverOpts.put(MysqldResourceI.PORT, Integer.toString(port)); File baseDir = new FileUtil().newFile(serverOpts .get(MysqldResourceI.BASEDIR)); MysqldResourceI mysqld = resourceFactory.newMysqldResource(baseDir); mysqld.addCompletionListenser(new Runnable() { public void run() { remove(mapKey); } }); launchCount++; String threadName = "driver_launched_mysqld_" + launchCount; mysqld.start(threadName, serverOpts); getStartedMysqlds().put(mapKey, mysqld); }
new FileUtil().deleteTree(baseDir);
public ProcessUtil(String pid, PrintStream out, PrintStream err) { this(new FileUtil(), pid, out, err, new Str(), new Shell.Factory(), new Streams(), new Threads()); }
public void testCreateUser() throws Exception { baseDir = new File(new FileUtil().tmp(), "mxj-user-test"); fileUtil.deleteTree(baseDir); mysqld = new MysqldResource(baseDir);
public MysqldResource(File baseDir, PrintStream out, PrintStream err) { this(baseDir, out, err, new FileUtil(), new Shell.Factory(), new Streams(), new Threads(), new Str(), new ClassUtil()); }
fileUtil = new FileUtil(new FakeShellFactory(), '\\', new Streams()); fileUtil.addExecutableRights(new File("bogus"), System.out, System.err); assertNull(shell.args); assertEquals(0, shell.runCalled); fileUtil = new FileUtil(new FakeShellFactory(), '/', new Streams()); fileUtil.addExecutableRights(new File("bogus"), System.out, System.err); assertEquals(1, shell.runCalled);
public void testSetters() { shell.setRuntime(new RuntimeI.Default()); shell.setEnvironment(new String[0]); shell.setWorkingDir(new FileUtil().tmp()); shell.run(); assertTrue(shell.hasReturned()); assertEquals(1, shell.returnCode()); }
File baseDir2 = new File(new FileUtil().tmp(), "cmxj-dir2"); String[] startArgs2 = new String[] { "--" + MysqldResourceI.PORT + "=" + port2,