Java Code Examples for org.apache.commons.configuration.BaseConfiguration#setProperty()
The following examples show how to use
org.apache.commons.configuration.BaseConfiguration#setProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesaServicesTest.java From proarc with GNU General Public License v3.0 | 6 votes |
@Before public void setUp() { conf = new BaseConfiguration(); conf.setProperty(DesaServices.PROPERTY_DESASERVICES, "ds1, dsNulls"); String prefix = DesaServices.PREFIX_DESA + '.' + "ds1" + '.'; conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, "ds1user"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_PASSWD, "ds1passwd"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_PRODUCER, "ds1producer"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_OPERATOR, "ds1operator"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_EXPORTMODELS, "model:id1, model:id2"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_RESTAPI, "https://SERVER/dea-frontend/rest/sipsubmission"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_WEBSERVICE, "https://SERVER/dea-frontend/ws/SIPSubmissionService"); conf.setProperty(prefix + DesaConfiguration.PROPERTY_NOMENCLATUREACRONYMS, "acr1, acr2"); prefix = DesaServices.PREFIX_DESA + '.' + "dsNulls" + '.'; conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, null); conf.setProperty(prefix + DesaConfiguration.PROPERTY_PASSWD, ""); conf.setProperty(prefix + DesaConfiguration.PROPERTY_EXPORTMODELS, null); conf.setProperty(prefix + DesaConfiguration.PROPERTY_NOMENCLATUREACRONYMS, null); prefix = DesaServices.PREFIX_DESA + '.' + "dsNotActive" + '.'; conf.setProperty(prefix + DesaConfiguration.PROPERTY_USER, "NA"); desaServices = new DesaServices(conf); }
Example 2
Source File: LogPatternsPage.java From otroslogviewer with Apache License 2.0 | 6 votes |
private void importFromIde() { final BaseConfiguration configuration = new BaseConfiguration(); final WizardSettings settings = this.getController().getSettings(); configuration.setProperty(ConfKeys.JUMP_TO_CODE_HOST, settings.get(Config.IDE_HOST)); configuration.setProperty(ConfKeys.JUMP_TO_CODE_PORT, settings.get(Config.IDE_PORT)); loggerConfigTextPane.setEditable(false); loggerConfigTextPane.setText("Importing log patterns from IDE"); new SwingWorker<Set<String>, Void>() { @Override protected Set<String> doInBackground() throws Exception { return new JumpToCodeServiceImpl(configuration).loggerPatterns(); } @Override protected void done() { try { loggerConfigTextPane.setEditable(true); loggerConfigTextPane.setText(Joiner.on("\n").join(get())); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } }.execute(); }
Example 3
Source File: GraphDatabaseConfiguration.java From grakn with GNU Affero General Public License v3.0 | 5 votes |
public org.apache.commons.configuration.Configuration getConfigurationAtOpen() { BaseConfiguration result = new BaseConfiguration(); for (String k : configurationAtOpen.getKeys("")) { result.setProperty(k, configurationAtOpen.get(k, Object.class)); } return result; }
Example 4
Source File: EntityGraphFactory.java From baleen with Apache License 2.0 | 5 votes |
private Graph createTransformGraph(boolean multiValue) { BaseConfiguration configuration = new BaseConfiguration(); configuration.setProperty(Graph.GRAPH, TinkerGraph.class.getName()); if (multiValue) { configuration.setProperty( TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name()); } else { configuration.setProperty( TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.single.name()); } return TinkerGraph.open(configuration); }
Example 5
Source File: BufferingLogDataCollectorProxyTest.java From otroslogviewer with Apache License 2.0 | 5 votes |
@BeforeMethod public void initTest() throws InterruptedException, InvocationTargetException { BaseConfiguration configuration = new BaseConfiguration(); configuration.setProperty(ConfKeys.TAILING_PANEL_PLAY, true); delegate = new ProxyLogDataCollector(); bufferingLogDataCollectorProxy = new BufferingLogDataCollectorProxy(delegate, sleepTime, configuration); // Initialize swing thread SwingUtilities.invokeAndWait(() -> { }); }
Example 6
Source File: JumpToCodeClientTest.java From otroslogviewer with Apache License 2.0 | 5 votes |
@BeforeMethod public void setUp() { wireMock = new WireMockServer(wireMockConfig()); wireMock.stubFor(get(urlPathEqualTo("/")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withHeader("plugin-features", "jumpByLine,jumpByMessage,contentByLine,contentByMessage,allFile,loggersConfig") .withHeader("ide", "idea") .withBody(""))); wireMock.stubFor(get(urlPathEqualTo("/")) .withQueryParam("o", equalTo("test")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withHeader("plugin-features", "jumpByLine,jumpByMessage,contentByLine,contentByMessage,allFile,loggersConfig") .withHeader("ide", "idea") .withBody(""))); wireMock.stubFor(get(urlPathEqualTo("/")) .withQueryParam("o", equalTo("loggersConfig")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withHeader("plugin-features", "jumpByLine,jumpByMessage,contentByLine,contentByMessage,allFile,loggersConfig") .withHeader("ide", "idea") .withBody(LOGGER_PATTERNS_RESPONSE))); wireMock.start(); final BaseConfiguration configuration = new BaseConfiguration(); configuration.setProperty(ConfKeys.JUMP_TO_CODE_HOST, "localhost"); configuration.setProperty(ConfKeys.JUMP_TO_CODE_PORT, wireMock.port()); jumpToCodeClient = new JumpToCodeClient(configuration); }
Example 7
Source File: FetchDataTest.java From BUbiNG with Apache License 2.0 | 4 votes |
@Test public void testSyncWithProxy() throws IOException, NoSuchAlgorithmException, IllegalArgumentException, ConfigurationException, ClassNotFoundException { final URI url0 = BURL.parse(new MutableString("http://foo.bar/goo/zoo.html")); final URI url1 = BURL.parse(new MutableString("http://foo.bar/goo/naa.html")); final String content0 = "Esempio di pagina html..."; final String content1 = "<html><head>\n<title>Moved</title>\n</head>\n<body>\n<h1>Moved</h1>\n<p>This page has moved to <a href=\"http://foo.bar/goo/zoo.html\">http://foo.bar/goo/zoo.html</a>.</p>\n</body>\n</html>"; proxy = new SimpleFixedHttpProxy(); proxy.add200(url0, "", content0); proxy.addNon200(url1, "HTTP/1.1 301 Moved Permanently\n" + "Location: http://foo.bar/goo/zoo.html\n" + "Content-Type: text/html\n", content1 ); proxy.start(); HttpClient httpClient = getHttpClient(new HttpHost("localhost", proxy.port()), false); // Test normal operations FetchData fetchData = new FetchData(testConfiguration); fetchData.fetch(url0, httpClient, null, null, false); assertNull(fetchData.exception); assertEquals(content0, IOUtils.toString(fetchData.response().getEntity().getContent(), Charsets.ISO_8859_1)); assertEquals(content0, IOUtils.toString(fetchData.response().getEntity().getContent(), Charsets.ISO_8859_1)); fetchData.fetch(url1, httpClient, null, null, false); assertNull(fetchData.exception); assertEquals(url0.toString(), fetchData.response().getFirstHeader(HttpHeaders.LOCATION).getValue()); assertEquals(content1, IOUtils.toString(fetchData.response().getEntity().getContent(), Charsets.ISO_8859_1)); assertEquals(content1, IOUtils.toString(fetchData.response().getEntity().getContent(), Charsets.ISO_8859_1)); fetchData.close(); // Test for truncated response body for(int l = 0; l < 2000; l = l * 2 + 1) { BaseConfiguration baseConfiguration = new BaseConfiguration(); baseConfiguration.setProperty("responseBodyMaxByteSize", Integer.toString(l)); fetchData = new FetchData(Helpers.getTestConfiguration(this, baseConfiguration, true)); fetchData.fetch(url1, httpClient, null, null, false); assertNull(fetchData.exception); assertEquals(content1.substring(0, Math.min(l, content1.length())), IOUtils.toString(fetchData.response().getEntity().getContent(), Charsets.ISO_8859_1)); fetchData.close(); } }
Example 8
Source File: GraphContextImpl.java From windup with Eclipse Public License 1.0 | 4 votes |
private JanusGraph initializeJanusGraph(boolean createMode, boolean enableListeners) { LOG.fine("Initializing graph."); Path lucene = graphDir.resolve("graphsearch"); Path berkeley = graphDir.resolve("titangraph"); // TODO: Externalize this. conf = new BaseConfiguration(); // Sets a unique id in order to fix WINDUP-697. This causes Titan to not attempt to generate and ID, // as the Titan id generation code fails on machines with broken network configurations. conf.setProperty("graph.unique-instance-id", "windup_" + System.nanoTime() + "_" + RandomStringUtils.randomAlphabetic(6)); conf.setProperty("storage.directory", berkeley.toAbsolutePath().toString()); conf.setProperty("storage.backend", "berkeleyje"); // Sets the berkeley cache to a relatively small value to reduce the memory footprint. // This is actually more important than performance on some of the smaller machines out there, and // the performance decrease seems to be minimal. conf.setProperty("storage.berkeleydb.cache-percentage", 1); // Set READ UNCOMMITTED to improve performance conf.setProperty("storage.berkeleydb.lock-mode", LockMode.READ_UNCOMMITTED); conf.setProperty("storage.berkeleydb.isolation-level", BerkeleyJEStoreManager.IsolationLevel.READ_UNCOMMITTED); // Increase storage write buffer since we basically do a large bulk load during the first phases. // See http://s3.thinkaurelius.com/docs/titan/current/bulk-loading.html conf.setProperty("storage.buffer-size", "4096"); // Turn off transactions to improve performance conf.setProperty("storage.transactions", false); conf.setProperty("ids.block-size", 25000); // conf.setProperty("ids.flush", true); // conf.setProperty("", false); // // turn on a db-cache that persists across txn boundaries, but make it relatively small conf.setProperty("cache.db-cache", true); conf.setProperty("cache.db-cache-clean-wait", 0); conf.setProperty("cache.db-cache-size", .09); conf.setProperty("cache.db-cache-time", 0); conf.setProperty("index.search.backend", "lucene"); conf.setProperty("index.search.directory", lucene.toAbsolutePath().toString()); writeToPropertiesFile(conf, graphDir.resolve("TitanConfiguration.properties").toFile()); JanusGraph janusGraph = JanusGraphFactory.open(conf); /* * We only need to setup the eventing system when initializing a graph, not when loading it later for * reporting. */ if (enableListeners) { TraversalStrategies graphStrategies = TraversalStrategies.GlobalCache .getStrategies(StandardJanusGraph.class) .clone(); // Remove any old listeners if (graphStrategies.getStrategy(EventStrategy.class) != null) graphStrategies.removeStrategies(EventStrategy.class); graphStrategies.addStrategies(EventStrategy.build().addListener(mutationListener).create()); TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraph.class, graphStrategies); mutationListener.setGraph(this); } return janusGraph; }