final File getWindowsKillFile() { File parent = new File(fileUtil.tmp(), "c-mxj-utils"); File kill = new File(parent, "kill.exe"); if (!kill.exists()) { streams.createFileFromResource("kill.exe", kill); } return kill; }
public void testTempDir() { String property = System.getProperty("java.io.tmpdir"); assertNotNull(property); File javaTmp = new File(property); assertEquals(javaTmp.getPath(), true, javaTmp.exists()); assertEquals(javaTmp, fileUtil.tmp()); }
public void testDeleteTree() throws FileNotFoundException { File foo = new File(fileUtil.tmp(), "foo"); File bar = new File(foo, "bar"); bar.mkdirs(); assertEquals(true, bar.exists()); File baz = new File(foo, "baz"); FileOutputStream fos = new FileOutputStream(baz); PrintWriter out = new PrintWriter(fos); out.print("baz"); out.close(); assertEquals(true, baz.exists()); assertEquals(3, baz.length()); assertEquals(true, fileUtil.deleteTree(foo)); assertEquals(false, foo.exists()); }
MysqldResource(File baseDir, PrintStream out, PrintStream err, FileUtil fileUtil, Shell.Factory shellFactory, Streams streams, Threads threads, Str str, ClassUtil classUtil) { this.out = out; this.err = err; this.fileUtil = fileUtil; this.shellFactory = shellFactory; this.streams = streams; this.threads = threads; this.str = str; this.classUtil = classUtil; this.optionParser = new HelpOptionsParser(err, threads, classUtil, str); this.versionString = MysqldResourceI.DEFAULT_VERSION; this.killDelay = 30000; if (baseDir.equals(fileUtil.nullFile())) { this.baseDir = new File(fileUtil.tmp(), "mysql-c.mxj"); } else { this.baseDir = baseDir; } this.pidFile = null; this.msgPrefix = "[" + classUtil.shortName(getClass()) + "] "; this.options = new HashMap(); this.setShell(null); setOsAndArch(System.getProperty(Platform.OS_NAME), System .getProperty(Platform.OS_ARCH)); this.trace = new Exception(); this.completionListensers = new ArrayList(); }
public void testCreateUser() throws Exception { baseDir = new File(new FileUtil().tmp(), "mxj-user-test"); fileUtil.deleteTree(baseDir); mysqld = new MysqldResource(baseDir);
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,