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