Example usage for javax.mail Store getURLName

List of usage examples for javax.mail Store getURLName

Introduction

In this page you can find the example usage for javax.mail Store getURLName.

Prototype

public URLName getURLName() 

Source Link

Document

Return a URLName representing this service.

Usage

From source file:de.saly.elasticsearch.imap.AbstractIMAPRiverUnitTest.java

protected void checkStoreForTestConnection(final Store store) {
    if (!store.isConnected()) {
        IMAPUtils.close(store);/*from w ww  .j  ava2 s.  c  o  m*/
        throw new RuntimeException("Store not connected");
    }

    if (!store.getURLName().getUsername().toLowerCase().startsWith("es_imapriver_unittest")) {
        IMAPUtils.close(store);
        throw new RuntimeException(
                "User " + store.getURLName().getUsername() + " belongs not to a valid test mail connection");
    }
}

From source file:org.apache.jmeter.protocol.mail.sampler.MailFileFolder.java

public MailFileFolder(Store store, String path) {
    super(store);
    String base = store.getURLName().getHost(); // == ServerName from mail sampler
    File parentFolder = new File(base);
    isFile = parentFolder.isFile();/*from ww w.j  a  v a2  s. c  om*/
    if (isFile) {
        folderPath = new File(base);
    } else {
        folderPath = new File(base, path);
    }
}