Skip to content
This repository was archived by the owner on Feb 23, 2022. It is now read-only.

Commit 8aa3826

Browse files
committed
removed test dependency on commons-io (all the necessary functionality is present in the compile dependency on guava)
1 parent 35d9339 commit 8aa3826

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,5 @@
109109
<type>jar</type>
110110
<scope>test</scope>
111111
</dependency>
112-
<dependency>
113-
<groupId>commons-io</groupId>
114-
<artifactId>commons-io</artifactId>
115-
<version>1.4</version>
116-
<type>jar</type>
117-
<scope>test</scope>
118-
</dependency>
119112
</dependencies>
120113
</project>

src/test/java/org/syphr/mythtv/proto/QueryFileTransferTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,21 @@
1515
*/
1616
package org.syphr.mythtv.proto;
1717

18-
import java.io.BufferedInputStream;
1918
import java.io.BufferedOutputStream;
2019
import java.io.File;
2120
import java.io.FileOutputStream;
2221
import java.io.IOException;
23-
import java.io.InputStream;
2422
import java.io.OutputStream;
2523
import java.net.InetAddress;
2624
import java.net.URI;
2725
import java.net.URISyntaxException;
2826
import java.net.URL;
2927
import java.util.List;
28+
import java.util.zip.CRC32;
29+
import java.util.zip.Checksum;
3030

3131
import junit.framework.Assert;
3232

33-
import org.apache.commons.io.FileUtils;
34-
import org.apache.commons.io.IOUtils;
3533
import org.junit.AfterClass;
3634
import org.junit.BeforeClass;
3735
import org.junit.Test;
@@ -46,6 +44,9 @@
4644
import org.syphr.mythtv.test.Utils;
4745
import org.syphr.prom.PropertiesManager;
4846

47+
import com.google.common.io.Files;
48+
import com.google.common.io.Resources;
49+
4950
public class QueryFileTransferTest
5051
{
5152
private static final File LOCAL_TEMP = new File("target/testing");
@@ -74,10 +75,8 @@ public static void setUpBeforeClass() throws IOException, CommandException
7475
* Download a file directly for comparison later.
7576
*/
7677
OutputStream directDownloadOut = new BufferedOutputStream(new FileOutputStream(EXPECTED_FILE));
77-
InputStream directDownloadIn = new BufferedInputStream(new URL(TEST_URL).openStream());
78-
IOUtils.copy(directDownloadIn, directDownloadOut);
78+
Resources.copy(new URL(TEST_URL), directDownloadOut);
7979
directDownloadOut.close();
80-
directDownloadIn.close();
8180

8281
settings = Settings.createSettings();
8382

@@ -93,7 +92,7 @@ public static void tearDownAfterClass() throws IOException
9392
commandProto.done();
9493
commandSocketManager.disconnect();
9594

96-
FileUtils.deleteDirectory(LOCAL_TEMP);
95+
Files.deleteRecursively(LOCAL_TEMP);
9796
}
9897

9998
@Test
@@ -130,8 +129,9 @@ public void testDownloadReadDeleteFile() throws IOException, URISyntaxException,
130129
fileProto.done();
131130
fileSocketManager.disconnect();
132131

133-
Assert.assertEquals(FileUtils.checksumCRC32(EXPECTED_FILE),
134-
FileUtils.checksumCRC32(actualFile));
132+
Checksum crc32 = new CRC32();
133+
Assert.assertEquals(Files.getChecksum(EXPECTED_FILE, crc32),
134+
Files.getChecksum(actualFile, crc32));
135135

136136
Assert.assertNotNull(commandProto.queryFileExists(dest, TEST_STORAGE_GROUP));
137137
Assert.assertTrue(commandProto.deleteFile(dest, TEST_STORAGE_GROUP));

0 commit comments

Comments
 (0)