This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 2fc2a8ba61567096b9011e6791c745fcca53d630 Author: Tran Tien Duc <[email protected]> AuthorDate: Thu Jun 6 12:13:43 2019 +0700 JAMES-2146 Reuse FileSystemFixture in jmap tests --- server/protocols/jmap/pom.xml | 6 +++ .../james/jmap/crypto/ClassLoaderFileSystem.java | 45 ---------------------- .../jmap/crypto/JamesSignatureHandlerFixture.java | 3 +- .../james/jmap/crypto/SecurityKeyLoaderTest.java | 7 ++-- 4 files changed, 12 insertions(+), 49 deletions(-) diff --git a/server/protocols/jmap/pom.xml b/server/protocols/jmap/pom.xml index fb6df6a..eb622e6 100644 --- a/server/protocols/jmap/pom.xml +++ b/server/protocols/jmap/pom.xml @@ -115,6 +115,12 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>james-server-filesystem-api</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>james-server-jetty</artifactId> </dependency> <dependency> diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/ClassLoaderFileSystem.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/ClassLoaderFileSystem.java deleted file mode 100644 index 43687e4..0000000 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/ClassLoaderFileSystem.java +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you 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. * - ****************************************************************/ - -package org.apache.james.jmap.crypto; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.james.filesystem.api.FileSystem; - -class ClassLoaderFileSystem implements FileSystem { - - @Override - public InputStream getResource(String url) throws IOException { - return ClassLoader.getSystemResourceAsStream(url); - } - - @Override - public File getFile(String fileURL) throws FileNotFoundException { - return null; - } - - @Override - public File getBasedir() throws FileNotFoundException { - return null; - } -} diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/JamesSignatureHandlerFixture.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/JamesSignatureHandlerFixture.java index 392f50f..8becead 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/JamesSignatureHandlerFixture.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/JamesSignatureHandlerFixture.java @@ -21,6 +21,7 @@ package org.apache.james.jmap.crypto; import java.util.Optional; +import org.apache.james.filesystem.api.FileSystemFixture; import org.apache.james.jmap.JMAPConfiguration; class JamesSignatureHandlerFixture { @@ -45,7 +46,7 @@ class JamesSignatureHandlerFixture { .build(); SecurityKeyLoader loader = new SecurityKeyLoader( - new ClassLoaderFileSystem(), + FileSystemFixture.CLASSPATH_FILE_SYSTEM, jmapConfiguration); return new JamesSignatureHandler(loader); diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java index 152f672..c47f33f 100644 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/crypto/SecurityKeyLoaderTest.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.security.KeyStoreException; import java.util.Optional; +import org.apache.james.filesystem.api.FileSystemFixture; import org.apache.james.jmap.JMAPConfiguration; import org.junit.jupiter.api.Test; @@ -42,7 +43,7 @@ class SecurityKeyLoaderTest { .build(); SecurityKeyLoader loader = new SecurityKeyLoader( - new ClassLoaderFileSystem(), + FileSystemFixture.CLASSPATH_FILE_SYSTEM, jmapConfiguration); assertThatThrownBy(loader::load) @@ -60,7 +61,7 @@ class SecurityKeyLoaderTest { .build(); SecurityKeyLoader loader = new SecurityKeyLoader( - new ClassLoaderFileSystem(), + FileSystemFixture.CLASSPATH_FILE_SYSTEM, jmapConfiguration); assertThatThrownBy(loader::load) @@ -78,7 +79,7 @@ class SecurityKeyLoaderTest { .build(); SecurityKeyLoader loader = new SecurityKeyLoader( - new ClassLoaderFileSystem(), + FileSystemFixture.CLASSPATH_FILE_SYSTEM, jmapConfiguration); assertThat(loader.load()) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
