Example usage for org.apache.commons.configuration BaseConfiguration BaseConfiguration

List of usage examples for org.apache.commons.configuration BaseConfiguration BaseConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration BaseConfiguration BaseConfiguration.

Prototype

BaseConfiguration

Source Link

Usage

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldSkipWhenShouldRunSetToFalseAndSkipNotSet() {
    Configuration config = new BaseConfiguration();
    config.setProperty("run", false);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(true, conf.isSkip());/*from  www .ja  v  a  2 s  .c om*/
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldNotSkipWhenShouldRunSetToTrueAndSkipNotSet() {
    Configuration config = new BaseConfiguration();
    config.setProperty("run", true);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(false, conf.isSkip());// w  w  w.j a v  a  2s  .  c  om
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldSkipWhenSkipSetToTrueAndShouldRunNotSet() {
    Configuration config = new BaseConfiguration();
    config.setProperty("skip", true);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(true, conf.isSkip());/*from   ww  w. j a  v a2s . c om*/
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldNotSkipWhenSkipSetToFalseAndShouldRunNotSet() {
    Configuration config = new BaseConfiguration();
    config.setProperty("skip", false);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(false, conf.isSkip());/*w  w w  . j av a2 s  .c om*/
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldSkipIgnoringShouldRunValueWhenSkipSetToTrue() {
    Configuration config = new BaseConfiguration();
    config.setProperty("skip", true);
    config.setProperty("run", true);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(true, conf.isSkip());/*from   w  w w . j  a  v  a 2  s.  c  o  m*/
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void shouldNotSkipIgnoringShouldRunValueWhenSkipSetToFalse() {
    Configuration config = new BaseConfiguration();
    config.setProperty("skip", false);
    config.setProperty("run", true);

    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);

    assertEquals(false, conf.isSkip());/*from  w w w  . ja  va  2s. co  m*/
}

From source file:org.sonar.plugins.php.core.AbstractPhpPluginConfigurationTest.java

@Test
public void testDynamicAnalysisProperty() {
    Configuration config = new BaseConfiguration();
    Project project = MockUtils.createMockProject(config);
    FakeConfiguration conf = new FakeConfiguration(project);
    assertEquals(true, conf.isDynamicAnalysisEnabled());

    // Set to FALSE
    config.setProperty("sonar.dynamicAnalysis", "false");
    conf = new FakeConfiguration(project);
    assertEquals(false, conf.isDynamicAnalysisEnabled());

    // Set to REUSE REPORTS (may be possible in Sonar, does not make sense for the moment in PHP plugin but must not break)
    config.setProperty("sonar.dynamicAnalysis", "reuseReports");
    conf = new FakeConfiguration(project);
    assertEquals(true, conf.isDynamicAnalysisEnabled());
}

From source file:org.sonar.plugins.squid.SquidSensorTest.java

@Test
public void testGetBytecodeFiles() {
    ProjectClasspath projectClasspath = mock(ProjectClasspath.class);
    when(projectClasspath.getElements()).thenReturn(Arrays.asList(new File("classes")));
    SquidSensor sensor = new SquidSensor(null, null, projectClasspath, null, null);
    Configuration configuration = new BaseConfiguration();
    Project project = mock(Project.class);
    when(project.getConfiguration()).thenReturn(configuration);

    configuration.setProperty(CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY, true);
    assertThat(sensor.getBytecodeFiles(project).size(), is(0));

    configuration.setProperty(CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY, false);
    assertThat(sensor.getBytecodeFiles(project).size(), is(1));
    assertThat(sensor.getBytecodeFiles(project),
            sameInstance((Collection<File>) projectClasspath.getElements()));
}

From source file:org.sonar.plugins.twitter.TwitterPublisherTest.java

@Test
public void updateStatus() throws TwitterException {
    Configuration configuration = new BaseConfiguration();
    configuration.setProperty(USERNAME_PROPERTY, "user");
    configuration.setProperty(PASSWORD_PROPERTY, "pass");
    configuration.setProperty(HOST_PROPERTY, HOST_DEFAULT_VALUE);

    when(project.getConfiguration()).thenReturn(configuration);
    when(project.getName()).thenReturn("SimpleProject");
    doNothing().when(publisher).updateStatus(anyString());

    publisher.executeOn(project, context);

    // verify(publisher).updateStatus(contains("SimpleProject"));
}

From source file:org.sonar.plugins.xaml.XamlLanguageTest.java

@Before
public void setup() {
    config = new BaseConfiguration();
}