Skip to content

Commit

Permalink
Support gimap
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
  • Loading branch information
jbescos committed Oct 24, 2022
1 parent c48ac8d commit c24efdf
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 34 deletions.
5 changes: 2 additions & 3 deletions demos/demo/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@
import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Provider;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:angus-mail
@Test
public void test() throws NoSuchProviderException {
public void test() throws NoSuchProviderException, ClassNotFoundException {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
assertEquals(Provider.class, session.getProvider("imap").getClass());
Class.forName("com.sun.mail.imap.IMAPProvider");
}
}
6 changes: 2 additions & 4 deletions demos/logging/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@

import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Provider;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:jakarta.mail
@Test
public void test() throws NoSuchProviderException {
public void test() throws Exception {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
assertEquals(Provider.class, session.getProvider("imap").getClass());
Class.forName("com.sun.mail.imap.IMAPProvider");
}
}
10 changes: 3 additions & 7 deletions demos/servlet/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,20 @@

import org.junit.Test;

import com.sun.mail.dsn.DeliveryStatus;
import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.MessagingException;
import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Provider;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:jakarta.mail and org.eclipse.angus:dsn
@Test
public void test() throws NoSuchProviderException, MessagingException {
public void test() throws Exception {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
assertEquals(Provider.class, session.getProvider("imap").getClass());
new DeliveryStatus();
Class.forName("com.sun.mail.imap.IMAPProvider");
Class.forName("com.sun.mail.dsn.DeliveryStatus");
}
}
7 changes: 6 additions & 1 deletion demos/taglib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<artifactId>jakarta.mail</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>gimap</artifactId>
</dependency>
</dependencies>
</project>
22 changes: 22 additions & 0 deletions demos/taglib/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

module demo {
requires jakarta.servlet;
requires jakarta.mail;
requires com.sun.mail.gimap;
requires jakarta.servlet.jsp;
}
44 changes: 44 additions & 0 deletions demos/taglib/src/test/java/demo/ModulesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package demo;

import static org.junit.Assert.assertEquals;

import java.util.Properties;

import org.junit.Test;

import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.MessagingException;
import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Provider;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:jakarta.mail and org.eclipse.angus:gimap
@Test
public void test() throws Exception {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
Class.forName("com.sun.mail.imap.IMAPProvider");
Class.forName("com.sun.mail.gimap.GmailProvider");
}
}
10 changes: 5 additions & 5 deletions dsn/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
7 changes: 7 additions & 0 deletions providers/gimap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@
</build>

<dependencies>
<!-- Overwrite parent dependencies -->
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions providers/gimap/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,8 +16,8 @@

module com.sun.mail.gimap {

requires transitive jakarta.mail;
requires transitive com.sun.mail;
requires static com.sun.mail;
requires static jakarta.mail;

exports com.sun.mail.gimap;
exports com.sun.mail.gimap.protocol;
Expand Down
44 changes: 44 additions & 0 deletions providers/gimap/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package example.app;

import static org.junit.Assert.assertEquals;

import java.util.Properties;

import org.junit.Test;

import com.sun.mail.gimap.GmailProvider;
import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Provider;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:angus-mail and org.eclipse.angus:gimap
@Test
public void test() throws Exception {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
assertEquals(Provider.class, session.getProvider("imap").getClass());
Class.forName("com.sun.mail.gimap.GmailProvider");
}
}
22 changes: 22 additions & 0 deletions providers/gimap/src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

module example.app {
requires com.sun.mail.gimap;
requires com.sun.mail;
requires junit;
exports example.app;
}
10 changes: 10 additions & 0 deletions providers/imap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@
<packaging>jar</packaging>
<name>Angus Mail imap provider</name>

<dependencies>
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-core</artifactId>
</dependency>
</dependencies>
</project>
11 changes: 0 additions & 11 deletions providers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@
<packaging>pom</packaging>
<name>Angus Mail providers</name>

<dependencies>
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-core</artifactId>
</dependency>
</dependencies>

<modules>
<module>angus-mail</module>
<module>smtp</module>
Expand Down
10 changes: 10 additions & 0 deletions providers/pop3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@
<packaging>jar</packaging>
<name>Angus Mail pop3 provider</name>

<dependencies>
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-core</artifactId>
</dependency>
</dependencies>
</project>
10 changes: 10 additions & 0 deletions providers/smtp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@
<packaging>jar</packaging>
<name>Angus Mail smtp provider</name>

<dependencies>
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-core</artifactId>
</dependency>
</dependencies>
</project>

0 comments on commit c24efdf

Please sign in to comment.