Skip to content

Commit 2b5e66c

Browse files
committed
Remove Commons IO from Tests
1 parent 8befce6 commit 2b5e66c

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

dependencies/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies {
3030
api "commons-cli:commons-cli:1.5.0"
3131
api "commons-collections:commons-collections:3.2.2"
3232
api "commons-httpclient:commons-httpclient:3.1"
33-
api "commons-io:commons-io:2.11.0"
3433
api "commons-lang:commons-lang:2.6"
3534
api "commons-logging:commons-logging:1.2"
3635
api "commons-pool:commons-pool:1.6"

ldif/ldif-core/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies {
99
testImplementation platform('org.junit:junit-bom')
1010
testImplementation "org.junit.vintage:junit-vintage-engine"
1111
testImplementation "junit:junit"
12-
testImplementation "commons-io:commons-io"
1312
testImplementation "org.assertj:assertj-core"
1413
testImplementation ("log4j:log4j:1.2.17") {
1514
exclude group: 'javax.jms'

ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/Ldap233LdifParserTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import java.io.File;
2020
import java.io.IOException;
21+
import java.nio.file.Files;
2122

22-
import org.apache.commons.io.FileUtils;
2323
import org.junit.Test;
2424

2525
import org.springframework.ldap.ldif.parser.LdifParser;
@@ -39,7 +39,7 @@ public class Ldap233LdifParserTests {
3939
@Test
4040
public void ldap233Test() throws IOException {
4141
File testFile = File.createTempFile("ldapTest", ".ldif");
42-
FileUtils.write(testFile, "This is just some random text");
42+
Files.write(testFile.toPath(), "This is just some random text".getBytes());
4343

4444
LdifParser parser = new LdifParser(testFile);
4545
parser.setRecordSpecification(new BasicSchemaSpecification());

odm/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ dependencies {
2525

2626
testImplementation project(":spring-ldap-test"),
2727
"junit:junit",
28-
"jdepend:jdepend",
29-
"commons-io:commons-io"
28+
"jdepend:jdepend"
3029
testImplementation "org.apache.directory.server:apacheds-core-entry"
3130
testImplementation "org.apache.directory.server:apacheds-core"
3231
testImplementation "org.apache.directory.server:apacheds-protocol-ldap"

odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@
1717
package org.springframework.ldap.odm.test;
1818

1919
import java.io.File;
20+
import java.io.FileOutputStream;
21+
import java.io.OutputStream;
2022
import java.lang.reflect.Method;
2123
import java.net.URL;
2224
import java.net.URLClassLoader;
25+
import java.nio.file.Files;
26+
import java.nio.file.Path;
2327
import java.util.Iterator;
2428
import java.util.regex.Matcher;
2529
import java.util.regex.Pattern;
2630

2731
import javax.naming.ldap.LdapName;
2832

29-
import org.apache.commons.io.FileUtils;
3033
import org.junit.After;
3134
import org.junit.AfterClass;
3235
import org.junit.Before;
@@ -154,7 +157,10 @@ public void generate() throws Exception {
154157
final String packageName = "org.springframework.ldap.odm.testclasses";
155158

156159
File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt");
157-
FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile);
160+
Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath();
161+
try (OutputStream to = new FileOutputStream(tempFile)) {
162+
Files.copy(from, to);
163+
}
158164

159165
// Add classes dir to class path - needed for compilation
160166
System.setProperty("java.class.path",

test-support/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies {
1212
api "org.springframework:spring-test"
1313

1414
implementation "com.google.code.typica:typica"
15-
implementation "commons-io:commons-io"
1615

1716
optional "org.apache.directory.server:apacheds-core-entry"
1817
optional "org.apache.directory.server:apacheds-core"

test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
package org.springframework.ldap.itest.ad;
1818

1919
import java.io.File;
20+
import java.io.FileOutputStream;
21+
import java.io.OutputStream;
2022
import java.lang.reflect.Method;
2123
import java.net.URL;
2224
import java.net.URLClassLoader;
25+
import java.nio.file.Files;
26+
import java.nio.file.Path;
2327
import java.util.HashMap;
2428
import java.util.regex.Matcher;
2529
import java.util.regex.Pattern;
2630

27-
import org.apache.commons.io.FileUtils;
2831
import org.junit.After;
2932
import org.junit.Before;
3033
import org.junit.Test;
@@ -156,7 +159,10 @@ public void verifySchemaToJavaOnAd() throws Exception {
156159
final String packageName = "org.springframework.ldap.odm.testclasses";
157160

158161
File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt");
159-
FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile);
162+
Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath();
163+
try (OutputStream to = new FileOutputStream(tempFile)) {
164+
Files.copy(from, to);
165+
}
160166

161167
// Add classes dir to class path - needed for compilation
162168
System.setProperty("java.class.path",

0 commit comments

Comments
 (0)