diff options
Diffstat (limited to 'filter/qa/complex/filter/detection')
8 files changed, 1289 insertions, 0 deletions
diff --git a/filter/qa/complex/filter/detection/typeDetection/Helper.java b/filter/qa/complex/filter/detection/typeDetection/Helper.java new file mode 100644 index 000000000000..713d0befe98c --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/Helper.java @@ -0,0 +1,446 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: Helper.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.filter.detection.typeDetection; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.io.NotConnectedException; +import com.sun.star.io.XInputStream; + +import helper.StreamSimulator; +import java.io.*; +import java.net.URL; +import java.net.URLConnection; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.StringTokenizer; +import java.util.Vector; +import lib.TestParameters; +import share.LogWriter; +import util.utils; + + + +/** Helper class for "TypeDetection" + * This class do file hanlding. + */ +public class Helper { + + /** The runner log writer + * @member m_log for log purposes + * @member m_sTestDocPath directory for seraching files to load + * @member m_vFiles list of all files describet in "files.csv" + * @member m_hFileURLs contains the postition of a file name in the m_vFiles Vector + * @member m_hFileTypes contains the postition of a file type in the m_vFiles Vector + * @member m_param the test parameters + */ + + LogWriter m_log = null; + + String m_sTestDocPath = null; + + Vector m_vFiles = null; + + Hashtable m_hFileURLs = new Hashtable(); + + Hashtable m_hFileTypes = new Hashtable(); + + TestParameters m_param = null; + + /** + * construct a new instance of this class + * It creates the "todo" list and position lists for <code>URL</code> and + * and <code>Type</code> inside the "todo" list + * + * @param param the test parameters + * + * @param log the log writer + */ + + public Helper(TestParameters param, LogWriter log) { + + m_param = param; + m_log = log; + + + // get all files from the given directory + m_sTestDocPath = (String)param.get("TestDocumentPath"); + + // get all files from "files.csv" + m_vFiles = getToDoList((String)m_param.get("csv.files")); + + createFilesList(); + } + + + /** Reads a comma separated file (CSV). Every line of the file is + * repesented by an <code>Vector</code> entry. Every data entry of a row is + * also stored in a <code>Vector</code>. So the returned value is a + * <code>Vector[][]</code> where the first dimension represents a row + * and the second dimenesion inclueds the data values. + * @param csvFileName the name of the csv file + * @return Vector filled with Vector filled with data of a row + */ + public Vector getToDoList(String csvFileName){ + + try { + + Vector vAll = new Vector(); + Vector vFields = new Vector(); + + // get content of file + Vector content = getCSVFileContent(csvFileName); + + // remove superfluous content like "#" started lines + content = removeSuperfluousContent(content); + + // replace all place holders in file + content = replacePlaceHolder(content); + + // create Enumeration + Enumeration contentEnum = content.elements(); + + // the first line contains field names of the columns + // split line by ";" + StringTokenizer fields = new StringTokenizer( + contentEnum.nextElement().toString(),";"); + int fieldCount = 0; + while (fields.hasMoreElements()){ + vFields.add(fields.nextElement()); + fieldCount++; + } + + // fill vData with data of CSV-row + while (contentEnum.hasMoreElements()){ + Vector vData = new Vector(); + + StringTokenizer data = new StringTokenizer( + contentEnum.nextElement().toString(),";", true); + + // example: data = "firstData;secondData;;forthData" + // => three tokens => missing one data because the imagine + // "thirdData" was not recieved by data.nextToken() + // Therefore here comes a special handling for empty datas + boolean nextIsData = false; + int dataCount = 0; + while (data.hasMoreTokens()) { + Object myToken = data.nextToken(); + // if the "thirdData" will be recieved, myToken=";" but + // vData must add an empty String + if (myToken.equals(";")){ + if (nextIsData ) { + vData.add(""); + dataCount++; + nextIsData = false; + } + nextIsData = true; + } else { + vData.add(myToken.toString()); + dataCount++; + nextIsData = false; + } + } + for (int i=dataCount; i < fieldCount; i++) vData.add(""); + vAll.add(vData); + } + + + return vAll; + + } catch(ClassCastException e) { + e.printStackTrace(); + } + return null; + } + + /** The csv files "files", "preselectedFilter", "preselectedType" and + * "serviceName" are delivered beside this class. This function seeks for + * the csv files and read them. + * @param csvFileName the name of the csv file + * @return a Vector containing the content of the file. <null/> if the file + * cannot be read + */ + + public Vector getCSVFileContent(String csvFileName) { + try { + Vector content = new Vector(); + BufferedReader br; + String line; + if ( m_param.DebugIsActive ) { + System.out.println("Looking for "+csvFileName); + } + + URL url = getClassURL(csvFileName); + + if (url != null) { + URLConnection connection = url.openConnection(); + InputStream in = connection.getInputStream(); + + br = new BufferedReader(new InputStreamReader(in)); + try { + while( ( line = br.readLine() ) != null ) { + content.addElement( line ); + } + } catch (IOException e) { + br.close(); + return null; + } + br.close(); + return content; + } + + }catch (IOException e) { + }catch(java.lang.NullPointerException e) { + return null; + } + return null; + } + + /** returns a XInputStream of given file + * @param filePath the path to the file which shoud be loaded + * @return the XInputStream, <null/> if the + * file cannot be read + * @throws NotConnectedException was thrown if it was not possible to open <CODE>filePath</CODE> + */ + public XInputStream getFileStream( String filePath ) + throws NotConnectedException { + return new StreamSimulator(filePath, true, m_param); + } + + /** replaces place holder in preselectedFilter. + * Because of filter names depend on StarOffice version like + * "StarOffice 6.0 Textdokument" or ""StarSuite 7 Textdokument" + * The filter names must be changed. The place holder will be replaced + * by an equivalent in "typeDetection.props" + * @param content the content of a csv file + * @return changed file content + */ + private Vector replacePlaceHolder(Vector content){ + + Vector vReturn = new Vector(); + + Vector placeHolders = new Vector(); + Enumeration m_params = m_param.keys(); + String placeHolder = (String)m_param.get("placeHolder"); + + // get all place holdes from typeDetection.csv + while (m_params.hasMoreElements()){ + String holderKey = (String) m_params.nextElement(); + if (holderKey.startsWith(placeHolder)){ + placeHolders.add(holderKey); + } + } + + // replace all occurrences of place holders in 'CSVData' + Enumeration cont = content.elements(); + + while( cont.hasMoreElements() ) { + + String line = (String) cont.nextElement(); + String newLine = line; + Enumeration holders = placeHolders.elements(); + + while( holders.hasMoreElements() ) { + + String holder = (String) holders.nextElement(); + int startPos = line.indexOf(holder); + + if (startPos > -1){ + try{ + String holderValue = (String) m_param.get(holder); + + newLine = newLine.substring(0,startPos) + holderValue + + newLine.substring(startPos + holder.length()); + + } catch (java.lang.IndexOutOfBoundsException e){ + m_log.println("ERROR: problems while creating placeholder" + + " replaced list: "+ e); + } + } + } + vReturn.add(newLine); + } + return vReturn; + } + + /** Removes lines of an ascii file content which starts with "#" + * or are empty + * @param content content of a csv fiöe + * @return a stripped Vector + */ + public Vector removeSuperfluousContent(Vector content){ + try{ + Vector newContent = new Vector(); + Enumeration cont = content.elements(); + while( cont.hasMoreElements() ) { + String line = (String) cont.nextElement(); + if (( ! line.startsWith( "#" ))&& ( line.length() != 0 )) { + newContent.addElement( line ); + } + } + return newContent; + } catch (ClassCastException e){ + return null; + } + } + + /** returns a <code>MediaDescripto</code> filled with given properties and + * values. + * @param propNames String Array of propertie names + * @param values Objecr Array of propertie values + * @return <code>PropertyValue[]<code> + * @see com.sun.star.benas.PropertyValue + * @see com.sun.star.document.MediaDescriptor + */ + public PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) { + PropertyValue[] props = new PropertyValue[propNames.length] ; + + for (int i = 0; i < props.length; i++) { + props[i] = new PropertyValue() ; + props[i].Name = propNames[i] ; + if (values != null && i < values.length) { + props[i].Value = values[i] ; + } + } + + return props ; + } + + /** Appends system file separator if needed + * @param s the system path + * @return system path with ending system file separator + */ + public String ensureEndingFileSep(String s){ + if(s != null && !s.equals("") && !s.endsWith(File.separator)){ + s = s.trim() + File.separator; + }else if(s == null) + s = ""; + return s; + } + + /** Returns the file URL for the given file name assembled by + * "TestDocumentPath" of typeDetection.props and "fileURL" of files.csv + * @param fileAlias the alias name of the file + * @return file URL + * @throws FileAliasNotFoundException was thrown if alias does not exist + */ + public String getURLforfileAlias(String fileAlias) + throws FileAliasNotFoundException{ + try{ + String fileURL = (String) m_hFileURLs.get(fileAlias).toString(); + return utils.getFullURL(ensureEndingFileSep(m_sTestDocPath) + fileURL); + } catch (java.lang.NullPointerException e){ + throw new FileAliasNotFoundException(fileAlias); + } + + } + + /** Returns the file type for the given file name containing in files.csv + * @param fileAlias the alias name of the file + * @return file type + * @throws FileAliasNotFoundException was thrown if not alias was thorwn + */ + public String getTypeforfileAlias(String fileAlias) + throws FileAliasNotFoundException{ + try{ + return (String) m_hFileTypes.get(fileAlias).toString(); + } catch (java.lang.NullPointerException e){ + throw new FileAliasNotFoundException(fileAlias); + } + } + + /** + * Filles the Hashtable m_hFileURLs with all file names and their URL + * and the Hashtable m_hFilesTypes with all file names and thier file + * typ name. This informations are extracted from "files.csv" + * This is for faster acccess to get fileURL and fileType of fileAlias + */ + public void createFilesList(){ + for (int i = 0; i < m_vFiles.size();i++){ + Vector toDo = (Vector) m_vFiles.get(i); + m_hFileURLs.put((String) toDo.get(0).toString(), + (String) toDo.get(1).toString()); + m_hFileTypes.put((String) toDo.get(0).toString(), + (String) toDo.get(2).toString()); + } + } + + + /** Validate the returned file type for the file alias with the + * possible file types + * @param currentFileType the returned file type + * @param fileTypes all possible file types + * @return true if valid + */ + public boolean checkFileType(String currentFileType, String fileTypes){ + + StringTokenizer data = new StringTokenizer(fileTypes,":", true); + + boolean found = false; + while (data.hasMoreElements()) { + + String actualFileType = data.nextElement().toString(); + + found = found || currentFileType.equals(actualFileType); + } + return found; + } + + /** creates an input/output parameter of <code>PropertyValue[]<code>. + * @return PropertyValue[][] + * @param PropVal a PropertyValue + */ + public PropertyValue[][] createInOutPropertyValue(PropertyValue[] PropVal){ + PropertyValue[][] dummy = new PropertyValue[1][]; + dummy[0] = PropVal; + return dummy; + } + + public URL getClassURL(String fileName){ + String PackagePath = this.getClass().getPackage().getName().replace('.','/'); + return this.getClass().getResource("/" + PackagePath +"/" + fileName); + } + + public String getClassURLString(String fileName){ + return getClassURL(fileName).toString().replaceAll("file:",""); + } + + +} + +/** This exeception should be thrown if a method seeks for an invalid alias name */ +class FileAliasNotFoundException extends java.lang.Exception{ + /** throws error message with wrong alias name + * @param fileAlias the alias name + */ + public FileAliasNotFoundException(String fileAlias){ + super("Could not get '"+fileAlias +"'"); + } +}
\ No newline at end of file diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java new file mode 100644 index 000000000000..423d6fe166d1 --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java @@ -0,0 +1,562 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TypeDetection.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.filter.detection.typeDetection; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.document.XTypeDetection; +import com.sun.star.io.NotConnectedException; +import com.sun.star.io.XInputStream; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import complexlib.ComplexTestCase; +import java.io.File; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; +import util.utils; + + + +/** Check "TypeDetection" + * <p> + * This test will check the file type detection. This will be done by filling + * properties of a <code>MediaDescriptor</code>. + * + * In the test method <code>checkByURLonly</code> the + * <code>MediaDescriptor</code> was filled at once with the URL of a test + * file. At second it was filled with a <code>XInputStream</code> from test + * file. In both subtests the returned file type must match with an expected + * type. + * + * In the test method <code>checkPreselectedType</code> the + * <code>MediaDescriptor</code> was filled with the URL of the test file and + * with the name of a type which should be used. The returned type of the + * <code>TypeDetection<code> must match with an expected type. + * + * In the test method <code>checkPreselectedFilter</code> the + * <code>MediaDescriptor</code> was filled with the URL of the test file and + * with the name of a filter which should be used. The returned type of the + * <code>TypeDetection<code> must match with an expected type. + * + * In the test method <code>checkPreselectedDocService</code> the + * <code>MediaDescriptor</code> was filled with the URL of the test file and + * with the name of a document service which should be used. The returned type + * of the <code>TypeDetection<code> must match with an expected type. + * + * + * To get information which test file should support which type, filter and + * document service, this information was collect from configuration files: + * <UL> + * <LI><a href="#TypeDetection.props">TypeDetection.props</a></LI> + * <LI><a href="#files.csv">files.csv</a></LI> + * <LI><a href="#preselectedFilter.csv">preselectedFilter.csv</a></LI> + * <LI><a href="#preselectedType.csv">preselectedType.csv</a></LI> + * <LI><a href="#serviceName.csv">serviceName.csv</a></LI> + * </UL> + * <p> + * <h3><A name="TypeDetection.props"></A> + * <code>typeDetection.props</code></h3> + * At fist there will be the <code>typeDetection.props</code>. Here the following + * properties should be set (with example values): + * + * TestDocumentPath=file:///path/to/my/testdocuments + * placeHolder=% + * %SO6productname=StarOffice + * %SO6formatversion=6.0 + * + * <code>TestDocumentPath</code>: this is the path to your test documents. If + * you have grouped your documents ie. by writer, calc, ... then it should be + * the root path. To specify the particular sub folders you have to use + * <code>csv.files</code> + * <p> + * <code>files.csv</code>: In this file all test documents are listed. + * Syntax: fileAlias;fileURL;defaultURLFileType;StreamFileTypes + * Example: + * + * Writer6_1;Writer/Writer6.sxw;writer_StarOffice_XML_Writer;writer_StarOffice_XML_Writer + * text1;Writer/Text.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text + * + * The first example shows you the following: + * <code>Writer6_1</code> is a free chosen name + * <code>Writer/Writer6.sxw</code> is the document path. This will be assembled + * by <code>TestDocumentPath</code> from <code>typeDetection.props</code>. + * <code>writer_StarOffice_XML_Writer</code>: this is the default file type of + * this file + * + * The second example displays two document types for <code>XInputStream</CODE> + * (<code>writer_Text_encoded</CODE> and <code>writer_Text</CODE>. This two + * document types are listed by a colon ':' as separator. This is needed because + * XInputStream can detect a text file as writer_Text_encoded as well as + * writer_Text. + * <p> + * + * <H3><A name="preselectedFilter.csv"</a> + * <code>preselectedFilter.csv</code></H3> + * In this file you can choose a special + * filter to detect the document. This make sense ie. for csv-files: You can + * open csv files as Writer or as Calc. To check this case you have to specify + * in <code>csv.files</code> a fileAlias like ?csv_writer? and ?csv_calc? with + * the same fileURL and it's specific defaultFileType. + * The returned file type by <code>TypeDetection</code> must equal to + * correspond <code>defaultFileType</code> from <code>csv.files</code> + * + * Syntax: fileAlias;FilterName;FilterOptions;FilterData + * Example: Writer6_1;%SO6productname %SO6formatversion Textdokument;; + * + * The example shows the following: + * <code>Writer6_1</code> is the same as in <code>csv.files</code> + * <code>%SO6productname %SO6formatversion Textdokument</code> is the filter + * name which should be used. Here we have a special: <code>%SO6productname + * %SO6formatversion</code> will be replaced by the equals of + * <code>typeDetection.props</code>. The filter names depends on the Office + * name and version. So a future Office could called ?StarSuite 8?. + * <code>FilterOptions</code> is not relevant for this filter. But ie. for csv + * filter this entry could be used to specify the separator of the csv file. + * <code>FilterData<code> if filter needs some FilterData arguments you can + * specify it here + * + * <p> + * <H3><a name="preselectedType.csv"></A> + * <code>preselectedType.csv</code></H3> + * In this file you can preselect the type + * <code>TypeDetection</code> should use. + * The returned file type by <code>TypeDetection</code> must equal to the + * preselected file type. + * Note: If you try to use invalid types you will get a failed test because + * <code>TypeDetection</code> tries to find out the type itself. + * + * Syntax: fileAlias;fileType + * Example: Writer6_1;writer_StarOffice_XML_Writer + * + * This example shows the following: + * <code>Writer6_1</code> is the same as in <code>csv.files</code> + * <code>writer_StarOffice_XML_Writer</code> is the file type which was used as + * parameter in <code>MediaDescriptor</code>. This type must be returned from + * <code>TypeDetection</code> + * + * <p> + * <H3><a name="serviceName.csv"></A> + * <code>serviceName.csv</code></H3> In this file you can preselect a service name + * to detect the file type. The returned file type by + * <code>TypeDetection</code> must equal to correspond + * <code>defaultFileType</code> from <code>csv.files</code> + * + * Syntax: fileAlias;serviceName + * Example: Writer6_1;com.sun.star.text.FormatDetector + * + * This example shows the following: + * <code>Writer6_1</code> is the same as in <code>csv.files</code> + * <code>com.sun.star.text.FormatDetector</code> is the service name which was + * used as parameter in <code>MediaDescriptor</code>. + * + * + * <p> + * All these files will be copied by make file beside of + * <code>typeDetection.class</code>. + * @see com.sun.star.document.XTypeDetection + * @see com.sun.star.document.MediaDescriptor + */ +public class TypeDetection extends ComplexTestCase { + + /** + * @member m_xDetection the object to test + * @member helper instacne of helper class + */ + + static XTypeDetection m_xDetection; + static Helper helper = null; + + /** + * A function to tell the framework, which test functions are available. + * @return All test methods. + */ + public String[] getTestMethodNames() { + return new String[]{"checkByURLonly", + "checkPreselectedType", + "checkPreselectedFilter", + "checkPreselectedDocService", + "checkStreamLoader", + "checkStreamLoader"}; + + } + + /** Create the environment for following tests. + * Use either a component loader from desktop or + * from frame + * @throws Exception Exception + */ + public void before() throws Exception { + + // create TypeDetection + XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF(); + assure("Could not get XMultiServiceFactory", xMSF != null); + + Object oInterface = xMSF.createInstance( + "com.sun.star.document.TypeDetection"); + + if (oInterface == null) { + failed("Service wasn't created") ; + } + + XInterface oObj = (XInterface) oInterface ; + log.println("ImplName: "+utils.getImplName(oObj)); + + m_xDetection = (XTypeDetection) + UnoRuntime.queryInterface(XTypeDetection.class, oInterface); + Enumeration k = param.keys(); + while (k.hasMoreElements()){ + String kName = ((String)k.nextElement()).toString(); + log.println(kName + ":" + param.get(kName).toString()); + } + // create instrace of helper class + helper = new Helper(param, log); + + } + + /** + * close the environment + */ + public void after() { + } + + /** + * The <code>MediaDescriptor</code> was filled with the URL of a file. The + * <code>type</code> of the file is kown and must be returned by + * <code>MediaDescriptor</code> + * + * Syntax of files.csv: + * fileAlias;fileURL;fileType + * + */ + public void checkByURLonly() { + try{ + log.println("### checkByURLonly() ###"); + Vector CSVData = helper.getToDoList( + (String)param.get("csv.files")); + Enumeration allToDos = CSVData.elements(); + + while (allToDos.hasMoreElements()){ + Vector toDo = (Vector) allToDos.nextElement(); + + String fileAlias = (String) toDo.get(0); + String fileURL = (String) toDo.get(1); + String URLfileType = (String) toDo.get(2); + String StreamfileType = (String) toDo.get(3); + + fileURL = utils.getFullURL(helper.ensureEndingFileSep( + (String)param.get("TestDocumentPath")) + fileURL); + + log.println("actual '"+ fileAlias + + "' ['" + URLfileType + "']: '" + fileURL); + + checkMediaDescriptorURL(fileAlias, fileURL, URLfileType); + checkMediaDescriptorXInputStream(fileAlias, fileURL, StreamfileType); + } + + } catch (ClassCastException e){ + failed(e.toString(), true); + } + } + + /** To check the <CODE>TypeDedection</CODE> by URL the <CODE>MediaDescriptor</CODE> + * was filled at fist with the URL only, at second with <CODE>XInputStream</CODE> + * only. The <CODE>TypeDetection</CODE> must return the expected value + * @param fileAlias the alias name of the test file + * @param fileURL the URL of the test file + * @param fileType the expected type of the test file + * @see com.sun.star.document.MediaDescriptor + */ + private void checkMediaDescriptorURL( + String fileAlias, String fileURL, String fileType){ + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"URL"}, + new Object[] {fileURL}); + log.println("check only by URL..."); + + String type = m_xDetection.queryTypeByDescriptor( + helper.createInOutPropertyValue(MediaDescriptor), true); + + boolean fileTypeOK = helper.checkFileType(type, fileType); + + assure("\nURL-test : " + fileAlias + ":\n\treturned type: '" + type + + "'\n\texpected type: '" + fileType + "'",fileTypeOK ,true); + } + + /** Filles a MediaDescriptor with a <code>XInputStream</code> of the test + * file given by URL. + * Then the MediaDescriptor was used as parameter for TypeDetection. + * The TypeDetection must return expected type + * @param fileAlias the alias name of the test file + * @param fileURL the URL of the test file + * @param fileType the expected type of the test file + * @see com.sun.star.document.MediaDescriptor + * @see com.sun.star.io.XInputStream + */ + private void checkMediaDescriptorXInputStream( + String fileAlias, String fileURL, String fileType){ + + XInputStream xStream = null; + + try{ + xStream = helper.getFileStream( fileURL ); + } catch (NotConnectedException e) { + failed("Could not get XInputStream from file :'" + fileURL + "'",true); + return; + } + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"InputStream"}, + new Object[] {xStream}); + log.println("check only by XInputStream..."); + + String type = m_xDetection.queryTypeByDescriptor( + helper.createInOutPropertyValue(MediaDescriptor), true); + + boolean fileTypeOK = helper.checkFileType(type, fileType); + + assure("\nXInputStream-test: " + fileAlias + ":\n\treturned type: '" + type + + "'\n\texpected type: '" + fileType + "'", fileTypeOK, true); + + } + + /** + * The <code>MediaDescriptor</code> was filled with the URL of a file. The + * <code>type</code> of the file is kown and must be returned by + * <code>MediaDescriptor</code> + * + * Syntax of files.csv: + * fileAlias;fileURL;fileType + * + */ + public void checkPreselectedType() { + try{ + log.println("### checkPreselectedType() ###"); + + Vector CSVData = helper.getToDoList( + (String)param.get("csv.preselectedType")); + Enumeration allToDos = CSVData.elements(); + + while (allToDos.hasMoreElements()){ + try{ + Vector toDo = (Vector) allToDos.nextElement(); + + String fileAlias = (String) toDo.get(0); + String fileURL = helper.getURLforfileAlias(fileAlias); + String preselectFileType = (String) toDo.get(1); + String expectedFileType = (String) toDo.get(2); + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"URL", "MediaType"}, + new Object[] {fileURL, preselectFileType}); + log.println("check '" + fileAlias + "' with MediaType: '" + + preselectFileType + "'"); + + String type = m_xDetection.queryTypeByDescriptor( + helper.createInOutPropertyValue(MediaDescriptor), true); + + boolean fileTypeOK = helper.checkFileType(type, expectedFileType); + + assure("\n" + fileAlias + ":\n\treturned type: '" + type + + "'\n\texpected type: '" + expectedFileType + "'", + fileTypeOK, true); + + } catch (FileAliasNotFoundException e){ + failed(e.toString(),true); + } + + } + + } catch (ClassCastException e){ + failed(e.toString(), true); + } + } + + + /** + * Check loading from a stream. The source for the stream is the + * first fileAlias that matches "*.txt" in the file list + * of the given directory. + */ + public void checkPreselectedFilter() { + try{ + log.println("### checkPreselectedFilter() ###"); + + Vector CSVData = helper.getToDoList( + (String)param.get("csv.preselectedFilter")); + + Enumeration allToDos = CSVData.elements(); + + while (allToDos.hasMoreElements()){ + try{ + Vector toDo = (Vector) allToDos.nextElement(); + + String fileAlias = (String) toDo.get(0); + String fileURL = helper.getURLforfileAlias(fileAlias); + String filterName = (String) toDo.get(1); + String filterOptions = (String) toDo.get(2); + String filterData = (String) toDo.get(3); + String expectedType = (String) toDo.get(4); + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"URL","FilterName", + "FilterOptions","FilterData"}, + new Object[] {fileURL, filterName, + filterOptions, filterData}); + + log.println("check '" + fileAlias + "' with filter: '" + + filterName + "'"); + + String type = m_xDetection.queryTypeByDescriptor( + helper.createInOutPropertyValue(MediaDescriptor), true); + + boolean fileTypeOK = helper.checkFileType(type, expectedType); + + assure("\n" + fileAlias + ":\n\treturned type: '" + type + + "'\n\texpected type: '" + expectedType + "'", + fileTypeOK,true); + + } catch (FileAliasNotFoundException e){ + failed(e.toString(),true); + } + + } + + } catch (ClassCastException e){ + failed(e.toString(), true); + } + } + + /** + * Check URL encoding. The first fileAlias that matches "*.sxw" + * is used as source for several encodings. + */ + public void checkPreselectedDocService() { + try{ + log.println("### checkPreselectedDocService() ###"); + + Vector CSVData = helper.getToDoList((String)param.get("csv.serviceName")); + Enumeration allToDos = CSVData.elements(); + + while (allToDos.hasMoreElements()){ + try{ + Vector toDo = (Vector) allToDos.nextElement(); + + String fileAlias = (String) toDo.get(0); + String fileURL = helper.getURLforfileAlias(fileAlias); + String serviceName = (String) toDo.get(1); + String fileType = helper.getTypeforfileAlias(fileAlias); + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"URL", "DocumentSerivce"}, + new Object[] {fileURL, serviceName}); + log.println("check " + fileAlias); + + String type = m_xDetection.queryTypeByDescriptor( + helper.createInOutPropertyValue(MediaDescriptor), true); + + boolean fileTypeOK = helper.checkFileType(type, fileType); + + assure("\n" + fileAlias + ":\n\treturned type: '" + type + + "'\t\nexpected type: '" + fileType + "'", + fileTypeOK, true); + + } catch (FileAliasNotFoundException e){ + failed(e.toString(),true); + } + + } + + } catch (ClassCastException e){ + failed(e.toString(), true); + } + } + + public void checkStreamLoader(){ + try{ + + /* + *als Dateien die typeDetection.props und eine der csv-Dateien + *benutzten. diese können per dmake einfach auf andere Rechte setzten + * + */ + log.println("### checkStreamLoader() ###"); + String[] urls = new String[2]; + + urls[0] = helper.getClassURLString("TypeDetection.props"); + urls[1] = helper.getClassURLString("files.csv"); + + for (int j=0; j<urls.length; j++){ + String fileURL = urls[j]; + File file = new File(fileURL); + fileURL = utils.getFullURL(fileURL); + + PropertyValue[] MediaDescriptor = helper.createMediaDescriptor( + new String[] {"URL"}, + new Object[] {fileURL}); + + if (file.canWrite()) log.println("check writable file..."); + else log.println("check readonly file..."); + + PropertyValue[][] inOut = helper.createInOutPropertyValue(MediaDescriptor); + PropertyValue[] in = inOut[0]; + log.println("in-Parameter:"); + for (int i=0; i < in.length; i++){ + log.println("["+i+"] '" + in[i].Name + "':'" + in[i].Value.toString()+"'"); + } + + String type = m_xDetection.queryTypeByDescriptor(inOut, true); + + PropertyValue[] out = inOut[0]; + + boolean bStream = false; + log.println("out-Parameter"); + boolean bReadOnly = false; + for (int i=0; i < out.length; i++){ + if ((out[i].Name.equals("ReadOnly")) && (out[i].Value.toString().equals("true"))) bReadOnly = true; + log.println("["+i+"] '" + out[i].Name + "':'" + out[i].Value.toString()+"'"); + } + + if (file.canWrite() && bReadOnly) + assure("\nStreamLoader: file '"+ fileURL +"' is writable but out-Parameter does contain 'ReadOnly' property",false ,true); + else if ((!file.canWrite()) && (!bReadOnly)) + assure("\nStreamLoader: file '"+ fileURL +"'is readonly but out-Parameter does not contain 'ReadOnly' property",false ,true); + else assure("all ok",true,true); + + } + + } catch (ClassCastException e){ + failed(e.toString(), true); + } + + } +}
\ No newline at end of file diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.props b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.props new file mode 100644 index 000000000000..d8e919784a5d --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.props @@ -0,0 +1,13 @@ +# UNIX: +#TestDocumentPath=file:///net/margritte/usr/qaapi/dev/cws/filtercfg/docTypes +# WINDOWS +TestDocumentPath=//margritte/qaapi/dev/cws/filtercfg/docTypes + +csv.files=files.csv +csv.preselectedFilter=preselectedFilter.csv +csv.preselectedType=preselectedType.csv +csv.serviceName=serviceName.csv +csv.streamFileTypes=streamFileTypes.csv +placeHolder=% +%SO6productname=StarOffice +%SO6formatversion=6.0 diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv new file mode 100644 index 000000000000..84b593f0ed8e --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/files.csv @@ -0,0 +1,117 @@ +fileAlias;fileURL;defaultFileType;streamFileType +#************************************************************** +#** N O T E +#** +#** The detection for template filter amd wirter_text_encoded +#** will be chenged on following childworkspsace +#** +#************************************************************** +################################### +# W R I T E R D O C U M E N T S +################################# +rtf1;Writer/AoE2a.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format;writer_Rich_Text_Format +text1;Writer/Text_DOS.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +Word2000_document;Writer/Word2000.doc;writer_MS_Word_97;writer_MS_Word_97 +Word2000_template;Writer/Word2000_template.dot;writer_MS_Word_97_Vorlage;writer_MS_Word_97_Vorlage +Word6_document;Writer/Word6.doc;writer_MS_WinWord_60;writer_MS_WinWord_60 +Word6_template;Writer/Word6_template.dot;writer_MS_Word_95_Vorlage;writer_MS_Word_95_Vorlage +Word95_document;Writer/Word95.doc;writer_MS_WinWord_60;writer_MS_WinWord_60 +Word97_document;Writer/Word97.doc;writer_MS_Word_97;writer_MS_Word_97 +Word97_template;Writer/Word97_template.dot;writer_MS_Word_97_Vorlage;writer_MS_Word_97_Vorlage +WordXP_document;Writer/WordXP.doc;writer_MS_Word_97;writer_MS_Word_97 +WordXP_template;Writer/WordXP_template.dot;writer_MS_Word_97_Vorlage;writer_MS_Word_97_Vorlage +Writer3_document;Writer/Writer3.sdw;writer_StarWriter_30;writer_StarWriter_30_VorlageTemplate +Writer3_template;Writer/Writer3_template.vor;writer_StarWriter_30_VorlageTemplate;writer_StarWriter_30_VorlageTemplate +Writer4_document;Writer/Writer4.sdw;writer_StarWriter_40;writer_StarWriter_40_VorlageTemplate +Writer4_template;Writer/Writer4_template.vor;writer_StarWriter_40_VorlageTemplate;writer_StarWriter_40_VorlageTemplate +Writer5_document;Writer/Writer5.sdw;writer_StarWriter_50;writer_StarWriter_50_VorlageTemplate +Writer5_template;Writer/Writer5_template.vor;writer_StarWriter_50_VorlageTemplate;writer_StarWriter_50_VorlageTemplate +Writer6_document;Writer/Writer6.sxw;writer_StarOffice_XML_Writer;writer_StarOffice_XML_Writer +Writer6_template;Writer/Writer6_template.stw;writer_StarOffice_XML_Writer_Template;writer_StarOffice_XML_Writer +Writer6_html;Writer/WriterWeb.html;writer_web_HTML;writer_web_HTML +ApiPro3;Writer/AmiPro_3x.sam;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +Applix;Writer/Applix.aw;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +Text2;Writer/Counterstrike I.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +FrameMake_document;Writer/FrameMaker.mif;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +WordPro_Hangul;Writer/HangulWordPro.hwp;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +Ichitaro;Writer/Ichitaro.jtd;writer_JustSystem_Ichitaro_10;writer_JustSystem_Ichitaro_10 +MacWord5_document;Writer/MacWord_5.mcw;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +rtf2;Writer/RTF.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format +wps2000_document;Writer/WPS_2000.wps;writer_WPSSystem_WPS2000_10;writer_WPSSystem_WPS2000_10 +WinWord2_document;Writer/WinWord_2x.doc;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +WinWord6_95_document;Writer/WinWord_6_95.doc;writer_MS_WinWord_60;writer_MS_WinWord_60 +WinWord97_2000_XP_document;Writer/Winword_97_2000_xp.doc;writer_MS_Word_97;writer_MS_Word_97 +WordPerfect;Writer/WordPerfect.wpd;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +csv2;Writer/Text_CSV.txt;writer_Text_encoded:writer_Text;writer_Text_encoded:writer_Text +################################### +# C A L C D O C U M E N T S +################################## +csv1;Calc/Text_CSV.csv;calc_Text_txt_csv_StarCalc;writer_Text_encoded:writer_Text +Calc1;Calc/Calc1.SDC;calc_StarCalc_10;calc_StarCalc_10 +Calc2_document;Calc/Calc3.SDC;calc_StarCalc_30_VorlageTemplate;calc_StarCalc_30 +Calc2_template;Calc/Calc3.vor;calc_StarCalc_30;calc_StarCalc_30 +Calc4_document;Calc/Calc4.sdc;calc_StarCalc_40;calc_StarCalc_40 +Calc4_template;Calc/Calc4.vor;calc_StarCalc_40_VorlageTemplate;calc_StarCalc_40 +Calc5_document;Calc/Calc5.sdc;calc_StarCalc_50;calc_StarCalc_50 +Calc5_template;Calc/Calc5.vor;calc_StarCalc_50_VorlageTemplate;calc_StarCalc_50 +Calc6_document;Calc/Calc_6.stc;calc_StarOffice_XML_Calc;calc_StarOffice_XML_Calc +Calc6_template;Calc/Calc_6.sxc;calc_StarOffice_XML_Calc_Template;calc_StarOffice_XML_Calc +dif;Calc/DIF.DIF;calc_DIF;writer_Text_encoded:writer_Text +Excel2;Calc/Excel2.XLS;calc_MS_Excel_40;calc_MS_Excel_40 +Excel3;Calc/Excel3.XLS;calc_MS_Excel_40;calc_MS_Excel_40 +Excel4_document;Calc/Excel4.XLS;calc_MS_Excel_40;calc_MS_Excel_40 +Excel4_template;Calc/Excel4.XLT;calc_MS_Excel_40_VorlageTemplate;calc_MS_Excel_40 +Exel95_document;Calc/Excel5_95.XLS;calc_MS_Excel_5095;calc_MS_Excel_5095 +Exel95_template;Calc/Excel5_template.XLT;calc_MS_Excel_5095;calc_MS_Excel_5095 +Excel97_document;Calc/Excel97_2000_XP.xls;calc_MS_Excel_97;calc_MS_Excel_97 +#Excel97_1dummy;Calc/Excel97_2000_XP.dummy;calc_MS_Excel_97;calc_MS_Excel_97 +Excel97_template;Calc/Excel97_2000_XP.xlt;calc_MS_Excel_97;calc_MS_Excel_97 +Calc_html;Calc/HTML_Calc.html;writer_web_HTML;writer_web_HTML +Lotus;Calc/Lotus.WK1;writer_Lotus_1_2_3_10_DOS_StarWriter;writer_Lotus_1_2_3_10_DOS_StarWriter +Calc_rtf;Calc/RTF_StarOffice_Calc.rtf;writer_Rich_Text_Format;writer_Rich_Text_Format +slk;Calc/SYLK.SLK;calc_SYLK;writer_Text_encoded:writer_Text_encoded +Webpagequery;Calc/Webpagequery.html;writer_web_HTML;writer_web_HTML +dbase;Calc/dbase.DBF;calc_dBase;writer_Text_encoded +###################################################### +# D R A W +###################################################### +draw6_document;Draw/draw1.sxd;draw_StarOffice_XML_Draw;draw_StarOffice_XML_Draw +draw6_template;Draw/draw2.std;draw_StarOffice_XML_Draw_Template;draw_StarOffice_XML_Draw +draw5_document;Draw/draw3.sda;draw_StarDraw_50;draw_StarDraw_50_Vorlage +draw5_template;Draw/draw4.vor;draw_StarDraw_50_Vorlage;draw_StarDraw_50_Vorlage +draw3_document;Draw/draw5.sdd;draw_StarDraw_30;draw_StarDraw_30 +draw3_template;Draw/draw6.vor;draw_StarDraw_30;draw_StarDraw_30 +###################################################### +# I M P R E S S +###################################################### +Impress6_document;Impress/imp1.sxi;impress_StarOffice_XML_Impress;impress_StarOffice_XML_Impress +Impress4_document;Impress/imp10.sdd;impress_StarImpress_40;impress_StarImpress_40 +Impress4_template;Impress/imp11.vor;iimpress_StarImpress_40_Vorlage;impress_StarImpress_40 +Impress6_template;Impress/imp2.sti;impress_StarOffice_XML_Impress_Template;impress_StarOffice_XML_Impress +PowerPoint97_document;Impress/imp3.ppt;impress_MS_PowerPoint_97;impress_MS_PowerPoint_97 +PowerPoint97_template;Impress/imp4.pot;impress_MS_PowerPoint_97_Vorlage;impress_MS_PowerPoint_97 +DrawImpress6_document;Impress/imp5.sxd;draw_StarOffice_XML_Draw;draw_StarOffice_XML_Draw +DrawImpress5_document;Impress/imp6.sda;draw_StarDraw_50;draw_StarDraw_50_Vorlage +DrawImpress3_document;Impress/imp7.sdd;draw_StarDraw_30;draw_StarDraw_30 +Impress5_document;Impress/imp8.sdd;impress_StarImpress_50;impress_StarImpress_50 +Impress5_template;Impress/imp9.vor;impress_StarImpress_50_Vorlage;impress_StarImpress_50 +####################################################### +# G R A P H I C S +###################################################### +bitmap;Graphics/pic.bmp;bmp_MS_Windows;bmp_MS_Windows +emf;Graphics/pic.emf;emf_MS_Windows_Metafile;emf_MS_Windows_Metafile:writer_Text_encoded:writer_Text +eps;Graphics/pic.eps;eps_Encapsulated_PostScript;eps_Encapsulated_PostScript +gif;Graphics/pic.gif;gif_Graphics_Interchange;gif_Graphics_Interchange +jpg;Graphics/pic.jpg;jpg_JPEG;jpg_JPEG +met;Graphics/pic.met;met_OS2_Metafile;met_OS2_Metafile:writer_Text_encoded:writer_Text +pbm;Graphics/pic.pbm;pbm_Portable_Bitmap;pbm_Portable_Bitmap +pct;Graphics/pic.pct;pct_Mac_Pict;pct_Mac_Pict +pgm;Graphics/pic.pgm;pgm_Portable_Graymap;pgm_Portable_Graymap +png;Graphics/pic.png;png_Portable_Network_Graphic;png_Portable_Network_Graphic +ppm;Graphics/pic.ppm;ppm_Portable_Pixelmap;ppm_Portable_Pixelmap +ras;Graphics/pic.ras;ras_Sun_Rasterfile;ras_Sun_Rasterfile +svm;Graphics/pic.svm;svm_StarView_Metafile;svm_StarView_Metafile:writer_Text_encoded:writer_Text +tif;Graphics/pic.tif;tif_Tag_Image_File;tif_Tag_Image_File:writer_Text_encoded:writer_Text +wmf;Graphics/pic.wmf;wmf_MS_Windows_Metafile;wmf_MS_Windows_Metafile:writer_Text_encoded:writer_Text + + diff --git a/filter/qa/complex/filter/detection/typeDetection/makefile.mk b/filter/qa/complex/filter/detection/typeDetection/makefile.mk new file mode 100644 index 000000000000..dea5044fb60c --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/makefile.mk @@ -0,0 +1,133 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.9.102.1 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ = ..$/..$/..$/..$/.. +PRJNAME = filter +TARGET = TypeDetection +PACKAGE = complex$/filter$/detection$/typeDetection + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JAVAFILES = TypeDetection.java Helper.java +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + +# --- Parameters for the test -------------------------------------- + +# start an office if the parameter is set for the makefile +.IF "$(OFFICE)" == "" +CT_APPEXECCOMMAND = +.ELSE +CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +.ENDIF + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).TypeDetection + +# start the runner application +CT_APP = org.openoffice.Runner + +# --- Targets ------------------------------------------------------ + +.IF "$(depend)" == "" + CHMOD $(CLASSDIR)$/$(PACKAGE)$/TypeDetection.props \ + $(CLASSDIR)$/$(PACKAGE)$/preselectedFilter.csv \ + $(CLASSDIR)$/$(PACKAGE)$/preselectedType.csv \ + $(CLASSDIR)$/$(PACKAGE)$/serviceName.csv \ + $(CLASSDIR)$/$(PACKAGE)$/files.csv : ALLTAR +.ELSE + CHMOD $(CLASSDIR)$/$(PACKAGE)$/TypeDetection.props \ + $(CLASSDIR)$/$(PACKAGE)$/preselectedFilter.csv \ + $(CLASSDIR)$/$(PACKAGE)$/preselectedType.csv \ + $(CLASSDIR)$/$(PACKAGE)$/serviceName.csv \ + $(CLASSDIR)$/$(PACKAGE)$/files.csv : ALLDEP +.ENDIF + + +TST: + @echo "$(USE_SHELL)" + +.INCLUDE : target.mk + +$(CLASSDIR)$/$(PACKAGE)$/preselectedFilter.csv : preselectedFilter.csv + cp preselectedFilter.csv $(CLASSDIR)$/$(PACKAGE)$/preselectedFilter.csv + jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/preselectedFilter.csv + +$(CLASSDIR)$/$(PACKAGE)$/preselectedType.csv : preselectedType.csv + cp preselectedType.csv $(CLASSDIR)$/$(PACKAGE)$/preselectedType.csv + jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/preselectedType.csv + +$(CLASSDIR)$/$(PACKAGE)$/serviceName.csv : serviceName.csv + cp serviceName.csv $(CLASSDIR)$/$(PACKAGE)$/serviceName.csv + jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/serviceName.csv + +$(CLASSDIR)$/$(PACKAGE)$/files.csv : files.csv + cp files.csv $(CLASSDIR)$/$(PACKAGE)$/files.csv + jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/files.csv + +$(CLASSDIR)$/$(PACKAGE)$/TypeDetection.props : TypeDetection.props + cp TypeDetection.props $(CLASSDIR)$/$(PACKAGE)$/TypeDetection.props + jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/TypeDetection.props + +# --- chmod -------------------------------------------------------- + +.IF "$(USE_SHELL)" != "4nt" +CHMOD : + chmod 444 $(CLASSDIR)$/$(PACKAGE)$/*.csv + chmod 666 $(CLASSDIR)$/$(PACKAGE)$/*.props +.ELSE +CHMOD : + echo erstmanix +.ENDIF + + + +RUN: run + +run: + java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) + + + diff --git a/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv b/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv new file mode 100644 index 000000000000..71370e0b78f2 --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/preselectedFilter.csv @@ -0,0 +1,6 @@ +fileAlias;FilterName;FilterOptions;FilterData;expectedFileType +text1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text +csv1;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text +csv1;Text - txt - csv (StarCalc);;;calc_Text_txt_csv_StarCalc +csv2;%SO6productname %SO6formatversion Textdokument;;;writer_Text_encoded:writer_Text +csv2;Text - txt - csv (StarCalc);;;calc_Text_txt_csv_StarCalc diff --git a/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv b/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv new file mode 100644 index 000000000000..7fa0c2462da9 --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/preselectedType.csv @@ -0,0 +1,6 @@ +fileAlias;preselectFileType;expectFileType +csv1;writer_Text;writer_Text_encoded:writer_Text +csv1;calc_Text_txt_csv_StarCalc;calc_Text_txt_csv_StarCalc +#csv2;writer_Text_encoded +#csv2;calc_Text_txt_csv_StarCalc +text1;writer_Text_encoded;writer_Text_encoded:writer_Text
\ No newline at end of file diff --git a/filter/qa/complex/filter/detection/typeDetection/serviceName.csv b/filter/qa/complex/filter/detection/typeDetection/serviceName.csv new file mode 100644 index 000000000000..744a5ac993e0 --- /dev/null +++ b/filter/qa/complex/filter/detection/typeDetection/serviceName.csv @@ -0,0 +1,6 @@ +fileAlias;serviceName;expectedType +text1;com.sun.star.text.FormatDetector +csv1;com.sun.star.text.FormatDetector;writer_Text_encoded +csv1;com.sun.star.comp.calc.FormatDetector;calc_Text_txt_csv_StarCalc +csv2;com.sun.star.text.FormatDetector;writer_Text_encoded +csv2;com.sun.star.comp.calc.FormatDetector;calc_Text_txt_csv_StarCalc |