1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir package complex.tdoc; 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir import com.sun.star.beans.XPropertiesChangeNotifier; 30*cdf0e10cSrcweir import com.sun.star.beans.XPropertyContainer; 31*cdf0e10cSrcweir import com.sun.star.beans.XPropertySetInfoChangeNotifier; 32*cdf0e10cSrcweir import com.sun.star.container.XChild; 33*cdf0e10cSrcweir import com.sun.star.lang.XComponent; 34*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 35*cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo; 36*cdf0e10cSrcweir import com.sun.star.lang.XTypeProvider; 37*cdf0e10cSrcweir import com.sun.star.text.XTextDocument; 38*cdf0e10cSrcweir import com.sun.star.ucb.XCommandInfoChangeNotifier; 39*cdf0e10cSrcweir import com.sun.star.ucb.XCommandProcessor; 40*cdf0e10cSrcweir import com.sun.star.ucb.XContent; 41*cdf0e10cSrcweir import com.sun.star.ucb.XContentIdentifier; 42*cdf0e10cSrcweir import com.sun.star.ucb.XContentIdentifierFactory; 43*cdf0e10cSrcweir import com.sun.star.ucb.XContentProvider; 44*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 45*cdf0e10cSrcweir import util.WriterTools; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir import org.junit.After; 48*cdf0e10cSrcweir import org.junit.AfterClass; 49*cdf0e10cSrcweir import org.junit.Before; 50*cdf0e10cSrcweir import org.junit.BeforeClass; 51*cdf0e10cSrcweir import org.junit.Test; 52*cdf0e10cSrcweir import org.openoffice.test.OfficeConnection; 53*cdf0e10cSrcweir import static org.junit.Assert.*; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir /** 56*cdf0e10cSrcweir * Check the TransientDocumentsContentProvider (TDOC). Three documents are 57*cdf0e10cSrcweir * loaded. Then every possible TDCP content type is instantiated and its 58*cdf0e10cSrcweir * interfaces are tested.<br> 59*cdf0e10cSrcweir * Important: opened documents are numbered in the order they are opened and 60*cdf0e10cSrcweir * numbers are not reused. This test will work only, if you start a new office 61*cdf0e10cSrcweir * with an accept parameter (writer is initially opened). Otherwise loaded 62*cdf0e10cSrcweir * documents are not found. 63*cdf0e10cSrcweir */ 64*cdf0e10cSrcweir public class CheckContentProvider { 65*cdf0e10cSrcweir private final String testDocuments[] = new String[]{"filter.sxw", "chinese.sxw", "Iterator.sxw"}; 66*cdf0e10cSrcweir private final int countDocs = testDocuments.length; 67*cdf0e10cSrcweir private XMultiServiceFactory xMSF = null; 68*cdf0e10cSrcweir private XTextDocument[] xTextDoc = null; 69*cdf0e10cSrcweir private XContent xContent = null; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir /** 72*cdf0e10cSrcweir * The test methods: the test methods have to be executed in a specified 73*cdf0e10cSrcweir * order. This order is: 74*cdf0e10cSrcweir * <ol> 75*cdf0e10cSrcweir * <li>"checkTDOCRoot"</li> 76*cdf0e10cSrcweir * <li>"checkTDOCRootInterfaces"</li> 77*cdf0e10cSrcweir * <li>"checkTDOCDocument"</li> 78*cdf0e10cSrcweir * <li>"checkTDOCDocumentInterfaces"</li> 79*cdf0e10cSrcweir * <li>"checkTDOCFolder"</li> 80*cdf0e10cSrcweir * <li>"checkTDOCFolderInterfaces"</li> 81*cdf0e10cSrcweir * <li>"checkTDOCStream"</li> 82*cdf0e10cSrcweir * <li>"checkTDOCStreamInterfaces"</li> 83*cdf0e10cSrcweir * </ol> 84*cdf0e10cSrcweir * Important is, that the test of the element comes first, then the test of 85*cdf0e10cSrcweir * its interfaces. 86*cdf0e10cSrcweir **/ 87*cdf0e10cSrcweir // public String[] getTestMethodNames() { 88*cdf0e10cSrcweir // return new String[]{"checkTDOCRoot", 89*cdf0e10cSrcweir // "checkTDOCRootInterfaces", 90*cdf0e10cSrcweir // "checkTDOCDocument", 91*cdf0e10cSrcweir // "checkTDOCDocumentInterfaces", 92*cdf0e10cSrcweir // "checkTDOCFolder", 93*cdf0e10cSrcweir // "checkTDOCFolderInterfaces", 94*cdf0e10cSrcweir // "checkTDOCStream", 95*cdf0e10cSrcweir // "checkTDOCStreamInterfaces", 96*cdf0e10cSrcweir // }; 97*cdf0e10cSrcweir // } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir /** 100*cdf0e10cSrcweir * Open some documents before the test 101*cdf0e10cSrcweir */ 102*cdf0e10cSrcweir @Before public void before() { 103*cdf0e10cSrcweir xMSF = getMSF(); 104*cdf0e10cSrcweir xTextDoc = new XTextDocument[countDocs]; 105*cdf0e10cSrcweir System.out.println("Open some new documents."); 106*cdf0e10cSrcweir for (int i=0; i<countDocs; i++) { 107*cdf0e10cSrcweir String fileName = TestDocument.getUrl(testDocuments[i]); 108*cdf0e10cSrcweir System.out.println("Doc " + i + ": " + fileName); 109*cdf0e10cSrcweir xTextDoc[i] = WriterTools.loadTextDoc(xMSF, fileName); 110*cdf0e10cSrcweir assertNotNull("Can't load document " + fileName, xTextDoc[i]); 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir /** 115*cdf0e10cSrcweir * Close the documents 116*cdf0e10cSrcweir */ 117*cdf0e10cSrcweir @After public void after() { 118*cdf0e10cSrcweir System.out.println("Close all documents."); 119*cdf0e10cSrcweir for (int i=0; i<countDocs; i++) { 120*cdf0e10cSrcweir xTextDoc[i].dispose(); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir /** 125*cdf0e10cSrcweir * Check the tdcp root. 126*cdf0e10cSrcweir */ 127*cdf0e10cSrcweir @Test public void checkTDOCRoot() { 128*cdf0e10cSrcweir try { 129*cdf0e10cSrcweir // create a content provider 130*cdf0e10cSrcweir Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider"); 131*cdf0e10cSrcweir XContentProvider xContentProvider = 132*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentProvider.class, o); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // create the ucb 135*cdf0e10cSrcweir XContentIdentifierFactory xContentIdentifierFactory = 136*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker")); 137*cdf0e10cSrcweir // create a content identifier from the ucb for tdoc 138*cdf0e10cSrcweir XContentIdentifier xContentIdentifier = 139*cdf0e10cSrcweir xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/"); 140*cdf0e10cSrcweir // get content 141*cdf0e10cSrcweir xContent = xContentProvider.queryContent(xContentIdentifier); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir String content = xContent.getContentType(); 144*cdf0e10cSrcweir System.out.println("#### Content root: " + content); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // try to get some documents: should be "countDocs" at least. 147*cdf0e10cSrcweir XContentIdentifier[] xContentId = new XContentIdentifier[countDocs+5]; 148*cdf0e10cSrcweir XContent[] xCont = new XContent[countDocs+5]; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir for (int i=0; i<countDocs+5; i++) { 151*cdf0e10cSrcweir xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i); 152*cdf0e10cSrcweir // get content 153*cdf0e10cSrcweir xCont[i] = xContentProvider.queryContent(xContentId[i]); 154*cdf0e10cSrcweir int returnVal = xContentProvider.compareContentIds(xContentId[i], xContentIdentifier); 155*cdf0e10cSrcweir String cont = null; 156*cdf0e10cSrcweir if (xCont[i] != null) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir cont = xCont[i].getContentType(); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir System.out.println("Document Content " + i + ": " + cont + " compare with root: " + returnVal); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir xContentId[i] = xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/" + i + "/content.xml"); 163*cdf0e10cSrcweir // get content 164*cdf0e10cSrcweir xCont[i] = xContentProvider.queryContent(xContentId[i]); 165*cdf0e10cSrcweir cont = null; 166*cdf0e10cSrcweir if (xCont[i] != null) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir cont = xCont[i].getContentType(); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir System.out.println("\tContent.xml Content " + i + ": " + cont); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir util.dbg.printInterfaces(xContent); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir catch(Exception e) { 176*cdf0e10cSrcweir e.printStackTrace(); 177*cdf0e10cSrcweir fail("Unexpected Exception: " + e.getMessage()); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir /** 182*cdf0e10cSrcweir * Check the interfaces of the root. 183*cdf0e10cSrcweir */ 184*cdf0e10cSrcweir @Test public void checkTDOCRootInterfaces() { 185*cdf0e10cSrcweir checkInterfaces(false); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir /** 189*cdf0e10cSrcweir * Check the tdcp document: document 3 is used. 190*cdf0e10cSrcweir */ 191*cdf0e10cSrcweir @Test public void checkTDOCDocument() { 192*cdf0e10cSrcweir try { 193*cdf0e10cSrcweir xContent = null; 194*cdf0e10cSrcweir Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider"); 195*cdf0e10cSrcweir XContentProvider xContentProvider = 196*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentProvider.class, o); 197*cdf0e10cSrcweir // create the ucb 198*cdf0e10cSrcweir XContentIdentifierFactory xContentIdentifierFactory = 199*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker")); 200*cdf0e10cSrcweir // create a content identifier from the ucb for tdoc 201*cdf0e10cSrcweir XContentIdentifier xContentIdentifier = 202*cdf0e10cSrcweir xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/3"); 203*cdf0e10cSrcweir // get content 204*cdf0e10cSrcweir xContent = xContentProvider.queryContent(xContentIdentifier); 205*cdf0e10cSrcweir // assertNotNull(xContent); 206*cdf0e10cSrcweir String content = xContent.getContentType(); 207*cdf0e10cSrcweir System.out.println("#### Document root: " + content); 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir catch(Exception e) { 210*cdf0e10cSrcweir e.printStackTrace(); 211*cdf0e10cSrcweir fail("Unexpected Exception: " + e.getMessage()); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir /** 216*cdf0e10cSrcweir * Check the interfaces on the document. 217*cdf0e10cSrcweir */ 218*cdf0e10cSrcweir @Test public void checkTDOCDocumentInterfaces() { 219*cdf0e10cSrcweir checkInterfaces(true); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir /** 223*cdf0e10cSrcweir * Check a folder on document 2 (document 2 contains an embedded picture and 224*cdf0e10cSrcweir * therefore contans a subfolder "Pictures" 225*cdf0e10cSrcweir */ 226*cdf0e10cSrcweir @Test public void checkTDOCFolder() { 227*cdf0e10cSrcweir try { 228*cdf0e10cSrcweir xContent = null; 229*cdf0e10cSrcweir Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider"); 230*cdf0e10cSrcweir XContentProvider xContentProvider = 231*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentProvider.class, o); 232*cdf0e10cSrcweir // create the ucb 233*cdf0e10cSrcweir XContentIdentifierFactory xContentIdentifierFactory = 234*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker")); 235*cdf0e10cSrcweir // create a content identifier from the ucb for tdoc 236*cdf0e10cSrcweir XContentIdentifier xContentIdentifier = 237*cdf0e10cSrcweir xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/2/Pictures"); 238*cdf0e10cSrcweir // get content 239*cdf0e10cSrcweir xContent = xContentProvider.queryContent(xContentIdentifier); 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir String content = xContent.getContentType(); 242*cdf0e10cSrcweir System.out.println("#### Folder type: " + content); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir catch(Exception e) { 245*cdf0e10cSrcweir e.printStackTrace(); 246*cdf0e10cSrcweir fail("Unexpected Exception: " + e.getMessage()); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir /** 251*cdf0e10cSrcweir * Check the interfaces on the folder. 252*cdf0e10cSrcweir */ 253*cdf0e10cSrcweir @Test public void checkTDOCFolderInterfaces() { 254*cdf0e10cSrcweir checkInterfaces(true); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir /** 258*cdf0e10cSrcweir * Open a stream to the embedded picture of document 1. 259*cdf0e10cSrcweir */ 260*cdf0e10cSrcweir @Test public void checkTDOCStream() { 261*cdf0e10cSrcweir try { 262*cdf0e10cSrcweir xContent = null; 263*cdf0e10cSrcweir Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsContentProvider"); 264*cdf0e10cSrcweir XContentProvider xContentProvider = 265*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentProvider.class, o); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir // create the ucb 268*cdf0e10cSrcweir XContentIdentifierFactory xContentIdentifierFactory = 269*cdf0e10cSrcweir UnoRuntime.queryInterface(XContentIdentifierFactory.class, xMSF.createInstance("com.sun.star.ucb.UniversalContentBroker")); 270*cdf0e10cSrcweir // create a content identifier from the ucb for tdoc 271*cdf0e10cSrcweir XContentIdentifier xContentIdentifier = 272*cdf0e10cSrcweir xContentIdentifierFactory.createContentIdentifier("vnd.sun.star.tdoc:/1/Pictures/10000000000000640000004B9C743800.gif"); 273*cdf0e10cSrcweir // get content 274*cdf0e10cSrcweir xContent = xContentProvider.queryContent(xContentIdentifier); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir String content = xContent.getContentType(); 277*cdf0e10cSrcweir System.out.println("#### Folder type: " + content); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir catch(Exception e) { 280*cdf0e10cSrcweir e.printStackTrace(); 281*cdf0e10cSrcweir fail("Unexpected Exception: " + e.getMessage()); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir /** 286*cdf0e10cSrcweir * Check the interfaces on the stream. 287*cdf0e10cSrcweir */ 288*cdf0e10cSrcweir @Test public void checkTDOCStreamInterfaces() { 289*cdf0e10cSrcweir checkInterfaces(true); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir /** 293*cdf0e10cSrcweir * Since all tdcp content types implement (nearly) the same interfaces, they 294*cdf0e10cSrcweir * are called here. 295*cdf0e10cSrcweir * Executed interface tests are (in this order): 296*cdf0e10cSrcweir * <ol> 297*cdf0e10cSrcweir * <li>XTypeProvider</li> 298*cdf0e10cSrcweir * <li>XServiceInfo</li> 299*cdf0e10cSrcweir * <li>XCommandProcessor</li> 300*cdf0e10cSrcweir * <li>XChild</li> 301*cdf0e10cSrcweir * <li>XPropertiesChangeNotifier</li> 302*cdf0e10cSrcweir * <li>XPropertySetInfoChangeNotifier</li> 303*cdf0e10cSrcweir * <li>XCommandInfoChangeNotifier</li> 304*cdf0e10cSrcweir * <li>XContent</li> 305*cdf0e10cSrcweir * <li>XPropertyContainer</li> 306*cdf0e10cSrcweir * <li>XComponent</li> 307*cdf0e10cSrcweir * </ol> 308*cdf0e10cSrcweir * @param hasParent True, if the tested content type does have a parent: 309*cdf0e10cSrcweir * only the root has not. Used in the XChild interface test. 310*cdf0e10cSrcweir */ 311*cdf0e10cSrcweir private void checkInterfaces(boolean hasParent) { 312*cdf0e10cSrcweir // check the XTypeProvider interface 313*cdf0e10cSrcweir _XTypeProvider xTypeProvider = new _XTypeProvider(); 314*cdf0e10cSrcweir xTypeProvider.oObj = UnoRuntime.queryInterface(XTypeProvider.class, xContent); 315*cdf0e10cSrcweir // xTypeProvider.log = log; 316*cdf0e10cSrcweir assertNotNull("getImplementationId()", xTypeProvider._getImplementationId()); 317*cdf0e10cSrcweir assertNotNull("getTypes()", xTypeProvider._getTypes()); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // check the XSewrviceInfo interface 320*cdf0e10cSrcweir _XServiceInfo xServiceInfo = new _XServiceInfo(); 321*cdf0e10cSrcweir xServiceInfo.oObj = UnoRuntime.queryInterface(XServiceInfo.class, xContent); 322*cdf0e10cSrcweir // xServiceInfo.log = log; 323*cdf0e10cSrcweir assertNotNull("getImplementationName()", xServiceInfo._getImplementationName()); 324*cdf0e10cSrcweir assertNotNull("getSupportedServiceNames()", xServiceInfo._getSupportedServiceNames()); 325*cdf0e10cSrcweir assertNotNull("supportsService()", xServiceInfo._supportsService()); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir // check the XCommandProcessor interface 328*cdf0e10cSrcweir _XCommandProcessor xCommandProcessor = new _XCommandProcessor(); 329*cdf0e10cSrcweir xCommandProcessor.oObj = UnoRuntime.queryInterface(XCommandProcessor.class, xContent); 330*cdf0e10cSrcweir // xCommandProcessor.log = log; 331*cdf0e10cSrcweir xCommandProcessor.before(getMSF()); 332*cdf0e10cSrcweir assertNotNull("createCommandIdentifier()", xCommandProcessor._createCommandIdentifier()); 333*cdf0e10cSrcweir assertNotNull("execute()", xCommandProcessor._execute()); 334*cdf0e10cSrcweir assertNotNull("abort()", xCommandProcessor._abort()); 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir // check the XChild interface 337*cdf0e10cSrcweir _XChild xChild = new _XChild(); 338*cdf0e10cSrcweir xChild.oObj = UnoRuntime.queryInterface(XChild.class, xContent); 339*cdf0e10cSrcweir // xChild.log = log; 340*cdf0e10cSrcweir // hasParent dermines, if this content has a parent 341*cdf0e10cSrcweir assertNotNull("getParent()", xChild._getParent(hasParent)); 342*cdf0e10cSrcweir // parameter does dermine, if this funczion is supported: generally not supported with tdcp content 343*cdf0e10cSrcweir assertNotNull("setParent()", xChild._setParent(false)); 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir // check the XPropertyChangeNotifier interface 346*cdf0e10cSrcweir _XPropertiesChangeNotifier xPropChange = new _XPropertiesChangeNotifier(); 347*cdf0e10cSrcweir xPropChange.oObj = UnoRuntime.queryInterface(XPropertiesChangeNotifier.class, xContent); 348*cdf0e10cSrcweir // xPropChange.log = log; 349*cdf0e10cSrcweir assertNotNull("addPropertiesChangeListener()", xPropChange._addPropertiesChangeListener()); 350*cdf0e10cSrcweir assertNotNull("removePropertiesChangeListener()", xPropChange._removePropertiesChangeListener()); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir // check the XPropertySetInfoChangeNotifier interface 353*cdf0e10cSrcweir _XPropertySetInfoChangeNotifier xPropSetInfo = new _XPropertySetInfoChangeNotifier(); 354*cdf0e10cSrcweir xPropSetInfo.oObj = UnoRuntime.queryInterface(XPropertySetInfoChangeNotifier.class, xContent); 355*cdf0e10cSrcweir // xPropSetInfo.log = log; 356*cdf0e10cSrcweir assertNotNull("addPropertiesChangeListener()", xPropSetInfo._addPropertiesChangeListener()); 357*cdf0e10cSrcweir assertNotNull("removePropertiesChangeListener()", xPropSetInfo._removePropertiesChangeListener()); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir // check the XCommandInfoChangeNotifier interface 360*cdf0e10cSrcweir _XCommandInfoChangeNotifier xCommandChange = new _XCommandInfoChangeNotifier(); 361*cdf0e10cSrcweir xCommandChange.oObj = UnoRuntime.queryInterface(XCommandInfoChangeNotifier.class, xContent); 362*cdf0e10cSrcweir // xCommandChange.log = log; 363*cdf0e10cSrcweir assertNotNull("addCommandInfoChangeListener()", xCommandChange._addCommandInfoChangeListener()); 364*cdf0e10cSrcweir assertNotNull("removeCommandInfoChangeListener()", xCommandChange._removeCommandInfoChangeListener()); 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir // check the XContent interface 367*cdf0e10cSrcweir _XContent xCont = new _XContent(); 368*cdf0e10cSrcweir xCont.oObj = UnoRuntime.queryInterface(XContent.class, xContent); 369*cdf0e10cSrcweir // xCont.log = log; 370*cdf0e10cSrcweir assertNotNull("addContentEventListener()", xCont._addContentEventListener()); 371*cdf0e10cSrcweir assertNotNull("getContentType()", xCont._getContentType()); 372*cdf0e10cSrcweir assertNotNull("getIdentifier()", xCont._getIdentifier()); 373*cdf0e10cSrcweir assertNotNull("removeContentEventListener()", xCont._removeContentEventListener()); 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir // check the XPropertyContainer interface 376*cdf0e10cSrcweir _XPropertyContainer xPropCont = new _XPropertyContainer(); 377*cdf0e10cSrcweir xPropCont.oObj = UnoRuntime.queryInterface(XPropertyContainer.class, xContent); 378*cdf0e10cSrcweir // xPropCont.log = log; 379*cdf0e10cSrcweir assertNotNull("addProperty()", xPropCont._addProperty()); 380*cdf0e10cSrcweir assertNotNull("removeProperty()", xPropCont._removeProperty()); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir // check the XComponent interface 383*cdf0e10cSrcweir _XComponent xComponent = new _XComponent(); 384*cdf0e10cSrcweir xComponent.oObj = UnoRuntime.queryInterface(XComponent.class, xContent); 385*cdf0e10cSrcweir // xComponent.log = log; 386*cdf0e10cSrcweir assertNotNull("addEventListener()", xComponent._addEventListener()); 387*cdf0e10cSrcweir assertNotNull("removeEventListener()", xComponent._removeEventListener()); 388*cdf0e10cSrcweir // assure("dispose()", xComponent._dispose()); 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir private XMultiServiceFactory getMSF() 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 397*cdf0e10cSrcweir return xMSF1; 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // setup and close connections 401*cdf0e10cSrcweir @BeforeClass public static void setUpConnection() throws Exception { 402*cdf0e10cSrcweir System.out.println("setUpConnection()"); 403*cdf0e10cSrcweir connection.setUp(); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir @AfterClass public static void tearDownConnection() 407*cdf0e10cSrcweir throws InterruptedException, com.sun.star.uno.Exception 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir System.out.println("tearDownConnection()"); 410*cdf0e10cSrcweir connection.tearDown(); 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir private static final OfficeConnection connection = new OfficeConnection(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir } 416