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:de.unisb.cs.st.javalanche.mutation.runtime.MutationSwitcher.java

/**
 * Turns the current mutation off.//from   w  w  w .j  a  va 2 s.  c om
 */
public void switchOff() {
    if (currentMutation != null) {
        System.clearProperty(currentMutation.getMutationVariable());
        System.clearProperty(CURRENT_MUTATION_KEY);
        stopWatch.stop();
        logger.info("Disabling mutation: " + currentMutation.getMutationVariable() + " Time active "
                + DurationFormatUtils.formatDurationHMS(stopWatch.getTime()));
        currentMutation = null;
    }
}

From source file:com.honnix.cheater.bundle.CheaterActivator.java

private void unsetTrustStore() {
    File file = new File(TEMP_TRUST_STORE);

    if (file.exists()) {
        file.delete();//from   w w w .  j av  a2  s. co m
    }

    System.clearProperty(CheaterConstant.TRUST_STORE_KEY);
}

From source file:org.apache.juddi.keygen.KeyGeneratorTest.java

/**
 * The DefaultKeyGenerator/* w w w. j a  v  a2  s . co m*/
 * @throws ConfigurationException
 */
@Test
public void testDefaultKeyGenerator() {
    System.setProperty(Property.JUDDI_KEYGENERATOR, "org.apache.juddi.keygen.DefaultKeyGenerator");
    try {
        KeyGenerator keyGenerator = KeyGeneratorFactory.forceNewKeyGenerator();
        Assert.assertEquals(org.apache.juddi.keygen.DefaultKeyGenerator.class, keyGenerator.getClass());
        String key = keyGenerator.generate();
        Assert.assertNotNull(key);
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        Assert.fail("unexpected");
    }
    System.clearProperty(Property.JUDDI_KEYGENERATOR);
}

From source file:org.talend.core.utils.StudioSSLContextProvider.java

private static void changeProperty() {
    final IPreferenceStore sslStore = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
    CryptoHelper cryptoHelper = CryptoHelper.getDefault();
    String keyStore = sslStore.getString(SSLPreferenceConstants.KEYSTORE_FILE);
    if (keyStore != null && !"".equals(keyStore.trim())) {
        System.setProperty(SSLPreferenceConstants.KEYSTORE_FILE, keyStore);
        System.setProperty(SSLPreferenceConstants.KEYSTORE_PASSWORD,
                cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD)));
        System.setProperty(SSLPreferenceConstants.KEYSTORE_TYPE,
                sslStore.getString(SSLPreferenceConstants.KEYSTORE_TYPE));
    } else {//  w ww  .  jav  a  2 s .c  om
        System.clearProperty(SSLPreferenceConstants.KEYSTORE_FILE);
        System.clearProperty(SSLPreferenceConstants.KEYSTORE_PASSWORD);
        System.clearProperty(SSLPreferenceConstants.KEYSTORE_TYPE);
    }
    String trustStore = sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_FILE);
    if (trustStore != null && !"".equals(trustStore.trim())) {
        System.setProperty(SSLPreferenceConstants.TRUSTSTORE_FILE, trustStore);
        System.setProperty(SSLPreferenceConstants.TRUSTSTORE_PASSWORD,
                cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD)));
        System.setProperty(SSLPreferenceConstants.TRUSTSTORE_TYPE,
                sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE));
    } else {
        System.clearProperty(SSLPreferenceConstants.TRUSTSTORE_FILE);
        System.clearProperty(SSLPreferenceConstants.TRUSTSTORE_PASSWORD);
        System.clearProperty(SSLPreferenceConstants.TRUSTSTORE_TYPE);
    }
}

From source file:org.digidoc4j.ConfigurationTest.java

@Before
public void setUp() {
    System.clearProperty("digidoc4j.mode");
    configuration = new Configuration(TEST);
}

From source file:com.streamsets.datacollector.publicrestapi.TestCredentialsDeploymentResource.java

@After
public void tearDown() throws Exception {
    System.clearProperty(DPM_AGENT_PUBLIC_KEY);
    super.tearDown();
}

From source file:com.talis.inject.guice.PropertiesConfiguredModuleFactoryTest.java

@Test(expected = ConfigurationException.class)
public void invalidClassSpecifiedInFile() throws Exception {
    File tmpFile = File.createTempFile("injector-module", ".properties");
    tmpFile.deleteOnExit();/*from   w  ww  .  j a v  a  2 s.  c om*/
    FileUtils.writeStringToFile(tmpFile,
            String.format("%s=%s", PropertiesConfiguredModuleFactory.MODULE_PROPERTY, String.class.getName()));
    System.clearProperty(PropertiesConfiguredModuleFactory.PROPERTIES_LOCATION_PROP);

    try {
        System.setProperty(PropertiesConfiguredModuleFactory.PROPERTIES_LOCATION_PROP,
                tmpFile.getAbsolutePath());
        new PropertiesConfiguredModuleFactory().getModules();
    } finally {
        System.clearProperty(PropertiesConfiguredModuleFactory.PROPERTIES_LOCATION_PROP);
    }
}

From source file:org.apache.solr.client.solrj.embedded.JettyWebappTest.java

@Override
public void tearDown() throws Exception {
    try {//from  www.  j a  va  2  s .c om
        server.stop();
    } catch (Exception ex) {
    }
    System.clearProperty("tests.shardhandler.randomSeed");
    System.clearProperty("solr.data.dir");
    System.clearProperty("solr.tests.doContainerStreamCloseAssert");
    super.tearDown();
}

From source file:com.xebialabs.overcast.OvercastPropertiesTest.java

@Test
public void testHomeDirHasPrecedenceOverClasspath() {
    System.clearProperty("precedenceTestValue");
    OvercastProperties.reloadOvercastProperties();

    assertThat(OvercastProperties.getOvercastProperty("precedenceTestValue"), is("valueFromHome"));
}

From source file:org.exnebula.bootstrap.BootConfigLocatorTest.java

@Test
public void findPropertyFirst() {
    File jar = getFileFromProtectionDomain(Test.class);
    System.setProperty(BootConfigLocator.JVM_CONFIG_OPTION, "./pom.xml");

    String modifiedFileName = replaceExtension(jar.getName(), "pom");

    File result = BootConfigLocator.locateFile(Test.class, modifiedFileName);
    System.clearProperty(BootConfigLocator.JVM_CONFIG_OPTION);
    assertEquals(new File(".", "pom.xml"), result);
}