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.TestStressInPlaceUpdates.java

@After
public void after() {
    System.clearProperty("solr.tests.intClassName");
    System.clearProperty("solr.tests.longClassName");
    System.clearProperty("solr.tests.floatClassName");
    System.clearProperty("solr.tests.doubleClassName");
}

From source file:com.netflix.curator.framework.imps.TestWithCluster.java

@Test
public void testReadOnly() throws Exception {
    System.setProperty("readonlymode.enabled", "true");
    try {//from w ww  .  j  a v  a  2  s  .c  om
        Timing timing = new Timing();

        CuratorFramework client = null;
        TestingCluster cluster = new TestingCluster(2);
        try {
            cluster.start();

            client = CuratorFrameworkFactory.builder().connectString(cluster.getConnectString())
                    .canBeReadOnly(true).connectionTimeoutMs(timing.connection())
                    .sessionTimeoutMs(timing.session()).retryPolicy(new ExponentialBackoffRetry(100, 3))
                    .build();
            client.start();

            client.create().forPath("/test");

            final CountDownLatch readOnlyLatch = new CountDownLatch(1);
            final CountDownLatch reconnectedLatch = new CountDownLatch(1);
            ConnectionStateListener listener = new ConnectionStateListener() {
                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState) {
                    if (newState == ConnectionState.READ_ONLY) {
                        readOnlyLatch.countDown();
                    } else if (newState == ConnectionState.RECONNECTED) {
                        reconnectedLatch.countDown();
                    }
                }
            };
            client.getConnectionStateListenable().addListener(listener);

            InstanceSpec ourInstance = cluster
                    .findConnectionInstance(client.getZookeeperClient().getZooKeeper());
            Iterator<InstanceSpec> iterator = cluster.getInstances().iterator();
            InstanceSpec killInstance = iterator.next();
            if (killInstance.equals(ourInstance)) {
                killInstance = iterator.next(); // kill the instance we're not connected to
            }
            cluster.killServer(killInstance);

            Assert.assertEquals(reconnectedLatch.getCount(), 1);
            Assert.assertTrue(timing.awaitLatch(readOnlyLatch));

            Assert.assertEquals(reconnectedLatch.getCount(), 1);
            cluster.restartServer(killInstance);
            Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
        } finally {
            IOUtils.closeQuietly(client);
            IOUtils.closeQuietly(cluster);
        }
    } finally {
        System.clearProperty("readonlymode.enabled");
    }
}

From source file:org.nuxeo.ecm.admin.setup.TestSetupWizardActionBean.java

@After
public void tearDown() {
    System.clearProperty(ConfigurationGenerator.NUXEO_CONF);
    System.clearProperty(Environment.NUXEO_HOME);
    System.clearProperty("jboss.home.dir");
    System.clearProperty(Environment.NUXEO_DATA_DIR);
    System.clearProperty(Environment.NUXEO_LOG_DIR);
}

From source file:com.googlecode.janrain4j.conf.PropertyConfigTest.java

@Before
public void setUp() {
    System.clearProperty(API_KEY_KEY);
    System.clearProperty(APPLICATION_ID_KEY);
    System.clearProperty(APPLICATION_DOMAIN_KEY);
    System.clearProperty(TOKEN_URL_KEY);
    System.clearProperty(LANGUAGE_PREFERENCE_KEY);
    System.clearProperty(PROXY_HOST_KEY);
    System.clearProperty(PROXY_PORT_KEY);
    System.clearProperty(PROXY_USERNAME_KEY);
    System.clearProperty(PROXY_PASSWORD_KEY);
    System.clearProperty(CONNECT_TIMEOUT_KEY);
    System.clearProperty(READ_TIMEOUT_KEY);
    System.clearProperty(SET_STATUS_PROVIDER_NAMES_KEY);
    System.clearProperty(ACTIVITY_PROVIDER_NAMES_KEY);
}

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

private void clearSystemProperties() {
    System.clearProperty(m_category.getCategoryProperty());
}

From source file:org.jolokia.jsr160.Jsr160RequestDispatcherTest.java

@Test
public void simpleDispatchWithUser() throws InstanceNotFoundException, IOException, ReflectionException,
        AttributeNotFoundException, MBeanException, NotChangedException {
    System.setProperty("TEST_WITH_USER", "roland");
    try {//from   w w  w  . jav  a2  s  .c om
        JmxRequest req = preparePostReadRequest("roland");
        Map result = (Map) dispatcher.dispatchRequest(req);
        assertTrue(result.containsKey("HeapMemoryUsage"));
    } finally {
        System.clearProperty("TEST_WITH_USER");
    }
}

From source file:org.apache.solr.core.TestCoreContainer.java

@Test
public void testShareSchema() throws Exception {
    System.setProperty("shareSchema", "true");

    CoreContainer cores = init(CONFIGSETS_SOLR_XML);

    try {// w  w  w.j a v a 2  s.c  o  m
        SolrCore core1 = cores.create("core1", ImmutableMap.of("configSet", "minimal"));
        SolrCore core2 = cores.create("core2", ImmutableMap.of("configSet", "minimal"));

        assertSame(core1.getLatestSchema(), core2.getLatestSchema());

    } finally {
        cores.shutdown();
        System.clearProperty("shareSchema");
    }
}

From source file:com.seleniumtests.ut.util.logging.TestSeleniumRobotLogger.java

/**
 * Check that in RUN mode, debug logs are not displayed
 * @throws IOException /* ww  w  . j  a va  2  s  .  c  om*/
 */
@Test(groups = { "ut" })
public void testLogInRunMode() throws IOException {
    try {
        SeleniumRobotLogger.reset();
        System.setProperty(SeleniumRobotLogger.INTERNAL_DEBUG, "none");
        SeleniumRobotLogger.updateLogger(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(),
                SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory());

        Logger logger = spy(SeleniumRobotLogger.getLogger(TestSeleniumRobotLogger.class));

        logger.info(SeleniumRobotLogger.START_TEST_PATTERN + "testLogInRunMode");
        logger.info("some info");
        logger.debug("some debug");
        logger.info(SeleniumRobotLogger.END_TEST_PATTERN + "testLogInRunMode");

        verify(logger, times(3)).callAppenders(any(LoggingEvent.class));

        // check log file content
        SeleniumRobotLogger.parseLogFile();
        String logs = SeleniumRobotLogger.getTestLogs().get("testLogInRunMode");
        Assert.assertTrue(logs.contains("some info"));
        Assert.assertFalse(logs.contains("some debug"));

    } finally {
        System.clearProperty(SeleniumRobotLogger.INTERNAL_DEBUG);
        SeleniumRobotLogger.reset();
    }
}

From source file:org.codehaus.cargo.container.spi.configuration.AbstractLocalConfigurationTest.java

/**
 * Test override.//  www .  j  a  v  a2s  . co  m
 */
public void testOverride() {
    assertEquals(null, this.configuration.getPropertyValue("cargo.test"));
    try {
        System.setProperty("cargo.test", "somevalue");
        assertEquals("somevalue", this.configuration.getPropertyValue("cargo.test"));
    } finally {
        System.clearProperty("cargo.test");
    }
    assertEquals(null, this.configuration.getPropertyValue("cargo.test"));
}

From source file:org.bonitasoft.platform.setup.PlatformSetupIT.java

@After
public void after() throws Exception {
    System.clearProperty(BONITA_SETUP_FOLDER);
    platformSetup.destroy();
}