[
https://issues.apache.org/jira/browse/JAMES-992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16187448#comment-16187448
]
ASF GitHub Bot commented on JAMES-992:
--------------------------------------
Github user chibenwa commented on a diff in the pull request:
https://github.com/apache/james-project/pull/73#discussion_r142033179
--- Diff:
mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java
---
@@ -0,0 +1,60 @@
+package org.apache.james.transport.matchers;
+
+import org.apache.james.core.MailAddress;
+import org.apache.mailet.base.test.FakeMail;
+import org.apache.mailet.base.test.FakeMatcherConfig;
+import org.apache.mailet.base.test.MimeMessageBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.mail.internet.MimeMessage;
+
+import static org.junit.Assert.assertNotNull;
+
+public class HasMimeTypeTest {
+
+ private HasMimeType matcher;
+ private final String RECIPIENT = "[email protected]";
+ private final String FROM = "[email protected]";
+ private final String MIME_TYPES = "multipart/mixed";
+ private MimeMessage message;
+ private FakeMail mail;
+
+ @Before
+ public void setUp() throws Exception {
+ matcher = new HasMimeType();
+ message = MimeMessageBuilder.mimeMessageBuilder()
+ .setMultipartWithBodyParts(
+ MimeMessageBuilder.bodyPartBuilder()
+ .data("simple text")
+ .disposition("text")
+ .build(),
+ MimeMessageBuilder.bodyPartBuilder()
+ .filename("text_file.txt")
+ .disposition("attachment")
+ .build(),
+ MimeMessageBuilder.bodyPartBuilder()
+ .type("application/zip")
+ .filename("zip_file.zip")
+ .disposition("attachment")
+ .build())
+ .setSubject("test")
+ .build();
+
+ mail = FakeMail.builder()
+ .mimeMessage(message)
+ .sender(new MailAddress(FROM))
+ .recipient(new MailAddress(RECIPIENT))
+ .build();
+ }
+
+ @Test
+ public void hasMimeType() throws Exception {
+ matcher.init(FakeMatcherConfig.builder()
+ .matcherName("HasMimeType")
+ .condition(MIME_TYPES)
+ .build());
+ assertNotNull(matcher.match(mail));
+ }
+
--- End diff --
You miss one test on a non matching case.
> Limit max line length for protocol when using Netty
> ---------------------------------------------------
>
> Key: JAMES-992
> URL: https://issues.apache.org/jira/browse/JAMES-992
> Project: James Server
> Issue Type: Improvement
> Reporter: Norman Maurer
> Fix For: 3.0-M1
>
>
> We should limit the max characters per line so nobody can cause OOM when
> doing a DOS attach
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]