Remove Commons IO from Tests

This commit is contained in:
Josh Cummings
2023-05-10 17:21:51 -06:00
parent 8befce6dd1
commit 2b5e66c4fd
7 changed files with 19 additions and 11 deletions

View File

@@ -30,7 +30,6 @@ dependencies {
api "commons-cli:commons-cli:1.5.0"
api "commons-collections:commons-collections:3.2.2"
api "commons-httpclient:commons-httpclient:3.1"
api "commons-io:commons-io:2.11.0"
api "commons-lang:commons-lang:2.6"
api "commons-logging:commons-logging:1.2"
api "commons-pool:commons-pool:1.6"

View File

@@ -9,7 +9,6 @@ dependencies {
testImplementation platform('org.junit:junit-bom')
testImplementation "org.junit.vintage:junit-vintage-engine"
testImplementation "junit:junit"
testImplementation "commons-io:commons-io"
testImplementation "org.assertj:assertj-core"
testImplementation ("log4j:log4j:1.2.17") {
exclude group: 'javax.jms'

View File

@@ -18,8 +18,8 @@ package org.springframework.ldap.ldif;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.springframework.ldap.ldif.parser.LdifParser;
@@ -39,7 +39,7 @@ public class Ldap233LdifParserTests {
@Test
public void ldap233Test() throws IOException {
File testFile = File.createTempFile("ldapTest", ".ldif");
FileUtils.write(testFile, "This is just some random text");
Files.write(testFile.toPath(), "This is just some random text".getBytes());
LdifParser parser = new LdifParser(testFile);
parser.setRecordSpecification(new BasicSchemaSpecification());

View File

@@ -25,8 +25,7 @@ dependencies {
testImplementation project(":spring-ldap-test"),
"junit:junit",
"jdepend:jdepend",
"commons-io:commons-io"
"jdepend:jdepend"
testImplementation "org.apache.directory.server:apacheds-core-entry"
testImplementation "org.apache.directory.server:apacheds-core"
testImplementation "org.apache.directory.server:apacheds-protocol-ldap"

View File

@@ -17,16 +17,19 @@
package org.springframework.ldap.odm.test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.naming.ldap.LdapName;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -154,7 +157,10 @@ public final class SchemaToJavaTests {
final String packageName = "org.springframework.ldap.odm.testclasses";
File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt");
FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile);
Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath();
try (OutputStream to = new FileOutputStream(tempFile)) {
Files.copy(from, to);
}
// Add classes dir to class path - needed for compilation
System.setProperty("java.class.path",

View File

@@ -12,7 +12,6 @@ dependencies {
api "org.springframework:spring-test"
implementation "com.google.code.typica:typica"
implementation "commons-io:commons-io"
optional "org.apache.directory.server:apacheds-core-entry"
optional "org.apache.directory.server:apacheds-core"

View File

@@ -17,14 +17,17 @@
package org.springframework.ldap.itest.ad;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -156,7 +159,10 @@ public final class SchemaToJavaAdITests {
final String packageName = "org.springframework.ldap.odm.testclasses";
File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt");
FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile);
Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath();
try (OutputStream to = new FileOutputStream(tempFile)) {
Files.copy(from, to);
}
// Add classes dir to class path - needed for compilation
System.setProperty("java.class.path",