List of usage examples for java.lang System clearProperty
public static String clearProperty(String key)
From source file:com.yahoo.athenz.common.server.db.DataSourceFactoryTest.java
@Test public void testPoolConfigZeroValues() { System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TOTAL, "0"); System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_IDLE, "0"); System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MIN_IDLE, "0"); System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_WAIT, "0"); System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_TIMEOUT, "0"); System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_INTERVAL, "0"); GenericObjectPoolConfig config = DataSourceFactory.setupPoolConfig(); assertNotNull(config);/*from w w w . j a v a 2s .com*/ // MaxTotal and MaxIdle are set to -1 if the value is 0 assertEquals(config.getMaxTotal(), -1); assertEquals(config.getMaxIdle(), -1); assertEquals(config.getMinIdle(), 0); assertEquals(config.getMaxWaitMillis(), 0); assertEquals(config.getMinEvictableIdleTimeMillis(), 0); assertEquals(config.getTimeBetweenEvictionRunsMillis(), 0); assertTrue(config.getTestWhileIdle()); assertTrue(config.getTestOnBorrow()); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TOTAL); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_IDLE); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MIN_IDLE); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_WAIT); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_TIMEOUT); System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_EVICT_IDLE_INTERVAL); }
From source file:org.apache.solr.cloud.AbstractFullDistribZkTestBase.java
@AfterClass public static void afterClass() { System.clearProperty("solrcloud.update.delay"); System.clearProperty("genericCoreNodeNames"); }
From source file:com.gemstone.gemfire.management.internal.RestAgent.java
private void stopHttpService() { if (this.httpServer != null) { logger.info("Stopping the HTTP service..."); try {/*from w w w . j a v a2s.co m*/ this.httpServer.stop(); } catch (Exception e) { logger.warn("Failed to stop the HTTP service because: {}", e.getMessage(), e); } finally { try { this.httpServer.destroy(); } catch (Exception ignore) { logger.error("Failed to properly release resources held by the HTTP service: {}", ignore.getMessage(), ignore); } finally { this.httpServer = null; System.clearProperty("catalina.base"); System.clearProperty("catalina.home"); } } } }
From source file:com.addthis.hydra.data.io.TestDiskBackedList2.java
@Test public void dontExceedMaxDiskSpaceTest() throws IOException { System.setProperty("max.total.query.size.bytes", "200"); DiskBackedList2<TestValue> dbl = new DiskBackedList2<>(codec, 50, Files.createTempDir()); try {/*from w ww. ja va2 s . c o m*/ boolean failed = false; for (int i = 0; i < 100; i++) { try { dbl.add(new TestValue(i)); } catch (RuntimeException ex) { System.out.println(ex); failed = true; break; } } Assert.assertEquals(true, failed); System.clearProperty("max.total.query.size.bytes"); dbl.clear(); } finally { if (dbl != null) { LessFiles.deleteDir(dbl.getDirectory()); } } }
From source file:org.apache.solr.cloud.ClusterStateUpdateTest.java
@Test public void testCoreRegistration() throws Exception { System.setProperty("solrcloud.update.delay", "1"); Map<String, Object> props2 = new HashMap<String, Object>(); props2.put("configName", "conf1"); ZkNodeProps zkProps2 = new ZkNodeProps(props2); SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); zkClient.makePath(ZkStateReader.COLLECTIONS_ZKNODE + "/testcore", ZkStateReader.toJSON(zkProps2), CreateMode.PERSISTENT, true); zkClient.makePath(ZkStateReader.COLLECTIONS_ZKNODE + "/testcore/shards", CreateMode.PERSISTENT, true); zkClient.close();/*from w w w.j a v a 2 s .c o m*/ CoreDescriptor dcore = buildCoreDescriptor(container1, "testcore", "testcore") .withDataDir(dataDir4.getAbsolutePath()).build(); if (container1.getZkController() != null) { container1.preRegisterInZk(dcore); } SolrCore core = container1.create(dcore); container1.register(core, false); ZkController zkController2 = container2.getZkController(); String host = zkController2.getHostName(); // slight pause - TODO: takes an oddly long amount of time to schedule tasks // with almost no delay ... ClusterState clusterState2 = null; Map<String, Slice> slices = null; for (int i = 75; i > 0; i--) { clusterState2 = zkController2.getClusterState(); slices = clusterState2.getSlicesMap("testcore"); if (slices != null && slices.containsKey("shard1") && slices.get("shard1").getReplicasMap().size() > 0) { break; } Thread.sleep(500); } assertNotNull(slices); assertTrue(slices.containsKey("shard1")); Slice slice = slices.get("shard1"); assertEquals("shard1", slice.getName()); Map<String, Replica> shards = slice.getReplicasMap(); assertEquals(1, shards.size()); Replica zkProps = shards.get(host + ":1661_solr_testcore"); assertNotNull(zkProps); assertEquals(host + ":1661_solr", zkProps.getStr(ZkStateReader.NODE_NAME_PROP)); assertEquals("http://" + host + ":1661/solr", zkProps.getStr(ZkStateReader.BASE_URL_PROP)); Set<String> liveNodes = clusterState2.getLiveNodes(); assertNotNull(liveNodes); assertEquals(3, liveNodes.size()); container3.shutdown(); // slight pause (15s timeout) for watch to trigger for (int i = 0; i < (5 * 15); i++) { if (zkController2.getClusterState().getLiveNodes().size() == 2) { break; } Thread.sleep(200); } assertEquals(2, zkController2.getClusterState().getLiveNodes().size()); // quickly kill / start client container2.getZkController().getZkClient().getSolrZooKeeper().getConnection().disconnect(); container2.shutdown(); System.setProperty("hostPort", "1662"); System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath()); container2 = new CoreContainer(solrHomeDirectory.getAbsolutePath()); container2.load(); System.clearProperty("hostPort"); // pause for watch to trigger for (int i = 0; i < 200; i++) { if (container1.getZkController().getClusterState() .liveNodesContain(container2.getZkController().getNodeName())) { break; } Thread.sleep(100); } assertTrue(container1.getZkController().getClusterState() .liveNodesContain(container2.getZkController().getNodeName())); // core.close(); // don't close - this core is managed by container1 now }
From source file:com.seleniumtests.ut.browserfactory.TestEdgeCapabilityFactory.java
@Test(groups = { "ut" }) public void testCreateEdgeCapabilitiesStandardDriverPathLocal() { try {//from w w w . j a v a 2s. co m Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL); new EdgeCapabilitiesFactory(config).createCapabilities(); Assert.assertTrue(System.getProperty(EdgeDriverService.EDGE_DRIVER_EXE_PROPERTY) .replace(File.separator, "/").contains("/drivers/MicrosoftWebDriver_")); } finally { System.clearProperty(EdgeDriverService.EDGE_DRIVER_EXE_PROPERTY); } }
From source file:com.seleniumtests.it.reporter.TestCustomReporter.java
@Test(groups = { "it" }) public void testXmlCharacterEscape(ITestContext testContext) throws Exception { try {/*from ww w . j a v a2 s. co m*/ System.setProperty("customTestReports", "SUP::xml::reporter/templates/report.supervision.vm"); executeSubTest(new String[] { "com.seleniumtests.it.stubclasses.StubTestClassForEncoding" }); String detailedReportContent = FileUtils .readFileToString(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "testAndSubActions", "SUP-result.xml").toFile()); // check step 1 has been encoded Assert.assertTrue(detailedReportContent.contains("<name>step 1 <>"'&/</name>")); } finally { System.clearProperty("customTestReports"); } }
From source file:com.ericsson.eiffel.remrem.publish.cli.CliOptions.java
/** * Remove the system properties added by this application *///from w w w . j a v a 2 s . co m public static void clearSystemProperties() { String key = PropertiesConfig.MESSAGE_BUS_HOST; System.clearProperty(key); key = PropertiesConfig.EXCHANGE_NAME; System.clearProperty(key); key = PropertiesConfig.USE_PERSISTENCE; System.clearProperty(key); key = PropertiesConfig.CLI_MODE; System.clearProperty(key); key = PropertiesConfig.MESSAGE_BUS_PORT; System.clearProperty(key); key = PropertiesConfig.TLS; System.clearProperty(key); key = PropertiesConfig.DOMAIN_ID; System.clearProperty(key); }
From source file:fr.jetoile.hadoopunit.component.SolrCloudBootstrap.java
@Override public Bootstrap stop() { if (state == State.STARTED) { state = State.STOPPING;//from w w w . j ava 2 s .co m LOGGER.info("{} is stopping", this.getClass().getName()); try { System.clearProperty("zkHost"); this.solrServer.stop(); } catch (Exception e) { LOGGER.error("unable to stop SolrCloudBootstrap", e); } state = State.STOPPED; LOGGER.info("{} is stopped", this.getClass().getName()); } return this; }
From source file:com.seleniumtests.it.driver.TestWebUiDriver.java
/** * Check that HAR capture file is present in result with manual steps * //from w w w . j ava 2 s . co m * @throws Exception */ @Test(groups = { "it" }) public void testReportContainsHarCaptureWithManualSteps() throws Exception { try { System.setProperty(SeleniumTestsContext.CAPTURE_NETWORK, "true"); executeSubTest(1, new String[] { "com.seleniumtests.it.stubclasses.StubTestClassForDriverTest" }, ParallelMode.METHODS, new String[] { "testDriverManualSteps" }); Assert.assertTrue(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "testDriverManualSteps", "networkCapture.har").toFile().exists()); JSONObject json = new JSONObject(FileUtils .readFileToString(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(), "testDriverManualSteps", "networkCapture.har").toFile())); JSONArray pages = json.getJSONObject("log").getJSONArray("pages"); Assert.assertEquals(pages.length(), 2); Assert.assertEquals(pages.getJSONObject(0).getString("id").trim(), "testDriverManualSteps"); Assert.assertEquals(pages.getJSONObject(1).getString("id").trim(), "Reset"); // step "Write" is not recorded because the driver is not created before the DriverTestPage object is created } finally { System.clearProperty(SeleniumTestsContext.CAPTURE_NETWORK); } }