Search in sources :

Example 1 with MailResourceConfig

use of com.sun.appserv.management.config.MailResourceConfig in project Payara by payara.

the class MailResourceConfigTest method ensureDefaultInstance.

/**
 *     synchronized because multiple instances are created, and we've chosen to remove/add
 *     this resource multiple times for some specific tests.
 */
public static synchronized MailResourceConfig ensureDefaultInstance(final DomainConfig dc) {
    MailResourceConfig result = dc.getResourcesConfig().getMailResourceConfigMap().get(getDefaultInstanceName());
    if (result == null) {
        result = createInstance(dc, getDefaultInstanceName(), MAIL_RESOURCE_HOST, MAIL_RESOURCE_USER, MAIL_RESOURCE_FROM, OPTIONS);
        assert !AttributeResolverHelper.resolveBoolean(result, "Enabled");
        final StandaloneServerConfig serverConfig = dc.getServersConfig().getStandaloneServerConfigMap().get("server");
        final Map<String, String> options = new HashMap<String, String>();
        options.put(ResourceConfigKeys.ENABLED_KEY, "false");
        final ResourceRefConfig ref = serverConfig.createResourceRefConfig(result.getName(), options);
        assert !AttributeResolverHelper.resolveBoolean(ref, "Enabled");
        RefHelper.removeAllRefsTo(result, false);
    }
    return result;
}
Also used : StandaloneServerConfig(com.sun.appserv.management.config.StandaloneServerConfig) HashMap(java.util.HashMap) MailResourceConfig(com.sun.appserv.management.config.MailResourceConfig) ResourceRefConfig(com.sun.appserv.management.config.ResourceRefConfig)

Example 2 with MailResourceConfig

use of com.sun.appserv.management.config.MailResourceConfig in project Payara by payara.

the class ReferencesTest method removeMailResourceConfig.

void removeMailResourceConfig() {
    final Map<String, MailResourceConfig> mails = getDomainConfig().getResourcesConfig().getMailResourceConfigMap();
    MailResourceConfig mr = mails.get(MAIL_RESOURCE_NAME);
    if (mr != null) {
        getDomainConfig().getResourcesConfig().removeMailResourceConfig(mr.getName());
    }
}
Also used : MailResourceConfig(com.sun.appserv.management.config.MailResourceConfig)

Example 3 with MailResourceConfig

use of com.sun.appserv.management.config.MailResourceConfig in project Payara by payara.

the class ReferencesTest method ensureMailResourceConfig.

MailResourceConfig ensureMailResourceConfig() {
    final Map<String, MailResourceConfig> mails = getDomainConfig().getResourcesConfig().getMailResourceConfigMap();
    MailResourceConfig mr = mails.get(MAIL_RESOURCE_NAME);
    if (mr == null) {
        mr = createMailResourceConfig();
    }
    return mr;
}
Also used : MailResourceConfig(com.sun.appserv.management.config.MailResourceConfig)

Aggregations

MailResourceConfig (com.sun.appserv.management.config.MailResourceConfig)3 ResourceRefConfig (com.sun.appserv.management.config.ResourceRefConfig)1 StandaloneServerConfig (com.sun.appserv.management.config.StandaloneServerConfig)1 HashMap (java.util.HashMap)1