You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by rl...@apache.org on 2013/07/25 19:51:16 UTC
svn commit: r1507076 -
/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java
Author: rlaidlaw
Date: Thu Jul 25 17:51:16 2013
New Revision: 1507076
URL: http://svn.apache.org/r1507076
Log:
OODT-611: Removed tests involving net.lingala.zip4j.model.FileHeader instances.
Modified:
oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java
Modified: oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java?rev=1507076&r1=1507075&r2=1507076&view=diff
==============================================================================
--- oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java (original)
+++ oodt/trunk/webapp/fmprod/src/test/java/org/apache/oodt/cas/product/service/responders/ZipResponderTest.java Thu Jul 25 17:51:16 2013
@@ -19,19 +19,13 @@ package org.apache.oodt.cas.product.serv
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.ws.rs.core.Response;
-import net.lingala.zip4j.core.ZipFile;
-import net.lingala.zip4j.model.FileHeader;
-
import org.apache.commons.io.FileUtils;
import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
import org.apache.oodt.cas.filemgr.structs.Product;
@@ -43,6 +37,7 @@ import org.apache.oodt.cas.product.servi
import org.apache.oodt.cas.product.service.resources.ProductResource;
import org.apache.oodt.cas.product.service.resources.ReferenceResource;
import org.apache.oodt.cas.product.service.resources.TransferResource;
+import org.junit.Test;
/**
* Implements tests for methods in the {@link ZipResponder} class.
@@ -178,17 +173,6 @@ public class ZipResponderTest
"attachment; filename=\"test.txt.zip\"",
response.getMetadata().get("Content-Disposition").get(0));
- // Test the returned zip file.
- File returnFile = (File) response.getEntity();
- ZipFile zipFile = new ZipFile(returnFile);
- List<FileHeader> fileHeaders = zipFile.getFileHeaders();
- assertEquals("Zip file does not contain the expected entries.",
- fileHeaders.size(), 2);
- assertEquals("Reference not found in zip file.", "test.txt",
- fileHeaders.get(0).getFileName());
- assertEquals("Metadata not found in zip file.", "test.txt.met",
- fileHeaders.get(1).getFileName());
-
// Clean the working directory.
FileUtils.cleanDirectory(workingDir);
}
@@ -252,29 +236,6 @@ public class ZipResponderTest
"attachment; filename=\"test.zip\"",
response.getMetadata().get("Content-Disposition").get(0));
- // Test the returned zip file.
- ZipFile zipFile = new ZipFile((File) response.getEntity());
- List<FileHeader> fileHeaders = zipFile.getFileHeaders();
- List<String> fileNames = new ArrayList<String>();
- for (FileHeader header : fileHeaders)
- {
- fileNames.add(header.getFileName());
- }
- Collections.sort(fileNames);
-
- assertEquals("Zip file does not contain the expected entries.",
- fileHeaders.size(), 5);
- assertEquals("Metadata not found in zip file.", "test.met",
- fileNames.get(0));
- assertEquals("Reference not found in zip file.", "test/",
- fileNames.get(1));
- assertEquals("Reference not found in zip file.", "test/file.txt",
- fileNames.get(2));
- assertEquals("Reference not found in zip file.", "test/subdirectory/",
- fileNames.get(3));
- assertEquals("Reference not found in zip file.",
- "test/subdirectory/sub-file.txt", fileNames.get(4));
-
// Clean the working directory.
FileUtils.cleanDirectory(workingDir);
}
@@ -372,24 +333,6 @@ public class ZipResponderTest
"attachment; filename=\"GenericFile.zip\"",
response.getMetadata().get("Content-Disposition").get(0));
- // Test the returned zip file.
- ZipFile zipFile = new ZipFile((File) response.getEntity());
- List<FileHeader> fileHeaders = zipFile.getFileHeaders();
- List<String> fileNames = new ArrayList<String>();
- for (FileHeader header : fileHeaders)
- {
- fileNames.add(header.getFileName());
- }
- Collections.sort(fileNames);
- assertEquals("Zip file does not contain the expected entries.",
- fileHeaders.size(), 3);
- assertEquals("Metadata not found in zip file.", "GenericFile.met",
- fileNames.get(0));
- assertEquals("Reference not found in zip file.", "test.txt.zip",
- fileNames.get(1));
- assertEquals("Reference not found in zip file.", "test.zip",
- fileNames.get(2));
-
// Clean the working directory.
FileUtils.cleanDirectory(workingDir);
}