diff options
Diffstat (limited to 'framework/qa/complex/loadAllDocuments')
13 files changed, 1660 insertions, 0 deletions
diff --git a/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java new file mode 100644 index 000000000000..1c67271fd6bb --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java @@ -0,0 +1,750 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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.loadAllDocuments; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.FrameSearchFlag; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.XStorable; +import com.sun.star.io.XInputStream; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XCloseable; +import com.sun.star.ucb.XSimpleFileAccess; + + +import helper.URLHelper; + +import java.io.File; +import java.io.InputStreamReader; + +import java.util.Enumeration; +import java.util.Vector; + +// ---------- junit imports ----------------- +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import org.openoffice.test.OfficeFileUrl; +import static org.junit.Assert.*; +// ------------------------------------------ + +//----------------------------------------------- +/** @short Check the interface method XComponentLoader.loadComponentFromURL() + + @descr A prerequisite for this test is a server which allows access to files + that will be loaded via three different access methods: + <ul> + <li>1. nfs (mounted directory / mapped network drive)</li> + <li>2. ftp</li> + <li>3. http</li> + </ul> + <p> + The test will look for a list of files from the <i>TestDocumentPath</i> + on and load these files from the mounted directory, via ftp and http. + The parameters for this have to be "ftp_access" and "http_access". + If they are not given, tests for ftp and http will fail. + + @todo We need a further test for accessing UNC pathes on windows! + */ +public class CheckXComponentLoader +{ + //------------------------------------------- + // some const + + /** used to classify the result of a loadComponentFromURL() request. */ + private static final int RESULT_UNKNOWN = 0; + private static final int RESULT_VALID_DOC = 1; + private static final int RESULT_EMPTY_DOC = 2; + private static final int RESULT_ILLEGALARGUMENTEXCEPTION = 3; + private static final int RESULT_IOEXCEPTION = 4; + private static final int RESULT_RUNTIMEEXCEPTION = 5; + private static final int RESULT_EXCEPTION = 6; + + /** File/URL separators. */ + private static final String fs_url = "/"; + // private static final String fs_sys = System.getProperty("file.separator"); + + /** used for testing password protected files. */ + private static final String SUFFIX_PASSWORD_TEMPFILE = "password_"; + private static final String PREFIX_PASSWORD_TEMPFILE = ".sxw"; + private static final String DEFAULT_PASSWORD = "DefaultPasswordForComponentLoaderTest"; + + //------------------------------------------- + // member + + /** points to the global uno service manager. */ + private XMultiServiceFactory m_xMSF = null; + + /** provides XComponentLoader interface. */ + private XFrame m_xDesktop = null; + + /** provides XComponentLoader interface too. */ + private XFrame m_xFrame = null; + + /** will be set to xDesktop OR xFrame. */ + private XComponentLoader m_xLoader = null; + + /** can be used to open local files as stream. */ + private XSimpleFileAccess m_xStreamProvider = null; + + /** directory for creating temp. files. */ + private String m_sTempPath = null; + + /** directory for searching files to load */ + private String m_sTestDocPath = null; + + /** files of m_sTestDocPath to test. */ + private static Vector m_lTestFiles = null; + + //------------------------------------------- + // test environment + + //------------------------------------------- + /** @short A function to tell the framework, + which test functions are available. + + @return All test methods. + @todo Think about selection of tests from outside ... + */ +// public String[] getTestMethodNames() +// { +// // TODO think about trigger of sub-tests from outside +// return new String[] +// { +// "checkURLEncoding" , +// "checkURLHandling" , +// "checkUsingOfMediaDescriptor", +// "checkStreamLoading" , +// "checkLoadingWithPassword" +// }; +// } + + //------------------------------------------- + /** @short Create the environment for following tests. + + @descr Use either a component loader from desktop or + from frame + */ + @Before public void before() + { + // get uno service manager from global test environment + m_xMSF = getMSF(); + + // create stream provider + try + { + m_xStreamProvider = UnoRuntime.queryInterface(XSimpleFileAccess.class, m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess")); + } + catch(java.lang.Throwable ex) + { + fail("Could not create a stream provider instance."); + } + + // create desktop instance + try + { + m_xDesktop = UnoRuntime.queryInterface(XFrame.class, m_xMSF.createInstance("com.sun.star.frame.Desktop")); + } + catch(java.lang.Throwable ex) + { + fail("Could not create the desktop instance."); + } + + // create frame instance + m_xFrame = m_xDesktop.findFrame("testFrame_componentLoader", + FrameSearchFlag.TASKS | FrameSearchFlag.CREATE); + assertNotNull("Couldn't create test frame.", m_xFrame); + + // define default loader for testing + // TODO think about using of bot loader instances! + m_xLoader = UnoRuntime.queryInterface(XComponentLoader.class, m_xDesktop); + assertNotNull("Desktop service doesnt support needed component loader interface.", m_xLoader); + + // get temp path for this environment + final String tempDirURL = util.utils.getOfficeTemp/*Dir*/(getMSF()); + m_sTempPath = graphical.FileHelper.getSystemPathFromFileURL(tempDirURL); + // m_sTempPath = "."+fs_sys; + + // get all files from the given directory + // TODO URLHelper should ignore directories! + m_lTestFiles = new Vector(); + final String sTestDocURL = OfficeFileUrl.getAbsolute(new File("testdocuments")); + m_sTestDocPath = graphical.FileHelper.getSystemPathFromFileURL(sTestDocURL); + try + { + File aBaseDir = new File(m_sTestDocPath); + Vector lDirContent = URLHelper.getSystemFilesFromDir(aBaseDir.getPath()); + Enumeration lList = lDirContent.elements(); + int nBasePathLength = m_sTestDocPath.length(); + while(lList.hasMoreElements()) + { + File aFile = (File)lList.nextElement(); + + // ignore broken links and directories at all + if ( + (!aFile.exists()) || + (!aFile.isFile()) + ) + { + continue; + } + + String sCompletePath = aFile.getAbsolutePath(); + String sSubPath = sCompletePath.substring(nBasePathLength); + + // Some test files are checked into CVS. ignore CVS helper files! +// if (sSubPath.indexOf("CVS") > -1) +// { +// continue; +// } + + m_lTestFiles.add(sSubPath); + } + } + catch(java.lang.Throwable ex) + { + fail("Couldn't find test documents."); + } + } + + //------------------------------------------- + /** @short close the environment. + */ + @After public void after() + { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xFrame); + try + { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException exVeto) + { fail("Test frame couldn't be closed successfully."); } + + m_xFrame = null; + m_xLoader = null; + } + + //------------------------------------------- + /** @short Look for files in the given directory for loading. + */ + @Test public void checkUsingOfMediaDescriptor() + { + InteractionHandler xHandler = new InteractionHandler(); + StatusIndicator xIndicator = new StatusIndicator(StatusIndicator.SHOWSTATUS_LOG); + + PropertyValue[] lProps = new PropertyValue[3]; + + lProps[0] = new PropertyValue(); + lProps[0].Name = "Hidden"; + lProps[0].Value = Boolean.TRUE; + + lProps[1] = new PropertyValue(); + lProps[1].Name = "InteractionHandler"; + lProps[1].Value = xHandler; + + lProps[2] = new PropertyValue(); + lProps[2].Name = "StatusIndicator"; + lProps[2].Value = xIndicator; + + Enumeration aSnapshot = m_lTestFiles.elements(); + while (aSnapshot.hasMoreElements()) + { + File aSysFile = new File(m_sTestDocPath, (String)aSnapshot.nextElement()); + String sURL = URLHelper.getFileURLFromSystemPath(aSysFile); + + if (/*! (sURL.endsWith(".jpg") || + sURL.endsWith(".gif"))*/ + true + ) + { + loadURL(m_xLoader, RESULT_VALID_DOC, sURL, "_blank", 0, lProps); + // Its not needed to reset this using states! + // Its done internaly ... + if (!xIndicator.wasUsed()) + { + System.out.println("External progress was not used for loading."); + } + if (xHandler.wasUsed()) + { + System.out.println("External interaction handler was not used for loading."); + } + } + } + } + + //------------------------------------------- + /** TODO document me and move this method to a more global helper! */ + private String impl_getTempFileName(String sTempPath, + String sSuffix , + String sPrefix ) + { + File aDir = new File(sTempPath); + aDir.mkdirs(); +// if (!aDir.exists()) +// { +// fail("Could not access temp directory \"" + sTempPath + "\"."); +// } + + // TODO: create a temp file which not exist! + for (int i=0; i<999999; ++i) + { + File aTempFile = new File(aDir, sSuffix+i+sPrefix); + if (!aTempFile.exists()) + { + return aTempFile.getAbsolutePath(); + } + } + + fail("Seems that all temp file names are currently in use!"); + return null; + } + + //------------------------------------------- + /** TODO document me and move this method to a more global helper! */ + private void impl_createTempOfficeDocument(XComponentLoader xLoader , + String sSourceURL, + String sTargetURL, + String sFilter , + String sPassword ) + { + PropertyValue[] lLoadProps = new PropertyValue[1]; + + lLoadProps[0] = new PropertyValue(); + lLoadProps[0].Name = "Hidden"; + lLoadProps[0].Value = Boolean.TRUE; + + PropertyValue[] lSaveProps = new PropertyValue[3]; + + lSaveProps[0] = new PropertyValue(); + lSaveProps[0].Name = "FilterName"; + lSaveProps[0].Value = sFilter; + + lSaveProps[1] = new PropertyValue(); + lSaveProps[1].Name = "PassWord"; + lSaveProps[1].Value = sPassword; + + lSaveProps[2] = new PropertyValue(); + lSaveProps[2].Name = "Overwrite"; + lSaveProps[2].Value = Boolean.TRUE; + + XComponent xDoc = null; + try + { + // load it + xDoc = xLoader.loadComponentFromURL(sSourceURL, "_blank", 0, lLoadProps); + assertNotNull("Could create office document, which should be saved as temp one.", xDoc); + + // save it as temp file + XStorable xStore = UnoRuntime.queryInterface(XStorable.class, xDoc); + xStore.storeAsURL(sTargetURL, lSaveProps); + + // Dont forget to close this file. Otherwise the temp file is locked! + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDoc); + xClose.close(false); + } + catch(java.lang.Throwable ex) + { + fail("Could not create temp office document."); + } + } + + //------------------------------------------- + /** @short Check the password handling. + + @descr The used password is the one given + as password for the ftp connection, + or - if none given a default one. + */ + @Test public void checkLoadingWithPassword() + { + String sTempFile = impl_getTempFileName(m_sTempPath, SUFFIX_PASSWORD_TEMPFILE, PREFIX_PASSWORD_TEMPFILE); + File aTestFile = new File(sTempFile); + String sTestURL = URLHelper.getFileURLFromSystemPath(aTestFile); + + impl_createTempOfficeDocument(m_xLoader, "private:factory/swriter", sTestURL, "StarOffice XML (Writer)", DEFAULT_PASSWORD); + + PropertyValue[] lArgs1 = new PropertyValue[2]; + + lArgs1[0] = new PropertyValue(); + lArgs1[0].Name = "Hidden"; + lArgs1[0].Value = Boolean.TRUE; + + lArgs1[1] = new PropertyValue(); + lArgs1[1].Name = "Password"; + lArgs1[1].Value = DEFAULT_PASSWORD; + + PropertyValue[] lArgs2 = new PropertyValue[1]; + + lArgs2[0] = new PropertyValue(); + lArgs2[0].Name = "Hidden"; + lArgs2[0].Value = Boolean.TRUE; + + loadURL(m_xLoader, RESULT_VALID_DOC, sTestURL, "_blank", 0, lArgs1); +// TODO: wrong? loadURL(m_xLoader, RESULT_EMPTY_DOC, sTestURL, "_blank", 0, lArgs2); + } + + /** + * Check URL encoding. The first filename that matches "*.sxw" + * is used as source for several encodings. + */ + @Test public void checkURLEncoding() { + PropertyValue[] lProps = new PropertyValue[1]; + + lProps[0] = new PropertyValue(); + lProps[0].Name = "Hidden"; + lProps[0].Value = Boolean.TRUE; + + // first get encoding of this system + InputStreamReader in = new InputStreamReader(System.in); + String sSystemEncoding = in.getEncoding(); + + System.out.println("This system's encoding: " + sSystemEncoding); + + assertNotNull("Found an empty directory. There are no files for testing.", m_lTestFiles); + + + // get a file name as byte array + Enumeration aSnapshot = m_lTestFiles.elements(); + byte[] baURL = null; + + while (aSnapshot.hasMoreElements()) { + File aFile = new File(m_sTestDocPath, (String)aSnapshot.nextElement()); + String sFile = URLHelper.getFileURLFromSystemPath(aFile); + + // take the first sxw file as stream + if (sFile.endsWith(".sxw")) { + baURL = sFile.getBytes(); + + break; + } + } + + assertNotNull("Found no file to load. Cannot test.", baURL); + + //construct several different encoded strings + String[] sEncoding = new String[] { + "US-ASCII", "TRUE", // us ascii encoding + "ISO-8859-1", "TRUE", // iso encoding + "UTF-8", "TRUE", // 8 bit utf encoding + "UTF-16BE", "FALSE", // 16 bit big endian utf + "UTF-16LE", "FALSE", // 16 bit little endian utf + "UTF-16", "FALSE" // 16 bit, order specified by byte order mark + + }; + + for (int i = 0; i < sEncoding.length; i = i + 2) { + try { + String encURL = new String(baURL, sEncoding[i]); + System.out.println("ENC[" + sEncoding[i] + "]"); + + if (sEncoding[i + 1].equals("TRUE")) { + loadURL(m_xLoader, RESULT_VALID_DOC, encURL, "_blank", 0, + lProps); + } else { + //with cws_loadenv01 changed to IllegalArgumentException + loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, encURL, "_blank", 0, + lProps); + } + } catch (java.io.UnsupportedEncodingException e) { + fail("Unsopported Encoding: " + sEncoding[i] + + "\n Not able to test encoding on this platform."); + } + } + } + + /** + * Check url handling with a load of URLs. + * 1. unsupported URLs. + * 2. "stupid" URLs + * 3. case sensitive URLs + * 4. FTP URLs + * 5. HTTP URLs + */ +// public void checkURLHandling() { +// PropertyValue[] lProps = new PropertyValue[1]; +// +// lProps[0] = new PropertyValue(); +// lProps[0].Name = "Hidden"; +// lProps[0].Value = Boolean.TRUE; +// +// System.out.println("check possible but unsupported URLs"); +// +// String[] sIllegalArgs = new String[] { +// "slot:5000", "slot:10909", ".uno:SaveAs", ".uno:Open", +// }; +// loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, sIllegalArgs, +// "_blank", 0, lProps); +// +// System.out.println("check stupid URLs"); +// +// sIllegalArgs = new String[] { +// "slot:xxx", "slot:111111111", ".uno:save_as", ".uno:open_this", +// ".UnO:*", +// }; +// loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, sIllegalArgs, +// "_blank", 0, lProps); +// +// String[] sEmptyDocs = new String[] { +// "mailo:hansi.meier@germany.sun.com", "file:/c:\\test/file.cxx", +// "file:///c|:\\test/file.cxx", "http_server://staroffice-doc\\", +// "c:\\\\test///\\test.sxw", "news_:staroffice-doc", +// "newsletter@blubber", "private_factory/swriter", +// "private:factory//swriter", "private:factory/swriter/___", +// "c:\\test\\test.sxw", "macro:///ImportWizard.Main.Main", +// "macro:///Euro.AutoPilotRun.StartAutoPilot", +// "service:com.sun.star.frame.Frame", +// "mailto:steffen.grund@germany.sun.com", "news:staroffice-doc", +// "macro:/ExportWizard", "macro://Euro.AutoPilotRun.StartAutoPilot", +// "service:com.sun.star.frame." +// }; +// +// //with cws_loadenv01 changed to IllegalArgumentException +// loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, sEmptyDocs, "_blank", 0, +// lProps); +// +// System.out.println("check case senstive URLs"); +// +// sIllegalArgs = new String[] { +// "sLot:5000", "sloT:10909", ".unO:SaveAs", ".uno:OPEN", +// }; +// loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, sIllegalArgs, +// "_blank", 0, lProps); +// +// sEmptyDocs = new String[] { +// "private:factory/SWRITER", "private:factory/SWRITER/WEB", +// "macro:///importwizard.main.main", +// "Macro:///euro.autopilotrun.startautopilot", +// "Service:Com.Sun.Star.Frame.Frame", +// "Mailto:andreas.schluens@germany.sun.com", "neWs:staroffice-doc", +// "News:Staroffice-doc" +// }; +// +// //with cws_loadenv01 changed to IllegalArgumentException +// loadURL(m_xLoader, RESULT_ILLEGALARGUMENTEXCEPTION, sEmptyDocs, "_blank", 0, +// lProps); +// +// System.out.println("check FTP URLs"); +// +// String sFTPURL = (String) param.get("FtpAccess"); +// Enumeration aSnapshot = m_lTestFiles.elements(); +// +// while (aSnapshot.hasMoreElements()) { +// String doc = (String) aSnapshot.nextElement(); +// +// +// // if os is windows +// doc = doc.replace('\\', '/'); +// if (doc.indexOf("CVS")<0) { +// loadURL(m_xLoader, RESULT_VALID_DOC, sFTPURL + "/" + doc, +// "_blank", 0, lProps); +// } +// } +// +// System.out.println("check HTTP URLs"); +// +// String sHTTPURL = (String) param.get("HttpAccess"); +// aSnapshot = m_lTestFiles.elements(); +// +// while (aSnapshot.hasMoreElements()) { +// String doc = (String) aSnapshot.nextElement(); +// +// +// // if os is windows +// doc = doc.replace('\\', '/'); +// if (doc.indexOf("CVS")<0) { +// loadURL(m_xLoader, RESULT_VALID_DOC, sHTTPURL + "/" + doc, +// "_blank", 0, lProps); +// } +// } +// } + + /** TODo document me + */ + @Test public void checkStreamLoading() + { + PropertyValue[] lProps = new PropertyValue[2]; + + lProps[0] = new PropertyValue(); + lProps[0].Name = "Hidden"; + lProps[0].Value = Boolean.TRUE; + + lProps[1] = new PropertyValue(); + lProps[1].Name = "InputStream"; + + Enumeration aSnapshot = m_lTestFiles.elements(); + while (aSnapshot.hasMoreElements()) + { + File aFile = new File(m_sTestDocPath, (String) aSnapshot.nextElement()); + String sURL = URLHelper.getFileURLFromSystemPath(aFile); + +// if (sURL.indexOf("CVS") > -1) +// { +// continue; +// } + + try + { + XInputStream xStream = m_xStreamProvider.openFileRead(sURL); + lProps[1].Value = xStream; + } + catch(com.sun.star.uno.Exception e) + { + fail("Could not open test file \""+sURL+"\" for stream test."); + } + + // check different version of "private:stream" URL! + loadURL(m_xLoader, RESULT_VALID_DOC, "private:stream" , "_blank", 0, lProps); + // loadURL(m_xLoader, RESULT_VALID_DOC, "private:stream" , "_blank", 0, lProps); + // loadURL(m_xLoader, RESULT_VALID_DOC, "private:stream/", "_blank", 0, lProps); + } + } + + /** + * Loads one URL with the given parameters using the method + * loadComponentFromURL(). Further it's possible to specify, whch result is + * required and we check internally if it was reached. Logging of errors + * and success stories is done inside this method too. Of course we catch + * all possible exceptions and try to leave the office without any forgotten + * but opened documents. + */ + private void loadURL(XComponentLoader m_xLoader, int nRequiredResult, + String sURL, String sTarget, int nFlags, + PropertyValue[] lProps) { + int nResult = RESULT_EMPTY_DOC; + XComponent xDoc = null; + + try { + xDoc = m_xLoader.loadComponentFromURL(sURL, sTarget, nFlags, + lProps); + + if (xDoc != null) { + nResult = RESULT_VALID_DOC; + } else { + nResult = RESULT_EMPTY_DOC; + } + } catch (com.sun.star.lang.IllegalArgumentException exArgument) { + nResult = RESULT_ILLEGALARGUMENTEXCEPTION; + } catch (com.sun.star.io.IOException exIO) { + nResult = RESULT_IOEXCEPTION; + } catch (com.sun.star.uno.RuntimeException exRuntime) { + nResult = RESULT_RUNTIMEEXCEPTION; + } catch (Exception e) { + nResult = RESULT_EXCEPTION; + } + + try { + if (xDoc != null) { + xDoc.dispose(); + xDoc = null; + } + } catch (com.sun.star.uno.RuntimeException exClosing) { + System.out.println("exception during disposing of a document found!" + + " Doesn't influence test - but should be checked."); + } + + String sMessage = "URL[\"" + sURL + "\"]"; + + if (nResult == nRequiredResult) { + System.out.println(sMessage + " expected result [" + + convertResult2String(nResult) + "] "); + } else { + fail(sMessage + " unexpected result [" + + convertResult2String(nResult) + "] " + + "\nrequired was [" + + convertResult2String(nRequiredResult) + "]" + + "\nwe got [" + convertResult2String(nResult) + "]" + ); + } + } + + private void loadURL(XComponentLoader m_xLoader, int nRequiredResult, + String[] sURL, String sTarget, int nFlags, + PropertyValue[] lProps) { + for (int i = 0; i < sURL.length; i++) + { + loadURL(m_xLoader, nRequiredResult, sURL[i], sTarget, nFlags, lProps); + } + } + + /** + * it match the int result value to a string, which can be used for logging + */ + private static String convertResult2String(int nResult) { + switch (nResult) { + case RESULT_VALID_DOC: + return "VALID_DOC"; + + case RESULT_EMPTY_DOC: + return "EMPTY_DOC"; + + case RESULT_ILLEGALARGUMENTEXCEPTION: + return "ILLEGALARGUMENTEXCEPTION"; + + case RESULT_IOEXCEPTION: + return "IOEXCEPTION"; + + case RESULT_RUNTIMEEXCEPTION: + return "RUNTIMEEXCEPTION"; + + case RESULT_EXCEPTION: + return "ALLOTHEREXCEPTION"; + } + + return "unknown!"; + } + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass + public static void setUpConnection() throws Exception + { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + private static final OfficeConnection connection = new OfficeConnection(); + +} diff --git a/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.props b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.props new file mode 100644 index 000000000000..84bdb5aba92a --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.props @@ -0,0 +1,3 @@ +FtpAccess=ftp://apitest:apitest@margritte/%2e%2e/share/easyDocTypes +HttpAccess=http://margritte:8080/share/easyDocTypes +ThreadTimeOut=600000 diff --git a/framework/qa/complex/loadAllDocuments/InteractionHandler.java b/framework/qa/complex/loadAllDocuments/InteractionHandler.java new file mode 100644 index 000000000000..92d8f3c34543 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/InteractionHandler.java @@ -0,0 +1,155 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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.loadAllDocuments; + +import com.sun.star.beans.PropertyValue; + +import com.sun.star.uno.Exception; +import com.sun.star.uno.RuntimeException; + +import com.sun.star.task.XInteractionHandler; +import com.sun.star.task.XInteractionAbort; +import com.sun.star.task.XInteractionRetry; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.AnyConverter; + +//import java.lang.*; + + +/** + * Implemets a simple interaction handler, + * which can abort all incoming interactions only ... but make it possible to + * log it. So it can be used for debug and test purposes. + */ +public class InteractionHandler implements XInteractionHandler +{ + // ____________________ + + /** + * @const RETRY_COUNT it defines the max count of + * retrying of an interaction + */ + private static final int RETRY_COUNT = 3; + + // ____________________ + + /** + * @member m_aRequest the origianl interaction request + * safed for later analyzing + * @member m_bWasUsed true if the interaction handler was used + * @member m_nTry count using of RETRY continuations + */ + private Object m_aRequest ; + private int m_nTry ; + private boolean m_bWasUsed ; + + + /** + * ctor + * It's initialize an object of this class with default values + * and set the protocol stack. So the outside code can check + * if this handler was used or not. + */ + public InteractionHandler() + { + m_aRequest = null ; + //m_aProtocol = aProtocol; + m_nTry = 0 ; + m_bWasUsed = false; + } + + /** + * Called to start the interaction, because the outside code whish to solve + * a detected problem or to inform the user about something. + * We safe the informations here and can handle two well known continuations + * only. + * [abort and retry]. + * + * @param xRequest + * describe the interaction + */ + public void handle(com.sun.star.task.XInteractionRequest xRequest) + { + m_bWasUsed = true; + + // first sav thje original request + // Our user can use this information later for some debug analyzing + Object aRequest = xRequest.getRequest(); + synchronized(this) + { + m_aRequest = aRequest; + } + + // analyze the possible continuations. + // We can abort all incoming interactions only. + // But additional we can try to continue it several times too. + // Of course after e.g. three loops we have to stop and abort it. + com.sun.star.task.XInteractionContinuation[] lContinuations = xRequest.getContinuations(); + + com.sun.star.task.XInteractionAbort xAbort = null; + com.sun.star.task.XInteractionRetry xRetry = null; + com.sun.star.uno.Type xAbortType = new com.sun.star.uno.Type(com.sun.star.task.XInteractionAbort.class); + com.sun.star.uno.Type xRetryType = new com.sun.star.uno.Type(com.sun.star.task.XInteractionRetry.class); + + for (int i=0; i<lContinuations.length; ++i) + { + try + { + if (xAbort == null) + xAbort = (com.sun.star.task.XInteractionAbort)AnyConverter.toObject(xAbortType, lContinuations[i]); + if (xRetry == null) + xRetry = (com.sun.star.task.XInteractionRetry)AnyConverter.toObject(xRetryType, lContinuations[i]); + } + catch(com.sun.star.lang.IllegalArgumentException exArg) {} + } + + // try it again, but only if it wasn't tried to much before. + if (xRetry != null) + { + synchronized(this) + { + if (m_nTry < RETRY_COUNT) + { + ++m_nTry; + xRetry.select(); + return; + } + } + } + + // otherwhise we can abort this interaction only + if (xAbort != null) + { + xAbort.select(); + } + } + + public boolean wasUsed() { + return m_bWasUsed; + } +} diff --git a/framework/qa/complex/loadAllDocuments/StatusIndicator.java b/framework/qa/complex/loadAllDocuments/StatusIndicator.java new file mode 100644 index 000000000000..c28993010ed8 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/StatusIndicator.java @@ -0,0 +1,237 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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.loadAllDocuments; + +// __________ Imports __________ + +// structs, const, ... +import com.sun.star.beans.PropertyValue; + +// exceptions +import com.sun.star.uno.Exception; +import com.sun.star.uno.RuntimeException; + +// interfaces +import com.sun.star.task.XStatusIndicator; + +// helper +import com.sun.star.uno.UnoRuntime; + +// others +//import java.lang.*; + +// __________ Implementation __________ + +/** + * Implemets a simple status indicator, which + * provide informations about state of a load request. + * It can be used as an argument e.g. for loadComponentFromURL(). + */ +public class StatusIndicator implements com.sun.star.task.XStatusIndicator +{ + // ____________________ + + /** + * @const SHOWSTATUS_NO don't show the status - but save information about using of this indicator object + * @const SHOWSTATUS_LOG the possible set protocol object will be used (it covers STDOUT, STDERR automaticly too) + * @const SHOWSTATUS_DIALOG the status will be shown inside a java dialog + * @const SHOWSTATUS_LINK the status will be notified to interested listener (one listener only!) + */ + public static final int SHOWSTATUS_NO = 0; + public static final int SHOWSTATUS_LOG = 1; + public static final int SHOWSTATUS_DIALOG = 4; + public static final int SHOWSTATUS_LINK = 8; + + // ____________________ + + /** + * @member m_sText text, which describe the current status + * @member m_nRange max value for any progress + * @member m_nValue the progress value + * @member m_nOut regulate, how the status will be shown + * @member m_aProtocol used for logging and transport information about used interface of this object + */ + private String m_sText ; + private int m_nRange ; + private int m_nValue ; + private int m_nOut ; +// private Protocol m_aProtocol ; + private boolean m_bWasUsed ; + + // ____________________ + + /** + * ctor + * It's initialize an object of this class with default values. + */ + public StatusIndicator( int nOut) + { + m_sText = new String() ; + m_nRange = 100 ; + m_nValue = 0 ; + m_nOut = nOut ; + //m_aProtocol = aProtocol ; + m_bWasUsed = false; +// aProtocol.resetUsingState(); + } + + // ____________________ + + /** + * It starts the progress and set the initial text and range. + * + * @param sText + * the initial text for showing + * + * @param nRange + * the new range for following progress + */ + public void start( /*IN*/String sText, /*IN*/int nRange ) + { + synchronized(this) + { + //m_aProtocol.log("start("+sText+","+nRange+")\n"); + m_bWasUsed = true; +// m_aProtocol.itWasUsed(); + + m_sText = sText ; + m_nRange = nRange; + m_nValue = 0 ; + } + impl_show(); + } + + // ____________________ + + /** + * Finish the progress and reset internal members. + */ + public void end() + { + synchronized(this) + { + //m_aProtocol.log("end()\n"); + m_bWasUsed = true; +// m_aProtocol.itWasUsed(); + + m_sText = new String(); + m_nRange = 100; + m_nValue = 0; + } + impl_show(); + } + + // ____________________ + + /** + * Set the new description text. + * + * @param sText + * the new text for showing + */ + public void setText( /*IN*/String sText ) + { + synchronized(this) + { + //m_aProtocol.log("setText("+sText+")\n"); + m_bWasUsed = true; +// m_aProtocol.itWasUsed(); + + m_sText = sText; + } + impl_show(); + } + + // ____________________ + + /** + * Set the new progress value. + * + * @param nValue + * the new progress value + * Must fit the range! + */ + public void setValue( /*IN*/int nValue ) + { + synchronized(this) + { + //m_aProtocol.log("setValue("+nValue+")\n"); + m_bWasUsed = true; +// m_aProtocol.itWasUsed(); + + if (nValue<=m_nRange) + m_nValue = nValue; + } + impl_show(); + } + + // ____________________ + + /** + * Reset text and progress value to her defaults. + */ + public void reset() + { + synchronized(this) + { + //m_aProtocol.log("reset()\n"); + m_bWasUsed = true; +// m_aProtocol.itWasUsed(); + + m_sText = new String(); + m_nValue = 0; + } + impl_show(); + } + + // ____________________ + + /** + * Internal helper to show the status. + * Currently it's implement as normal text out on stdout. + * But of course other thimngs are possible here too. + * e.g. a dialog + */ + private void impl_show() + { +/* synchronized(this) + { + if ((m_nOut & SHOWSTATUS_LOG) == SHOWSTATUS_LOG) + //m_aProtocol.log("\t["+m_nValue+"/"+m_nRange+"] "+m_sText+"\n"); + + //if ((m_nOut & SHOWSTATUS_DIALOG) == SHOWSTATUS_DIALOG) + // not supported yet! + + //if ((m_nOut & SHOWSTATUS_LINK) == SHOWSTATUS_LINK) + // not supported yet! + } */ + } + + public boolean wasUsed() { + return m_bWasUsed; + } +} diff --git a/framework/qa/complex/loadAllDocuments/StreamSimulator.java b/framework/qa/complex/loadAllDocuments/StreamSimulator.java new file mode 100644 index 000000000000..7b59c25d0a79 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/StreamSimulator.java @@ -0,0 +1,474 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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.loadAllDocuments; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.lang.XMultiServiceFactory; + +/** + * Simulates an input and output stream and + * implements the interfaces XInputStream, XOutputStream. + * So it can be used for testing loading/saving of documents + * using streams instead of URLs. + */ +public class StreamSimulator implements com.sun.star.io.XInputStream , + com.sun.star.io.XOutputStream , + com.sun.star.io.XSeekable +{ + //_________________________________ + /** + * @member m_sFileName name of the corrsponding file on disk + * @member m_xInStream the internal input stream for reading + * @member m_xOutStream the internal input stream for writing + * @member m_xSeek points at runtime to m_xInStream or m_xOutStream and make it seekable + * + * @member m_bInWasUsed indicates, that the input stream interface was used + * @member m_bOutWasUsed indicates, that the output stream interface was used + */ + + private String m_sFileName ; + private com.sun.star.io.XInputStream m_xInStream ; + private com.sun.star.io.XOutputStream m_xOutStream ; + private com.sun.star.io.XSeekable m_xSeek ; + + public boolean m_bInWasUsed ; + public boolean m_bOutWasUsed ; + + /** + * construct a new instance of this class + * It set the name of the correspojnding file on disk, which + * should be source or target for the following operations on + * this object. And it regulate if it should function as + * input or output stream. + * + * @param sFileName + * name of the file on disk + * Will be used as source (if param bInput==true) + * or as target (if param bInput==false). + * + * @param bInput + * it specify, which interface should work at this object. + * <TRUE/> => we simulate an input stream + * <FALSE/> => we simulate an output stream + * + * @throw com.sun.star.io.NotConnectedException + * in case the internal streams to the file on disk couldn't + * be established. + * They are neccessary. Otherwhise this simulator can't + * really work. + */ + public StreamSimulator(XMultiServiceFactory xMSF, + String sFileName, boolean bInput) + throws com.sun.star.io.NotConnectedException + { + m_sFileName = sFileName ; + m_bInWasUsed = false ; + m_bOutWasUsed = false ; + + try + { + XSimpleFileAccess xHelper = (XSimpleFileAccess) + UnoRuntime.queryInterface(XSimpleFileAccess.class, + xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess")); + + if (xHelper == null) + throw new com.sun.star.io.NotConnectedException( + "ucb helper not available. Can't create streams."); + + if (bInput) + { + m_xInStream = xHelper.openFileRead(m_sFileName); + m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface( + com.sun.star.io.XSeekable.class, + m_xInStream); + } + else + { + m_xOutStream = xHelper.openFileWrite(m_sFileName); + m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface( + com.sun.star.io.XSeekable.class, + m_xOutStream); + } + } + catch(com.sun.star.uno.Exception exUno) + { + throw new com.sun.star.io.NotConnectedException( + "Could not open the file."); + } + } + + /** + * following methods simulates the XInputStream. + * The notice all actions inside the internal protocol + * and try to map all neccessary functions to the internal + * open in-stream. + */ + public int readBytes(byte[][] lData, int nBytesToRead ) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException + { + m_bInWasUsed = true; + + if (m_xInStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + int nRead = 0; + try + { + nRead = m_xInStream.readBytes(lData,nBytesToRead); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + + return nRead; + } + + public int readSomeBytes(byte[][] lData, int nMaxBytesToRead) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException , + com.sun.star.io.IOException + { + m_bInWasUsed = true; + + if (m_xInStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + int nRead = 0; + try + { + nRead = m_xInStream.readSomeBytes(lData,nMaxBytesToRead); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + return nRead; + } + + //_________________________________ + + public void skipBytes(int nBytesToSkip) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException , + com.sun.star.io.IOException + { + m_bInWasUsed = true; + + if (m_xInStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + try + { + m_xInStream.skipBytes(nBytesToSkip); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + } + + public int available() throws com.sun.star.io.NotConnectedException, + com.sun.star.io.IOException + { + m_bInWasUsed = true; + + if (m_xInStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + int nAvailable = 0; + try + { + nAvailable = m_xInStream.available(); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + return nAvailable; + } + + //_________________________________ + + public void closeInput() throws com.sun.star.io.NotConnectedException, + com.sun.star.io.IOException + { + m_bInWasUsed = true; + + if (m_xInStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + try + { + m_xInStream.closeInput(); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + } + + /** + * following methods simulates the XOutputStream. + * The notice all actions inside the internal protocol + * and try to map all neccessary functions to the internal + * open out-stream. + */ + public void writeBytes(byte[] lData) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException , + com.sun.star.io.IOException + { + m_bOutWasUsed = true; + + if (m_xOutStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + try + { + m_xOutStream.writeBytes(lData); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + } + + //_________________________________ + + public void flush() throws com.sun.star.io.NotConnectedException , + com.sun.star.io.BufferSizeExceededException , + com.sun.star.io.IOException + { + m_bOutWasUsed = true; + + if (m_xOutStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + try + { + m_xOutStream.flush(); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + } + + //_________________________________ + + public void closeOutput() throws com.sun.star.io.NotConnectedException , + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException + { + m_bOutWasUsed = true; + + if (m_xOutStream == null) + { + throw new com.sun.star.io.NotConnectedException("stream not open"); + } + + try + { + m_xOutStream.closeOutput(); + } + catch (com.sun.star.io.NotConnectedException exConnect) { + } + catch (com.sun.star.io.BufferSizeExceededException exBuffer ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + } + + /** + * following methods simulates the XSeekable. + * The notice all actions inside the internal protocol + * and try to map all neccessary functions to the internal + * open stream. + */ + public void seek(long nLocation ) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.io.IOException + { + if (m_xInStream != null) + m_bInWasUsed = true; + else + if (m_xOutStream != null) + m_bOutWasUsed = true; +// else + //m_aProtocol.log("\tno stream open!\n"); + + if (m_xSeek == null) + { + throw new com.sun.star.io.IOException("stream not seekable"); + } + + try + { + m_xSeek.seek(nLocation); + } + catch (com.sun.star.lang.IllegalArgumentException exArg ) { + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + } + + public long getPosition() throws com.sun.star.io.IOException + { + + if (m_xInStream != null) + m_bInWasUsed = true; + else + if (m_xOutStream != null) + m_bOutWasUsed = true; +// else + //m_aProtocol.log("\tno stream open!\n"); + + if (m_xSeek == null) + { + throw new com.sun.star.io.IOException("stream not seekable"); + } + + long nPos = 0; + try + { + nPos = m_xSeek.getPosition(); + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + return nPos; + } + + //_________________________________ + + public long getLength() throws com.sun.star.io.IOException + { + + if (m_xInStream != null) + m_bInWasUsed = true; + else + if (m_xOutStream != null) + m_bOutWasUsed = true; +// else + //m_aProtocol.log("\tno stream open!\n"); + + if (m_xSeek == null) + { + throw new com.sun.star.io.IOException("stream not seekable"); + } + + long nLen = 0; + try + { + nLen = m_xSeek.getLength(); + } + catch (com.sun.star.io.IOException exIO ) { + } + catch (com.sun.star.uno.RuntimeException exRuntime) { + } + catch (com.sun.star.uno.Exception exUno ) { + } + + return nLen; + } +} diff --git a/framework/qa/complex/loadAllDocuments/TestDocument.java b/framework/qa/complex/loadAllDocuments/TestDocument.java new file mode 100644 index 000000000000..fe41a6161c4a --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/TestDocument.java @@ -0,0 +1,41 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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.loadAllDocuments; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument +{ + public static String getUrl(String name) + { + return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); + } + + private TestDocument() {} +} diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/Calc_6.sxc b/framework/qa/complex/loadAllDocuments/testdocuments/Calc_6.sxc Binary files differnew file mode 100644 index 000000000000..4b2b572085dc --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/Calc_6.sxc diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/Writer6.sxw b/framework/qa/complex/loadAllDocuments/testdocuments/Writer6.sxw Binary files differnew file mode 100644 index 000000000000..1b2c2cb2dab6 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/Writer6.sxw diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/draw1.sxd b/framework/qa/complex/loadAllDocuments/testdocuments/draw1.sxd Binary files differnew file mode 100644 index 000000000000..58c8772cb04b --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/draw1.sxd diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/imp1.sxi b/framework/qa/complex/loadAllDocuments/testdocuments/imp1.sxi Binary files differnew file mode 100644 index 000000000000..efcdf9b6a25e --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/imp1.sxi diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/password_check.sxw b/framework/qa/complex/loadAllDocuments/testdocuments/password_check.sxw Binary files differnew file mode 100644 index 000000000000..ec545b99e22a --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/password_check.sxw diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/pic.gif b/framework/qa/complex/loadAllDocuments/testdocuments/pic.gif Binary files differnew file mode 100644 index 000000000000..abbbc65f6340 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/pic.gif diff --git a/framework/qa/complex/loadAllDocuments/testdocuments/pic.jpg b/framework/qa/complex/loadAllDocuments/testdocuments/pic.jpg Binary files differnew file mode 100644 index 000000000000..6b4b744f8ea1 --- /dev/null +++ b/framework/qa/complex/loadAllDocuments/testdocuments/pic.jpg |