1 package com.openedit.archive; 2 3 import java.io.ByteArrayOutputStream ; 4 import java.io.File ; 5 6 import com.openedit.OpenEditException; 7 import com.openedit.WebPageRequest; 8 import com.openedit.generators.Output; 9 import com.openedit.util.FileUtils; 10 11 public class OriginalDocumentGeneratorTest extends ArchiveTest 12 { 13 public OriginalDocumentGeneratorTest( String inName ) 14 { 15 super( inName ); 16 } 17 18 public void testGenerate() throws OpenEditException 19 { 20 String path = "/testcatalog/downloads/originals/acfanvent01dottif1078102626/ACFanVent01.tif"; 21 WebPageRequest request = getFixture().createPageRequest( path ); 22 getFixture().getModuleManager().executePathActions( request.getPage(), request ); 23 24 Output out = new Output(); 25 ByteArrayOutputStream baos = (ByteArrayOutputStream ) request.getOutputStream(); 26 out.setStream( baos ); 27 28 request.getPage().generate( request , out ); 29 byte[] bytes = baos.toByteArray(); 30 assertTrue( "empty file", bytes.length > 1000 ); 31 36 } 37 79 protected void setUp() throws Exception 80 { 81 File etc = new File ( getStore().getRootDirectory().getParentFile(),"etc"); 82 File input = new File ( etc, "archivefiles"); 84 File output = new File ( "/tmp/archivefiles"); 85 FileUtils util = new FileUtils(); 86 util.dirCopy(input,output); 87 } 88 89 90 } 91 | Popular Tags |