List of usage examples for org.apache.commons.configuration PropertiesConfiguration addProperty
public void addProperty(String key, Object value)
From source file:org.sonar.plugins.objectivec.violations.OCLintSensorTest.java
@Test public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { final Project project = new Project("Test"); final OCLintSensor testedSensor = new OCLintSensor(); final PropertiesConfiguration config = new PropertiesConfiguration(); config.addProperty("sonar.language", "Test"); project.setConfiguration(config);//from ww w . j a v a 2s. c o m assertFalse(testedSensor.shouldExecuteOnProject(project)); }
From source file:org.sourceforge.net.javamail4ews.util.Util.java
public static Configuration getConfiguration(Session pSession) { try {//w w w . j a va 2s . c o m PropertiesConfiguration prop = new PropertiesConfiguration(); for (Object aKey : pSession.getProperties().keySet()) { Object aValue = pSession.getProperties().get(aKey); prop.addProperty(aKey.toString(), aValue); } CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(prop); URL lURL = Thread.currentThread().getContextClassLoader() .getResource("javamail-ews-bridge.default.properties"); config.addConfiguration(new PropertiesConfiguration(lURL)); return config; } catch (ConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:org.wso2.andes.server.plugins.ExtrasTest.java
@Override public void setUp() throws Exception { PropertiesConfiguration properties = new PropertiesConfiguration(); properties.addProperty("plugin-directory", PLUGIN_DIRECTORY); properties.addProperty("cache-directory", CACHE_DIRECTORY); ServerConfiguration config = new ServerConfiguration(properties); // This Test requires an application Registry ApplicationRegistry.initialise(new TestApplicationRegistry(config)); _registry = ApplicationRegistry.getInstance(); }
From source file:services.plugins.atlassian.jira.jira1.JiraPluginRunner.java
/** * Get the properties for a portfolio entry registration as a byte array. * /* w w w. j a v a2 s . c o m*/ * @param needs * set to true if the needs should be synchronized * @param defects * set to true if the defects should be synchronized */ public static byte[] getPropertiesForPortfolioEntryAsByte(boolean needs, boolean defects) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); propertiesConfiguration.addProperty("needs", needs); propertiesConfiguration.addProperty("defects", defects); Properties properties = ConfigurationConverter.getProperties(propertiesConfiguration); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { properties.store(buffer, "properties"); return buffer.toByteArray(); } catch (IOException e) { Logger.error("impossible to store the properties in the buffer", e); return null; } }
From source file:services.plugins.redmine.RedminePluginRunner.java
/** * Get the properties for a portfolio entry registration as a byte array. * //ww w.ja va 2 s .co m * @param needs * set to true if the needs should be synchronized * @param defects * set to true if the defects should be synchronized * @param iterations * set to true if the iterations should be synchronized */ public static byte[] getPropertiesForPortfolioEntryAsByte(boolean needs, boolean defects, boolean iterations) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); propertiesConfiguration.addProperty("needs", needs); propertiesConfiguration.addProperty("defects", defects); propertiesConfiguration.addProperty("iterations", iterations); Properties properties = ConfigurationConverter.getProperties(propertiesConfiguration); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { properties.store(buffer, "properties"); return buffer.toByteArray(); } catch (IOException e) { Logger.error("impossible to store the properties in the buffer", e); return null; } }
From source file:umich.ms.batmass.projects.core.type.BMProjectFactory.java
public void createProjectDirStructure(Path path, String name) throws IOException, ConfigurationException { Path projDirPath = Paths.get(path.toAbsolutePath().toString(), getProjectDir()); Files.createDirectories(projDirPath); Path projPropFile = Paths.get(projDirPath.toString(), getProjectPropfile()); Files.createFile(projPropFile); PropertiesConfiguration config = new PropertiesConfiguration(projPropFile.toFile()); config.addProperty(BMProject.PROP_NAME, name); config.save();/*from w w w .jav a2 s . c o m*/ }