List of usage examples for org.apache.commons.io FileUtils touch
public static void touch(File file) throws IOException
From source file:org.sonar.application.config.JdbcSettingsTest.java
@Test public void driver_file() throws Exception { File driverFile = new File(homeDir, "extensions/jdbc-driver/oracle/ojdbc6.jar"); FileUtils.touch(driverFile); String path = underTest.driverPath(homeDir, Provider.ORACLE); assertThat(path).isEqualTo(driverFile.getAbsolutePath()); }
From source file:org.sonar.application.config.JdbcSettingsTest.java
@Test public void too_many_files_in_driver_dir() throws Exception { FileUtils.touch(new File(homeDir, "extensions/jdbc-driver/oracle/ojdbc5.jar")); FileUtils.touch(new File(homeDir, "extensions/jdbc-driver/oracle/ojdbc6.jar")); expectedException.expect(MessageException.class); expectedException.expectMessage("Directory must contain only one JAR file: extensions/jdbc-driver/oracle"); underTest.driverPath(homeDir, Provider.ORACLE); }
From source file:org.sonar.application.EnvTest.java
@Test public void files() throws Exception { File home = temp.newFolder(); File confFile = new File(home, "conf/sonar.properties"); File logFile = new File(home, "logs/sonar.log"); FileUtils.touch(confFile); FileUtils.touch(logFile);// w w w. j a va 2 s . c om Env env = new Env(confFile.toURL()); assertThat(env.rootDir()).isDirectory().exists().isEqualTo(home); assertThat(env.file("conf/sonar.properties")).isFile().exists().isEqualTo(confFile); assertThat(env.file("logs/sonar.log")).isFile().exists().isEqualTo(logFile); assertThat(env.file("xxx/unknown.log")).doesNotExist(); }
From source file:org.sonar.application.EnvTest.java
@Test public void fresh_dir() throws Exception { File home = temp.newFolder(); File confFile = new File(home, "conf/sonar.properties"); File logFile = new File(home, "logs/sonar.log"); FileUtils.touch(confFile); FileUtils.touch(logFile);/*ww w. j a va 2 s.c o m*/ Env env = new Env(confFile.toURL()); File data = env.freshDir("data/h2"); assertThat(data).isDirectory().exists(); assertThat(data.getParentFile().getName()).isEqualTo("data"); assertThat(data.getParentFile().getParentFile()).isEqualTo(home); // clean directory File logs = env.freshDir("logs"); assertThat(logs).isDirectory().exists(); assertThat(logs.listFiles()).isEmpty(); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void checkAndComplete_sets_driver_path_for_oracle() throws Exception { File home = temp.newFolder(); File driverFile = new File(home, "extensions/jdbc-driver/oracle/ojdbc6.jar"); FileUtils.touch(driverFile); Props props = newProps(JDBC_URL, "jdbc:oracle:thin:@localhost/XE"); settings.checkAndComplete(home, props); assertThat(props.nonNullValueAsFile(ProcessProperties.JDBC_DRIVER_PATH)).isEqualTo(driverFile); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void checkAndComplete_sets_driver_path_for_h2() throws Exception { File home = temp.newFolder(); File driverFile = new File(home, "lib/jdbc/h2/h2.jar"); FileUtils.touch(driverFile); Props props = newProps(JDBC_URL, "jdbc:h2:tcp://localhost:9092/sonar"); settings.checkAndComplete(home, props); assertThat(props.nonNullValueAsFile(ProcessProperties.JDBC_DRIVER_PATH)).isEqualTo(driverFile); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void checkAndComplete_sets_driver_path_for_postgresql() throws Exception { File home = temp.newFolder(); File driverFile = new File(home, "lib/jdbc/postgresql/pg.jar"); FileUtils.touch(driverFile); Props props = newProps(JDBC_URL, "jdbc:postgresql://localhost/sonar"); settings.checkAndComplete(home, props); assertThat(props.nonNullValueAsFile(ProcessProperties.JDBC_DRIVER_PATH)).isEqualTo(driverFile); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void checkAndComplete_sets_driver_path_for_mssql() throws Exception { File home = temp.newFolder(); File driverFile = new File(home, "lib/jdbc/mssql/sqljdbc4.jar"); FileUtils.touch(driverFile); Props props = newProps(JDBC_URL, "jdbc:sqlserver://localhost/sonar;SelectMethod=Cursor"); settings.checkAndComplete(home, props); assertThat(props.nonNullValueAsFile(ProcessProperties.JDBC_DRIVER_PATH)).isEqualTo(driverFile); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void driver_file() throws Exception { File home = temp.newFolder(); File driverFile = new File(home, "extensions/jdbc-driver/oracle/ojdbc6.jar"); FileUtils.touch(driverFile); String path = settings.driverPath(home, Provider.ORACLE); assertThat(path).isEqualTo(driverFile.getAbsolutePath()); }
From source file:org.sonar.application.JdbcSettingsTest.java
@Test public void too_many_files_in_driver_dir() throws Exception { File home = temp.newFolder(); FileUtils.touch(new File(home, "extensions/jdbc-driver/oracle/ojdbc5.jar")); FileUtils.touch(new File(home, "extensions/jdbc-driver/oracle/ojdbc6.jar")); expectedException.expect(MessageException.class); expectedException.expectMessage("Directory must contain only one JAR file: extensions/jdbc-driver/oracle"); settings.driverPath(home, Provider.ORACLE); }