1 4 package com.openedit.util; 5 6 import java.io.ByteArrayOutputStream ; 7 import java.io.File ; 8 import java.io.OutputStream ; 9 10 import com.openedit.BaseTestCase; 11 import com.openedit.page.Page; 12 import com.openedit.page.manage.PageManager; 13 14 17 public class ZipUtilitiesTest extends BaseTestCase 18 { 19 20 public ZipUtilitiesTest( String arg0 ) 21 { 22 super( arg0 ); 23 } 25 26 public static void main(String [] args) 27 { 28 junit.textui.TestRunner.run(ZipUtilitiesTest.class); 29 } 30 31 protected PageManager getPageManager() throws Exception 32 { 33 return getFixture().getPageManager(); 34 } 35 36 public void testPageZipUtil() throws Exception 37 { 38 39 Page page = getPageManager().getPage("/zip_test/test_sub/"); 40 assertEquals("true", page.get("excludefromzips")); 41 42 43 PageZipUtil pageZipUtil = new PageZipUtil(getPageManager()); 44 ByteArrayOutputStream os = new ByteArrayOutputStream (); 45 pageZipUtil.setRoot(getRoot()); 46 pageZipUtil.zipFile("/zip_test", os); 47 int len = os.toByteArray().length; 48 assertTrue(len > 0); 49 assertTrue(len < 1000); 50 } 51 52 } 53 | Popular Tags |