Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail</artifactId>
<version>2.0.1</version>
<version>2.1.12</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import com.icegreen.greenmail.user.GreenMailUser;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.ServerSetup;
import com.sun.mail.util.MailSSLSocketFactory;
import jakarta.mail.*;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import java.security.GeneralSecurityException;
import java.util.Properties;

public class GreenmailIntegrationTestCase {
Expand Down Expand Up @@ -78,12 +76,10 @@ protected Folder openFolder(Store store, String folderName) throws MessagingExce
return folder;
}

protected Store connectToIMAPServer() throws GeneralSecurityException, MessagingException {
protected Store connectToIMAPServer() throws MessagingException {
Properties props = new Properties();

MailSSLSocketFactory socketFactory = new MailSSLSocketFactory();
socketFactory.setTrustedHosts(new String[]{"127.0.0.1", "localhost"});
props.put("mail.imaps.ssl.socketFactory", socketFactory);
props.put("mail.imaps.ssl.trust", emailServerHost);
props.put("mail.imaps.ssl.checkserveridentity", "false");

Session session = Session.getInstance(props, null);
Store store = session.getStore("imaps");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalToIgnoringCase;
import static org.mockito.Mockito.*;

public class POASubmissionsDownloaderIT extends GreenmailIntegrationTestCase {
Expand Down Expand Up @@ -88,7 +89,7 @@ private void assertEmailIsProperlyProcessed(String subject, String poa, String s
POASubmission submission = captor.getValue();
assertThat(submission.getSubject(), equalTo(subject));
assertThat(submission.getContent(), equalTo(poa));
assertThat(submission.getContentType(), equalTo(contentType));
assertThat(submission.getContentType(), equalToIgnoringCase(contentType));
assertThat(submission.getSubmitter(), equalTo(sender));

ArgumentCaptor<StatusMessage> statusCaptor = ArgumentCaptor.forClass(StatusMessage.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package edu.pdx.cs.joy.grader;

import com.google.common.annotations.VisibleForTesting;
import com.sun.mail.util.MailSSLSocketFactory;
import jakarta.mail.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
Expand Down Expand Up @@ -280,17 +278,16 @@ private Store connectToIMAPServer() {
Properties props = new Properties();

if (this.trustLocalhostSSL) {
MailSSLSocketFactory socketFactory= new MailSSLSocketFactory();
socketFactory.setTrustedHosts("127.0.0.1", "localhost");
props.put("mail.imaps.ssl.socketFactory", socketFactory);
props.put("mail.imaps.ssl.trust", "127.0.0.1 localhost");
props.put("mail.imaps.ssl.checkserveridentity", "false");
}

Session session = Session.getInstance(props, null);
Store store = session.getStore("imaps");
store.connect(this.emailServerHostName, this.emailServerPort, this.userName, this.password);
return store;

} catch (MessagingException | GeneralSecurityException ex) {
} catch (MessagingException ex) {
throw new IllegalStateException("While connecting to " + this.emailServerHostName + ":" + this.emailServerPort, ex);
}
}
Expand Down
Loading