diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-11 16:25:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-12 08:16:17 +0000 |
commit | 117a82cd090ddd8efbc500350dc6082730f04720 (patch) | |
tree | 50c07684d43c06fd54d17532caca6a3afafd6967 /qadevOOo/runner/util | |
parent | 04b183a9bc792a53a9f081353a79486faa4f3872 (diff) |
java: remove dead code in qadevOOo
found by running UCDetector over the code many times, like peeling
an onion
Change-Id: I54d5147eb1b5c921ad236331bc4c1f765b13ca83
Reviewed-on: https://gerrit.libreoffice.org/13445
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'qadevOOo/runner/util')
20 files changed, 1 insertions, 942 deletions
diff --git a/qadevOOo/runner/util/BasicMacroTools.java b/qadevOOo/runner/util/BasicMacroTools.java deleted file mode 100644 index ead35dd78b40..000000000000 --- a/qadevOOo/runner/util/BasicMacroTools.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ -package util; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XNameAccess; -import com.sun.star.frame.XController; -import com.sun.star.frame.XDispatch; -import com.sun.star.frame.XDispatchProvider; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XModel; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.script.XLibraryContainer; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.*; -import com.sun.star.util.URL; -import com.sun.star.util.XURLTransformer; - - - -public class BasicMacroTools { - private final XDispatchProvider mDispProv; - private final XMultiServiceFactory mMSF; - private final XURLTransformer mParser; - private final XNameAccess mLCxNA; //LibraryContainer::XNameAccess - private final XLibraryContainer mLCxLC; //LibraryContainer::XLibraryContainer - - /* - *While initializing the Basic Libraries will be appendend to the Document - */ - public BasicMacroTools(XMultiServiceFactory msf, XModel xModel, - XComponent xDoc) throws java.lang.Exception { - mMSF = msf; - mDispProv = makeDispatchProvider(xModel); - mParser = makeParser(mMSF); - - Object DocLibCont = null; - - try { - XPropertySet xDocProps = UnoRuntime.queryInterface( - XPropertySet.class, xDoc); - DocLibCont = xDocProps.getPropertyValue("BasicLibraries"); - } catch (com.sun.star.uno.Exception e) { - throw new Exception( - "Couldn't get BasicLibraries-Container from document", e); - } - - mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, - DocLibCont); - - mLCxLC = UnoRuntime.queryInterface( - XLibraryContainer.class, DocLibCont); - } - - /* - * While initializing the Basic Libraries will be appendend to the Office - */ - public BasicMacroTools(XMultiServiceFactory msf, XModel xModel) - throws java.lang.Exception { - mMSF = msf; - mDispProv = makeDispatchProvider(xModel); - mParser = makeParser(mMSF); - - Object ASLC = null; - - try { - ASLC = mMSF.createInstance( - "com.sun.star.script.ApplicationScriptLibraryContainer"); - } catch (com.sun.star.uno.Exception e) { - throw new Exception("Couldn't create ApplicationScriptLibraryContainer", e); - } - - mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, - ASLC); - - mLCxLC = UnoRuntime.queryInterface( - XLibraryContainer.class, ASLC); - } - - private static XDispatchProvider makeDispatchProvider(XModel aModel) - throws java.lang.Exception { - XController xController = aModel.getCurrentController(); - XFrame xFrame = xController.getFrame(); - - if (xFrame == null) { - throw new Exception("Could not create DispatchProvider"); - } - - return UnoRuntime.queryInterface( - XDispatchProvider.class, xFrame); - } - - private static XURLTransformer makeParser(XMultiServiceFactory mMSF) - throws java.lang.Exception { - return UnoRuntime.queryInterface( - XURLTransformer.class, mMSF.createInstance( - "com.sun.star.util.URLTransformer")); - } - - public void loadLibrary(String LibraryName, String LibraryURL) - throws java.lang.Exception { - try { - appendLibrary(LibraryName, LibraryURL); - } catch (java.lang.Exception e) { - throw new Exception("Could not append Library " + LibraryName, e); - } - - try { - mLCxLC.loadLibrary(LibraryName); - } catch (com.sun.star.container.NoSuchElementException e) { - throw new Exception("Could not load Library " + LibraryName, e); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new Exception("Could not load Library " + LibraryName, e); - } - } - - private void appendLibrary(String LibraryName, String LibraryURL) - throws java.lang.Exception { - try { - removeLibrary(LibraryName); - } catch (java.lang.Exception e) { - } - - try { - mLCxLC.createLibraryLink(LibraryName, LibraryURL, false); - } catch (com.sun.star.container.ElementExistException e) { - throw new Exception("Library " + LibraryName + "already exists.", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new Exception("Could not link Basic library " + LibraryName, e); - } - } - - public void removeLibrary(String LibraryName) throws java.lang.Exception { - if (mLCxNA.hasByName(LibraryName)) { - try { - mLCxLC.removeLibrary(LibraryName); - } catch (com.sun.star.container.NoSuchElementException e) { - throw new Exception("Could not remove Basic library " + LibraryName + ", Library does not exist", e); - } catch (com.sun.star.lang.WrappedTargetException e) { - throw new Exception("Could not remove Basic library " + LibraryName, e); - } - } - } - - public void runMarco(String MacroName) throws java.lang.Exception { - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = "macro://./" + MacroName; //Standard.Stock.GetSymbol('micro','')"; - mParser.parseStrict(aParseURL); - - URL aURL = aParseURL[0]; - XDispatch xDispatcher = mDispProv.queryDispatch(aURL, "", 0); - - if (xDispatcher != null) { - xDispatcher.dispatch(aURL, null); - } else { - throw new Exception("Could not run Macro " + MacroName); - } - } - - /** - * Set the given <CODE>secureURL</CODE> as secure URL for marco execution. - * The macros of documents located in <CODE>secureURL</CODE> will be executed - * automatically. - * @param xMSF the XMultiServiceFactory - * @param secureURL the URL the documet is located - * @throws java.lang.Exception throws this exception on any error - */ - public static void addSecureBasicMarcosURL(XMultiServiceFactory xMSF, String secureURL) - throws Exception { - - secureURL = utils.getFullURL(secureURL); - - // configure Office to allow to execute macos - PropertyValue[] ProvArgs = new PropertyValue [1]; - PropertyValue Arg = new PropertyValue(); - Arg.Name = "nodepath"; - Arg.Value = "/org.openoffice.Office.Common/Security"; - ProvArgs[0] = Arg; - - Object oProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider"); - - - XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oProvider); - - Object oSecure = oProviderMSF.createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationUpdateAccess", - ProvArgs); - - XPropertySet oSecureProps = UnoRuntime.queryInterface(XPropertySet.class, oSecure); - - Object oScripting = oSecureProps.getPropertyValue("Scripting"); - XPropertySet oScriptingSettings = UnoRuntime.queryInterface(XPropertySet.class, oScripting); - - oScriptingSettings.setPropertyValue("SecureURL", new String[]{secureURL}); - oScriptingSettings.setPropertyValue("OfficeBasic", Integer.valueOf(2)); - - XChangesBatch oSecureChange = UnoRuntime.queryInterface(XChangesBatch.class, oSecure); - oSecureChange.commitChanges(); - } -} diff --git a/qadevOOo/runner/util/BookmarkDsc.java b/qadevOOo/runner/util/BookmarkDsc.java index 3f4b8943b714..95d6a57f2d1c 100644 --- a/qadevOOo/runner/util/BookmarkDsc.java +++ b/qadevOOo/runner/util/BookmarkDsc.java @@ -36,11 +36,6 @@ public class BookmarkDsc extends InstDescr { initBookmark(); } - public BookmarkDsc( String name ) { - this.name = name; - initBookmark(); - } - @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/ControlDsc.java b/qadevOOo/runner/util/ControlDsc.java deleted file mode 100644 index 736fe01b0351..000000000000 --- a/qadevOOo/runner/util/ControlDsc.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; - -/** - * Describes a Control to be inserted in a container - */ - -public class ControlDsc extends InstDescr { - - private String name; - static final String ifcName = "com.sun.star.form.XFormComponent"; - String service = "com.sun.star.form.component.CommandButton"; - - public ControlDsc( String kind ) { - service="com.sun.star.form.component."+kind; - initControl(); - } - @Override - public String getName() { - return name; - } - - @Override - public String getIfcName() { - return ifcName; - } - @Override - public String getService() { - return service; - } - - private void initControl() { - try { - ifcClass = Class.forName( ifcName ); - } - catch( ClassNotFoundException cnfE ) { - } - } - @Override - public XInterface createInstance( XMultiServiceFactory docMSF ) { - - Object SrvObj = null; - try { - SrvObj = docMSF.createInstance( service ); - } - catch( com.sun.star.uno.Exception cssuE ){ - } - - XInterface Control = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj ); - - return Control; - - } -} diff --git a/qadevOOo/runner/util/FootnoteDsc.java b/qadevOOo/runner/util/FootnoteDsc.java index dc0574157324..3fc082a3de62 100644 --- a/qadevOOo/runner/util/FootnoteDsc.java +++ b/qadevOOo/runner/util/FootnoteDsc.java @@ -36,11 +36,6 @@ public class FootnoteDsc extends InstDescr { initFootnote(); } - public FootnoteDsc( String name ) { - this.name = name; - initFootnote(); - } - @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java index 644a2530c5e5..7a069de899e7 100644 --- a/qadevOOo/runner/util/FrameDsc.java +++ b/qadevOOo/runner/util/FrameDsc.java @@ -46,12 +46,6 @@ public class FrameDsc extends InstDescr { initFrame(); } - public FrameDsc( String FrameName, int nHeight, int nWidth ) { - name = FrameName; - height = nHeight; - width = nWidth; - initFrame(); - } @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/InstDescr.java b/qadevOOo/runner/util/InstDescr.java index 7b349b0f8427..7b7098be6867 100644 --- a/qadevOOo/runner/util/InstDescr.java +++ b/qadevOOo/runner/util/InstDescr.java @@ -31,12 +31,6 @@ abstract public class InstDescr { protected abstract String getName(); /** - * the method getIfcClass - */ - public Class<?> getIfcClass() { - return ifcClass; - } - /** * the method getService */ protected abstract String getService(); diff --git a/qadevOOo/runner/util/ParagraphDsc.java b/qadevOOo/runner/util/ParagraphDsc.java index 318ada2e0e5b..e4c73a6969a3 100644 --- a/qadevOOo/runner/util/ParagraphDsc.java +++ b/qadevOOo/runner/util/ParagraphDsc.java @@ -37,11 +37,6 @@ public class ParagraphDsc extends InstDescr { initParagraph(); } - public ParagraphDsc( String name ) { - this.name = name; - initParagraph(); - } - @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/ReferenceMarkDsc.java b/qadevOOo/runner/util/ReferenceMarkDsc.java deleted file mode 100644 index 82f8c3ffc7e4..000000000000 --- a/qadevOOo/runner/util/ReferenceMarkDsc.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.text.XTextContent; - -/** - * the class ReferenceMarkDsc - */ -public class ReferenceMarkDsc extends InstDescr { - - private static final String service = "com.sun.star.text.ReferenceMark"; - private static final String ifcName = "com.sun.star.text.XTextContent"; - private String name = null; - - - public ReferenceMarkDsc() { - initReferenceMark(); - } - - public ReferenceMarkDsc( String name ) { - this.name = name; - initReferenceMark(); - } - - @Override - public String getName() { - return name; - } - - @Override - public String getIfcName() { - return ifcName; - } - - @Override - public String getService() { - return service; - } - - private void initReferenceMark() { - try { - ifcClass = Class.forName( ifcName ); - } - catch( ClassNotFoundException cnfE ) { - } - } - @Override - public XInterface createInstance( XMultiServiceFactory docMSF ) { - Object ServiceObj = null; - - try { - ServiceObj = docMSF.createInstance( service ); - } - catch( com.sun.star.uno.Exception cssuE ){ - } - XTextContent RM = (XTextContent)UnoRuntime.queryInterface( ifcClass, - ServiceObj ); - return RM; - } -}
\ No newline at end of file diff --git a/qadevOOo/runner/util/StyleFamilyDsc.java b/qadevOOo/runner/util/StyleFamilyDsc.java deleted file mode 100644 index daef8b563401..000000000000 --- a/qadevOOo/runner/util/StyleFamilyDsc.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; - -/** - * the class StyleFamilyDsc - */ -public class StyleFamilyDsc extends InstDescr { - - private String name; - static final String ifcName = "com.sun.star.style.XStyle"; - String service = "com.sun.star.style.CharacterStyle"; - - public StyleFamilyDsc( String kind ) { - service = "com.sun.star.style." + kind; - initStyleFamily(); - } - @Override - public String getName() { - return name; - } - - @Override - public String getIfcName() { - return ifcName; - } - @Override - public String getService() { - return service; - } - - private void initStyleFamily() { - try { - ifcClass = Class.forName( ifcName ); - } - catch( ClassNotFoundException cnfE ) { - } - } - @Override - public XInterface createInstance( XMultiServiceFactory docMSF ) { - - - Object SrvObj = null; - try { - SrvObj = docMSF.createInstance( service ); - } - catch( com.sun.star.uno.Exception cssuE ){ - } - - XInterface StyleFamily = (XInterface)UnoRuntime.queryInterface(ifcClass, SrvObj ); - - return StyleFamily; - - } -} diff --git a/qadevOOo/runner/util/TableDsc.java b/qadevOOo/runner/util/TableDsc.java index 905e117879c9..09dd50d1200f 100644 --- a/qadevOOo/runner/util/TableDsc.java +++ b/qadevOOo/runner/util/TableDsc.java @@ -43,12 +43,6 @@ public class TableDsc extends InstDescr { initTable(); } - public TableDsc( String TableName, int nRows, int nColumns ) { - name = TableName; - rows = nRows; - columns = nColumns; - initTable(); - } @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/TextSectionDsc.java b/qadevOOo/runner/util/TextSectionDsc.java index 814d59c147f1..5478b4c59d34 100644 --- a/qadevOOo/runner/util/TextSectionDsc.java +++ b/qadevOOo/runner/util/TextSectionDsc.java @@ -36,11 +36,6 @@ public class TextSectionDsc extends InstDescr { initTextSection(); } - public TextSectionDsc( String name ) { - this.name = name; - initTextSection(); - } - @Override public String getName() { return name; diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index 48ed314e0b00..73603622063c 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -205,26 +205,6 @@ public class UITools { } } - /** - * returns the message of a Basic-MessageBox - * @return the message of a Basic-MessageBox - * @throws java.lang.Exception if something fail - */ - public String getMsgBoxText() - throws java.lang.Exception - { - try{ - XAccessibleContext xMessage =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.LABEL); - - XInterface xMessageInterface = UnoRuntime.queryInterface(XInterface.class, xMessage); - - return getString(xMessageInterface); - } catch (Exception e) { - throw new Exception("Could not get message from Basic-MessageBox:", e); - } - } - /** * Prints the accessible tree to the <CODE>logWriter</CODE> only if <CODE>debugIsActive</CODE> * is set to <CODE>true</CODE> diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java index f814f1a6b9b2..87cc2e712cc6 100644 --- a/qadevOOo/runner/util/ValueChanger.java +++ b/qadevOOo/runner/util/ValueChanger.java @@ -800,8 +800,6 @@ public class ValueChanger { Class<?> enumClass = oldValue.getClass(); Field[] flds = enumClass.getFields(); - newValue = null; - for (int i = 0; i < flds.length; i++) { if (Enum.class.equals(flds[i].getType().getSuperclass())) { diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index bc989da981e6..24438008b8a1 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -51,15 +51,6 @@ public class XMLTools { */ public AttributeList() {} - /** - * Constructs a list which will report to <code>log</code> - * specified about each <code>XDocumentHandler</code> method - * call. - */ - public AttributeList(PrintWriter log) { - this.log = log ; - } - private AttributeList(XAttributeList list) { if (list == null) return ; for (short i = 0; i < list.getLength(); i++) { @@ -468,20 +459,6 @@ public class XMLTools { /** * Creates a tag with the name specified, which must have an - * attribute with name specified. The value of this attribute - * doesn't make sense. - * @param tagName The name of the tag. - * @param attrName The name of attribute which must be contained - * in the tag. - */ - public Tag(String tagName, String attrName) { - name = tagName ; - attrList = new String[1][3] ; - attrList[0][0] = attrName ; - } - - /** - * Creates a tag with the name specified, which must have an * attribute with the value specified. The type of value * assumed to be 'CDATA'. * @param tagName The name of the tag. @@ -498,43 +475,6 @@ public class XMLTools { } /** - * Creates a tag with the name specified, which must have - * attributes specified. The value of thesee attributes - * doesn't make sense. - * @param tagName The name of the tag. - * @param attrNames Array with names of attributes which must - * be contained in the tag. - */ - public Tag(String tagName, String[] attrNames) { - name = tagName ; - attrList = new String[attrNames.length][3] ; - for (int i = 0; i < attrNames.length; i++) { - attrList[i][0] = attrNames[i] ; - } - } - - /** - * Creates a tag with the name specified, which must have an - * attributes with their values specified. The type of all values - * assumed to be 'CDATA'. - * @param tagName The name of the tag. - * @param attrValues An array with attribute names and their values. - * <code>attrValues[N][0]</code> element contains the name of Nth - * attribute, and <code>attrValues[N][1]</code> element contains - * value of Nth attribute, if value is <code>null</code> then the - * attribute value can be any. - */ - public Tag(String tagName, String[][] attrValues) { - name = tagName ; - attrList = new String[attrValues.length][3] ; - for (int i = 0; i < attrValues.length; i++) { - attrList[i][0] = attrValues[i][0] ; - attrList[i][1] = "CDATA" ; - attrList[i][2] = attrValues[i][1] ; - } - } - - /** * Gets tag String description. */ @Override diff --git a/qadevOOo/runner/util/compare/DocComparator.java b/qadevOOo/runner/util/compare/DocComparator.java deleted file mode 100644 index f46e46a6012d..000000000000 --- a/qadevOOo/runner/util/compare/DocComparator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util.compare; - -import java.io.IOException; - -public interface DocComparator { - - boolean isReferenceExistent() throws IOException; - - boolean isDiffReferenceExistent() throws IOException; - - boolean compareDiff() throws IOException; - -} diff --git a/qadevOOo/runner/util/compare/DocComparatorFactory.java b/qadevOOo/runner/util/compare/DocComparatorFactory.java deleted file mode 100644 index 470cb0376368..000000000000 --- a/qadevOOo/runner/util/compare/DocComparatorFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util.compare; - -import lib.TestParameters; - -public class DocComparatorFactory -{ - /** - * @param s is a name like 'ooo' 'pdf' or 'msoffice' - * @return a new DocComparator Object - */ - static public DocComparator createComparator(String s, TestParameters aParams) throws IllegalArgumentException - { - if (s.equalsIgnoreCase("gfx") || s.equalsIgnoreCase("graphical")) - { - return GraphicalComparator.getInstance(aParams); - } - else if (s.equalsIgnoreCase("pdf")) - { - throw new IllegalArgumentException("PDF not implemented yet."); - } - else - { - throw new IllegalArgumentException("DocComparator for '" + s + "' not supported!"); - } - - // unreachable: return null; - } - -} diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java deleted file mode 100644 index 3e91dd04d280..000000000000 --- a/qadevOOo/runner/util/compare/GraphicalComparator.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ -package util.compare; - -import convwatch.GraphicalDifferenceCheck; -import convwatch.GraphicalTestArguments; -import convwatch.DirectoryHelper; -import convwatch.FileHelper; - -import lib.TestParameters; -import java.io.IOException; - -import convwatch.ConvWatchException; - -class GraphicalComparator implements DocComparator -{ - private final GraphicalTestArguments m_aArguments; - - protected GraphicalComparator(TestParameters aParams) - { - m_aArguments = new GraphicalTestArguments(aParams); - } - - /** - * @return an instance of this object, but only it's interface - */ - static DocComparator getInstance(TestParameters aParams) - { - // setting the default test parameter - // TEST aParams - GraphicalComparator a = new GraphicalComparator(aParams); - return a; - } - - - - /** - * build a new file from _sEntry by - * replacing the path equals to _sInputPath with _sReferencePath and replace it's suffix by _sNewSuffix. - * If _sInputPath is empty, replace the whole path by _sReferencePath. - */ - private String createSpecialFile(String _sEntry, String _sInputPath, String _sReferencePath, String _sNewSuffix) - { - String fs = System.getProperty("file.separator"); - String sNewSubDir = ""; - if (_sInputPath.length() > 0) - { - sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(_sEntry, _sInputPath); - } - String sNameNoSuffix = FileHelper.getNameNoSuffix(FileHelper.getBasename(_sEntry)); - - // add the sub path to the difference path - String sNewReferencePath; - if (sNewSubDir.length() > 0) - { - sNewReferencePath = _sReferencePath + fs + sNewSubDir; - } - else - { - sNewReferencePath = _sReferencePath; - } - // add the difference name - sNewReferencePath += fs + sNameNoSuffix + _sNewSuffix; - return sNewReferencePath; - } - - private boolean isReferenceOrDiffExistent(String _sNewSuffix) - { - boolean isExistent = false; - - // LLA? What if sReferencePath is a directory, but directory is empty? is the result then true or false; - - // wir muessen durch den InputPath durch und dann fuer jedes Dokument prufen, ob im angegebenen ReferencePath eine Reference existiert. - String sInputPath = m_aArguments.getInputPath(); - if (FileHelper.isDir(sInputPath)) - { - Object[] aList = DirectoryHelper.traverse(sInputPath, FileHelper.getFileFilter(), m_aArguments.includeSubDirectories()); - for (int i=0;i<aList.length;i++) - { - // get document + path - String sEntry = (String)aList[i]; - String sNewReferencePath = createSpecialFile(sEntry, sInputPath, m_aArguments.getReferencePath(), _sNewSuffix); - // split path from document path which only is equal to sInputPath (sub path) - if (FileHelper.exists(sNewReferencePath)) - { - isExistent = true; - } - } - } - else - { - // sInputPath is a file - String sNewReferencePath = createSpecialFile(sInputPath, "", m_aArguments.getReferencePath(), _sNewSuffix); - if (FileHelper.exists(sNewReferencePath)) - { - isExistent = true; - } - } - return isExistent; - } - - /** - * REFERENCE_PATH must set to directory/file, where the reference (*.prn files) (should) exist - */ - public boolean isReferenceExistent() - { - return isReferenceOrDiffExistent(".prn"); - } - - /** - * INPUT_PATH must set, to directory/file, where the documents exist. - * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) will create. - */ - public void createReference() throws IOException - { - // woher kommt das TestDocument - // INPUT_PATH - // wohin - // REFERENCE_PATH - // mit was (Reference Application) - // AppExecutionCmd - try - { - String referenceInputPath = null; - if(m_aArguments.getReferenceInputPath() == null) - { - GraphicalDifferenceCheck.createReferences(m_aArguments.getInputPath(), m_aArguments.getReferencePath(), m_aArguments); - } - else - { - referenceInputPath = m_aArguments.getReferenceInputPath(); - GraphicalDifferenceCheck.createReferences(referenceInputPath, m_aArguments.getReferencePath(), m_aArguments); - } - } - catch (ConvWatchException e) - { - // wrap it to IOException - java.io.IOException ex2 = new java.io.IOException(e.getMessage()); - ex2.initCause(e); - throw ex2; - } - } - - /** - * INPUT_PATH must set, to directory/file, where the documents exist. - * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) will create. - * OUTPUT_PATH must set to a directory, there the whole ouptut will create - */ - public boolean compare() throws IOException - { - try - { - if (FileHelper.isDebugEnabled()) - { - System.err.println(" Inputpath: '" + m_aArguments.getInputPath() + "'"); - System.err.println(" Outputpath: '" + m_aArguments.getOutputPath() + "'"); - System.err.println("Referencepath: '" + m_aArguments.getReferencePath() + "'"); - } - return GraphicalDifferenceCheck.check(m_aArguments.getInputPath(), m_aArguments.getOutputPath(), m_aArguments.getReferencePath(), m_aArguments); - } - catch(ConvWatchException e) - { - // wrap it to IOException - if (FileHelper.isDebugEnabled()) - { - System.err.println("Exception caught"); - System.err.println(" Inputpath: '" + m_aArguments.getInputPath() + "'"); - System.err.println(" Outputpath: '" + m_aArguments.getOutputPath() + "'"); - System.err.println("Referencepath: '" + m_aArguments.getReferencePath() + "'"); - } - java.io.IOException ex2 = new java.io.IOException(e.getMessage()); - ex2.initCause(e); - throw ex2; - } - } - - /** - * - * INPUT_PATH must set to the original documents the directory structure is taken to see if the references exist in the DIFF_PATH - * DIFF_PATH must set to the diff references - */ - public boolean isDiffReferenceExistent() throws IOException - { - return isReferenceOrDiffExistent(".prn.diff0001.jpg"); - } - - /** - * INPUT_PATH must set, to directory/file, where the documents exist. - * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) exists. - * OUTPUT_PATH must set to a directory, where the whole ouptut will create. Here the diffReference will create. - * At the momemt it's not possible to say only where the diffreferences will create. - */ - public void createDiffReference() throws IOException - { - // this is the same like compareDiff(), but trash the result. - compareDiff(); - } - - /** - * INPUT_PATH must set, to directory/file, where the documents exist. - * REFERENCE_PATH must set to directory/file, where the created references (*.prn files) exists. - * OUTPUT_PATH must set to a directory, where the whole ouptut will create. - * DIFF_PATH must set to a directory, where the older difference references exist, it's possible to set this to the same as REFERENCE_PATH - * but this is not the default and will not automatically set. - */ - public boolean compareDiff() throws IOException - { - try - { - return GraphicalDifferenceCheck.check(m_aArguments.getInputPath(), m_aArguments.getOutputPath(), m_aArguments.getReferencePath(), m_aArguments.getDiffPath(), m_aArguments); - } - catch(ConvWatchException e) - { - // wrap it to IOException - java.io.IOException ex2 = new java.io.IOException(e.getMessage()); - ex2.initCause(e); - throw ex2; - } - } - -} diff --git a/qadevOOo/runner/util/compare/PDFComparator.java b/qadevOOo/runner/util/compare/PDFComparator.java deleted file mode 100644 index edd7e7ea1908..000000000000 --- a/qadevOOo/runner/util/compare/PDFComparator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 regarding copyright - * ownership. The ASF licenses this file 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 . - */ - -package util.compare; - -import lib.TestParameters; - -class PDFComparator extends GraphicalComparator -{ - protected PDFComparator(TestParameters aParams) - { - super(aParams); - } - - static DocComparator getInstance(TestParameters aParams) - { - aParams.put(convwatch.PropertyName.DOC_COMPARATOR_REFERENCE_TYPE, "pdf"); - PDFComparator a = new PDFComparator(aParams); - return a; - } - -} - diff --git a/qadevOOo/runner/util/db/DatabaseDocument.java b/qadevOOo/runner/util/db/DatabaseDocument.java index 4b8228f316a1..8ad6d770155c 100644 --- a/qadevOOo/runner/util/db/DatabaseDocument.java +++ b/qadevOOo/runner/util/db/DatabaseDocument.java @@ -44,11 +44,6 @@ public class DatabaseDocument m_storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument ); } - public DataSource getDataSource() - { - return m_dataSource; - } - public XOfficeDatabaseDocument getDatabaseDocument() { return m_databaseDocument; diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 3fe4f2b64e5a..76d1666f248d 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -193,24 +193,7 @@ public class utils { return fulldocURL; } - /** - * - * This method creates folders needed - * - */ - public static void make_Directories(String first, String path) { - String already_done = null; - String fs = System.getProperty("file.separator"); - StringTokenizer path_tokenizer = new StringTokenizer(path, fs, false); - already_done = first; - while (path_tokenizer.hasMoreTokens()) { - String part = path_tokenizer.nextToken(); - File new_dir = new File(already_done + File.separatorChar + part); - already_done = new_dir.toString(); - //create the directory - new_dir.mkdirs(); - } - } + |