1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package graphical;
25 
26 
27 /**
28  *
29  * @author ll93751
30  */
31 public class PostscriptCreator extends EnhancedComplexTestCase
32 {
33 
34     // @Override
getTestMethodNames()35     public String[] getTestMethodNames()
36     {
37         return new String[]{"DocumentToPostscript"};
38     }
39 
40     /**
41      * test function.
42      */
DocumentToPostscript()43     public void DocumentToPostscript()
44     {
45         GlobalLogWriter.set(log);
46         ParameterHelper aParam = new ParameterHelper(param);
47 
48         param.put(util.PropertyName.OFFICE_CLOSE_TIME_OUT, 2000);
49         // run through all documents found in Inputpath
50         foreachDocumentinInputPath(aParam);
51     }
52 
53 
checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams)54     public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException
55     {
56         GlobalLogWriter.println("  Document: " + _sDocumentName);
57         GlobalLogWriter.println("   results: " + _sResult);
58         IOffice aOffice = new Office(_aParams, _sResult);
59 
60         PerformanceContainer a = new PerformanceContainer();
61         a.startTime(PerformanceContainer.AllTime);
62 
63         // _aParams.getTestParameters().put(util.PropertyName.DEBUG_IS_ACTIVE, Boolean.TRUE);
64         a.startTime(PerformanceContainer.OfficeStart);
65         aOffice.start();
66         a.stopTime(PerformanceContainer.OfficeStart);
67 
68         // _aParams.getTestParameters().put(util.PropertyName.DEBUG_IS_ACTIVE, Boolean.FALSE);
69 
70         // This force an error! _sDocumentName = helper.StringHelper.doubleQuote(_sDocumentName);
71         try
72         {
73             a.startTime(PerformanceContainer.Load);
74             aOffice.load(_sDocumentName);
75             a.stopTime(PerformanceContainer.Load);
76 
77             a.startTime(PerformanceContainer.Print);
78             aOffice.storeAsPostscript();
79             a.stopTime(PerformanceContainer.Print);
80         }
81         finally
82         {
83             a.startTime(PerformanceContainer.OfficeStop);
84             aOffice.close();
85             a.stopTime(PerformanceContainer.OfficeStop);
86 
87             a.stopTime(PerformanceContainer.AllTime);
88 
89             a.print( System.out );
90         }
91     }
92 
93 
94 
95 
96 //    public static void main(String [] _args)
97 //    {
98 //        String args[] = {
99 //            "-TimeOut", "3600000",
100 //            "-tb", "java_complex",
101 //            "-o", "graphical.PostscriptCreator",
102 ////            "-DOC_COMPARATOR_INPUT_PATH", "D:\\temp\\input",
103 ////            "-DOC_COMPARATOR_OUTPUT_PATH", "D:\\temp\\output",
104 ////            "-DOC_COMPARATOR_REFERENCE_PATH", "D:\\temp\\output\\ref",
105 ////            "-DOC_COMPARATOR_PRINT_MAX_PAGE", "9999",
106 ////            "-DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION", "180",
107 ////            "-DOC_COMPARATOR_HTML_OUTPUT_PREFIX", "http://so-gfxcmp-lin.germany.sun.com/gfxcmp_ui/cw.php?inifile=",
108 //////            "-DOC_COMPARATOR_REFERENCE_CREATOR_TYPE", "PDF",      /* default: "OOo" */
109 //////            "-DOC_COMPARATOR_REFERENCE_CREATOR_TYPE", "msoffice", /* default: "OOo" */
110 //////            "-OFFICE_VIEWABLE", "false",
111 ////            "-AppExecutionCommand", "\"C:/home/ll93751/staroffice9_DEV300_m25/Sun/StarOffice 9/program/soffice.exe\"  -norestore -nocrashreport -accept=pipe,name=ll93751;urp;",
112 //////            "-NoOffice"
113 //            "-DOC_COMPARATOR_PRINT_MAX_PAGE","9999",
114 //            "-DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION","180",
115 //            "-DOC_COMPARATOR_HTML_OUTPUT_PREFIX","http://so-gfxcmp.germany.sun.com/gfxcmp_ui/cw.php?inifile=",
116 //            "-DOC_COMPARATOR_REFERENCE_CREATOR_TYPE","OOo",
117 //            "-DOC_COMPARATOR_DB_INFO_STRING","p:DEV300_m18,c:,d:LLA_test,src:DEV300_m18,dest:,doc:LLA_test,id:34715,distinct:2008-06-27_13-39-09_d6f22d4c-958d-10",
118 //            "-DISTINCT","2008-06-27_13-39-09_d6f22d4c-958d-10",
119 //            "-TEMPPATH","//so-gfxcmp-lin/gfxcmp-data/wntmsci/temp/2008-06-27_13-39-09_d6f22d4c-958d-10/34715",
120 ////            "ConnectionString","socket,host=localhost,port=8101",
121 //            "-OFFICE_VIEWABLE","true",
122 //            "-wntmsci.DOC_COMPARATOR_INPUT_PATH","\\\\so-gfxcmp-lin\\doc-pool\\LLA_test\\issue_79214.odb",
123 //            "-wntmsci.DOC_COMPARATOR_OUTPUT_PATH","\\\\so-gfxcmp-lin\\gfxcmp-data\\wntmsci\\convwatch-output\\LLA_test\\DEV300_m11",
124 //            "-wntmsci.AppExecutionCommand","\"C:\\gfxcmp\\programs\\staroffice8_DEV300_m11\\Sun\\StarOffice 9\\program\\soffice.exe\"  -norestore -nocrashreport -accept=pipe,name=ll93751;urp;",
125 //            "-wntmsci.AppKillCommand","\"C:\\bin\\pskill.exe soffice.bin;C:\\bin\\pskill.exe winword;C:\\bin\\pskill.exe excel\"",
126 //
127 //        };
128 //
129 //        org.openoffice.Runner.main(args);
130 //    }
131 
132 }
133