Pax 考试 karaf 4.0.7 使用模拟 javamail
Pax exam karaf 4.0.7 using mock javamail
我想在 pax 考试环境中使用 javamail-mock2,但问题是 pax 考试无法从测试中看到 META-INF 文件夹。如何将 javamail.providers 文件添加到 javamail-mock2 将看到配置文件并加载模拟提供程序的套件中?
MP
DEBUG: JavaMail version 1.5.5
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
test/java/resources/META-INF/javamail.供应商
protocol=mock_smtp; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=mock_smtps; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=mock_pop3; type=store; class=de.saly.javamail.mock2.POP3MockStore; vendor=JavaMail Mock2 provider;
protocol=mock_imap; type=store; class=de.saly.javamail.mock2.IMAPMockStore; vendor=JavaMail Mock2 provider;
protocol=mock_pop3s; type=store; class=de.saly.javamail.mock2.POP3SSLMockStore; vendor=JavaMail Mock2 provider;
protocol=mock_imaps; type=store; class=de.saly.javamail.mock2.IMAPSSLMockStore; vendor=JavaMail Mock2 provider;
#Override real providers
protocol=smtp${mock.postfix}; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=smtps${mock.postfix}; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=pop3${mock.postfix}; type=store; class=de.saly.javamail.mock2.POP3MockStore; vendor=JavaMail Mock2 provider;
protocol=imap${mock.postfix}; type=store; class=de.saly.javamail.mock2.IMAPMockStore; vendor=JavaMail Mock2 provider;
protocol=pop3s${mock.postfix}; type=store; class=de.saly.javamail.mock2.POP3SSLMockStore; vendor=JavaMail Mock2 provider;
protocol=imaps${mock.postfix}; type=store; class=de.saly.javamail.mock2.IMAPSSLMockStore; vendor=JavaMail Mock2 provider;
最后我得到错误:
javax.mail.NoSuchProviderException: No provider for mock_imaps
javamail-mock2 可能与 OSGi 不兼容。我们构建了一个模拟邮件包,用于在 OSGi 中测试 Camel:https://github.com/apache/camel/tree/master/tests/test-bundles/mock-javamail_1.7
我想在 pax 考试环境中使用 javamail-mock2,但问题是 pax 考试无法从测试中看到 META-INF 文件夹。如何将 javamail.providers 文件添加到 javamail-mock2 将看到配置文件并加载模拟提供程序的套件中?
MP
DEBUG: JavaMail version 1.5.5
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
test/java/resources/META-INF/javamail.供应商
protocol=mock_smtp; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=mock_smtps; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=mock_pop3; type=store; class=de.saly.javamail.mock2.POP3MockStore; vendor=JavaMail Mock2 provider;
protocol=mock_imap; type=store; class=de.saly.javamail.mock2.IMAPMockStore; vendor=JavaMail Mock2 provider;
protocol=mock_pop3s; type=store; class=de.saly.javamail.mock2.POP3SSLMockStore; vendor=JavaMail Mock2 provider;
protocol=mock_imaps; type=store; class=de.saly.javamail.mock2.IMAPSSLMockStore; vendor=JavaMail Mock2 provider;
#Override real providers
protocol=smtp${mock.postfix}; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=smtps${mock.postfix}; type=transport; class=de.saly.javamail.mock2.MockTransport; vendor=JavaMail Mock2 provider;
protocol=pop3${mock.postfix}; type=store; class=de.saly.javamail.mock2.POP3MockStore; vendor=JavaMail Mock2 provider;
protocol=imap${mock.postfix}; type=store; class=de.saly.javamail.mock2.IMAPMockStore; vendor=JavaMail Mock2 provider;
protocol=pop3s${mock.postfix}; type=store; class=de.saly.javamail.mock2.POP3SSLMockStore; vendor=JavaMail Mock2 provider;
protocol=imaps${mock.postfix}; type=store; class=de.saly.javamail.mock2.IMAPSSLMockStore; vendor=JavaMail Mock2 provider;
最后我得到错误:
javax.mail.NoSuchProviderException: No provider for mock_imaps
javamail-mock2 可能与 OSGi 不兼容。我们构建了一个模拟邮件包,用于在 OSGi 中测试 Camel:https://github.com/apache/camel/tree/master/tests/test-bundles/mock-javamail_1.7