Compare commits
7 Commits
613a74ca92
...
feature/ja
| Author | SHA1 | Date | |
|---|---|---|---|
| 85c181a433 | |||
| e0fde434df | |||
| db1d81bcd9 | |||
| 31aea194df | |||
| 782a736cdc | |||
| c4a5f12511 | |||
| b9482de3b1 |
@ -1,5 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
setlocal
|
|
||||||
set BASEPATH=%~dp0%
|
|
||||||
cd %BASEPATH%\..
|
|
||||||
mvn release:clean release:prepare -Dmaven.test.skip=true -Darguments="-Dmaven.test.skip=true -DskipTests"
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
|
|
||||||
@ -14,7 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<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">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
@ -24,7 +24,7 @@ limitations under the License.
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<groupId>de.muehlencord</groupId>
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<name>shared-configuration</name>
|
<name>shared-configuration</name>
|
||||||
@ -36,7 +36,7 @@ limitations under the License.
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@ -21,12 +21,12 @@ limitations under the License.
|
|||||||
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<artifactId>shared-db</artifactId>
|
<artifactId>shared-db</artifactId>
|
||||||
<packaging>ejb</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<groupId>de.muehlencord</groupId>
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<name>shared-db</name>
|
<name>shared-db</name>
|
||||||
@ -61,7 +61,7 @@ limitations under the License.
|
|||||||
<!-- Testing -->
|
<!-- Testing -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@ -15,18 +15,17 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<groupId>de.muehlencord</groupId>
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<artifactId>shared-jeeutil</artifactId>
|
<artifactId>shared-jeeutil</artifactId>
|
||||||
<packaging>ejb</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>shared-jeeutil</name>
|
<name>shared-jeeutil</name>
|
||||||
|
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<netbeans.compile.on.save>all</netbeans.compile.on.save>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
||||||
@ -16,34 +16,40 @@ limitations under the License.
|
|||||||
<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">
|
<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">
|
||||||
<artifactId>shared-network</artifactId>
|
<artifactId>shared-network</artifactId>
|
||||||
|
|
||||||
<build>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
</build>
|
<name>shared-network</name>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>shared</artifactId>
|
||||||
|
<groupId>de.muehlencord</groupId>
|
||||||
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>shared-util</artifactId>
|
<artifactId>shared-util</artifactId>
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>javax.mail</artifactId>
|
<groupId>jakarta.mail</groupId>
|
||||||
<groupId>com.sun.mail</groupId>
|
<artifactId>jakarta.mail-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>ews-java-api</artifactId>
|
<artifactId>ews-java-api</artifactId>
|
||||||
@ -56,29 +62,17 @@ limitations under the License.
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>jaxws-api</artifactId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<groupId>javax.xml.ws</groupId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<name>shared-network</name>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>shared</artifactId>
|
|
||||||
<groupId>de.muehlencord</groupId>
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -16,20 +16,20 @@
|
|||||||
package de.muehlencord.shared.network.mail;
|
package de.muehlencord.shared.network.mail;
|
||||||
|
|
||||||
import de.muehlencord.shared.util.StringUtil;
|
import de.muehlencord.shared.util.StringUtil;
|
||||||
|
import jakarta.mail.Flags;
|
||||||
|
import jakarta.mail.Folder;
|
||||||
|
import jakarta.mail.Message;
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.mail.Session;
|
||||||
|
import jakarta.mail.Store;
|
||||||
|
import jakarta.mail.internet.MimeMessage;
|
||||||
|
import jakarta.mail.search.MessageIDTerm;
|
||||||
|
import jakarta.mail.search.SearchTerm;
|
||||||
|
import jakarta.mail.util.SharedByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import javax.mail.Flags;
|
|
||||||
import javax.mail.Folder;
|
|
||||||
import javax.mail.Message;
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import javax.mail.Session;
|
|
||||||
import javax.mail.Store;
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
import javax.mail.search.MessageIDTerm;
|
|
||||||
import javax.mail.search.SearchTerm;
|
|
||||||
import javax.mail.util.SharedByteArrayInputStream;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
@ -15,12 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package de.muehlencord.shared.network.mail;
|
package de.muehlencord.shared.network.mail;
|
||||||
|
|
||||||
|
import jakarta.mail.Address;
|
||||||
|
import jakarta.mail.internet.InternetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.mail.Address;
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mail message
|
* A mail message
|
||||||
|
|||||||
@ -16,18 +16,19 @@
|
|||||||
package de.muehlencord.shared.network.mail;
|
package de.muehlencord.shared.network.mail;
|
||||||
|
|
||||||
import static de.muehlencord.shared.util.StringUtil.getStackTraceString;
|
import static de.muehlencord.shared.util.StringUtil.getStackTraceString;
|
||||||
|
|
||||||
|
import jakarta.mail.BodyPart;
|
||||||
|
import jakarta.mail.Message;
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.mail.Multipart;
|
||||||
|
import jakarta.mail.internet.MimeMessage;
|
||||||
|
import jakarta.mail.internet.MimeMultipart;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import javax.mail.BodyPart;
|
|
||||||
import javax.mail.Message;
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import javax.mail.Multipart;
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
import javax.mail.internet.MimeMultipart;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import de.muehlencord.shared.network.mail.DefaultMailReader;
|
|||||||
import de.muehlencord.shared.network.mail.MailProtocol;
|
import de.muehlencord.shared.network.mail.MailProtocol;
|
||||||
import de.muehlencord.shared.network.mail.MailReaderConfiguration;
|
import de.muehlencord.shared.network.mail.MailReaderConfiguration;
|
||||||
import de.muehlencord.shared.network.mail.MailReaderConnectionException;
|
import de.muehlencord.shared.network.mail.MailReaderConnectionException;
|
||||||
import javax.mail.Session;
|
import jakarta.mail.Session;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|||||||
@ -25,17 +25,16 @@ import org.junit.jupiter.api.Disabled;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class HttpLayerTest extends BaseTest {
|
class HttpLayerTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
public void testPostByMap() throws Exception {
|
void testPostByMap() throws Exception {
|
||||||
System.out.println("testPostByMap");
|
System.out.println("testPostByMap");
|
||||||
Map<String, String[]> map = new HashMap<>();
|
Map<String, String[]> map = new HashMap<>();
|
||||||
String[] value = {"Hello World!", "Hello World again"};
|
String[] value = { "Hello World!", "Hello World again" };
|
||||||
map.put("message", value);
|
map.put("message", value);
|
||||||
|
|
||||||
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
||||||
@ -44,15 +43,15 @@ public class HttpLayerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
public void testPostByMapList() throws Exception {
|
void testPostByMapList() throws Exception {
|
||||||
System.out.println("testPostByMapList");
|
System.out.println("testPostByMapList");
|
||||||
List<Map<String, String[]>> list = new LinkedList<>();
|
List<Map<String, String[]>> list = new LinkedList<>();
|
||||||
Map<String, String[]> map = new HashMap<>();
|
Map<String, String[]> map = new HashMap<>();
|
||||||
String[] value = {"Hello World!", "Hello World again"};
|
String[] value = { "Hello World!", "Hello World again" };
|
||||||
map.put("message", value);
|
map.put("message", value);
|
||||||
list.add(map);
|
list.add(map);
|
||||||
map = new HashMap<>();
|
map = new HashMap<>();
|
||||||
String[] urlValue = {"http://localhost:8080/testurl"};
|
String[] urlValue = { "http://localhost:8080/testurl" };
|
||||||
map.put("url", urlValue);
|
map.put("url", urlValue);
|
||||||
list.add(map);
|
list.add(map);
|
||||||
|
|
||||||
@ -62,14 +61,14 @@ public class HttpLayerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
public void testByValue() throws Exception {
|
void testByValue() throws Exception {
|
||||||
System.out.println("testByValue");
|
System.out.println("testByValue");
|
||||||
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
||||||
httpLayer.post("message", "Hello World by single parameter");
|
httpLayer.post("message", "Hello World by single parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithUnknownURL() throws MessageNotSendException {
|
void testWithUnknownURL() throws MessageNotSendException {
|
||||||
System.out.println("testWithUnknownURL");
|
System.out.println("testWithUnknownURL");
|
||||||
HttpLayer httpLayer = new HttpLayer("http://localhost/thisURLDoesNotExist");
|
HttpLayer httpLayer = new HttpLayer("http://localhost/thisURLDoesNotExist");
|
||||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||||
@ -79,7 +78,7 @@ public class HttpLayerTest extends BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidURL() throws MessageNotSendException {
|
void testInvalidURL() throws MessageNotSendException {
|
||||||
System.out.println("testInvalidURL");
|
System.out.println("testInvalidURL");
|
||||||
HttpLayer httpLayer = new HttpLayer("joern@muehlencord.de");
|
HttpLayer httpLayer = new HttpLayer("joern@muehlencord.de");
|
||||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||||
@ -88,7 +87,7 @@ public class HttpLayerTest extends BaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnsupportedURL() throws MessageNotSendException {
|
void testUnsupportedURL() throws MessageNotSendException {
|
||||||
System.out.println("testUnsupportedURL");
|
System.out.println("testUnsupportedURL");
|
||||||
HttpLayer httpLayer = new HttpLayer("ftp://localhost");
|
HttpLayer httpLayer = new HttpLayer("ftp://localhost");
|
||||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||||
|
|||||||
@ -15,6 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package de.muehlencord.shared.network.mail;
|
package de.muehlencord.shared.network.mail;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
||||||
|
|
||||||
|
import jakarta.mail.Message;
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.mail.Multipart;
|
||||||
|
import jakarta.mail.PasswordAuthentication;
|
||||||
|
import jakarta.mail.Session;
|
||||||
|
import jakarta.mail.Transport;
|
||||||
|
import jakarta.mail.internet.AddressException;
|
||||||
|
import jakarta.mail.internet.InternetAddress;
|
||||||
|
import jakarta.mail.internet.MimeBodyPart;
|
||||||
|
import jakarta.mail.internet.MimeMessage;
|
||||||
|
import jakarta.mail.internet.MimeMultipart;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -22,18 +35,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import javax.mail.Message;
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import javax.mail.Multipart;
|
|
||||||
import javax.mail.PasswordAuthentication;
|
|
||||||
import javax.mail.Session;
|
|
||||||
import javax.mail.Transport;
|
|
||||||
import javax.mail.internet.AddressException;
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
import javax.mail.internet.MimeBodyPart;
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
import javax.mail.internet.MimeMultipart;
|
|
||||||
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -63,7 +64,7 @@ public class TestSendMail {
|
|||||||
props.put("mail.smtp.port", "587");
|
props.put("mail.smtp.port", "587");
|
||||||
props.put("mail.debug", "true");
|
props.put("mail.debug", "true");
|
||||||
|
|
||||||
Session mailSession = Session.getInstance(props, new javax.mail.Authenticator() {
|
Session mailSession = Session.getInstance(props, new jakarta.mail.Authenticator() {
|
||||||
@Override
|
@Override
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(RECEIVER, PASSWORD);
|
return new PasswordAuthentication(RECEIVER, PASSWORD);
|
||||||
|
|||||||
@ -47,9 +47,9 @@ limitations under the License.
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<groupId>de.muehlencord</groupId>
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
91
pom.xml
91
pom.xml
@ -18,8 +18,9 @@ limitations under the License.
|
|||||||
<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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>de.muehlencord</groupId>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
<name>shared</name>
|
<name>shared</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
@ -54,17 +55,24 @@ limitations under the License.
|
|||||||
<url>https://jomu.timelord.de/git/jomu/shared/</url>
|
<url>https://jomu.timelord.de/git/jomu/shared/</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://jomu.timelord.de/git/api/packages/jomu/maven</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ossrh</id>
|
<id>jomu-gitea</id>
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
<url>https://jomu.timelord.de/git/api/packages/jomu/maven</url>
|
||||||
</repository>
|
</repository>
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
<id>ossrh</id>
|
<id>jomu-gitea</id>
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
<url>https://jomu.timelord.de/git/api/packages/jomu/maven</url>
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<groupId>de.muehlencord</groupId>
|
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>Gitea</system>
|
<system>Gitea</system>
|
||||||
@ -79,24 +87,36 @@ limitations under the License.
|
|||||||
<maven.compiler.release>17</maven.compiler.release>
|
<maven.compiler.release>17</maven.compiler.release>
|
||||||
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<slf4j.version>2.0.6</slf4j.version>
|
<slf4j.version>2.0.12</slf4j.version>
|
||||||
<jackson.version>2.14.2</jackson.version>
|
<jackson.version>2.16.1</jackson.version>
|
||||||
<lombok.version>1.18.26</lombok.version>
|
<lombok.version>1.18.30</lombok.version>
|
||||||
<junit.version>5.9.2</junit.version>
|
<junit.version>5.10.2</junit.version>
|
||||||
|
|
||||||
<poi.version>5.2.3</poi.version>
|
<poi.version>5.2.5</poi.version>
|
||||||
<commons-net.version>3.9.0</commons-net.version>
|
<commons-net.version>3.10.0</commons-net.version>
|
||||||
<commons-lang.version>3.12.0</commons-lang.version>
|
<commons-lang.version>3.14.0</commons-lang.version>
|
||||||
<gson.version>2.10.1</gson.version>
|
<gson.version>2.10.1</gson.version>
|
||||||
<fusionauth.version>5.2.2</fusionauth.version>
|
<fusionauth.version>5.3.1</fusionauth.version>
|
||||||
<bouncycastle.version>1.70</bouncycastle.version>
|
<bouncycastle.version>1.70</bouncycastle.version>
|
||||||
<hibernate.version>6.1.7.Final</hibernate.version>
|
<hibernate.version>6.1.7.Final</hibernate.version>
|
||||||
<com-sun-mail.version>1.6.2</com-sun-mail.version>
|
<jakarta.mail-api.version>2.1.2</jakarta.mail-api.version>
|
||||||
|
<ews-java-api.version>2.0</ews-java-api.version>
|
||||||
|
<scrypt.version>1.4.0</scrypt.version>
|
||||||
|
|
||||||
<jakarta-faces.version>4.0.4</jakarta-faces.version>
|
<jakarta-faces.version>4.0.5</jakarta-faces.version>
|
||||||
<joinfaces.version>5.1.4</joinfaces.version>
|
<joinfaces.version>5.1.8</joinfaces.version>
|
||||||
<jakarta.interceptor-api.version>2.1.0</jakarta.interceptor-api.version>
|
<jakarta.interceptor-api.version>2.1.0</jakarta.interceptor-api.version>
|
||||||
<jakarta-inject-api.version>2.0.0</jakarta-inject-api.version>
|
<jakarta-inject-api.version>2.0.1</jakarta-inject-api.version>
|
||||||
|
|
||||||
|
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
|
||||||
|
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||||
|
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
||||||
|
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
|
||||||
|
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
||||||
|
<maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
|
||||||
|
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
|
||||||
|
<license-maven-plugin.version>1.14</license-maven-plugin.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@ -156,14 +176,15 @@ limitations under the License.
|
|||||||
|
|
||||||
<!-- mail -->
|
<!-- mail -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>javax.mail</artifactId>
|
<groupId>jakarta.mail</groupId>
|
||||||
<groupId>com.sun.mail</groupId>
|
<artifactId>jakarta.mail-api</artifactId>
|
||||||
<version>${com-sun-mail.version}</version>
|
<version>${jakarta.mail-api.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>ews-java-api</artifactId>
|
<artifactId>ews-java-api</artifactId>
|
||||||
<groupId>com.microsoft.ews-java-api</groupId>
|
<groupId>com.microsoft.ews-java-api</groupId>
|
||||||
<version>2.0</version>
|
<version>${ews-java-api.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Faces -->
|
<!-- Faces -->
|
||||||
@ -210,7 +231,7 @@ limitations under the License.
|
|||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>scrypt</artifactId>
|
<artifactId>scrypt</artifactId>
|
||||||
<groupId>com.lambdaworks</groupId>
|
<groupId>com.lambdaworks</groupId>
|
||||||
<version>1.4.0</version>
|
<version>${scrypt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
@ -267,7 +288,7 @@ limitations under the License.
|
|||||||
</configuration>
|
</configuration>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<version>1.6.8</version>
|
<version>${nexus-staging-maven-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- ensure sources are build so they are also uploaded -->
|
<!-- ensure sources are build so they are also uploaded -->
|
||||||
@ -297,7 +318,7 @@ limitations under the License.
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>3.1.1</version>
|
<version>${maven-javadoc-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- create license file -->
|
<!-- create license file -->
|
||||||
@ -321,7 +342,7 @@ limitations under the License.
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<version>1.14</version>
|
<version>${license-maven-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- sign jar archives -->
|
<!-- sign jar archives -->
|
||||||
@ -340,7 +361,7 @@ limitations under the License.
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>1.6</version>
|
<version>${maven-gpg-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
@ -360,27 +381,20 @@ limitations under the License.
|
|||||||
<target>${maven.compiler.target}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>3.8.1</version>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- build maven ejb artifacts -->
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-ejb-plugin</artifactId>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- create new releases -->
|
<!-- create new releases -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<version>2.5.3</version>
|
<version>${maven-release-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- control junit tests from maven build -->
|
<!-- control junit tests from maven build -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>2.22.2</version>
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
@ -397,7 +411,6 @@ limitations under the License.
|
|||||||
<configuration>
|
<configuration>
|
||||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
<version>2.5.3</version>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -407,7 +420,7 @@ limitations under the License.
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<version>3.6.1</version>
|
<version>${maven-dependency-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
|
|
||||||
@ -14,7 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<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">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
@ -26,7 +26,7 @@ limitations under the License.
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>shared</artifactId>
|
<artifactId>shared</artifactId>
|
||||||
<groupId>de.muehlencord</groupId>
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ limitations under the License.
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -15,18 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package de.muehlencord.shared.util;
|
package de.muehlencord.shared.util;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import org.bouncycastle.util.encoders.Base64;
|
import org.bouncycastle.util.encoders.Base64;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class PasswordUtilTest {
|
class PasswordUtilTest {
|
||||||
|
|
||||||
private static SecureRandom secureRandom;
|
private static SecureRandom secureRandom;
|
||||||
private static String systemSalt64Coded;
|
private static String systemSalt64Coded;
|
||||||
@ -37,21 +38,21 @@ public class PasswordUtilTest {
|
|||||||
secureRandom = new SecureRandom();
|
secureRandom = new SecureRandom();
|
||||||
|
|
||||||
systemSaltBytes = new byte[32];
|
systemSaltBytes = new byte[32];
|
||||||
secureRandom.nextBytes (systemSaltBytes);
|
secureRandom.nextBytes(systemSaltBytes);
|
||||||
systemSalt64Coded = new String(Base64.encode (systemSaltBytes));
|
systemSalt64Coded = new String(Base64.encode(systemSaltBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHash() {
|
void testGetHash() {
|
||||||
PasswordUtil pwUtil = new PasswordUtil(systemSalt64Coded);
|
PasswordUtil pwUtil = new PasswordUtil(systemSalt64Coded);
|
||||||
|
|
||||||
String password1 = pwUtil.getHash("password");
|
String password1 = pwUtil.getHash("password");
|
||||||
String password2 = pwUtil.getHash("password");
|
String password2 = pwUtil.getHash("password");
|
||||||
|
|
||||||
assertFalse (password1.equals(password2));
|
assertNotEquals(password1, password2);
|
||||||
assertTrue (pwUtil.matches ("password", password1));
|
assertTrue(pwUtil.matches("password", password1));
|
||||||
assertFalse (pwUtil.matches ("wrongpassword", password1));
|
assertFalse(pwUtil.matches("wrongpassword", password1));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user