From e7ae0941207b0c8d27c80162127b25d90788a112 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Tue, 9 Nov 2004 12:47:23 +0000 Subject: INTEGRATION: CWS jl13 (1.1.2); FILE ADDED 2004/10/21 09:23:45 sg 1.1.2.1: #116217#NEW: initial version --- ucb/qa/complex/tdoc/CheckContentProvider.java | 431 ++++++++++++++++++++++++++ 1 file changed, 431 insertions(+) create mode 100755 ucb/qa/complex/tdoc/CheckContentProvider.java (limited to 'ucb/qa') diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java new file mode 100755 index 000000000000..f5cbceea5ec3 --- /dev/null +++ b/ucb/qa/complex/tdoc/CheckContentProvider.java @@ -0,0 +1,431 @@ +/************************************************************************* + * + * $RCSfile: CheckContentProvider.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Date: 2004-11-09 13:47:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.beans.XPropertiesChangeNotifier; +import com.sun.star.beans.XPropertyContainer; +import com.sun.star.beans.XPropertySetInfoChangeNotifier; +import com.sun.star.container.XChild; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.text.XTextDocument; +import com.sun.star.ucb.XCommandInfoChangeNotifier; +import com.sun.star.ucb.XCommandProcessor; +import com.sun.star.ucb.XContent; +import com.sun.star.ucb.XContentIdentifier; +import com.sun.star.ucb.XContentIdentifierFactory; +import com.sun.star.ucb.XContentProvider; +import com.sun.star.uno.UnoRuntime; +import complexlib.ComplexTestCase; +import complex.tdoc.interfaces._XChild; +import complex.tdoc.interfaces._XCommandInfoChangeNotifier; +import complex.tdoc.interfaces._XComponent; +import complex.tdoc.interfaces._XServiceInfo; +import complex.tdoc.interfaces._XTypeProvider; +import complex.tdoc.interfaces._XCommandProcessor; +import complex.tdoc.interfaces._XContent; +import complex.tdoc.interfaces._XPropertiesChangeNotifier; +import complex.tdoc.interfaces._XPropertyContainer; +import complex.tdoc.interfaces._XPropertySetInfoChangeNotifier; +import lib.TestEnvironment; +import util.WriterTools; +import util.utils; + +/** + * Check the TransientDocumentsContentProvider (TDOC). Three documents are + * loaded. Then every possible TDCP content type is instantiated and its + * interfaces are tested.
+ * Important: opened documents are numbered in the order they are opened and + * numbers are not reused. This test will work only, if you start a new office + * with an accept parameter (writer is initially opened). Otherwise loaded + * documents are not found. + */ +public class CheckContentProvider extends ComplexTestCase { + private final String testDocuments[] = new String[]{"filter.sxw", "chinese.sxw", "Iterator.sxw"}; + private final int countDocs = testDocuments.length; + private XMultiServiceFactory xMSF = null; + private XTextDocument[] xTextDoc = null; + private XContent xContent = null; + + /** + * The test methods: the test methods have to be executed in a specified + * order. This order is: + *
    + *
  1. "checkTDOCRoot"
  2. + *
  3. "checkTDOCRootInterfaces"
  4. + *
  5. "checkTDOCDocument"
  6. + *
  7. "checkTDOCDocumentInterfaces"
  8. + *
  9. "checkTDOCFolder"
  10. + *
  11. "checkTDOCFolderInterfaces"
  12. + *
  13. "checkTDOCStream"
  14. + *
  15. "checkTDOCStreamInterfaces"
  16. + *
+ * Important is, that the test of the element comes first, then the test of + * its interfaces. + **/ + public String[] getTestMethodNames() { + return new String[]{"checkTDOCRoot", + "checkTDOCRootInterfaces", + "checkTDOCDocument", + "checkTDOCDocumentInterfaces", + "checkTDOCFolder", + "checkTDOCFolderInterfaces", + "checkTDOCStream", + "checkTDOCStreamInterfaces", + }; + } + + /** + * Open some documents before the test + */ + public void before() { + xMSF = (XMultiServiceFactory)param.getMSF(); + xTextDoc = new XTextDocument[countDocs]; + log.println("Open some new documents."); + for (int i=0; i + *
  • XTypeProvider
  • + *
  • XServiceInfo
  • + *
  • XCommandProcessor
  • + *
  • XChild
  • + *
  • XPropertiesChangeNotifier
  • + *
  • XPropertySetInfoChangeNotifier
  • + *
  • XCommandInfoChangeNotifier
  • + *
  • XContent
  • + *
  • XPropertyContainer
  • + *
  • XComponent
  • + * + * @param hasParent True, if the tested content type does have a parent: + * only the root has not. Used in the XChild interface test. + */ + private void checkInterfaces(boolean hasParent) { + // check the XTypeProvider interface + _XTypeProvider xTypeProvider = new _XTypeProvider(); + xTypeProvider.oObj = (XTypeProvider)UnoRuntime.queryInterface(XTypeProvider.class, xContent); + xTypeProvider.log = log; + assure("getImplementationId()", xTypeProvider._getImplementationId()); + assure("getTypes()", xTypeProvider._getTypes()); + + // check the XSewrviceInfo interface + _XServiceInfo xServiceInfo = new _XServiceInfo(); + xServiceInfo.oObj = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, xContent); + xServiceInfo.log = log; + assure("getImplementationName()", xServiceInfo._getImplementationName()); + assure("getSupportedServiceNames()", xServiceInfo._getSupportedServiceNames()); + assure("supportsService()", xServiceInfo._supportsService()); + + // check the XCommandProcessor interface + _XCommandProcessor xCommandProcessor = new _XCommandProcessor(); + xCommandProcessor.oObj = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xContent); + xCommandProcessor.log = log; + xCommandProcessor.before((XMultiServiceFactory)param.getMSF()); + assure("createCommandIdentifier()", xCommandProcessor._createCommandIdentifier()); + assure("execute()", xCommandProcessor._execute()); + assure("abort()", xCommandProcessor._abort()); + + // check the XChild interface + _XChild xChild = new _XChild(); + xChild.oObj = (XChild)UnoRuntime.queryInterface(XChild.class, xContent); + xChild.log = log; + // hasParent dermines, if this content has a parent + assure("getParent()", xChild._getParent(hasParent)); + // parameter does dermine, if this funczion is supported: generally not supported with tdcp content + assure("setParent()", xChild._setParent(false)); + + // check the XPropertyChangeNotifier interface + _XPropertiesChangeNotifier xPropChange = new _XPropertiesChangeNotifier(); + xPropChange.oObj = (XPropertiesChangeNotifier)UnoRuntime.queryInterface(XPropertiesChangeNotifier.class, xContent); + xPropChange.log = log; + assure("addPropertiesChangeListener()", xPropChange._addPropertiesChangeListener()); + assure("removePropertiesChangeListener()", xPropChange._removePropertiesChangeListener()); + + // check the XPropertySetInfoChangeNotifier interface + _XPropertySetInfoChangeNotifier xPropSetInfo = new _XPropertySetInfoChangeNotifier(); + xPropSetInfo.oObj = (XPropertySetInfoChangeNotifier)UnoRuntime.queryInterface(XPropertySetInfoChangeNotifier.class, xContent); + xPropSetInfo.log = log; + assure("addPropertiesChangeListener()", xPropSetInfo._addPropertiesChangeListener()); + assure("removePropertiesChangeListener()", xPropSetInfo._removePropertiesChangeListener()); + + // check the XCommandInfoChangeNotifier interface + _XCommandInfoChangeNotifier xCommandChange = new _XCommandInfoChangeNotifier(); + xCommandChange.oObj = (XCommandInfoChangeNotifier)UnoRuntime.queryInterface(XCommandInfoChangeNotifier.class, xContent); + xCommandChange.log = log; + assure("addCommandInfoChangeListener()", xCommandChange._addCommandInfoChangeListener()); + assure("removeCommandInfoChangeListener()", xCommandChange._removeCommandInfoChangeListener()); + + // check the XContent interface + _XContent xCont = new _XContent(); + xCont.oObj = (XContent)UnoRuntime.queryInterface(XContent.class, xContent); + xCont.log = log; + assure("addContentEventListener()", xCont._addContentEventListener()); + assure("getContentType()", xCont._getContentType()); + assure("getIdentifier()", xCont._getIdentifier()); + assure("removeContentEventListener()", xCont._removeContentEventListener()); + + // check the XPropertyContainer interface + _XPropertyContainer xPropCont = new _XPropertyContainer(); + xPropCont.oObj = (XPropertyContainer)UnoRuntime.queryInterface(XPropertyContainer.class, xContent); + xPropCont.log = log; + assure("addProperty()", xPropCont._addProperty()); + assure("removeProperty()", xPropCont._removeProperty()); + + // check the XComponent interface + _XComponent xComponent = new _XComponent(); + xComponent.oObj = (XComponent)UnoRuntime.queryInterface(XComponent.class, xContent); + xComponent.log = log; + assure("addEventListener()", xComponent._addEventListener()); + assure("removeEventListener()", xComponent._removeEventListener()); +// assure("dispose()", xComponent._dispose()); + } +} -- cgit