List of usage examples for org.apache.commons.configuration PropertiesConfiguration setProperty
public void setProperty(String key, Object value)
From source file:org.apache.atlas.web.service.SecureEmbeddedServerTestBase.java
/** * Runs the existing webapp test cases, this time against the initiated secure server instance. * @throws Exception//from ww w .j a va 2 s. c o m */ @Test public void runOtherSuitesAgainstSecureServer() throws Exception { final PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty(CERT_STORES_CREDENTIAL_PROVIDER_PATH, providerUrl); // setup the credential provider setupCredentials(); try { secureEmbeddedServer = new SecureEmbeddedServer(securePort, TestUtils.getWarPath()) { @Override protected PropertiesConfiguration getConfiguration() { return configuration; } }; secureEmbeddedServer.server.start(); TestListenerAdapter tla = new TestListenerAdapter(); TestNG testng = new TestNG(); testng.setTestClasses(new Class[] { AdminJerseyResourceIT.class, EntityJerseyResourceIT.class, MetadataDiscoveryJerseyResourceIT.class, TypesJerseyResourceIT.class }); testng.addListener(tla); testng.run(); } finally { secureEmbeddedServer.server.stop(); } }
From source file:org.apache.bookkeeper.stats.prometheus.TestPrometheusMetricsProvider.java
@Test public void testStartNoHttp() { PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ENABLE, false); PrometheusMetricsProvider provider = new PrometheusMetricsProvider(); try {/* w ww. j a v a2 s. co m*/ provider.start(config); assertNull(provider.server); } finally { provider.stop(); } }
From source file:org.apache.bookkeeper.stats.prometheus.TestPrometheusMetricsProvider.java
@Test public void testStartNoHttpWhenBkHttpEnabled() { PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ENABLE, true); config.setProperty("httpServerEnabled", true); @Cleanup("stop") PrometheusMetricsProvider provider = new PrometheusMetricsProvider(); provider.start(config);/* ww w.j a v a 2 s.co m*/ assertNull(provider.server); }
From source file:org.apache.bookkeeper.stats.prometheus.TestPrometheusMetricsProvider.java
@Test public void testStartWithHttp() { PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_ENABLE, true); config.setProperty(PrometheusMetricsProvider.PROMETHEUS_STATS_HTTP_PORT, 0); // ephemeral PrometheusMetricsProvider provider = new PrometheusMetricsProvider(); try {//from w ww . ja v a2 s .c o m provider.start(config); assertNotNull(provider.server); } finally { provider.stop(); } }
From source file:org.apache.cloudstack.network.contrail.management.TestDbSetup.java
public static void updateSqlPort(int port, String propertyFileOverride) throws Exception { PropertiesConfiguration config = new PropertiesConfiguration(propertyFileOverride); System.out.println("File: " + propertyFileOverride + "; old: db.properties port: " + config.getProperty("db.cloud.port") + ", new port: " + port); config.setProperty("db.cloud.port", "" + port); config.setProperty("db.cloud.username", System.getProperty("user.name")); config.setProperty("db.cloud.password", ""); config.setProperty("db.usage.port", "" + port); config.setProperty("db.usage.username", System.getProperty("user.name")); config.setProperty("db.usage.password", ""); config.setProperty("db.simulator.port", "" + port); config.setProperty("db.simulator.username", System.getProperty("user.name")); config.setProperty("db.simulator.password", ""); config.save();//w w w . j av a 2 s. c o m }
From source file:org.apache.qpid.server.configuration.QueueConfigurationTest.java
@Override public void setUp() throws Exception { super.setUp(); BrokerTestHelper.setUp();//from w w w .j av a2s .co m _broker = BrokerTestHelper.createBrokerMock(); _env = new PropertiesConfiguration(); _emptyConf = new VirtualHostConfiguration("test", _env, _broker); PropertiesConfiguration fullEnv = new PropertiesConfiguration(); fullEnv.setProperty("queues.maximumMessageAge", 1); fullEnv.setProperty("queues.maximumQueueDepth", 1); fullEnv.setProperty("queues.maximumMessageSize", 1); fullEnv.setProperty("queues.maximumMessageCount", 1); fullEnv.setProperty("queues.minimumAlertRepeatGap", 1); fullEnv.setProperty("queues.deadLetterQueues", true); fullEnv.setProperty("queues.maximumDeliveryCount", 5); _fullHostConf = new VirtualHostConfiguration("test", fullEnv, _broker); }
From source file:org.apache.qpid.server.configuration.QueueConfigurationTest.java
private VirtualHostConfiguration overrideConfiguration(String property, Object value) throws ConfigurationException { PropertiesConfiguration queueConfig = new PropertiesConfiguration(); queueConfig.setProperty("queues.queue.test." + property, value); CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(_fullHostConf.getConfig()); config.addConfiguration(queueConfig); return new VirtualHostConfiguration("test", config, _broker); }
From source file:org.apache.ranger.ldapconfigcheck.LdapConfig.java
public void updateInputPropFile(String ldapUrl, String bindDn, String bindPassword, String userSearchBase, String userSearchFilter, String authUser, String authPass) { try {// www .j a v a2s.c om PropertiesConfiguration config = new PropertiesConfiguration(CONFIG_FILE); // Update properties in memory and update the file as well prop.setProperty(LGSYNC_LDAP_URL, ldapUrl); prop.setProperty(LGSYNC_LDAP_BIND_DN, bindDn); prop.setProperty(LGSYNC_LDAP_BIND_PASSWORD, bindPassword); prop.setProperty(LGSYNC_USER_SEARCH_BASE, userSearchBase); prop.setProperty(LGSYNC_USER_SEARCH_FILTER, userSearchFilter); prop.setProperty(AUTH_USERNAME, authUser); prop.setProperty(AUTH_PASSWORD, authPass); config.setProperty(LGSYNC_LDAP_URL, ldapUrl); config.setProperty(LGSYNC_LDAP_BIND_DN, bindDn); //config.setProperty(LGSYNC_LDAP_BIND_PASSWORD, bindPassword); config.setProperty(LGSYNC_USER_SEARCH_BASE, userSearchBase); config.setProperty(LGSYNC_USER_SEARCH_FILTER, userSearchFilter); config.setProperty(AUTH_USERNAME, authUser); config.setProperty(AUTH_PASSWORD, authPass); config.save(); } catch (ConfigurationException e) { System.out.println("Failed to update " + CONFIG_FILE + ": " + e); } }
From source file:org.apache.whirr.ClusterSpecTest.java
@Test public void testFirewallRules() throws Exception { PropertiesConfiguration conf = new PropertiesConfiguration("whirr-core-test.properties"); conf.setProperty("whirr.firewall-rules", "8000,8001"); conf.setProperty("whirr.firewall-rules.serviceA", "9000,9001"); ClusterSpec spec = ClusterSpec.withTemporaryKeys(conf); Map<String, List<String>> firewallRules = spec.getFirewallRules(); assertThat(firewallRules.get(null).equals(Lists.<String>newArrayList("8000", "8001")), is(true)); assertThat(firewallRules.get("serviceA").equals(Lists.<String>newArrayList("9000", "9001")), is(true)); }
From source file:org.apache.whirr.ClusterSpecTest.java
@Test public void testHardwareIdPerInstanceTemplate() throws Exception { PropertiesConfiguration conf = new PropertiesConfiguration("whirr-core-test.properties"); conf.setProperty("whirr.instance-templates", "2 noop, 1 role1+role2, 1 role1, 3 spots"); conf.setProperty("whirr.hardware-id", "c1.xlarge"); conf.setProperty("whirr.templates.noop.hardware-id", "m1.large"); conf.setProperty("whirr.templates.role1+role2.hardware-id", "t1.micro"); conf.setProperty("whirr.templates.role1+role2.image-id", "us-east-1/ami-123324"); conf.setProperty("whirr.templates.spots.aws-ec2-spot-price", 0.5f); ClusterSpec spec = ClusterSpec.withTemporaryKeys(conf); List<InstanceTemplate> templates = spec.getInstanceTemplates(); InstanceTemplate noops = get(templates, 0); assert noops.getRoles().contains("noop"); assertEquals(noops.getHardwareId(), "m1.large"); assertEquals(noops.getImageId(), null); InstanceTemplate second = get(templates, 1); assertEquals(second.getHardwareId(), "t1.micro"); assertEquals(second.getImageId(), "us-east-1/ami-123324"); InstanceTemplate third = get(templates, 2); assertEquals(third.getHardwareId(), null); assertEquals(third.getImageId(), null); InstanceTemplate spots = get(templates, 3); assertEquals(spots.getAwsEc2SpotPrice(), 0.5f, 0.001); }