@Test public void shouldReturnHomeDirSetUsingPropertySlingHome() throws Exception { BundleContext bundleContext = programBundleContextToReturn(null, "aPath"); ConfigurationUtils configurationUtil = new ConfigurationUtils(bundleContext); File homeDir = configurationUtil.getHomeDir(); assertEquals("aPath/modeshape", homeDir.getPath()); }
File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; }
ConfigurationUtils { File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; } }
ConfigurationUtils { File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; } ConfigurationUtils( BundleContext bundleContext ); }
ConfigurationUtils { File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; } ConfigurationUtils( BundleContext bundleContext );  }
ConfigurationUtils { File getHomeDir() { File homeDir; String repoHomePath = bundleContext.getProperty(SLING_REPOSITORY_HOME); String slingHomePath = bundleContext.getProperty(SLING_HOME); String repositoryName = getRepositoryName(); if (repoHomePath != null) { homeDir = new File(repoHomePath, repositoryName); } else if (slingHomePath != null) { homeDir = new File(slingHomePath, repositoryName); } else { homeDir = new File(repositoryName); } log.info("Creating default config for Modeshape in " + homeDir); if (!homeDir.isDirectory()) { if (!homeDir.mkdirs()) { log.info("verifyConfiguration: Cannot create Modeshape home " + homeDir + ", failed creating default configuration"); return null; } } return homeDir; } ConfigurationUtils( BundleContext bundleContext );   }