List of usage examples for org.apache.commons.configuration Configuration setProperty
void setProperty(String key, Object value);
From source file:org.sonar.plugins.csharp.fxcop.FxCopSensorTest.java
@Test public void testShouldNotExecuteOnProjectUsingPatterns() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(FxCopConstants.ASSEMBLIES_TO_SCAN_KEY, new String[] { "**/*.whatever" }); FxCopSensor sensor = new FxCopSensor(null, null, null, null, new CSharpConfiguration(conf), microsoftWindowsEnvironment); when(solution.getSolutionDir()).thenReturn(TestUtils.getResource("/Sensor")); when(vsProject1.getDirectory()).thenReturn(TestUtils.getResource("/Sensor")); Project project = mock(Project.class); when(project.getName()).thenReturn("Project #1"); when(project.getLanguageKey()).thenReturn("cs"); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.gallio.CoverageDecoratorTest.java
@Test public void testShouldNotExecuteOnProjectIfSkip() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(GallioConstants.MODE, GallioConstants.MODE_SKIP); CoverageDecorator decorator = new CoverageDecorator(new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(decorator.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.gallio.GallioSensorTest.java
@Test public void testShouldNotExecuteOnProjectIfSkip() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(GallioConstants.MODE, GallioConstants.MODE_SKIP); GallioSensor sensor = new GallioSensor(new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.gallio.GallioSensorTest.java
@Test public void testShouldNotExecuteOnProjectIfReuseReports() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(GallioConstants.MODE, GallioConstants.MODE_REUSE_REPORT); GallioSensor sensor = new GallioSensor(new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.csharp.gallio.TestReportSensorTest.java
@Test public void testShouldNotExecuteOnProjectIfSkip() throws Exception { Configuration conf = new BaseConfiguration(); conf.setProperty(GallioConstants.MODE, GallioConstants.MODE_SKIP); TestReportSensor sensor = new TestReportSensor(new CSharpConfiguration(conf), microsoftWindowsEnvironment); assertFalse(sensor.shouldExecuteOnProject(project)); }
From source file:org.sonar.plugins.cutoff.CutoffFilterTest.java
@Test public void shouldParseDate() { Configuration conf = new PropertiesConfiguration(); conf.setProperty(CutoffConstants.DATE_PROPERTY, "2009-05-18"); assertThat(new CutoffFilter(conf).getCutoffDate().getDate(), is(18)); }
From source file:org.sonar.plugins.cutoff.CutoffFilterTest.java
@Test(expected = SonarException.class) public void shouldFailIfDateIsBadlyFormed() { Configuration conf = new PropertiesConfiguration(); conf.setProperty(CutoffConstants.DATE_PROPERTY, "2009/18/05"); new CutoffFilter(conf); }
From source file:org.sonar.plugins.cutoff.CutoffFilterTest.java
@Test public void shouldUsePeriodIfDateIsNotSet() { Configuration conf = new PropertiesConfiguration(); conf.setProperty(CutoffConstants.PERIOD_IN_DAYS_PROPERTY, "10"); assertThat(new CutoffFilter(conf).getCutoffDate().getTime(), greaterThan(System.currentTimeMillis() - 11 * 24 * 60 * 60 * 1000)); assertThat(new CutoffFilter(conf).getCutoffDate().getTime(), lessThan(System.currentTimeMillis() - 9 * 24 * 60 * 60 * 1000)); }
From source file:org.sonar.plugins.cxx.CxxLanguageTest.java
@Test public void shouldReturnConfiguredSuffixes() { Configuration config = new BaseConfiguration(); config.setProperty(CxxPlugin.FILE_SUFFIXES_KEY, "C, c"); CxxLanguage cxx = new CxxLanguage(config); String[] expected = { "C", "c" }; assertThat(cxx.getFileSuffixes(), is(expected)); }
From source file:org.sonar.plugins.email.EmailSendingTest.java
@Before public void start() { server = SimpleSmtpServer.start(port); Configuration configuration = new BaseConfiguration(); configuration.setProperty(EmailPublisher.ENABLED_PROPERTY, true); configuration.setProperty(EmailPublisher.PORT_PROPERTY, Integer.toString(port)); configuration.setProperty(EmailPublisher.FROM_PROPERTY, "sonar@domain"); configuration.setProperty(EmailPublisher.TO_PROPERTY, "user@domain"); project = new Project("org.example:foo", "", "Foo"); project.setConfiguration(configuration); Server server = mock(Server.class); when(server.getURL()).thenReturn("http://localhost:9000"); publisher = new EmailPublisher(server); context = mock(SensorContext.class); }