Skip to content
Open
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
60 changes: 2 additions & 58 deletions greenmail-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version='1.0'?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>== GreenMail Core ==</name>
<description>GreenMail - Email Test Servers</description>
Expand Down Expand Up @@ -42,63 +43,6 @@
<artifactId>angus-activation</artifactId>
<scope>runtime</scope>
</dependency>

<!-- We need junit in compile scope since we want to offer Junit specific functionality (e.g. the GreenMailRule) -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
<!-- We only need the API in compile scope. Matchers are needed in test scope -->
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Test scope -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<!-- Transitively by junit:junit, required for running tests -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
1 change: 1 addition & 0 deletions greenmail-core/src/test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For compatibility with the cyclic dependency, the test for this module are in the `greenmail-tests` project.
4 changes: 2 additions & 2 deletions greenmail-docker/standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;

public class DockerServiceIT {
class DockerServiceIT {

private final String bindAddress = System.getProperty("greenmail.host.address", "127.0.0.1");

@Test
public void testAllServices() throws MessagingException, InterruptedException {
void testAllServices() throws MessagingException, InterruptedException {
// Ugly workaround : GreenMail in docker starts with open TCP connections,
// but TLS sockets might not be ready yet.
TimeUnit.SECONDS.sleep(1);
Expand Down
4 changes: 2 additions & 2 deletions greenmail-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

<!-- Test scope -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package com.icegreen.greenmail.spring;

import com.icegreen.greenmail.util.GreenMail;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.icegreen.greenmail.spring.GreenMailBeanDefinitionParser.DEFAULT_SERVER_STARTUP_TIMEOUT;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

import static com.icegreen.greenmail.spring.GreenMailBeanDefinitionParser.DEFAULT_SERVER_STARTUP_TIMEOUT;
import static org.assertj.core.api.Assertions.assertThat;
import com.icegreen.greenmail.util.GreenMail;

/**
* Tests GreenMailBean.
*
* @author Marcel May (mm)
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class GreenMailBeanTest {
@SpringJUnitConfig
class GreenMailBeanTest {
@Autowired
private GreenMailBean greenMailBean;

@Test
public void testCreate() {
void testCreate() {
GreenMail greenMail = greenMailBean.getGreenMail();

// Test if the protocol got activated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
package com.icegreen.greenmail.spring;

import org.junit.Test;
import org.junit.runner.RunWith;
import static com.icegreen.greenmail.spring.GreenMailBeanDefinitionParser.DEFAULT_SERVER_STARTUP_TIMEOUT;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static com.icegreen.greenmail.spring.GreenMailBeanDefinitionParser.DEFAULT_SERVER_STARTUP_TIMEOUT;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

/**
* Tests GreenMailBean configured via xml namespace handler.
*
* @author Marcel May (mm)
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class GreenMailNamespaceHandlerTest {
@SpringJUnitConfig
class GreenMailNamespaceHandlerTest {
@Autowired
private GreenMailBean greenMailBean;

@Test
public void testCreate() {
void testCreate() {
assert null!= greenMailBean;
assert "127.0.0.1".equals(greenMailBean.getHostname());
assert greenMailBean.getPortOffset() == 5000;
Expand Down
4 changes: 2 additions & 2 deletions greenmail-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
</dependency>
<!-- Test scope -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
package com.icegreen.greenmail.standalone;

import static org.assertj.core.api.Assertions.*;

import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

import com.icegreen.greenmail.configuration.PropertiesBasedGreenMailConfigurationBuilder;
import com.icegreen.greenmail.util.GreenMailUtil;
import com.icegreen.greenmail.util.PropertiesBasedServerSetupBuilder;
import com.icegreen.greenmail.util.ServerSetupTest;
import jakarta.mail.*;
import jakarta.mail.Folder;
import jakarta.mail.Message;
import jakarta.mail.MessagingException;
import jakarta.mail.Session;
import jakarta.mail.Store;
import jakarta.ws.rs.ProcessingException;
import jakarta.ws.rs.client.*;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.junit.After;
import org.junit.Test;

import java.util.List;
import java.util.Map;
import java.util.Properties;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class GreenMailStandaloneRunnerTest {
class GreenMailStandaloneRunnerTest {
private GreenMailStandaloneRunner runner;

@After
public void tearDown() {
@AfterEach
void tearDown() {
if (null != runner) {
runner.stop();
}
}

@Test
public void testDoRun() throws MessagingException {
void testDoRun() throws MessagingException {
runner = createAndConfigureRunner(new Properties());

GreenMailUtil.sendTextEmail("test2@localhost", "test1@localhost",
Expand All @@ -57,7 +65,7 @@ public void testDoRun() throws MessagingException {
}

@Test
public void testApi() {
void testApi() {
final Properties properties = new Properties();
properties.put(GreenMailApiServerBuilder.GREENMAIL_API_HOSTNAME, "localhost");
runner = createAndConfigureRunner(properties);
Expand Down
65 changes: 65 additions & 0 deletions greenmail-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.icegreen</groupId>
<artifactId>greenmail-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
</parent>

<name>== Greenmail Tests ==</name>
<artifactId>greenmail-tests</artifactId>
<description>provide all JUnit tests for greenmail</description>

<dependencies>
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<!-- Test scope -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<!-- Transitively by junit:junit, required for running tests -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading