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:com.xebialabs.overcast.OvercastPropertiesTest.java

@Test
public void testPropertyHasPrecedenceOverClasspath() throws IOException {

    System.setProperty("user.home", new File("src/test/resources/dir-without-conf").getAbsolutePath());
    System.clearProperty("precedenceTestValue");
    System.setProperty("overcast.conf.file", "src/test/resources/property-path/overcast.conf");

    File cfg = new File("overcast.conf");
    File bkp = new File("backup.conf");

    try {//from   w  w w  .  j  av a2s .c o  m
        FileUtils.moveFile(cfg, bkp);
        OvercastProperties.reloadOvercastProperties();
        assertThat(OvercastProperties.getOvercastProperty("precedenceTestValue"), is("valueFromProperty"));
    } finally {
        FileUtils.moveFile(bkp, cfg);
    }
}

From source file:org.apache.solr.ltr.TestRerankBase.java

protected static void unchooseDefaultFeatureFormat() {
    System.clearProperty(SYSTEM_PROPERTY_SOLR_LTR_TRANSFORMER_FV_DEFAULTFORMAT);
}

From source file:org.apache.brooklyn.util.core.ClassLoaderUtilsTest.java

@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
    if (origWhiteListKey != null) {
        System.setProperty(ClassLoaderUtils.WHITE_LIST_KEY, origWhiteListKey);
    } else {/* w w  w .  ja v  a2s .co m*/
        System.clearProperty(ClassLoaderUtils.WHITE_LIST_KEY);
    }
    if (mgmt != null) {
        Entities.destroyAll(mgmt);
    }
}

From source file:com.autonomy.aci.client.services.impl.DocumentProcessorTest.java

@Test
public void testConvertACIResponseToDOMParserConfigurationException() throws AciErrorException, IOException {
    // Set the property to be our mock implementation that will throw a ParserConfigurationException...
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
            "com.autonomy.aci.client.mock.MockDocumentBuilderFactory");

    try {//from   www.j  a  va 2 s.  c o m
        // Setup with a proper XML response file...
        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        response.setEntity(new InputStreamEntity(getClass().getResourceAsStream("/GetVersion.xml"), -1));

        // Set the AciResponseInputStream...
        final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);

        // Process...
        processor.process(stream);
        fail("Should have raised an ProcessorException.");
    } catch (final ProcessorException pe) {
        // Check for the correct causes...
        assertThat("Cause not correct.", pe.getCause(), is(instanceOf(ParserConfigurationException.class)));
    } finally {
        // Remove the duff system property...
        System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
    }
}

From source file:com.jive.myco.seyren.core.util.graphite.GraphiteHttpClientTest.java

@Test
public void authIsAddedWhenUsernameAndPasswordAreProvided() throws Exception {
    System.setProperty("GRAPHITE_USERNAME", "seyren");
    System.setProperty("GRAPHITE_PASSWORD", "s3yr3N");
    graphiteHttpClient = new GraphiteHttpClient(seyrenConfig(clientDriver.getBaseUrl()));

    String response = "[{\"target\": \"service.error.1MinuteRate\", \"datapoints\": [[0.20, 1337453460],[0.01, 1337453463]]}]";

    clientDriver.addExpectation(onRequestTo("/render/").withParam("from", "-11minutes")
            .withParam("until", "-1minutes").withParam("uniq", Pattern.compile("[0-9]+"))
            .withParam("format", "json").withParam("target", "service.error.1MinuteRate").withHeader(
                    "Authorization", "Basic c2V5cmVuOnMzeXIzTg=="),
            giveResponse(response, "application/json"));

    graphiteHttpClient.getTargetJson("service.error.1MinuteRate");

    System.clearProperty("GRAPHITE_USERNAME");
    System.clearProperty("GRAPHITE_PASSWORD");
}

From source file:com.github.brandtg.pantopod.tor.TorProxyManager.java

@Override
public void stop() throws Exception {
    synchronized (sync) {
        if (pidFile.exists()) {
            stopProcess(pidFile, 2 /* SIGINT */);
            System.clearProperty("socksProxyHost");
            System.clearProperty("socksProxyPort");
        }//from w  ww  .  j  a v  a  2 s .co m
    }
}

From source file:org.elasticsearch.hadoop.LocalEs.java

@Override
protected void after() {
    if (master != null) {
        if (USE_SLAVE && slave != null) {
            System.out.println("Stopping Elasticsearch Slave...");
            slave.stop();/*ww  w  .j a va2s .  co m*/
            slave = null;
        }

        System.out.println("Stopping Elasticsearch Master...");
        try {
            System.clearProperty(TestUtils.ES_LOCAL_PORT);
            master.stop();
        } catch (Exception ex) {
            // ignore
        }
        master = null;

        // delete data folder
        TestUtils.delete(new File(ES_DATA_PATH));
    }
}

From source file:org.codice.alliance.nsili.orb.impl.CorbaOrbImpl.java

/**
 * Initializes the Corba ORB with no additional arguments
 *//* ww  w. ja v  a  2s.  c o m*/
public void init() {
    shutdown();

    System.setProperty("com.sun.CORBA.POA.ORBPersistentServerPort", String.valueOf(corbaPort));
    System.setProperty("com.sun.CORBA.ORBServerPort", String.valueOf(corbaPort));
    System.setProperty("com.sun.CORBA.transport.ORBTCPReadTimeouts", getCorbaWaitTime());

    orb = org.omg.CORBA.ORB.init(new String[0], null);
    if (orb != null) {
        LOGGER.debug("Successfully initialized CORBA orb on port: {}", corbaPort);
    } else {
        LOGGER.error("Unable to initialize CORBA orb on port: {}", corbaPort);
    }

    orbRunThread = new Thread(() -> orb.run());
    orbRunThread.start();

    System.clearProperty("com.sun.CORBA.POA.ORBPersistentServerPort");
    System.clearProperty("com.sun.CORBA.ORBServerPort");
    System.clearProperty("com.sun.CORBA.transport.ORBTCPReadTimeouts");

    for (CorbaServiceListener listener : corbaServiceListeners) {
        listener.corbaInitialized();
    }
}

From source file:com.brienwheeler.apps.main.ContextMainTest.java

@Test
public void testContextDefault() throws InterruptedException {
    PropertiesTestUtils.clearAllTestSystemProperties();
    System.clearProperty(TestDataConstants.RMAP_TEST_PROP);
    Assert.assertNull(System.getProperty(TestDataConstants.RMAP_TEST_PROP));

    ContextMain main = new ContextMain(new String[] {});
    main.run();/*from  w w w .j a  v a2 s .  c  o m*/

    Assert.assertEquals(TestDataConstants.RMAP_TEST_VAL, System.getProperty(TestDataConstants.RMAP_TEST_PROP));
}

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

@After
public void after() {
    HttpClientUtil.resetHttpClientBuilder(); // also resets SchemaRegistryProvider
    System.clearProperty(ZkStateReader.URL_SCHEME);
    SSLContext.setDefault(DEFAULT_SSL_CONTEXT);
}