@Test void getDocumentationPath_WhenNoExternalConfigurationIsGiven_DefaultsToScenariooHomeFolder() { when(servletContext.getInitParameter("scenariooDataDirectory")).thenReturn(null); when(systemEnvironment.getScenariooDataDirectory()).thenReturn(null); when(systemEnvironment.getUserHome()).thenReturn("/home/someuser"); String expectedPath = new File("/home/someuser/.scenarioo").getAbsolutePath(); String actual = logic.getDataPath(servletContext); assertEquals(expectedPath, actual); }
String getDataPath(final ServletContext servletContext) { String configSource = "servlet context"; String configurationDirectory = servletContext.getInitParameter( "scenariooDataDirectory"); if (StringUtils.isBlank(configurationDirectory)) { configSource = "SCENARIOO_DATA environment variable or scenarioo.data application property"; configurationDirectory = systemEnvironment.getScenariooDataDirectory(); } if (StringUtils.isBlank(configurationDirectory)) { configSource = "default scenarioo data directory"; configurationDirectory = new File(systemEnvironment.getUserHome(), USER_HOME_BASE_DIRECTORY).getAbsolutePath(); } LOGGER.info(" Taking documentation data path from " + configSource + ": " + configurationDirectory); return configurationDirectory; }
ScenariooDataPathLogic { String getDataPath(final ServletContext servletContext) { String configSource = "servlet context"; String configurationDirectory = servletContext.getInitParameter( "scenariooDataDirectory"); if (StringUtils.isBlank(configurationDirectory)) { configSource = "SCENARIOO_DATA environment variable or scenarioo.data application property"; configurationDirectory = systemEnvironment.getScenariooDataDirectory(); } if (StringUtils.isBlank(configurationDirectory)) { configSource = "default scenarioo data directory"; configurationDirectory = new File(systemEnvironment.getUserHome(), USER_HOME_BASE_DIRECTORY).getAbsolutePath(); } LOGGER.info(" Taking documentation data path from " + configSource + ": " + configurationDirectory); return configurationDirectory; } }
ScenariooDataPathLogic { String getDataPath(final ServletContext servletContext) { String configSource = "servlet context"; String configurationDirectory = servletContext.getInitParameter( "scenariooDataDirectory"); if (StringUtils.isBlank(configurationDirectory)) { configSource = "SCENARIOO_DATA environment variable or scenarioo.data application property"; configurationDirectory = systemEnvironment.getScenariooDataDirectory(); } if (StringUtils.isBlank(configurationDirectory)) { configSource = "default scenarioo data directory"; configurationDirectory = new File(systemEnvironment.getUserHome(), USER_HOME_BASE_DIRECTORY).getAbsolutePath(); } LOGGER.info(" Taking documentation data path from " + configSource + ": " + configurationDirectory); return configurationDirectory; } ScenariooDataPathLogic(final SystemEnvironment systemEnvironment); }
ScenariooDataPathLogic { String getDataPath(final ServletContext servletContext) { String configSource = "servlet context"; String configurationDirectory = servletContext.getInitParameter( "scenariooDataDirectory"); if (StringUtils.isBlank(configurationDirectory)) { configSource = "SCENARIOO_DATA environment variable or scenarioo.data application property"; configurationDirectory = systemEnvironment.getScenariooDataDirectory(); } if (StringUtils.isBlank(configurationDirectory)) { configSource = "default scenarioo data directory"; configurationDirectory = new File(systemEnvironment.getUserHome(), USER_HOME_BASE_DIRECTORY).getAbsolutePath(); } LOGGER.info(" Taking documentation data path from " + configSource + ": " + configurationDirectory); return configurationDirectory; } ScenariooDataPathLogic(final SystemEnvironment systemEnvironment);  }
ScenariooDataPathLogic { String getDataPath(final ServletContext servletContext) { String configSource = "servlet context"; String configurationDirectory = servletContext.getInitParameter( "scenariooDataDirectory"); if (StringUtils.isBlank(configurationDirectory)) { configSource = "SCENARIOO_DATA environment variable or scenarioo.data application property"; configurationDirectory = systemEnvironment.getScenariooDataDirectory(); } if (StringUtils.isBlank(configurationDirectory)) { configSource = "default scenarioo data directory"; configurationDirectory = new File(systemEnvironment.getUserHome(), USER_HOME_BASE_DIRECTORY).getAbsolutePath(); } LOGGER.info(" Taking documentation data path from " + configSource + ": " + configurationDirectory); return configurationDirectory; } ScenariooDataPathLogic(final SystemEnvironment systemEnvironment);   }