This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push: new 23b2c88cd6 Fixed typos, removed whitespace 23b2c88cd6 is described below commit 23b2c88cd6a69e823600adadb373bff76b7eaa26 Author: mseidel <msei...@apache.org> AuthorDate: Sun Sep 18 11:34:55 2022 +0200 Fixed typos, removed whitespace --- .../complex/framework/recovery/RecoveryTest.java | 368 ++++++++++----------- 1 file changed, 184 insertions(+), 184 deletions(-) diff --git a/main/framework/qa/complex/framework/recovery/RecoveryTest.java b/main/framework/qa/complex/framework/recovery/RecoveryTest.java index 13b0348f0e..016f4e63cb 100644 --- a/main/framework/qa/complex/framework/recovery/RecoveryTest.java +++ b/main/framework/qa/complex/framework/recovery/RecoveryTest.java @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -91,22 +91,22 @@ import static org.junit.Assert.*; // ------------------------------------------ public class RecoveryTest extends ComplexTestCase { - + static XMultiServiceFactory xMSF; static SOfficeFactory SOF; static RecoveryTools rt; /** - * If you devid the screen in four parts in the first of them the office + * If you divide the screen in four parts in the first of them the office * windows should be placed. The range of the first quarter is stored in the variable. - */ + */ static Point windowMaxPosition; /** * The office windows starts in the first quarter of the screen. In this variable * the maximum size for the windows was stored so the windows can be placed * visible on the screen. - */ + */ static Size windowMaxSize; - + /** * All office windows will be placed by this test on randomized positions. * This positions was stored in this Hashmap. The keys are the frame names @@ -114,30 +114,30 @@ public class RecoveryTest extends ComplexTestCase { * @see com.sun.star.awt.Rectangle */ private Hashtable windowsPosSize = new Hashtable(); - + /** * A function to tell the framework, which test functions are available. * @return All test methods. * * @todo: hidden documents * @todo: running presentation - * @todo: modular dialogs like Hpyerlink-Dialog - * @todo: sceond view of a document + * @todo: modular dialogs like Hyperlink-Dialog + * @todo: second view of a document * @todo: remove recovery data before start test * @todo: after a second start after the crash there should no documents recovered anymore * @todo: enable remove of recovery files - * @todo: makefile anpassen auf Parameter überprüfen + * @todo: modify makefile to check for parameters */ public String[] getTestMethodNames() { return new String[]{"testCrash"}; } - + /** Create the environment for following tests. * Use either a component loader from desktop or * from frame * @throws Exception Exception */ - + public void normalCrash(){ cleanRecoveryData(); startOffice(); @@ -150,18 +150,18 @@ public class RecoveryTest extends ComplexTestCase { handleCrashReporterDialog(true, true); checkDocumentCount(expectedDocumentCount); } - + public void testCrash(){ cleanRecoveryData(); restoreBackupRecoveryData(); startOffice(); int expectedDocumentCount = 3; -// handleRecoveryDialog_QuickExit(expectedDocumentCount); +// handleRecoveryDialog_QuickExit(expectedDocumentCount); handleRecoveryDialog_QuickExitAndSave(expectedDocumentCount); //handleCrashReporterDialog(true, true); //checkDocumentCount(expectedDocumentCount); } - + public void before() throws Exception { String msg ="\n\n\tPATH TO OFFICE BINARY MISSING!\n"; @@ -179,20 +179,20 @@ public class RecoveryTest extends ComplexTestCase { msg += "Please append to your command the following parameter:\n\n"; msg += "\t-NoOffice=true"; assure(msg, param.getBool("NoOffice")); - - + + rt = new RecoveryTools(param ,log); - + rt.removeParametersFromAppExecutionCommand(); - + log.println("start the office to test recovery feature..."); - + // make window ranges makeWindowPositionRage(); - + //makeRecoveryData(); } - + private void makeRecoveryData(){ cleanRecoveryData(); startOffice(); @@ -203,17 +203,17 @@ public class RecoveryTest extends ComplexTestCase { backupRecoveryData(); cleanRecoveryData(); } - + private void startOffice(){ assure("Could not connect to office", connect()); log.setWatcher(param.get("Watcher")); } - - + + private void checkDocumentCount(int expectedDocumentCount){ XEnumeration allComp = DesktopTools.getAllComponents(xMSF); int documentCount = 0; - + try{ while (allComp.hasMoreElements()){ allComp.nextElement(); @@ -222,21 +222,21 @@ public class RecoveryTest extends ComplexTestCase { } catch ( com.sun.star.container.NoSuchElementException e){} catch ( com.sun.star.lang.WrappedTargetException e){} - + String msg ="The amount of documents to recover is different form the expected amount:\n"; msg += "\texpected:\t" + expectedDocumentCount + "\n"; msg += "\tto recover:\t" + documentCount; assure(msg, expectedDocumentCount == documentCount); } - + /** * This function starts an office instance. It uses the AppExecutionCommad parameter. * @return TRUE if office is connected otherwise FALSE - */ + */ private boolean connect(){ try { - + OfficeProvider oProvider = new OfficeProvider(); xMSF = (XMultiServiceFactory)oProvider.getManager(param); @@ -246,25 +246,25 @@ public class RecoveryTest extends ComplexTestCase { catch (java.lang.Exception e) { log.println(e.getClass().getName()); log.println("Message: " + e.getMessage()); - failed("Cannot connect the Office."); + failed("Cannot connect the office."); return false; } return true; } - + /** * While creating the test environment the positions and sizes of the frames - * was saved. After the Office has recovered the documents, this functions + * was saved. After the office has recovered the documents, this functions * compares the saved positions and sizes with the current frame. */ private void compareWindowPositions(){ System.out.println("all frames:########"); System.out.println(windowsPosSize.entrySet().toString()); - + XEnumeration allComp = DesktopTools.getAllComponents(xMSF); - + String msg=null; - + while (allComp.hasMoreElements()){ try{ // get all components from the desktop @@ -277,18 +277,18 @@ public class RecoveryTest extends ComplexTestCase { // check if this frame was used in creation of test environment if (windowsPosSize.containsKey(frameName)){ - + Rectangle oldRect = (Rectangle) windowsPosSize.get(frameName); - + XWindow xWindow = xModel.getCurrentController().getFrame().getContainerWindow(); Rectangle newRect = xWindow.getPosSize(); - - + + boolean ok = oldRect.Height == newRect.Height; ok &= oldRect.Width == newRect.Width; ok &= oldRect.X == newRect.X; ok &= oldRect.Y == newRect.Y; - + if (!ok){ msg = "The frame '" + frameName + "' has a different position/size:\n"; msg += "original value -> restored value:\n"; @@ -299,24 +299,24 @@ public class RecoveryTest extends ComplexTestCase { } assure(msg, ok, CONTINUE); - + } } catch (com.sun.star.container.NoSuchElementException e) { } catch ( com.sun.star.lang.WrappedTargetException e) {} } - + } - + /** * This function crashes the office */ private void makeCrash(){ // get all documents Object[] allDocs = DesktopTools.getAllOpenDocuments(xMSF); - + // get one of them for dispatching XComponent xDoc = (XComponent) allDocs[0]; - log.println("make the crash in second thread"); + log.println("make the crash in second thread"); CrashThread crash = new CrashThread(xDoc, xMSF); crash.start(); @@ -327,50 +327,50 @@ public class RecoveryTest extends ComplexTestCase { /** * This function uses accessibility to handle the dialog which appears while the * office is crashed. It click the button "OK" to continue. - */ + */ private void handleRecoveryDialogAfterCrash(int expectedDocumentCount){ try{ - - // if the office crashes, the recovery feature needs some time + + // if the office crashes, the recovery feature needs some time // to save all docs. Therefore the recovery dialog could need some // time to pop up. - log.println("wating for recovery dialog..."); - + log.println("waiting for recovery dialog..."); + int counter = 0; int maximum = param.getInt(PropertyName.THREAD_TIME_OUT) / param.getInt(PropertyName.SHORT_WAIT); - + XDialog oDialog = rt.getActiveDialog(xMSF); - + while ( oDialog == null && (counter < maximum)) { rt.pause(); - oDialog = rt.getActiveDialog(xMSF); + oDialog = rt.getActiveDialog(xMSF); counter ++; } - + assure("could not get Recovery Window",(oDialog != null)); - + XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); - + UITools oUITools = new UITools(xMSF, xWindow); oUITools.printAccessibleTree((PrintWriter) log, param.getBool(PropertyName.DEBUG_IS_ACTIVE)); String[] documents = oUITools.getListBoxItems("The following files will be recovered"); log.println("there are " + documents.length + " documents to save"); - + String msg ="The amount of documents to recover is different form the expected amount:\n"; msg += "\texpected:\t" + expectedDocumentCount + "\n"; msg += "\tto recover:\t" + documents.length; - + assure(msg, expectedDocumentCount == documents.length); - + log.println("disable automatically launch of Office"); - oUITools.setCheckBoxValue("Launch StarOffice automatically", new Integer(0)); - + oUITools.setCheckBoxValue("Launch OpenOffice automatically", new Integer(0)); + log.println("start saving..."); oUITools.clickButton("OK"); - + rt.waitForClosedOffice(); } catch (Exception e){ @@ -378,47 +378,47 @@ public class RecoveryTest extends ComplexTestCase { failed("Could not handle crash-dialog: " + e.toString()); } } - + private void handleCrashReporterDialog(boolean cancel, boolean YesNo){ try{ - + log.println("try to get Crash Reporter Dialog..."); - + XDialog oDialog = rt.getActiveDialog(xMSF); assure("could not get CrashReporter Dialog", oDialog != null); - + XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); - + log.println(oDialog.getTitle()); UITools oUITools = new UITools(xMSF, xWindow); if (cancel) { log.println("clicking 'Cancel' button..."); - + try{ rt.clickThreadButton(xMSF, xWindow, "Cancel"); } catch (com.sun.star.accessibility.IllegalAccessibleComponentStateException e){ failed("Could not click 'Cancel' at CrashReporter Dialog"); } - + } else { log.println("clicking 'Next' button..."); - oUITools.clickButton("Next>>"); + oUITools.clickButton("Next >"); } - + } catch (Exception e){ failed("Could not handle CrashReporter Dialog: " + e.toString()); } } - + private void handleRecoveryDialog_QuickExit(int expectedDocumentCount){ log.println("handle Recovery Dialog at restart: quick exit"); handleRecoveryDialogAtRestart(expectedDocumentCount, false, true); handleAreYouSureDialog(true); handleSaveDocumentsDialog(false); - + } private void handleRecoveryDialog_QuickExitAndSave(int expectedDocumentCount){ log.println("handle Recovery Dialog at restart: quick exit"); @@ -427,31 +427,31 @@ public class RecoveryTest extends ComplexTestCase { handleSaveDocumentsDialog(true); } private void handleRecoveryDialog_Recover(int expectedDocumentCount){ - + } private void handleRecoveryDialog_RecoverAndCrashreporter(int expectedDocumentCount){ - + } /** * This function uses accessibility to handle the dialog which appears while the - * office is started after a crash. It waits until the "next>>" button is enabled + * office is started after a crash. It waits until the "Next" button is enabled * and click it then to continue. * @param expectedDocumentCount the amount of documents which must be displayed in the recovery dialog - * @param recover If the documenst should be recoverd this variable must be true. If it is fasle - * the recovery process was stoped and the button cancel was klicked. - * @param cancel If the recovery is fifnished, this parameter desicdes to klick the "Next" button + * @param recover If the document should be recovered this variable must be true. If it is false + * the recovery process was stopped and the button cancel was clicked. + * @param cancel If the recovery is finished, this parameter decides to click the "Next" button * or the click cancel. If the value is true, the cancel button was clicked. - */ + */ private void handleRecoveryDialogAtRestart(int expectedDocumentCount, boolean recover, boolean cancel){ try{ - + log.println("try to get Recovery Dialog..."); XDialog oDialog = null; oDialog = rt.getActiveDialogAfterStartup(xMSF); - + assure("could not get Recovery Dialog at start of office", (oDialog != null), CONTINUE); - + XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); log.println("got the following dialog: '" +oDialog.getTitle() + "'"); @@ -464,18 +464,18 @@ public class RecoveryTest extends ComplexTestCase { for (int i=0;i<documents.length;i++){ log.println(documents[i]); } - + String msg ="The amount of documents to recover is different form the expected amount:\n"; msg += "\texpected:\t" + expectedDocumentCount + "\n"; msg += "\tto recover:\t" + documents.length; - + assure(msg, expectedDocumentCount ==documents.length); - + if (recover){ - + log.println("clicking 'Start Recovery' button..."); oUITools.clickButton("Start Recovery >"); - + rt.pause(); //XAccessibleContext oButton = oUITools.getButton("Start Recovery >"); @@ -488,15 +488,15 @@ public class RecoveryTest extends ComplexTestCase { log.println("recovering..."); try{ - oButton = oUITools.getButton("Next >"); + oButton = oUITools.getButton("Next >"); } catch (java.lang.NullPointerException e){ // no fault: The title "Start Recovery" switches to "Next" - // while all documents are recoverd + // while all documents are recovered } rt.pause(); counter++; } - + if (cancel) { log.println("clicking 'Cancel' button..."); @@ -513,7 +513,7 @@ public class RecoveryTest extends ComplexTestCase { } rt.pause(); - + } else { log.println("do not recover: clicking 'Cancel' button..."); @@ -523,19 +523,19 @@ public class RecoveryTest extends ComplexTestCase { failed("Could not click 'Cancel' at recovery-dialog"); } } - + } catch (Exception e){ failed("Could not handle recovery-dialog at restart: " + e.toString()); } - + } - + /** * This function uses accessibility to handle the dialog "Are you sure". - * It click "Yes" or "No", dependend on the value of the parameter <CODE>Yes</CODE> + * It click "Yes" or "No", depending on the value of the parameter <CODE>Yes</CODE> * @param yes If value is <CODE>TRUE</CODE> the button "Yes" was clicked, otherwise the button * "No". - */ + */ private void handleAreYouSureDialog(boolean yes) { try{ @@ -548,13 +548,13 @@ public class RecoveryTest extends ComplexTestCase { failed("Could not handle 'Are you sure' dialog."); } } - + /** * This function uses accessibility to handle the dialog "Are you sure". * It click "Yes" or "No", depending on the value of the parameter <CODE>Yes</CODE> * @param saveDocuments If value is <CODE>TRUE</CODE> the button "Yes" was clicked, otherwise the button * "No". - */ + */ private void handleSaveDocumentsDialog(boolean saveDocuments) { try{ @@ -567,9 +567,9 @@ public class RecoveryTest extends ComplexTestCase { assure("could not get 'Save Documents' Dialog: ", (oDialog != null), CONTINUE); UITools oUITools = new UITools(xMSF, oDialog); - + oUITools.printAccessibleTree((PrintWriter) log, param.getBool(PropertyName.DEBUG_IS_ACTIVE)); - + String listBoxName = "Documents"; String[] documents = null; try{ @@ -583,7 +583,7 @@ public class RecoveryTest extends ComplexTestCase { log.println(documents[i]); } String tempURL = utils.getOfficeTempDir(xMSF); - + log.println("the destination for saving is: " + tempURL); try{ oUITools.setTextEditFiledText("Save to", tempURL); @@ -600,10 +600,10 @@ public class RecoveryTest extends ComplexTestCase { failed("Could not handle 'Are you sure' dialog."); } } - + /** * This function gets the current screen size and calculate the first - * quarter of it. This qaurter was used to position to Office windows. + * quarter of it. This quarter was used to position to office windows. * Further this function calculates the maximum window size so the window * is visible if it placed on extreme position. */ @@ -611,50 +611,50 @@ public class RecoveryTest extends ComplexTestCase { Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Point pos = new Point(); Size size = new Size(); - + // get the max position of the first quarter of the screen pos.x = screenDim.width / 2; pos.y = screenDim.height / 2; windowMaxPosition = pos; - + // get the max size of the windows while they placed in windowMaxPosition // range and not outside the visibility size.Height = screenDim.height; size.Width = screenDim.width; windowMaxSize = size; } - + private void generateDesktop(){ - + // create some documents with content makeWriterDoc("WriterDoc1", true); // makeCalcDoc("CalcDoc1", true); // makeDrawDoc("DrawDoc1", true); // makeImpressDoc("ImpressDoc1", true); // makeMathDoc("MathDoc1", true); - + // create some documents without content // makeMathDoc("_blank_math", false); // makeDrawDoc("_blank_draw", false); // makeCalcDoc("_blank_calc", false); // makeWriterDoc("_blank_writer", false); // makeImpressDoc("_blank_impress", false); - + // makeMathDoc("MathDocEmpty", false); // makeDrawDoc("DrawDocEmpty", false); // makeCalcDoc("CalcDocEmpty", false); makeWriterDoc("WriterDocEmpty", false); // makeImpressDoc("ImpressDocEmpty", false); - + log.println("Test object successfully created."); - + } - + private void makeImpressDoc(String frameName, boolean withContent){ log.println("creating Impress document '" + frameName + "'"); XComponent xImpressDoc = createNewImpressDoc(frameName); if (withContent) fillImpressDocWithContent(xImpressDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, xImpressDoc)); } @@ -662,37 +662,37 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Draw document '" + frameName + "'"); XComponent xDrawDoc = createNewDrawDoc(frameName); if (withContent) fillDrawDocWithContent(xDrawDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, xDrawDoc)); } - + private void makeCalcDoc(String frameName, boolean withContent){ log.println("creating Calc document '" + frameName + "'"); XSpreadsheetDocument xSpreadsheetDoc = createNewCalcDoc(frameName); if (withContent) fillCalcDocWithContent(xSpreadsheetDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc)); } - + private void positioningDocument(XModel model){ - + XWindow xWindow = model.getCurrentController().getFrame().getContainerWindow(); String frameName = model.getCurrentController().getFrame().getName(); - + // get randomized position and size - Rectangle posSize = makePosZize(); - + Rectangle posSize = makePosZize(); + // save position and size windowsPosSize.put(frameName, posSize); - + xWindow.setPosSize(posSize.X, posSize.Y, posSize.Width, posSize.Height, com.sun.star.awt.PosSize.POSSIZE); Rectangle test = xWindow.getPosSize(); log.println("x: "+test.X+" y:"+test.Y+" width:"+test.Width+" height:"+test.Height); } - + private Rectangle makePosZize(){ - + Rectangle posSize = new Rectangle(); Random rand = new Random(); @@ -704,34 +704,34 @@ public class RecoveryTest extends ComplexTestCase { int maxWidth = windowMaxSize.Width-posSize.Y; int height = rand.nextInt(maxHeight + 1); int width = rand.nextInt((windowMaxSize.Width-posSize.Y) + 1); - - // be sure that the new size his greater then the half of windowMaxSize + + // be sure that the new size is greater then the half of windowMaxSize posSize.Height = (height < (maxHeight / 2)) ? height + (maxHeight / 2) : height; posSize.Width = (width < (maxWidth / 2)) ? width + (maxWidth / 2) : width; - + return posSize; } - + private void makeMathDoc(String frameName, boolean withContent){ log.println("creating Math document '" + frameName + "'"); XComponent xMathDoc = createNewMathDoc(frameName); if (withContent) fillMathDocWithContent(xMathDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, xMathDoc)); } - + private XComponent createNewMathDoc(String frameName){ XComponent xMathDoc = null; try{ xMathDoc = SOF.createMathDoc(frameName); } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating math document '"+frameName+"':"); + log.println("Exception occurred while creating Math document '"+frameName+"':"); failed("Couldn't create test environment"); } return xMathDoc; } - - private void fillMathDocWithContent(XComponent xMathDoc){ + + private void fillMathDocWithContent(XComponent xMathDoc){ // setting a formula in document final String expFormula = "sum a cdot b"; final XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface @@ -739,34 +739,34 @@ public class RecoveryTest extends ComplexTestCase { try { xPS.setPropertyValue("Formula", expFormula); } catch(com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while filling math document with content."); + log.println("Exception occurred while filling Math document with content."); failed("Couldn't create test environment"); } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while filling math document with content."); + log.println("Exception occurred while filling Math document with content."); failed("Couldn't create test environment"); } catch(com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occurred while filling math document with content."); + log.println("Exception occurred while filling Math document with content."); failed("Couldn't create test environment"); } catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occurred while filling math document with content."); + log.println("Exception occurred while filling Math document with content."); failed("Couldn't create test environment"); } } - + private XComponent createNewImpressDoc(String frameName){ XComponent xImpressDoc = null; try{ xImpressDoc = SOF.createImpressDoc(frameName); } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating impress document '"+frameName+"':"); + log.println("Exception occurred while creating Impress document '"+frameName+"':"); failed("Couldn't create test environment"); } return xImpressDoc; } - - + + private void fillImpressDocWithContent(XComponent xImpressDoc){ - + log.println( "get presentation" ); XPresentationSupplier oPS = (XPresentationSupplier) UnoRuntime.queryInterface(XPresentationSupplier.class, xImpressDoc); @@ -786,35 +786,35 @@ public class RecoveryTest extends ComplexTestCase { try{ oInstance = (XInterface) oSingleMSF.createInstance(); } catch (com.sun.star.uno.Exception e) { - log.println("Could not create custom presentation while filling impress document with content."); + log.println("Could not create custom presentation while filling Impress document with content."); failed("Couldn't create test environment"); } try { xCP.insertByName("FirstPresentation",oInstance); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Could not instert custom presentation while filling impress document with content."); + log.println("Could not insert custom presentation while filling Impress document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.container.ElementExistException e) { - log.println("Could not instert custom presentation while filling impress document with content."); + log.println("Could not insert custom presentation while filling Impress document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Could not instert custom presentation while filling impress document with content."); + log.println("Could not insert custom presentation while filling Impress document with content."); failed("Couldn't create test environment"); } } - + private XComponent createNewDrawDoc(String frameName){ XComponent xDrawDoc = null; try{ xDrawDoc = SOF.createDrawDoc(frameName); } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating draw document '"+frameName+"':"); + log.println("Exception occurred while creating Draw document '"+frameName+"':"); failed("Couldn't create test environment"); } return xDrawDoc; } - + private void fillDrawDocWithContent(XComponent xDrawDoc){ XDrawPagesSupplier oDPS = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); @@ -826,17 +826,17 @@ public class RecoveryTest extends ComplexTestCase { oDP = (XDrawPage) AnyConverter.toObject( new Type(XDrawPage.class),oDPi.getByIndex(0)); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Could not get draw pages while filling draw document with content."); + log.println("Could not get Draw pages while filling Draw document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Could not get draw pages while filling draw document with content."); + log.println("Could not get Draw pages while filling Draw document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Could not get draw pages while filling draw document with content."); + log.println("Could not get Draw pages while filling Draw document with content."); failed("Couldn't create test environment"); } - //get a Shape + // get a Shape log.println( "getting Shape" ); XShapes oShapes = (XShapes) UnoRuntime.queryInterface (XShapes.class, oDP); @@ -861,16 +861,16 @@ public class RecoveryTest extends ComplexTestCase { new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); oShapeProps.setPropertyValue("ZOrder", new Integer(1)); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while setting or getting property value while filling draw document with content."); + log.println("Exception occurred while setting or getting property value while filling Draw document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.beans.UnknownPropertyException e) { - log.println("Exception occurred while setting or getting property value while filling draw document with content."); + log.println("Exception occurred while setting or getting property value while filling Draw document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while setting or getting property value while filling draw document with content."); + log.println("Exception occurred while setting or getting property value while filling Draw document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.beans.PropertyVetoException e) { - log.println("Exception occurred while setting or getting property value while filling draw document with content."); + log.println("Exception occurred while setting or getting property value while filling Draw document with content."); failed("Couldn't create test environment"); } } @@ -879,10 +879,10 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Writer document '" + frameName + "'"); XTextDocument xTextDoc = createNewWriterDoc(frameName); if (withContent) fillWriterDocWithContent(xTextDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, xTextDoc)); } - + private XTextDocument createNewWriterDoc(String frameName){ XTextDocument xTextDoc = null; try { @@ -893,7 +893,7 @@ public class RecoveryTest extends ComplexTestCase { } return xTextDoc; } - + private void fillWriterDocWithContent(XTextDocument xTextDoc){ try{ log.println( "inserting some lines" ); @@ -922,61 +922,61 @@ public class RecoveryTest extends ComplexTestCase { failed("Couldn't create test environment"); } } - + private XSpreadsheetDocument createNewCalcDoc(String frameName){ - + XSpreadsheetDocument xSheetDoc = null; - + try { xSheetDoc = SOF.createCalcDoc(frameName); } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating calc document '"+frameName+"':"); + log.println("Exception occurred while creating Calc document '"+frameName+"':"); failed("Couldn't create test environment"); } return xSheetDoc; } - + private void fillCalcDocWithContent(XSpreadsheetDocument xSpreadsheetDoc){ try{ XSpreadsheets oSpreadsheets = xSpreadsheetDoc.getSheets(); XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class), + new Type(XSpreadsheet.class), oSpreadsheets.getByName( oSpreadsheets.getElementNames()[0])); XCellRange testRange = oSheet.getCellRangeByName("$A$1:$D$4"); XSheetCellRange testSheetRange = (XSheetCellRange) UnoRuntime.queryInterface( - XSheetCellRange.class, + XSheetCellRange.class, testRange); oSheet.getCellByPosition(1, 1).setValue(1); oSheet.getCellByPosition(4, 5).setValue(1); oSheet.getCellByPosition(3, 2).setFormula("xTextDoc"); oSheet.getCellByPosition(3, 3).setFormula("xTextDoc"); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while filling calc document with content."); + log.println("Exception occurred while filling Calc document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Exception occurred while filling calc document with content."); + log.println("Exception occurred while filling Calc document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while filling calc document with content."); + log.println("Exception occurred while filling Calc document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while filling calc document with content."); + log.println("Exception occurred while filling Calc document with content."); failed("Couldn't create test environment"); } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while filling calc document with content."); + log.println("Exception occurred while filling Calc document with content."); failed("Couldn't create test environment"); } } - + /** * copies all files from the backup folder into a folder called backup.recoveryTest - * and copies the Recovery.xcu to recovery.xcu.recoeryTest - */ + * and copies the Recovery.xcu to recovery.xcu.recoveryTest + */ private void backupRecoveryData() { log.println("backup recovery data..."); @@ -988,11 +988,11 @@ public class RecoveryTest extends ComplexTestCase { failed("could not copy recovery data: " + e.toString()); } } - + /** * copies all files from the backup.recoveryTest folder into the backup folder * and copies the Recovery.xcu.recoveryTest to recovery.xcu - */ + */ private void restoreBackupRecoveryData() { log.println("restore backup recovery data..."); @@ -1004,13 +1004,13 @@ public class RecoveryTest extends ComplexTestCase { failed("could not copy recovery data: " + e.toString()); } } - + private void cleanRecoveryData(){ try{ log.println("bootstrapping the office to get user path to remove old recovery data..."); rt.cleanRecoveryData(); - + } catch (com.sun.star.io.IOException e){ failed("could not clean recovery data: " + e.toString()); }