Example usage for org.apache.commons.configuration Configuration getBoolean

List of usage examples for org.apache.commons.configuration Configuration getBoolean

Introduction

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

Prototype

boolean getBoolean(String key);

Source Link

Document

Get a boolean associated with the given configuration key.

Usage

From source file:org.sonar.plugins.php.phpunit.PhpUnitExecutorTest.java

@Test
public void testAnalyseMultipleTestDirectories() {
    PhpUnitConfiguration config = mock(PhpUnitConfiguration.class);
    Project project = mock(Project.class);
    MavenProject mProject = mock(MavenProject.class);
    when(project.getPom()).thenReturn(mProject);
    when(mProject.getBasedir()).thenReturn(new File("toto"));
    ProjectFileSystem pfs = mock(ProjectFileSystem.class);

    when(project.getFileSystem()).thenReturn(pfs);
    Configuration configuration = mock(Configuration.class);
    when(project.getConfiguration()).thenReturn(configuration);
    when(config.getProject()).thenReturn(project);

    when(configuration.containsKey(PHPUNIT_IGNORE_CONFIGURATION_PROPERTY_KEY)).thenReturn(false);
    when(configuration.getBoolean(PHPUNIT_IGNORE_CONFIGURATION_PROPERTY_KEY)).thenReturn(true);

    File testDir = new File("c:/php/math-php-test/sources/test");
    File testDir2 = new File("c:/php/math-php-test/sources/test2");
    when(project.getFileSystem().getTestDirs()).thenReturn(Arrays.asList(testDir, testDir2));

    PhpUnitExecutor executor = new PhpUnitExecutor(config, project);
    when(config.shouldRunCoverage()).thenReturn(false);
    when(config.getCoverageReportFile()).thenReturn(new File("phpUnit.coverage.xml"));
    List<String> commandLine = executor.getCommandLine();
    assertThat(commandLine).isNotEmpty();

    boolean found = false;
    for (String command : commandLine) {
        if (command != null && command.startsWith(PHPUNIT_CONFIGURATION_OPTION)) {
            found = true;/*w ww .j  a v a 2s.c  om*/
            break;
        }
    }
    assertThat(found).isTrue();
    assertThat(commandLine).excludes(PHPUNIT_IGNORE_CONFIGURATION_OPTION);
    assertThat(commandLine).excludes(testDir.toString());
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean readAllowRegisterLibraryAccounts() {

    boolean allow = false;

    try {/*from ww w .jav  a2s. c om*/
        final Configuration config = new PropertiesConfiguration(PATH);
        allow = config.getBoolean("allow.registerLibraryAccounts");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return allow;
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean readActivateGTC() {

    boolean activate = false;

    try {//from w ww .j av a  2 s  . c  o m
        final Configuration config = new PropertiesConfiguration(PATH);
        activate = config.getBoolean("activate.gtc");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return activate;
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean readActivatePaidAccess() {

    boolean activate = false;

    try {/*from w  w  w  .java  2  s.  c  om*/
        final Configuration config = new PropertiesConfiguration(PATH);
        activate = config.getBoolean("activate.paidAccess");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return activate;
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean readAnonymizationActivated() {

    boolean activated = false;

    try {/*from  ww w .  ja v  a2  s. c om*/
        final Configuration config = new PropertiesConfiguration(PATH);
        activated = config.getBoolean("anonymization.activated");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return activated;
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean searchCarelit() {

    boolean searchCarelit = false;

    try {// www .j ava  2s  . c o  m
        final Configuration config = new PropertiesConfiguration(PATH);
        searchCarelit = config.getBoolean("searchCarelit");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return searchCarelit;
}

From source file:util.AbstractReadSystemConfigurations.java

private static boolean readUseDaia() {

    boolean useDaia = false;

    try {/*from  w w  w  . j  av  a  2s  .  c  o m*/
        final Configuration config = new PropertiesConfiguration(PATH);
        useDaia = config.getBoolean("useDaia");

    } catch (final ConfigurationException e) {
        LOG.error(e.toString());
    }

    return useDaia;
}