List of usage examples for org.apache.commons.configuration Configuration setProperty
void setProperty(String key, Object value);
From source file:org.parosproxy.paros.core.scanner.AbstractPlugin.java
private void setProperty(Configuration conf, String key, String value) { conf.setProperty("plugins." + "p" + getId() + "." + key, value); }
From source file:org.qucosa.camel.component.opus4.Opus4DataSourceIT.java
@Before public void setUp() throws SQLException, ConfigurationException { Configuration conf = new BaseConfiguration(); conf.setProperty(Opus4DataSource.WEBAPI_PARAM_QUCOSA_HOST, "http://www.example.com"); conf.setProperty(Opus4DataSource.DB_PARAM_HOST, "jdbc:h2:mem:test;" + "INIT=RUNSCRIPT FROM 'classpath:QucosaProviderTest-DB_SETUP.sql' CHARSET 'UTF-8'"); conf.setProperty(Opus4DataSource.DB_PARAM_USER, "test"); conf.setProperty(Opus4DataSource.DB_PARAM_PASSWORD, "test"); qucosaProvider = new Opus4DataSource(); qucosaProvider.configure(conf);//from ww w . j a v a 2s .c o m }
From source file:org.qucosa.opus.Opus4ImmutableRepositoryTest.java
@Before public void setUp() throws SQLException, ConfigurationException { Configuration conf = new BaseConfiguration(); conf.setProperty(Opus4ImmutableRepository.WEBAPI_PARAM_QUCOSA_HOST, "http://www.example.com"); conf.setProperty(Opus4ImmutableRepository.WEBAPI_PARAM_QUCOSA_ROLE, "admin"); conf.setProperty(Opus4ImmutableRepository.DB_PARAM_HOST, "jdbc:h2:mem:test;" + "INIT=RUNSCRIPT FROM 'classpath:QucosaProviderTest-DB_SETUP.sql' CHARSET 'UTF-8'"); conf.setProperty(Opus4ImmutableRepository.DB_PARAM_USER, "test"); conf.setProperty(Opus4ImmutableRepository.DB_PARAM_PASSWORD, "test"); qucosaProvider = new Opus4ImmutableRepository(); qucosaProvider.configure(conf);//w ww . ja v a 2s. co m }
From source file:org.restcomm.sbc.Bootstrapper.java
@Override public void init(final ServletConfig config) throws ServletException { final ServletContext context = config.getServletContext(); final String path = context.getRealPath("WEB-INF/conf/sbc.xml"); // Initialize the configuration interpolator. final ConfigurationStringLookup strings = new ConfigurationStringLookup(); strings.addProperty("home", home(config)); strings.addProperty("uri", uri(config)); ConfigurationInterpolator.registerGlobalLookup("sbc", strings); // Load the RestComm configuration file. Configuration xml = null; try {// www .jav a2 s.c om xml = new XMLConfiguration(path); } catch (final ConfigurationException exception) { logger.error(exception); } xml.setProperty("runtime-settings.home-directory", home(config)); xml.setProperty("runtime-settings.root-uri", uri(config)); context.setAttribute(Configuration.class.getName(), xml); // Initialize global dependencies. final ClassLoader loader = getClass().getClassLoader(); // Create the actor system. //final Config settings = ConfigFactory.load(); ConfigFactory.load(); // Create the storage system. DaoManager storage = null; try { storage = storage(xml, loader); } catch (final ObjectInstantiationException exception) { throw new ServletException(exception); } context.setAttribute(DaoManager.class.getName(), storage); ShiroResources.getInstance().set(DaoManager.class, storage); ShiroResources.getInstance().set(Configuration.class, xml.subset("runtime-settings")); // Create high-level restcomm configuration RestcommConfiguration.createOnce(xml); // Initialize identityContext IdentityContext identityContext = new IdentityContext(xml); context.setAttribute(IdentityContext.class.getName(), identityContext); logger.info("Extern IP:" + xml.getString("runtime-settings.external-ip")); Version.printVersion(); }
From source file:org.rzo.yajsw.os.ms.win.w32.WindowsJavaHome.java
/** * The main method./* w w w . j a va2s . c o m*/ * * @param args * the arguments */ public static void main(String[] args) { Configuration conf = new BaseConfiguration(); conf.setProperty("wrapper.java.command", "java"); WindowsJavaHome javaHome = new WindowsJavaHome(conf); System.out.println(javaHome.findJava()); conf.setProperty("wrapper.java.customProcName", "test"); javaHome = new WindowsJavaHome(conf); System.out.println(javaHome.findJava()); conf.setProperty("wrapper.java.command", "javaw"); javaHome = new WindowsJavaHome(conf); System.out.println(javaHome.findJava()); conf.clear(); conf.setProperty("wrapper.java.minversion", "1.5.0"); conf.setProperty("wrapper.java.maxversion", "1.5.99"); conf.setProperty("wrapper.java.customProcName", "test"); javaHome = new WindowsJavaHome(conf); System.out.println(javaHome.findJava()); conf.clear(); conf.setProperty("wrapper.java.minversion", "1.6.0"); conf.setProperty("wrapper.java.customProcName", "test"); conf.setProperty("wrapper.java.preferJdk", true); javaHome = new WindowsJavaHome(conf); System.out.println(javaHome.findJava()); }
From source file:org.sonar.ant.LauncherTest.java
@Test public void testGetSqlLevel() throws Exception { Configuration conf = new BaseConfiguration(); assertThat(Launcher.getSqlLevel(conf), is("WARN")); conf.setProperty("sonar.showSql", "true"); assertThat(Launcher.getSqlLevel(conf), is("DEBUG")); conf.setProperty("sonar.showSql", "false"); assertThat(Launcher.getSqlLevel(conf), is("WARN")); }
From source file:org.sonar.ant.LauncherTest.java
@Test public void testGetSqlResultsLevel() throws Exception { Configuration conf = new BaseConfiguration(); assertThat(Launcher.getSqlResultsLevel(conf), is("WARN")); conf.setProperty("sonar.showSqlResults", "true"); assertThat(Launcher.getSqlResultsLevel(conf), is("DEBUG")); conf.setProperty("sonar.showSqlResults", "false"); assertThat(Launcher.getSqlResultsLevel(conf), is("WARN")); }
From source file:org.sonar.api.test.MavenTestUtils.java
public static Project loadProjectFromPom(Class clazz, String path) { MavenProject pom = loadPom(clazz, path); Configuration configuration = new MapConfiguration(pom.getProperties()); Project project = new Project(pom.getGroupId() + ":" + pom.getArtifactId()).setPom(pom) .setConfiguration(configuration); configuration.setProperty("sonar.java.source", MavenUtils.getJavaSourceVersion(pom)); configuration.setProperty("sonar.java.target", MavenUtils.getJavaVersion(pom)); configuration.setProperty(CoreProperties.ENCODING_PROPERTY, MavenUtils.getSourceEncoding(pom)); project.setFileSystem(new MavenModuleFileSystem(pom)); return project; }
From source file:org.sonar.batch.BatchPluginRepositoryTest.java
@Test public void shouldRegisterCustomCoverageExtension() { Configuration conf = new PropertiesConfiguration(); conf.setProperty(AbstractCoverageExtension.PARAM_PLUGIN, "clover,phpunit"); BatchPluginRepository repository = new BatchPluginRepository(); assertThat(repository.shouldRegisterCoverageExtension("cobertura", newJavaProject(), conf), is(false)); assertThat(repository.shouldRegisterCoverageExtension("clover", newJavaProject(), conf), is(true)); assertThat(repository.shouldRegisterCoverageExtension("phpunit", newJavaProject(), conf), is(true)); assertThat(repository.shouldRegisterCoverageExtension("other", newJavaProject(), conf), is(false)); }
From source file:org.sonar.batch.BatchPluginRepositoryTest.java
@Test public void shouldActivateOldVersionOfEmma() { Configuration conf = new PropertiesConfiguration(); conf.setProperty(AbstractCoverageExtension.PARAM_PLUGIN, "emma"); BatchPluginRepository repository = new BatchPluginRepository(); assertThat(repository.shouldRegisterCoverageExtension("sonar-emma-plugin", newJavaProject(), conf), is(true));/*ww w . j av a 2 s. c o m*/ assertThat(repository.shouldRegisterCoverageExtension("emma", newJavaProject(), conf), is(true)); assertThat(repository.shouldRegisterCoverageExtension("sonar-jacoco-plugin", newJavaProject(), conf), is(false)); assertThat(repository.shouldRegisterCoverageExtension("jacoco", newJavaProject(), conf), is(false)); assertThat(repository.shouldRegisterCoverageExtension("clover", newJavaProject(), conf), is(false)); assertThat(repository.shouldRegisterCoverageExtension("cobertura", newJavaProject(), conf), is(false)); }