Search in sources :

Example 21 with Configuration

use of org.apache.commons.configuration.Configuration in project pinot by linkedin.

the class BitmapIndexCreationBenchmark method main.

public static void main(String[] args) throws Exception {
    System.out.println("Starting generation");
    Configuration tableDataManagerConfig = new PropertiesConfiguration();
    List<String> indexColumns = Lists.newArrayList("contract_id", "seat_id");
    tableDataManagerConfig.setProperty(IndexLoadingConfigMetadata.KEY_OF_LOADING_INVERTED_INDEX, indexColumns);
    IndexLoadingConfigMetadata indexLoadingConfigMetadata = new IndexLoadingConfigMetadata(tableDataManagerConfig);
    ReadMode mode = ReadMode.heap;
    File indexDir = new File("/home/kgopalak/pinot_perf/index_dir/capReportingEvents_OFFLINE/capReportingEvents_capReportingEvents_daily_2");
    long start = System.currentTimeMillis();
    Loaders.IndexSegment.load(indexDir, mode, indexLoadingConfigMetadata);
    long end = System.currentTimeMillis();
    System.out.println("Took " + (end - start) + " to generate bitmap index");
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) ReadMode(com.linkedin.pinot.common.segment.ReadMode) IndexLoadingConfigMetadata(com.linkedin.pinot.common.metadata.segment.IndexLoadingConfigMetadata) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File)

Example 22 with Configuration

use of org.apache.commons.configuration.Configuration in project ninja by ninjaframework.

the class NinjaConstantTest method testAllConstants.

/**
     * This testcase makes sure that all constants defined
     * in NinjaConstant are working.
     * 
     * File conf/all_constants.conf simply contains all contstants.
     * We simply read them in and check if the constants are okay.
     * 
     * Aim is to prevent stupid spelling mistakes.  
     * 
     */
@Test
public void testAllConstants() {
    Configuration configuration = SwissKnife.loadConfigurationInUtf8("conf/all_constants.conf");
    assertEquals("LANGUAGES", configuration.getString(NinjaConstant.applicationLanguages));
    assertEquals("PREFIX", configuration.getString(NinjaConstant.applicationCookiePrefix));
    assertEquals("NAME", configuration.getString(NinjaConstant.applicationName));
    assertEquals("SECRET", configuration.getString(NinjaConstant.applicationSecret));
    assertEquals("SERVER_NAME", configuration.getString(NinjaConstant.serverName));
    assertEquals(9999, configuration.getInt(NinjaConstant.sessionExpireTimeInSeconds));
    assertEquals(false, configuration.getBoolean(NinjaConstant.sessionSendOnlyIfChanged));
    assertEquals(false, configuration.getBoolean(NinjaConstant.sessionTransferredOverHttpsOnly));
    assertEquals(true, configuration.getBoolean(NinjaConstant.sessionHttpOnly));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Test(org.junit.Test)

Example 23 with Configuration

use of org.apache.commons.configuration.Configuration in project ninja by ninjaframework.

the class NinjaPropertiesImplToolTest method testProdThrowsError.

@Test(expected = RuntimeException.class)
public void testProdThrowsError() throws Exception {
    PropertiesConfiguration defaultConfiguration = new PropertiesConfiguration();
    Configuration compositeConfiguration = new PropertiesConfiguration();
    String uuid = UUID.randomUUID().toString();
    String baseDirWithoutTrailingSlash = "/tmp/ninja-test-" + uuid;
    boolean isProd = true;
    NinjaPropertiesImplTool.checkThatApplicationSecretIsSet(isProd, baseDirWithoutTrailingSlash, defaultConfiguration, compositeConfiguration);
    FileUtils.deleteDirectory(new File(baseDirWithoutTrailingSlash));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) Test(org.junit.Test)

Example 24 with Configuration

use of org.apache.commons.configuration.Configuration in project ninja by ninjaframework.

the class NinjaPropertiesImplToolTest method testNothingHappensWhenApplicationSecretIsThere.

@Test
public void testNothingHappensWhenApplicationSecretIsThere() throws Exception {
    PropertiesConfiguration defaultConfiguration = new PropertiesConfiguration();
    Configuration compositeConfiguration = new PropertiesConfiguration();
    compositeConfiguration.setProperty(NinjaConstant.applicationSecret, "secret");
    String uuid = UUID.randomUUID().toString();
    String baseDirWithoutTrailingSlash = "/tmp/ninja-test-" + uuid;
    boolean isProd = true;
    // works in prod mode
    NinjaPropertiesImplTool.checkThatApplicationSecretIsSet(isProd, baseDirWithoutTrailingSlash, defaultConfiguration, compositeConfiguration);
    assertFalse(new File(baseDirWithoutTrailingSlash + "src/main/java/conf/application.conf").exists());
    isProd = false;
    // also works in the other modes:
    NinjaPropertiesImplTool.checkThatApplicationSecretIsSet(isProd, baseDirWithoutTrailingSlash, defaultConfiguration, compositeConfiguration);
    assertFalse(new File(baseDirWithoutTrailingSlash + "src/main/java/conf/application.conf").exists());
    FileUtils.deleteDirectory(new File(baseDirWithoutTrailingSlash));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) Test(org.junit.Test)

Example 25 with Configuration

use of org.apache.commons.configuration.Configuration in project ninja by ninjaframework.

the class NinjaPropertiesImplToolTest method testMissingSecretCreatesNewOneInDevMode.

@Test
public void testMissingSecretCreatesNewOneInDevMode() throws Exception {
    String uuid = UUID.randomUUID().toString();
    String baseDirWithoutTrailingSlash = "/tmp/ninja-test-" + uuid;
    String devConf = baseDirWithoutTrailingSlash + File.separator + "src/main/java/conf/application.conf";
    PropertiesConfiguration defaultConfiguration = new PropertiesConfiguration();
    defaultConfiguration.setFileName(devConf);
    Configuration compositeConfiguration = new PropertiesConfiguration();
    boolean isProd = false;
    NinjaPropertiesImplTool.checkThatApplicationSecretIsSet(isProd, baseDirWithoutTrailingSlash, defaultConfiguration, compositeConfiguration);
    assertTrue(compositeConfiguration.getString(NinjaConstant.applicationSecret).length() == 64);
    assertTrue(defaultConfiguration.getString(NinjaConstant.applicationSecret).length() == 64);
    assertTrue(Files.toString(new File(devConf), Charsets.UTF_8).contains(NinjaConstant.applicationSecret));
    // tear down
    FileUtils.deleteDirectory(new File(baseDirWithoutTrailingSlash));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) Test(org.junit.Test)

Aggregations

Configuration (org.apache.commons.configuration.Configuration)169 Test (org.junit.Test)42 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)39 ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)23 Test (org.testng.annotations.Test)22 File (java.io.File)13 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)13 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)11 Properties (java.util.Properties)10 AtlasException (org.apache.atlas.AtlasException)9 ZkUtils (kafka.utils.ZkUtils)8 IndexLoadingConfigMetadata (com.linkedin.pinot.common.metadata.segment.IndexLoadingConfigMetadata)7 HashMap (java.util.HashMap)7 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)7 ArrayList (java.util.ArrayList)6 AtlasClient (org.apache.atlas.AtlasClient)6 BeforeClass (org.testng.annotations.BeforeClass)6 IOException (java.io.IOException)5 SimpleEntry (java.util.AbstractMap.SimpleEntry)5 ConfigurationException (org.apache.commons.configuration.ConfigurationException)5