List of usage examples for org.apache.commons.configuration PropertiesConfiguration setProperty
public void setProperty(String key, Object value)
From source file:org.sonar.plugins.technicaldebt.ComplexityDebtDecoratorTest.java
@Test public void shouldNotFailIfMissingThreshold() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(TechnicalDebtPlugin.COMPLEXITY_THRESHOLDS, "METHOD=8"); ComplexityDebtDecorator debtDecorator = new ComplexityDebtDecorator(conf); assertThat(debtDecorator.classThreshold, is(Double.MAX_VALUE)); assertThat(debtDecorator.methodThreshold, is(8.0)); }
From source file:org.sonar.plugins.technicaldebt.ComplexityDebtDecoratorTest.java
@Test public void shouldNotFailIfEmptyThreshold() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(TechnicalDebtPlugin.COMPLEXITY_THRESHOLDS, "CLASS=;METHOD="); ComplexityDebtDecorator debtDecorator = new ComplexityDebtDecorator(conf); assertThat(debtDecorator.classThreshold, is(Double.MAX_VALUE)); assertThat(debtDecorator.methodThreshold, is(Double.MAX_VALUE)); }
From source file:org.sonar.plugins.web.language.WebTest.java
@Test public void testFileSuffixes() { Project project = new Project("test"); PropertiesConfiguration configuration = new PropertiesConfiguration(); project.setConfiguration(configuration); ProjectFileManager projectFileManager = new ProjectFileManager(project); assertEquals(3, projectFileManager.getFileSuffixes().length); configuration.setProperty(WebConstants.FILE_EXTENSIONS, "one,two"); assertEquals(2, projectFileManager.getFileSuffixes().length); configuration.setProperty(WebConstants.FILE_EXTENSIONS, "one"); assertEquals(1, projectFileManager.getFileSuffixes().length); configuration.setProperty(WebConstants.FILE_EXTENSIONS, ""); assertEquals(3, projectFileManager.getFileSuffixes().length); }
From source file:org.sonar.report.pdf.test.PDFPostJobTest.java
@Test(groups = { "post-job" }) public void doNotExecuteIfSkipParameter() { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.setProperty(PDFPostJob.SKIP_PDF_KEY, Boolean.TRUE); Project project = mock(Project.class); when(project.getConfiguration()).thenReturn(conf); assertFalse(new PDFPostJob(null).shouldExecuteOnProject(project)); }
From source file:org.sonar.server.ui.AuthenticatorFactoryTest.java
@Test public void startSelectedAuthenticator() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, FakeAuthenticator.class.getName()); LoginPasswordAuthenticator authenticator = new FakeAuthenticator(); AuthenticatorFactory factory = new AuthenticatorFactory(configuration, new LoginPasswordAuthenticator[] { authenticator }); factory.start();//from w w w. j a va 2 s .c o m assertThat(factory.getAuthenticator(), is(authenticator)); }
From source file:org.sonar.server.ui.AuthenticatorFactoryTest.java
@Test(expected = ConnectionException.class) public void authenticatorDoesNotStart() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, FailAuthenticator.class.getName()); AuthenticatorFactory factory = new AuthenticatorFactory(configuration, new LoginPasswordAuthenticator[] { new FakeAuthenticator(), new FailAuthenticator() }); factory.start();/*from ww w. j ava 2 s .c o m*/ factory.getAuthenticator(); }
From source file:org.sonar.server.ui.AuthenticatorFactoryTest.java
@Test(expected = AuthenticatorNotFoundException.class) public void authenticatorNotFound() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, "foo"); AuthenticatorFactory factory = new AuthenticatorFactory(configuration, new LoginPasswordAuthenticator[] { new FakeAuthenticator(), new FailAuthenticator() }); factory.start();/* w w w . j av a 2 s. com*/ factory.getAuthenticator(); }
From source file:org.sonar.server.ui.AuthenticatorFactoryTest.java
@Test public void ignoreStartupFailure() { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, FailAuthenticator.class.getName()); configuration.setProperty(CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE, Boolean.TRUE.toString()); AuthenticatorFactory factory = new AuthenticatorFactory(configuration, new LoginPasswordAuthenticator[] { new FakeAuthenticator(), new FailAuthenticator() }); factory.start();// ww w . j ava 2 s . c o m assertThat(factory.getAuthenticator(), not(nullValue())); }
From source file:org.springframework.data.hadoop.admin.cli.commands.PropertyUtil.java
/** * set Spring Hadoop Admin service URL//w w w.ja v a2s.c o m * * @param targetUrl service URL * @throws ConfigurationException */ public static void setTargetUrl(String targetUrl) throws ConfigurationException { PropertiesConfiguration config = new PropertiesConfiguration(adminPropertyFileName); config.setProperty("targetUrl", targetUrl); config.save(); }
From source file:org.springframework.data.hadoop.admin.cli.commands.PropertyUtil.java
/** * set HDFS URL/* w w w . j ava 2 s .c o m*/ * * @param dfsName HDFS URL * * @throws ConfigurationException */ public static void setDfsName(String dfsName) throws ConfigurationException { PropertiesConfiguration config = new PropertiesConfiguration(adminPropertyFileName); config.setProperty("dfs.default.name", dfsName); config.save(); }