@Test
public void testZipGeoTiffPPIO() throws Exception {
// Estimator process for checking limits
DownloadEstimatorProcess limits = new DownloadEstimatorProcess(
new StaticDownloadServiceConfiguration(), getGeoServer());
ZipArchivePPIO ppio = new ZipArchivePPIO(
DownloadServiceConfiguration.DEFAULT_COMPRESSION_LEVEL);
final WPSResourceManager resourceManager = new WPSResourceManager();
// Creates the new process for the download
DownloadProcess downloadProcess = new DownloadProcess(getGeoServer(), limits,
resourceManager);
// ROI as a BBOX
Envelope env = new Envelope(-125.074006936869, -123.88300771369998, 48.5552612829, 49.03872);
Polygon roi = JTS.toGeometry(env);
// Download the data with ROI
File rasterZip = downloadProcess.execute(getLayerId(MockData.USA_WORLDIMG), // layerName
null, // filter
"image/tiff", // outputFormat
null, // targetCRS
CRS.decode("EPSG:4326"), // roiCRS
roi, // roi
true, // cropToGeometry
new NullProgressListener() // progressListener
);
// Final checks on the result
Assert.assertNotNull(rasterZip);
// make sure we create files locally so that we don't clog the sytem temp
final File currentDirectory = new File(DownloadProcessTest.class.getResource(".").toURI());
File tempZipFile = File.createTempFile("zipppiotemp", ".zip", currentDirectory);
ppio.encode(rasterZip, new FileOutputStream(tempZipFile));
Assert.assertTrue(tempZipFile.length() > 0);
final File tempDir = new File(currentDirectory, Long.toString(System.nanoTime()));
Assert.assertTrue(tempDir.mkdir());