KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > archive > ConvertDocumentGeneratorTest


1 package com.openedit.archive;
2
3 import java.io.ByteArrayOutputStream JavaDoc;
4 import java.io.File JavaDoc;
5
6 import com.openedit.OpenEditException;
7 import com.openedit.WebPageRequest;
8 import com.openedit.util.FileUtils;
9
10 public class ConvertDocumentGeneratorTest extends ArchiveTest
11 {
12     boolean wrote = false;
13     public ConvertDocumentGeneratorTest( String JavaDoc inName )
14     {
15         super( inName );
16     }
17     
18     /**
19      * This is failing on Unix for some reason
20      * @throws OpenEditException
21      */

22     public void testConvertToEPS() throws OpenEditException
23     {
24         String JavaDoc path = "/testcatalog/downloads/converted/copysheetai123456789/copysheet.eps";
25         WebPageRequest request = getFixture().createPageRequest( path );
26         wrote = false;
27         //make sure it does nothing since a bytearray will fill up with a 5 meg file
28
ByteArrayOutputStream JavaDoc out = new ByteArrayOutputStream JavaDoc()
29         {
30             public synchronized void write(byte[] b, int off, int len) {wrote = true;};
31             public void write(byte[] b) throws java.io.IOException JavaDoc {wrote = true;};
32             public synchronized void write(int b) {wrote = true;};
33         };
34         request.putPageValue("out",out);
35         getFixture().getModuleManager().executePathActions( request.getPage(), request );
36         //request.getPage().generate( request );
37

38         //Not working in AntHILL assertTrue( "Did not write anything", wrote);
39
/*assertEquals( "First byte", '%', bytes[0] );
40         assertEquals( "Second byte", '!', bytes[1] );
41         assertEquals( "Third byte", 'P', bytes[2] );
42         assertEquals( "Fourth byte", 'S', bytes[3] );
43         */

44     }
45     
46     protected void setUp() throws Exception JavaDoc
47     {
48         File JavaDoc etc = new File JavaDoc( getStore().getRootDirectory().getParentFile(),"etc");
49         //copy back the export file
50
FileUtils util = new FileUtils();
51         File JavaDoc export = new File JavaDoc(etc,"/export.cre");
52         File JavaDoc out = new File JavaDoc(getStore().getRootDirectory(),"/upload/export.cre");
53         util.copyFiles(export,out);
54         File JavaDoc input = new File JavaDoc( etc, "archivefiles");
55         File JavaDoc output = new File JavaDoc( "/tmp/archivefiles");
56         util.dirCopy(input,output);
57     }
58
59     
60 }
61
Popular Tags