Revision e788634d
Added by Andreas Kohlbecker over 2 years ago
cdmlib-services/pom.xml | ||
---|---|---|
92 | 92 |
<artifactId>spring-context-support</artifactId> |
93 | 93 |
</dependency> |
94 | 94 |
<dependency> |
95 |
<groupId>javax.mail</groupId> |
|
96 |
<artifactId>javax.mail-api</artifactId> |
|
97 |
<!-- dependency managed by spring-context-support --> |
|
95 |
<groupId>com.sun.mail</groupId> |
|
96 |
<artifactId>javax.mail</artifactId> |
|
98 | 97 |
</dependency> |
99 | 98 |
<dependency> |
100 | 99 |
<groupId>org.subethamail</groupId> |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/EmailSendTest.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.cdm.api.service; |
10 | 10 |
|
11 | 11 |
import static org.junit.Assert.assertEquals; |
12 |
import static org.junit.Assert.assertNotNull; |
|
13 |
import static org.junit.Assert.assertTrue; |
|
12 | 14 |
|
13 | 15 |
import java.io.FileNotFoundException; |
14 | 16 |
import java.util.Objects; |
... | ... | |
57 | 59 |
} |
58 | 60 |
|
59 | 61 |
String from = env.getProperty(SendEmailConfigurer.FROM_ADDRESS); |
62 |
assertNotNull(from); |
|
63 |
assertTrue(from.contains("@")); |
|
60 | 64 |
|
61 | 65 |
boolean useWiser = Objects.equals(env.getProperty(SendEmailConfigurer.INT_TEST_SERVER), "wiser"); |
62 | 66 |
Wiser wiser = null; |
63 | 67 |
if(useWiser) { |
64 | 68 |
// start test smtp server |
65 | 69 |
wiser = new Wiser(); |
66 |
wiser.setPort(2500); // Default is 25
|
|
70 |
wiser.setPort(2500); // better use random port
|
|
67 | 71 |
wiser.start(); |
68 | 72 |
} |
69 | 73 |
|
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/security/PasswordResetServiceTest.java | ||
---|---|---|
26 | 26 |
import org.junit.After; |
27 | 27 |
import org.junit.Before; |
28 | 28 |
import org.junit.Test; |
29 |
import org.springframework.beans.factory.annotation.Autowired; |
|
30 |
import org.springframework.core.env.Environment; |
|
29 | 31 |
import org.springframework.mail.javamail.JavaMailSender; |
30 | 32 |
import org.springframework.util.concurrent.ListenableFuture; |
31 | 33 |
import org.subethamail.wiser.Wiser; |
... | ... | |
77 | 79 |
@SpringBeanByType |
78 | 80 |
private JavaMailSender emailSender; |
79 | 81 |
|
82 |
@Autowired |
|
83 |
private Environment env; |
|
84 |
|
|
80 | 85 |
private Wiser wiser = null; |
81 | 86 |
|
82 | 87 |
private CountDownLatch resetTokenSendSignal; |
... | ... | |
86 | 91 |
|
87 | 92 |
@Before |
88 | 93 |
public void startEmailServer() { |
94 |
// Integer smtpPort = env.getProperty(SendEmailConfigurer.PORT, Integer.class); |
|
89 | 95 |
wiser = new Wiser(); |
90 |
wiser.setPort(2500); // Default is 25
|
|
96 |
wiser.setPort(2500); // must be the same as configured for SendEmailConfigurer.PORT
|
|
91 | 97 |
wiser.start(); |
98 |
logger.debug("Wiser email server started"); |
|
92 | 99 |
} |
93 | 100 |
|
94 | 101 |
|
pom.xml | ||
---|---|---|
49 | 49 |
<aspectj.version>1.9.6</aspectj.version> <!-- checked 2020-08 --> |
50 | 50 |
<geotools.version>23.2</geotools.version> <!-- checked 2020-08 --> |
51 | 51 |
<dozer.version>6.5.0</dozer.version> <!-- checked 2021-02 --> |
52 |
<javax.mail.version>1.5.6</javax.mail.version> <!-- compatible to the one in spring-context-support/4.3.28.RELEASE --> |
|
52 | 53 |
<javadoc.opts>-Xdoclint:none</javadoc.opts> |
53 | 54 |
</properties> |
54 | 55 |
|
... | ... | |
1663 | 1664 |
</dependency> |
1664 | 1665 |
<dependency> |
1665 | 1666 |
<!-- Email functionality (used in cdmlib-services) --> |
1666 |
<groupId>javax.mail</groupId>
|
|
1667 |
<artifactId>javax.mail-api</artifactId>
|
|
1668 |
<version>1.5.6</version><!-- same as for spring-context-support/4.3.28.RELEASE -->
|
|
1667 |
<groupId>com.sun.mail</groupId>
|
|
1668 |
<artifactId>javax.mail</artifactId> |
|
1669 |
<version>${javax.mail.version}</version>
|
|
1669 | 1670 |
</dependency> |
1670 | 1671 |
<dependency> |
1671 | 1672 |
<!-- only needed for PasswordResetService, may be replaced by Thymeleaf --> |
Also available in: Unified diff
ref #9758 switching to other javax.mail implementation (step 2) and fixing port issues in test