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:org.apache.solr.cloud.TestMiniSolrCloudClusterSSL.java

@Before
public void before() {
    // undo the randomization of our super class
    log.info("NOTE: This Test ignores the randomized SSL & clientAuth settings selected by base class");
    HttpClientUtil.resetHttpClientBuilder(); // also resets SchemaRegistryProvider
    System.clearProperty(ZkStateReader.URL_SCHEME);
}

From source file:org.kawanfw.sql.tomcat.SystemPropUpdater.java

public void update() {
    // Do we have to set special values to the Connector?
    Enumeration<?> enumeration = properties.propertyNames();

    if (enumeration.hasMoreElements()) {
        System.out.println(SqlTag.SQL_PRODUCT_START + " Setting System Properties:");
    }//from   w  ww.  ja v  a  2  s.co  m

    while (enumeration.hasMoreElements()) {
        String property = (String) enumeration.nextElement();

        if (property.startsWith("systemSetProperty.")) {

            String theValue = properties.getProperty(property);

            String systemProperty = StringUtils.substringAfter(property, ".");

            debug("property      : " + property);
            debug("systemProperty: " + systemProperty);

            if (systemProperty.equals("compression")) {
                System.out.println(SqlTag.SQL_PRODUCT_START + "  -> Tomcat " + systemProperty
                        + " property not used in AceQL. See User Documentation for how to zip ResultSet.");
            } else {
                if (theValue != null && !theValue.isEmpty()) {

                    theValue = theValue.trim();

                    System.out.println(SqlTag.SQL_PRODUCT_START + "  -> " + systemProperty + " = " + theValue);
                    System.setProperty(systemProperty, theValue);
                }
            }

        }

        if (property.equals("systemClearProperty")) {

            String theValue = properties.getProperty(property);

            if (theValue != null && !theValue.isEmpty()) {

                theValue = theValue.trim();

                System.out.println(SqlTag.SQL_PRODUCT_START + "  -> " + theValue + " clear ");
                System.clearProperty(theValue);
            }
        }

    }
}

From source file:org.exoplatform.addons.es.integration.BaseIntegrationTest.java

@AfterClass
public static void cleanUrlProperties() {
    // Close ES Node
    if (node != null) {
        LOGGER.info("Embedded ES instance - Stopping");
        node.close();//  w  w  w.  ja  v  a2 s.  c  o m
        LOGGER.info("Embedded ES instance - Stopped");
    }

    if (propertiesSet) {
        System.clearProperty("exo.es.index.server.url");
        System.clearProperty("exo.es.indexing.batch.number");
        System.clearProperty("exo.es.indexing.replica.number.default");
        System.clearProperty("exo.es.indexing.shard.number.default");
        System.clearProperty("exo.es.search.server.url");
        System.clearProperty("jboss.i18n.generate-proxies");
    } else {
        //Reset server.url properties to default values
        PropertyManager.setProperty("exo.es.index.server.url", "http://127.0.0.1:9200");
        PropertyManager.setProperty("exo.es.search.server.url", "http://127.0.0.1:9200");
    }
}

From source file:de.uni.bremen.monty.moco.CompileTestProgramsTest.java

@Test
public void compileProgramTest() throws IOException, InterruptedException {
    final PrintStream bufferOut = System.out;
    final PrintStream bufferErr = System.err;
    final ByteArrayOutputStream outStream = setStdout();
    final ByteArrayOutputStream errorStream = setStdErr(file);

    if (inputFileExists(file)) {
        System.setProperty("testrun.readFromFile", changeFileExtension(file, ".input"));
    }//from w w w  .  j  a  va  2 s  .  c  om
    Main.main(new String[] { "-e", file.getAbsolutePath() });

    if (outputFileExists(file)) {
        assertThat(getOutput(errorStream), is(isEmptyString()));
        assertThat(getOutput(outStream), is(expectedResultFromFile(file)));
    } else {
        // chop the last char to not contain /n in the string
        assertThat(StringUtils.chop(getOutput(errorStream)), is(expectedErrorFromFile(file)));
        assertThat(getOutput(outStream), is(isEmptyString()));
    }
    System.clearProperty("testrun.readFromFile");
    System.setOut(bufferOut);
    System.setErr(bufferErr);
}

From source file:org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.SystemPropertyPrecedenceTestCase.java

@Test(expected = NoResolvedResultException.class)
public void overrideOfflineFlag() {

    try {//from   w w  w . jav a2s  .com
        System.setProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE, "true");

        Maven.configureResolver().fromFile(SETTINGS_XML_PATH).resolve("junit:junit:3.8.2").withTransitivity()
                .as(File.class);

        Assert.fail("Artifact junit:junit:3.8.2 should not be present in local repository");
    } finally {
        // this has to be executed in finally block
        System.clearProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE);
    }
}

From source file:com.proofpoint.http.server.TestHttpServerProvider.java

@AfterMethod
public void teardown() throws Exception {
    if (originalTrustStore != null) {
        System.setProperty(JAVAX_NET_SSL_TRUST_STORE, originalTrustStore);
    } else {/*from   w  ww .  ja  v a  2 s  . co m*/
        System.clearProperty(JAVAX_NET_SSL_TRUST_STORE);
    }

    try {
        if (server != null) {
            server.stop();
        }
    } finally {
        FileUtils.deleteRecursively(tempDir);
    }
}

From source file:org.apache.hive.jdbc.TestSSL.java

@After
public void tearDown() throws Exception {
    if (hs2Conn != null) {
        hs2Conn.close();/*from  w  ww  .  j ava2  s.  c o  m*/
    }
    if (miniHS2 != null && miniHS2.isStarted()) {
        miniHS2.stop();
    }
    System.clearProperty(JAVA_TRUST_STORE_PROP);
    System.clearProperty(JAVA_TRUST_STORE_PASS_PROP);
}

From source file:com.evolveum.midpoint.init.ConfigurationLoadTest.java

@Test(enabled = false)
public void t03complexConfigTest() {
    LOGGER.info("---------------- complexConfigTest -----------------");
    System.setProperty("midpoint.home", "target/midPointHome/");
    StartupConfiguration sc = new StartupConfiguration();
    assertNotNull(sc);/* w ww  .  java2 s.c o  m*/
    sc.init();
    Configuration c = sc.getConfiguration("midpoint");
    assertEquals(c.getString("repository.repositoryServiceFactoryClass"),
            "com.evolveum.midpoint.repo.xml.XmlRepositoryServiceFactory");

    @SuppressWarnings("unchecked")
    Iterator<String> i = c.getKeys();

    while (i.hasNext()) {
        String key = i.next();
        LOGGER.info("  " + key + " = " + c.getString(key));
    }

    assertEquals(c.getString("repository.serverPath"), "target/midPointHome/");

    //cleanup
    System.clearProperty("midpoint.home");
}

From source file:com.google.mr4c.config.category.CategoryBuilderTest.java

private void setSystemProperties() {
    System.clearProperty(m_category.getCategoryProperty());
    System.setProperty(m_category.getCategoryProperty(), m_sysFiles);
}

From source file:org.jberet.support.io.JsonItemReaderTest.java

@Test
public void testMovieFilterProcessor() throws Exception {
    final String filtering = "filtering";
    System.setProperty(filtering, "true");
    testReadWrite0(movieJson, "testMovieFilterProcessor.out", "1", "15", Movie.class, null, null,
            BatchStatus.COMPLETED);//from w ww.jav a  2s.c om
    System.clearProperty(filtering);
}