protected final File getValidSessionStoreDir(boolean mkdirs) { File dir = getSessionStoreDir(); if (dir == null) { return new ApplicationTemp().getDir("servlet-sessions"); } if (!dir.isAbsolute()) { dir = new File(new ApplicationHome().getDir(), dir.getPath()); } if (!dir.exists() && mkdirs) { dir.mkdirs(); } Assert.state(!mkdirs || dir.exists(), "Session dir " + dir + " does not exist"); Assert.state(!dir.isFile(), "Session dir " + dir + " points to a file"); return dir; }
@Test public void getValidSessionStoreWhenSessionStoreIsRelative() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSessionStoreDir(new File("sessions")); File dir = factory.getValidSessionStoreDir(false); assertThat(dir.getName()).isEqualTo("sessions"); assertThat(dir.getParentFile()).isEqualTo(new ApplicationHome().getDir()); }
private String getLogBaseDir() { if (StringUtils.hasLength(this.jtaProperties.getLogDir())) { return this.jtaProperties.getLogDir(); } File home = new ApplicationHome().getDir(); return new File(home, "transaction-logs").getAbsolutePath(); }
private File getLogBaseDir() { if (StringUtils.hasLength(this.jtaProperties.getLogDir())) { return new File(this.jtaProperties.getLogDir()); } File home = new ApplicationHome().getDir(); return new File(home, "transaction-logs"); }
private File getLogDir() { if (StringUtils.hasLength(this.jtaProperties.getLogDir())) { return new File(this.jtaProperties.getLogDir()); } File home = new ApplicationHome().getDir(); return new File(home, "transaction-logs"); }
@Test public void getValidSessionStoreWhenSessionStoreIsRelative() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSessionStoreDir(new File("sessions")); File dir = factory.getValidSessionStoreDir(false); assertThat(dir.getName(), equalTo("sessions")); assertThat(dir.getParentFile(), equalTo(new ApplicationHome().getDir())); }
/** * Used to find the Path the Main application is running on in order to * pick-up the user-configured properties files. * * @return */ @Bean public Path exomiserHome() { ApplicationHome home = new ApplicationHome(Main.class); logger.info("Exomiser home: {}", home.getDir()); return home.getDir().toPath(); }