I agree. I have taken some of the prototyping and implemented an ZipExporter as
described. The example below demonstrates the usage.
| @Test
| public void testExportZip() throws Exception
| {
| // Get an archive instance
| MemoryMapArchive archive = new
MemoryMapArchiveImpl("testArchive.jar");
|
| // Add some content
| Asset assetOne = new
ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test.properties");
| Path pathOne = new BasicPath("test.properties");
| archive.add(pathOne, assetOne);
| Asset assetTwo = new
ClassLoaderAsset("org/jboss/declarchive/impl/base/asset/Test2.properties");
| Path pathTwo = new BasicPath("nested", "test2.properties");
| archive.add(pathTwo, assetTwo);
|
| // Export as Zip InputStream
| InputStream zipStream = ZipExporter.exportZip(archive);
|
| // Validate the InputStream was created
| Assert.assertNotNull(zipStream);
|
| // Create a temp file
| File outFile = File.createTempFile("test", ".zip");
| // Write Zip contents to file
| writeOutFile(outFile, zipStream);
|
| // Use standard ZipFile library to read in written Zip file
| ZipFile expectedZip = new ZipFile(outFile);
|
| // Validate first entry
| assertAssetInZip(expectedZip, pathOne, assetOne);
| assertAssetInZip(expectedZip, pathTwo, assetTwo);
|
| }
|
I will continue to work on the ExplodedExporter as well.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251931#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...