Example usage for java.lang System clearProperty

List of usage examples for java.lang System clearProperty

Introduction

In this page you can find the example usage for java.lang System clearProperty.

Prototype

public static String clearProperty(String key) 

Source Link

Document

Removes the system property indicated by the specified key.

Usage

From source file:android.net.Proxy.java

/** @hide */
public static final void setHttpProxySystemProperty(String host, String port, String exclList) {
    if (exclList != null)
        exclList = exclList.replace(",", "|");
    if (false)/* ww  w.j  av  a  2 s. co  m*/
        Log.d(TAG, "setHttpProxySystemProperty :" + host + ":" + port + " - " + exclList);
    if (host != null) {
        System.setProperty("http.proxyHost", host);
        System.setProperty("https.proxyHost", host);
    } else {
        System.clearProperty("http.proxyHost");
        System.clearProperty("https.proxyHost");
    }
    if (port != null) {
        System.setProperty("http.proxyPort", port);
        System.setProperty("https.proxyPort", port);
    } else {
        System.clearProperty("http.proxyPort");
        System.clearProperty("https.proxyPort");
    }
    if (exclList != null) {
        System.setProperty("http.nonProxyHosts", exclList);
        System.setProperty("https.nonProxyHosts", exclList);
    } else {
        System.clearProperty("http.nonProxyHosts");
        System.clearProperty("https.nonProxyHosts");
    }
}

From source file:org.apache.solr.client.solrj.request.TestCoreAdmin.java

@After
public void after() {
    // wtf?//from   www  . j a  va2 s  .co m
    if (tempDirProp != null) {
        System.setProperty("tempDir", tempDirProp);
    } else {
        System.clearProperty("tempDir");
    }

    System.clearProperty("solr.solr.home");
}

From source file:org.eclipse.epp.internal.logging.aeri.ui.LogListenerTest.java

@Test
public void testNoReportIfBuildIdUnknown() {
    System.clearProperty(SYSPROP_ECLIPSE_BUILD_ID);
    Status status = new Status(IStatus.ERROR, TEST_PLUGIN_ID, "a message");

    sut.logging(status, "");

    verifyNoErrorReportLogged();/*from   w  w w .j av a 2s . c o  m*/
}

From source file:org.nuxeo.launcher.TestNuxeoLauncher.java

@Override
@After//ww w. j a  va  2  s  .  com
public void tearDown() {
    FileUtils.deleteQuietly(nuxeoHome);
    System.clearProperty(ConfigurationGenerator.NUXEO_CONF);
    System.clearProperty(Environment.NUXEO_HOME);
    System.clearProperty(TomcatConfigurator.TOMCAT_HOME);
    System.clearProperty(Environment.NUXEO_DATA_DIR);
    System.clearProperty(Environment.NUXEO_LOG_DIR);
}

From source file:org.apache.solr.cloud.AbstractFullDistribZkTestBase.java

@Override
protected void createServers(int numServers) throws Exception {

    System.setProperty("collection", "control_collection");
    String numShards = System.getProperty(ZkStateReader.NUM_SHARDS_PROP);

    // we want hashes by default for the control, so set to 1 shard as opposed to leaving unset
    // System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
    System.setProperty(ZkStateReader.NUM_SHARDS_PROP, "1");

    File controlJettyDir = new File(TEMP_DIR,
            getClass().getName() + "-controljetty-" + System.currentTimeMillis());
    setupJettySolrHome(controlJettyDir);

    controlJetty = createJetty(controlJettyDir, testDir + "/control/data"); // don't pass shard name... let it default to "shard1"
    System.clearProperty("collection");
    if (numShards != null) {
        System.setProperty(ZkStateReader.NUM_SHARDS_PROP, numShards);
    } else {// w w  w.jav  a2 s  .c o  m
        System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
    }
    controlClient = createNewSolrServer(controlJetty.getLocalPort());

    if (sliceCount <= 0) {
        // for now, just create the cloud client for the control if we don't create the normal cloud client.
        // this can change if more tests need it.
        controlClientCloud = createCloudClient("control_collection");
        controlClientCloud.connect();
        waitForCollection(controlClientCloud.getZkStateReader(), "control_collection", 0);
        // NOTE: we are skipping creation of the chaos monkey by returning here
        cloudClient = controlClientCloud; // temporary - some code needs/uses cloudClient
        return;
    }

    initCloud();

    createJettys(numServers, checkCreatedVsState).size();

    int cnt = getTotalReplicas(DEFAULT_COLLECTION);
    if (cnt > 0) {
        waitForCollection(cloudClient.getZkStateReader(), DEFAULT_COLLECTION, sliceCount);
    }

}

From source file:org.deventropy.junithelper.derby.EmbeddedDerbyResource.java

private void resetDerbyHome() {
    // Reset the Derby System Home property
    if (null != oldDerbySystemHomeValue && !oldDerbySystemHomeValue.isEmpty()) {
        System.setProperty(PROP_DERBY_SYSTEM_HOME, oldDerbySystemHomeValue);
        oldDerbySystemHomeValue = null;//ww w  . j  a v a  2 s  . co m
    } else {
        System.clearProperty(PROP_DERBY_SYSTEM_HOME);
    }
}

From source file:org.apache.bookkeeper.meta.MetadataDriversTest.java

@Test
public void testLoadBookieDriverFromSystemProperty() throws Exception {
    String saveDriversStr = System.getProperty(BK_METADATA_BOOKIE_DRIVERS_PROPERTY);
    try {/* w  w  w . java  2  s .  c  o m*/
        System.setProperty(BK_METADATA_BOOKIE_DRIVERS_PROPERTY, StringUtils
                .join(new String[] { BookieDriver1.class.getName(), BookieDriver2.class.getName() }, ':'));

        MetadataDrivers.loadInitialDrivers();

        MetadataBookieDriver loadedDriver1 = MetadataDrivers.getBookieDriver("driver1");
        assertEquals(BookieDriver1.class, loadedDriver1.getClass());
        MetadataBookieDriver loadedDriver2 = MetadataDrivers.getBookieDriver("driver2");
        assertEquals(BookieDriver2.class, loadedDriver2.getClass());
    } finally {
        if (null != saveDriversStr) {
            System.setProperty(BK_METADATA_BOOKIE_DRIVERS_PROPERTY, saveDriversStr);
        } else {
            System.clearProperty(BK_METADATA_BOOKIE_DRIVERS_PROPERTY);
        }
    }
}

From source file:com.seleniumtests.it.core.TestSeleniumRobotTestListener.java

@Test(groups = { "it" })
public void testContextDriverBlockingBeforeSuite(ITestContext testContext) throws Exception {

    try {//from  ww  w. j a  va 2  s  .co  m
        System.setProperty(SeleniumTestsContext.BROWSER, "htmlunit");
        System.setProperty("startLocation", "beforeSuite");
        executeSubTest(1,
                new String[] { "com.seleniumtests.it.stubclasses.StubTestClassForListener5.test1Listener5",
                        "com.seleniumtests.it.stubclasses.StubTestClassForListener5.test2Listener5" },
                "", "stub1");
    } finally {
        System.clearProperty(SeleniumTestsContext.BROWSER);
    }

    String logs = readSeleniumRobotLogFile();
    Assert.assertTrue(logs.contains(DRIVER_BLOCKED_MSG));
    Assert.assertFalse(logs.contains("start suite"));
    Assert.assertFalse(logs.contains("start test"));

    String outDir = new File(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory())
            .getAbsolutePath();
    JSONObject jsonResult = new JSONObject(
            FileUtils.readFileToString(Paths.get(outDir, "results.json").toFile()));

    // All tests should be skipped because configuration method is skipped
    Assert.assertEquals(jsonResult.getInt("skip"), 2);
}

From source file:org.geoserver.gwc.GWCTest.java

@After
public void tearDown() {
    System.clearProperty("ALLOW_ENV_PARAMETRIZATION");
    System.clearProperty("TEST_ENV_PROPERTY");
    GWC.set(null);
}