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.api.collections.CollectionsAPIDistributedZkTest.java

@Before
public void clearCluster() throws Exception {
    try {/*www  .  ja v  a2 s .c om*/
        cluster.deleteAllCollections();
    } finally {
        System.clearProperty("zkClientTimeout");
    }
}

From source file:org.apache.accumulo.server.AccumuloTest.java

@Test
public void testLocateLogConfig_Explicit() throws Exception {
    File confDir = new File(FileUtils.getTempDirectory(), "AccumuloTest" + System.currentTimeMillis());
    String confDirName = confDir.getAbsolutePath();
    System.setProperty("log4j.configuration", "myconfig.xml");
    try {/* w  ww  .  j ava2 s. com*/
        assertEquals("myconfig.xml", Accumulo.locateLogConfig(confDirName, "flogger"));
    } finally {
        FileUtils.deleteDirectory(confDir);
        System.clearProperty("log4j.configuration");
    }
}

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

/**
 * Shut down the cluster, including all Solr nodes and ZooKeeper
 *//*from   w w w .  ja  v  a  2s . co  m*/
public void shutdown() throws Exception {
    try {
        for (int i = jettys.size() - 1; i >= 0; --i) {
            stopJettySolrRunner(i);
        }
    } finally {
        try {
            zkServer.shutdown();
        } finally {
            System.clearProperty("solr.solrxml.location");
            System.clearProperty("zkHost");
        }
    }
}

From source file:org.apache.taverna.scufl2.rdfxml.TestRDFXMLWriter.java

@Test
public void writeBundleToStream() throws Exception {

    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    bundleIO.writeBundle(workflowBundle, outStream, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
    outStream.close();//from   w ww.j  av a  2s  .c  o  m

    InputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
    UCFPackage ucfPackage;
    try {
        // Avoid UCFPackage from creating a temporary file
        System.setProperty("org.odftoolkit.odfdom.tmpfile.disable", "true");
        ucfPackage = new UCFPackage(inStream);
    } finally {
        System.clearProperty("org.odftoolkit.odfdom.tmpfile.disable");
    }
    verifyPackageStructure(ucfPackage);

}

From source file:jenkins.plugins.publish_over_cifs.CifsHostConfiguration.java

private void configureJcifs(final BPBuildInfo buildInfo) {
    // freaking statics/sys props - what could possibly go wrong? aaargh!
    // will it even have any effect if the config changes after we have used jCIFS and have not rebooted?
    final String winsServer = (String) buildInfo.get(CifsPublisher.CTX_KEY_WINS_SERVER);
    final int soTimeout = timeout + SO_TIMEOUT_AFTER;
    if (winsServer == null) {
        buildInfo.printIfVerbose(Messages.console_config_noWins());
        System.clearProperty(CONFIG_PROPERTY_WINS);
        System.setProperty(CONFIG_PROPERTY_RESOLVE_ORDER, RESOLVE_WITHOUT_WINS);
    } else {//from   www  .j  a  va 2 s  .  c  om
        buildInfo.printIfVerbose(Messages.console_config_wins(winsServer));
        System.setProperty(CONFIG_PROPERTY_WINS, winsServer);
        System.setProperty(CONFIG_PROPERTY_RESOLVE_ORDER, RESOLVE_WITH_WINS);
    }
    if (buildInfo.isVerbose()) {
        buildInfo.println(Messages.console_config_timout(timeout));
        buildInfo.println(Messages.console_config_soTimeout(soTimeout));
    }
    System.setProperty(CONFIG_PROPERTY_TIMEOUT, Integer.toString(timeout));
    System.setProperty(CONFIG_PROPERTY_SO_TIMEOUT, Integer.toString(soTimeout));
}

From source file:net.krotscheck.jersey2.configuration.Jersey2ToolkitConfigTest.java

/**
 * Assert that the default version configuration in a compile environment is
 * null, and that you cannot override it. This will be populated once the
 * package is actually packaged and has the metadata associated with it.
 *///from   w w w . j a  v a  2s .c om
@Test
public void testDebugVersionConfiguration() {
    Configuration config = new Jersey2ToolkitConfig();

    Assert.assertEquals(null, config.getProperty("jersey2-toolkit.version"));

    // Override the version property.
    System.setProperty("jersey2-toolkit.version", "override1");

    Assert.assertEquals(null, config.getProperty("jersey2-toolkit.version"));

    System.clearProperty("jersey2-toolkit.version");
}

From source file:org.apache.archiva.remotedownload.AbstractDownloadTest.java

@After
@Override//from  www  .  ja v  a  2 s .c  o  m
public void tearDown() throws Exception {
    System.clearProperty("redback.admin.creation.file");
    super.tearDown();
    if (this.server != null) {
        this.server.stop();
    }
    if (this.tomcat != null) {
        this.tomcat.stop();
    }
}

From source file:com.seleniumtests.it.reporter.TestCustomReporter.java

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

    try {//  w w w . j  ava2  s.c o  m
        System.setProperty("customTestReports", "SUP::xml::reporter/templates/report.supervision.vm");

        executeSubTest(1, new String[] { "com.seleniumtests.it.stubclasses.StubTestClass" },
                ParallelMode.METHODS, new String[] { "testAndSubActions", "testInError", "testWithException" });

        // check content of the file. It should contain error
        String detailedReportContent = FileUtils
                .readFileToString(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(),
                        "testInError", "SUP-result.xml").toFile());
        detailedReportContent = detailedReportContent.replace("\n", "").replace("\r", "").replaceAll(">\\s+<",
                "><");
        Assert.assertTrue(detailedReportContent.contains(
                "<errors><error>            class java.lang.AssertionError: error                        at com.seleniumtests"));

        String detailedReportContent2 = FileUtils
                .readFileToString(Paths.get(SeleniumTestsContextManager.getGlobalContext().getOutputDirectory(),
                        "testAndSubActions", "SUP-result.xml").toFile());
        detailedReportContent2 = detailedReportContent2.replace("\n", "").replace("\r", "").replaceAll(">\\s+<",
                "><");
        Assert.assertTrue(detailedReportContent2.contains("<errors></errors>"));

        // check parameters are there
        Assert.assertTrue(detailedReportContent2.contains("<param name=\"runMode\" value=\"LOCAL\"/>"));
    } finally {
        System.clearProperty("customTestReports");
    }
}

From source file:org.nuxeo.connect.update.standalone.commands.TestConfig.java

@Override
@After// w  ww  .  ja v a 2  s. c o  m
public void tearDown() throws Exception {
    super.tearDown();
    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.onehippo.cms7.autoexport.AutoExportTest.java

@Override
@After//from  www .ja v  a 2 s . c o  m
public void tearDown() throws Exception {
    removeNode("/et:simple");
    removeNode("/et:foo");
    System.clearProperty("project.basedir");
    super.tearDown();
}