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");
}
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));
}
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));
}
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));
}
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));
}
Aggregations