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:com.payu.ratel.tests.zookeeper.ZookeeperServicePublishingTest.java

@After
public void close() throws Exception {
    remoteContext.close();// www.j a  v a 2s.  c o  m
    assertThat(serviceProvider.getInstance()).isNull();
    System.clearProperty(SERVICE_DISCOVERY_ZK_HOST);
}

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

@AfterClass
public static void afterClass() throws Exception {
    System.clearProperty("solrcloud.update.delay");
}

From source file:org.cloudfoundry.identity.uaa.BootstrapTests.java

@Test
public void testBrandingProperties() {
    System.setProperty("UAA_CONFIG_FILE", "./src/test/resources/test/config/uaa.yml");
    System.setProperty("environmentYamlKey", "environmentYamlKey");
    try {/*from  w  ww .j a v a  2 s .c  om*/
        context = getServletContext("file:./src/main/webapp/WEB-INF/spring-servlet.xml");
        Banner banner = IdentityZoneHolder.resolveBranding().getBanner();
        assertEquals("cool beagle", banner.getText());
        assertEquals(
                "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAATBJREFUeNqk008og3Ecx/HNnrJSu63kIC5qKRe7KeUiOSulTHJUTrsr0y5ycFaEgyQXElvt5KDYwU0uO2hSUy4KoR7v7/qsfmjPHvzq1e/XU8/39/3zPFHf9yP/WV7jED24nGRbxDFWUAsToM05zyKFLG60d/wmQBxWzwyOlMU1phELEyCmtPeRQRoVbKOM0VYB6q0QW+3IYQpJFFDEYFCAiMqwNY857Ko3SxjGBTbRXb+xMUamcMbWh148YwJvOHSCdyqTAdxZo72ADGwKT98C9CChcxUPQSVYLz50toae4Fy9WcAISl7AiN/RhS1N5RV5rOLxx5eom90pvGAI/VjHMm6bfspK18a1gXvsqM41XDVL052C1Tim56cYd/rR+mdSrXGluxfm5S8Z/HV9CjAAvQZLXoa5mpgAAAAASUVORK5CYII=",
                banner.getLogo());
        assertEquals("#F23456", banner.getTextColor());
        assertEquals("#F99999", banner.getBackgroundColor());
        assertEquals("http://example.com", banner.getLink());
    } finally {
        System.clearProperty("UAA_CONFIG_FILE");
    }
}

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

@AfterClass
public static void afterClass() {
    System.clearProperty("solr.directoryFactory");
    System.clearProperty("solrcloud.update.delay");
}

From source file:org.apache.solr.client.solrj.impl.HttpClientUtilTest.java

@Test
@SuppressWarnings("deprecation")
public void testSSLSystemProperties() throws IOException {
    CloseableHttpClient client = HttpClientUtil.createClient(null);
    try {//from  w  ww .  j a v  a2 s. c  om
        SSLTestConfig.setSSLSystemProperties();
        assertNotNull("HTTPS scheme could not be created using the javax.net.ssl.* system properties.",
                client.getConnectionManager().getSchemeRegistry().get("https"));

        System.clearProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME);
        client.close();
        client = HttpClientUtil.createClient(null);
        assertEquals(BrowserCompatHostnameVerifier.class, getHostnameVerifier(client).getClass());

        System.setProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME, "true");
        client.close();
        client = HttpClientUtil.createClient(null);
        assertEquals(BrowserCompatHostnameVerifier.class, getHostnameVerifier(client).getClass());

        System.setProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME, "");
        client.close();
        client = HttpClientUtil.createClient(null);
        assertEquals(BrowserCompatHostnameVerifier.class, getHostnameVerifier(client).getClass());

        System.setProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME, "false");
        client.close();
        client = HttpClientUtil.createClient(null);
        assertEquals(AllowAllHostnameVerifier.class, getHostnameVerifier(client).getClass());
    } finally {
        SSLTestConfig.clearSSLSystemProperties();
        System.clearProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME);
        client.close();
    }
}

From source file:org.kie.server.integrationtests.shared.KieServerBaseIntegrationTest.java

@AfterClass
public static void tearDown() {
    if (TestConfig.isLocalServer()) {
        stopKieServer();// w w  w.  ja  v  a 2  s  .  com
        stopKieController();
        System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);
    }
}

From source file:org.elasticsearch.plugins.PluginManagerIT.java

@After
public void clearPathHome() {
    System.clearProperty("es.default.path.home");
}

From source file:org.jasypt.spring31.annotation.EncryptablePropertySourcePostProcessorTest.java

@Test
public void withResolvablePlaceholderAndFactoryBean() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ConfigWithResolvablePlaceholderAndFactoryBean.class);
    System.setProperty("path.to.properties", "org/jasypt/spring31/annotation");
    ctx.refresh();//w w  w.jav a  2  s  .  c  o m
    assertThat(ctx.getBean(TestBean.class).getName(), equalTo("p1TestBean"));
    System.clearProperty("path.to.properties");
    ctx.close();

}

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

@Override
public void distribSetUp() throws Exception {
    super.distribSetUp();

    if (shardCount > 0) {
        System.setProperty("numShards", Integer.toString(shardCount));
    } else {//from  w w  w . ja v a2s  . c o m
        System.clearProperty("numShards");
    }

    if (isSSLMode()) {
        System.clearProperty("urlScheme");
        ZkStateReader zkStateReader = new ZkStateReader(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT,
                AbstractZkTestCase.TIMEOUT);
        try {
            zkStateReader.getZkClient().create(ZkStateReader.CLUSTER_PROPS,
                    Utils.toJSON(Collections.singletonMap("urlScheme", "https")), CreateMode.PERSISTENT, true);
        } finally {
            zkStateReader.close();
        }
    }
}

From source file:com.mylab.TransmitMailBean.java

/**
 * Initializes the bean and sends or queues the mail.
 * @param context/*ww w .jav a2s  . c o  m*/
 * @param request
 * @param response
 * @throws javax.servlet.jsp.JspException
 * @throws IOException 
 */
public void init(PageContext context, HttpServletRequest request, HttpServletResponse response) {
    try {

        remoteaddress = request.getRemoteAddr();

        jsp = new CmsJspXmlContentBean(context, request, response);

        GreetingcardConfigDao configDao = new OpenCmsGreetingcardConfigDao(jsp.getCmsObject());

        GreetingcardConfig config = null;

        try {
            config = configDao.readConfig();
        } catch (DataAccessException ex) {
        }

        cmsContext = new OpenCmsContext(jsp);

        CmsObject cms = jsp.getCmsObject();

        vfsService = new OpenCmsVFSService(jsp);

        //get the parameters from the request
        authorName = request.getParameter("author_name");
        authorMail = request.getParameter("author_address");
        receiverName = request.getParameter("receiver_name");
        receiverAddress = request.getParameter("receiver_address");
        subject = request.getParameter("subject");
        imagePath = request.getParameter("image_url");
        greetingcardTemplatePath = request.getParameter("greetingcard_fileName");
        transmitTime = request.getParameter("transmit_date");
        audiomessage = request.getParameter("audio_message");
        if ((audiomessage != null) && (audiomessage.length() > 0)) {
            if (audiomessage.contains("Letter-To-Hermione.mp3"))
                audiomessage = "";
            else {
                CmsShell cmdShell = new CmsShell("/usr/local/apache-tomcat-7.0.57/webapps/opencms/WEB-INF",
                        null, "opencms", "/bin/bash", null);
                file = new File("/home/jan/bin/opencmsshell.sh");
                try {
                    fileInputStream = new FileInputStream(file);
                    cmdShell.start(fileInputStream);
                    fileInputStream.close();
                    audiomessage = System.getProperty("audio_message");
                    System.clearProperty("audio_message");
                } catch (IOException ex) {
                }
            }
        }

        transmitDate = null;
        if (!"0".equals(transmitTime)) {
            transmitDate = new Date(Long.parseLong(transmitTime));
        }

        MailTransmission transmission = new OpenCmsMailTransmission(cms, config, new OpenCmsMailService());

        GreetingcardTemplateDao greetingcardTemplateDao = new OpenCmsGreetingcardTemplateDao(cms);

        // get url of the server for sending the url of the generated image

        String serverUrl = cmsContext.getServerPath(cmsContext.link(cmsContext.removeSiteRoot(imagePath)));
        //String serverUrl = GreetingCardHelper.getServerContextPath(request, jsp.link(cms.getRequestContext().removeSiteRoot(imagePath)));

        // construct the card
        Greetingcard card = new Greetingcard();
        card.setAuthorMail(authorMail);
        card.setAuthorName(authorName);
        card.setImagePath(imagePath);
        card.setReceiverMail(receiverAddress);
        card.setReceiverName(receiverName);
        card.setSubject(subject);
        card.setTransmitDate(transmitDate);
        card.setUrl(serverUrl);
        if ((audiomessage != null) && (audiomessage.length() > 0))
            card.setAudioPath("/greetingcards/.content/audiomessages/" + audiomessage);
        else
            card.setAudioPath("");

        // read the greetingcard template
        GreetingcardTemplate cardTemplate = greetingcardTemplateDao.readCard(greetingcardTemplatePath);

        // transform the content using MailTemplate
        // TODO this should be transformed using method parameters not constructor
        MailTemplate mailTemplate = new StringMailTemplate(cardTemplate.getMailText());
        card.setContent(mailTemplate.getContent(card));

        loginUser();

        // send the mail with the TransmitMail-class

        transmission.sendOrQueue(config, vfsService, card);

        logout();

        transmitted = true;

        count = getCounterManager().incrementCounter(counterKey + "_" + remoteaddress);

    } catch (MessagingException | DataAccessException e) {
        e.printStackTrace();
    } catch (CmsException e) {
        e.printStackTrace();
    } finally {
    }
}