JamesMailetLoaderTestpublic class JamesMailetLoaderTest extends TestCase Licensed to the Apache Software Foundation (ASF) under one *
or more contributor license agreements. See the NOTICE file *
distributed with this work for additional information *
regarding copyright ownership. The ASF licenses this file *
to you under the Apache License, Version 2.0 (the *
"License"); you may not use this file except in compliance *
with the License. You may obtain a copy of the License at *
*
http://www.apache.org/licenses/LICENSE-2.0 *
*
Unless required by applicable law or agreed to in writing, *
software distributed under the License is distributed on an *
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
KIND, either express or implied. See the License for the *
specific language governing permissions and limitations *
under the License. * |
Fields Summary |
---|
private JamesMailetLoader | m_jamesMailetLoader | private JamesMailetLoaderConfiguration | m_conf |
Methods Summary |
---|
private void | assetIsNullMailet(org.apache.mailet.Mailet mailet)
assertNotNull("Null mailet loaded", mailet);
assertTrue("Null mailet is expected class", mailet instanceof org.apache.james.transport.mailets.Null);
| private void | checkTestMailet(java.lang.String mailetName)
// use standard package
DefaultConfiguration configuration = new DefaultConfiguration("mailetLoaderTest");
configuration.addChild(Util.getValuedConfiguration("testMailetKey", "testMailetValue"));
Mailet mailet = m_jamesMailetLoader.getMailet(mailetName, configuration);
assertTrue("MailetLoaderTestMailet mailet is expected class", mailet instanceof MailetLoaderTestMailet);
MailetLoaderTestMailet mailetLoaderTestMailet = ((MailetLoaderTestMailet) mailet);
assertTrue("init was called by loader", mailetLoaderTestMailet.assertInitCalled());
MailetConfig mailetConfig = mailetLoaderTestMailet.getMailetConfig();
assertEquals("init was called w/ right config", "testMailetValue", mailetConfig.getInitParameter("testMailetKey"));
| private void | setUpLoader()
m_conf.init();
m_jamesMailetLoader.configure(m_conf);
| public void | testFullQualifiedUsingFakeConfig()
m_conf.add("none.existing.package"); // has to be here so the Loader won't choke
setUpLoader();
Mailet mailet = m_jamesMailetLoader.getMailet("org.apache.james.transport.mailets.Null", null);
assetIsNullMailet(mailet);
| public void | testStandardMailets()
m_conf.addStandardPackages();
setUpLoader();
// use standard package
Mailet mailetNull1 = m_jamesMailetLoader.getMailet("Null", null);
assetIsNullMailet(mailetNull1);
// use full qualified package in parallel
Mailet mailetNull2 = m_jamesMailetLoader.getMailet("org.apache.james.transport.mailets.Null", null);
assetIsNullMailet(mailetNull2);
| public void | testTestMailets()
m_conf.addStandardPackages();
setUpLoader();
checkTestMailet("MailetLoaderTestMailet");
checkTestMailet("MailetLoaderTestSMIMEMailet");
| public void | testUsingEmtpyConfig()
setUpLoader();
|
|