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.ow2.proactive.http.HttpClientBuilderTest.java

@After
public void tearDown() {
    System.clearProperty(WebProperties.WEB_HTTPS_ALLOW_ANY_CERTIFICATE.getKey());
    System.clearProperty(WebProperties.WEB_HTTPS_ALLOW_ANY_HOSTNAME.getKey());
}

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

@Test
public void testSkipBaseArgs() {
    String[] args = new String[] { P, TestDataConstants.PROPS_FILE1 };
    Main1 main = new Main1(args);
    main.dontUseBastOpts();/* www.  j  a va  2s.co m*/

    System.clearProperty(TestDataConstants.PROPS_FILE1_PROP);
    Assert.assertNull(System.getProperty(TestDataConstants.PROPS_FILE1_PROP));
    main.run();
    Assert.assertNull(System.getProperty(TestDataConstants.PROPS_FILE1_PROP));
    ArrayList<String> processedArgs = main.getProcessedArgs();
    Assert.assertTrue(Arrays.equals(args, processedArgs.toArray(new String[processedArgs.size()])));
}

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

/**
 * Check that in DEV mode, debug logs are displayed
 * @throws IOException /*from   w w w .j a  v a2  s . co  m*/
 */
@Test(groups = { "ut" })
public void testLogInDevMode() throws IOException {
    try {
        SeleniumRobotLogger.reset();
        System.setProperty(SeleniumRobotLogger.INTERNAL_DEBUG, "core");
        SeleniumRobotLogger.updateLogger(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(),
                SeleniumTestsContextManager.getThreadContext().getDefaultOutputDirectory());

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

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

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

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

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

From source file:org.apache.tinkerpop.gremlin.util.SystemUtilTest.java

@Test
public void shouldTrimSystemPropertyPrefixes() {
    System.setProperty("blah.a", "1");
    System.setProperty("blah.bbb", "true");
    System.setProperty("blah.c", "three");
    System.setProperty("bleep.d", "false");
    Configuration configuration = SystemUtil.getSystemPropertiesConfiguration("blah", true);
    assertEquals(3, IteratorUtils.count(configuration.getKeys()));
    assertEquals(1, configuration.getInt("a"));
    assertTrue(configuration.getBoolean("bbb"));
    assertEquals("three", configuration.getProperty("c"));
    assertFalse(configuration.containsKey("d") || configuration.containsKey("bleep.d"));
    System.clearProperty("blah.a");
    System.clearProperty("blah.bbb");
    System.clearProperty("blah.c");
    System.clearProperty("bleep.d");
}

From source file:org.springframework.xd.shell.security.SecuredShellAccessWithSslTest.java

@AfterClass
public static void tearDown() throws Exception {
    singleNodeApplication.close();// ww w  .jav a  2  s.c o m
    if (originalConfigLocation == null) {
        System.clearProperty("spring.config.location");
    } else {
        System.setProperty("spring.config.location", originalConfigLocation);
    }
}

From source file:com.yahoo.athenz.common.server.db.DataSourceFactoryTest.java

@Test
public void testCreateDataSourceWithFactoryInvalidTTL() {

    System.setProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TTL, "abc");

    // we ignore the invalid ttl and everything else should work fine

    MockConnectionFactory connectionFactory = new MockConnectionFactory();
    PoolableDataSource src = DataSourceFactory.create(connectionFactory);
    assertNotNull(src);// w w  w.  jav  a 2s  .  co m

    System.clearProperty(DataSourceFactory.ATHENZ_PROP_DBPOOL_MAX_TTL);
}

From source file:com.netflix.genie.common.client.TestBaseGenieClient.java

/**
 * Clear out any remaining things that may have been set in tests.
 *///w  w  w.  j  a  va2 s.  co  m
@AfterClass
public static void tearDownClass() {
    //Make sure eureka is never set
    if (eurekaEnv != null) {
        System.setProperty(BaseGenieClient.EUREKA_ENVIRONMENT_PROPERTY, eurekaEnv);
    } else {
        System.clearProperty(BaseGenieClient.EUREKA_ENVIRONMENT_PROPERTY);
    }
}

From source file:org.apache.solr.rest.schema.analysis.TestManagedStopFilterFactory.java

@After
private void after() throws Exception {
    jetty.stop();/*from  w ww .  j  a va  2  s  .co  m*/
    jetty = null;
    System.clearProperty("managed.schema.mutable");
    System.clearProperty("enable.update.log");

    if (restTestHarness != null) {
        restTestHarness.close();
    }
    restTestHarness = null;
}

From source file:com.p6spy.engine.spy.option.P6TestOptionDefaults.java

@Before
public void setUp() {
    // make sure to have no modules explicitly loaded by default
    {/*  www .j a va2 s .co  m*/
        System.clearProperty(SystemProperties.P6SPY_PREFIX + P6SpyOptions.MODULELIST);
        P6SpyOptions.getActiveInstance().reload();
    }
}

From source file:ninja.utils.NinjaPropertiesImplTest.java

@Test
public void testSkippingThroughModesWorks() {

    // check that mode tests works:
    NinjaPropertiesImpl ninjaPropertiesImpl = new NinjaPropertiesImpl(NinjaMode.test);
    assertEquals("test_testproperty", ninjaPropertiesImpl.get("testproperty"));

    // check that mode dev works:
    ninjaPropertiesImpl = new NinjaPropertiesImpl(NinjaMode.dev);
    assertEquals("dev_testproperty", ninjaPropertiesImpl.get("testproperty"));
    assertEquals("secret", ninjaPropertiesImpl.get(NinjaConstant.applicationSecret));

    // and in a completely different mode with no "%"-prefixed key the
    // default value use used
    ninjaPropertiesImpl = new NinjaPropertiesImpl(NinjaMode.prod);
    assertEquals("testproperty_without_prefix", ninjaPropertiesImpl.get("testproperty"));
    assertEquals("secret", ninjaPropertiesImpl.get(NinjaConstant.applicationSecret));

    // tear down//w  ww .j  av a2  s .  co m
    System.clearProperty(NinjaConstant.MODE_KEY_NAME);

}