Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade netty to 4.1.110 #82

Merged
merged 2 commits into from
Jun 13, 2024
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
30 changes: 12 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.hubspot</groupId>
<artifactId>basepom</artifactId>
<version>59.9</version>
<version>59.10-SNAPSHOT</version>
</parent>

<artifactId>NioImapClient</artifactId>
Expand Down Expand Up @@ -50,8 +50,7 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>${dep.netty.epoll.classifier}</classifier>
<artifactId>netty-transport-classes-epoll</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -155,6 +154,16 @@
<artifactId>greenmail</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-guava</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -181,19 +190,4 @@
<url>[email protected]:HubSpot/NioImapClient.git</url>
<tag>HEAD</tag>
</scm>

<profiles>
<profile>
<id>linux</id>
<activation>
<os>
<name>Linux</name>
<family>unix</family>
</os>
</activation>
<properties>
<dep.netty.epoll.classifier>${os.detected.classifier}</dep.netty.epoll.classifier>
</properties>
</profile>
</profiles>
</project>
24 changes: 13 additions & 11 deletions src/test/java/com/hubspot/imap/BaseGreenMailServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.google.common.net.HostAndPort;
import com.hubspot.imap.client.ImapClient;
import com.icegreen.greenmail.junit.GreenMailRule;
import com.icegreen.greenmail.junit4.GreenMailRule;
import com.icegreen.greenmail.user.GreenMailUser;
import com.icegreen.greenmail.util.GreenMailUtil;
import com.icegreen.greenmail.util.ServerSetup;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -14,14 +16,13 @@ public class BaseGreenMailServerTest {

protected static final String DEFAULT_FOLDER = "INBOX";

protected final ServerSetup serverSetup = new ServerSetup(
ThreadLocalRandom.current().nextInt(10000, 20000),
null,
"imap"
);

@Rule
public final GreenMailRule greenMail = new GreenMailRule(serverSetup);
public final GreenMailRule greenMail = new GreenMailRule(
new ServerSetup[] {
new ServerSetup(ThreadLocalRandom.current().nextInt(10000, 20000), null, "imap"),
new ServerSetup(ThreadLocalRandom.current().nextInt(10000, 20000), null, "imaps"),
}
);

protected GreenMailUser currentUser;

Expand All @@ -33,8 +34,9 @@ public void setUp() throws Exception {
protected ImapClientConfiguration getImapConfig() {
return ImapClientConfiguration
.builder()
.hostAndPort(HostAndPort.fromParts("localhost", greenMail.getImap().getPort()))
.useSsl(false)
.hostAndPort(HostAndPort.fromParts("localhost", greenMail.getImaps().getPort()))
.useSsl(true)
.trustManagerFactory(Optional.of(InsecureTrustManagerFactory.INSTANCE))
.connectTimeoutMillis(1000)
.tracingEnabled(true)
.noopKeepAliveIntervalSec(1)
Expand Down Expand Up @@ -67,7 +69,7 @@ protected void deliverRandomMessages(int n) {
GreenMailUtil.random() + "@localhost.com",
GreenMailUtil.random(),
GreenMailUtil.random(),
greenMail.getImap().getServerSetup()
greenMail.getImaps().getServerSetup()
)
);
}
Expand Down
9 changes: 4 additions & 5 deletions src/test/java/com/hubspot/imap/ImapMultiServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.hubspot.imap.client.ImapClient;
import com.hubspot.imap.protocol.exceptions.ConnectionClosedException;
import java.io.IOException;
Expand All @@ -25,12 +26,10 @@ private static List<TestServerConfig> getTestConfigs() throws IOException {
.getContextClassLoader()
.getResourceAsStream("profiles.yaml");

ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory())
.registerModule(new GuavaModule());

return objectMapper.readValue(
inputStream,
new TypeReference<List<TestServerConfig>>() {}
);
return objectMapper.readValue(inputStream, new TypeReference<>() {});
}

@Parameters(name = "{0}")
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/hubspot/imap/client/ImapClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public void testAppend() throws Exception {
)
.get();
assertThat(appendResponse.getCode()).isEqualTo(ResponseCode.OK);
long uid = Long.parseLong(appendResponse.getMessage().substring(25, 26));
long uid = Long.parseLong(appendResponse.getMessage().substring(22, 23));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greenmail imap server response timestamp changed from millis to secs


FetchResponse postAppendFetchAll = client
.fetch(
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/profiles.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[ ]
#- host: imap.gmail.com
# port: 993
# user: [email protected]
Expand Down