1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.sdbcx; 25 26 import com.sun.star.container.XNameAccess; 27 import com.sun.star.sdbcx.XTablesSupplier; 28 import com.sun.star.lang.XServiceInfo; 29 import com.sun.star.uno.UnoRuntime; 30 import lib.MultiMethodTest; 31 32 /** 33 * Testing <code>com.sun.star.sdbcx.XTablesSupplier</code> 34 * interface methods : 35 * <ul> 36 * <li><code> getTables()</code></li> 37 * </ul> <p> 38 * @see com.sun.star.sdbcx.XTablesSupplier 39 */ 40 public class _XTablesSupplier extends MultiMethodTest { 41 42 // oObj filled by MultiMethodTest 43 public XTablesSupplier oObj = null ; 44 45 /** 46 * Has OK status if method returns not null 47 * <code>XNameAccess</code> object, FAILED otherwise. 48 */ _getTables()49 public void _getTables() { 50 boolean result = true ; 51 52 XNameAccess tabs = oObj.getTables() ; 53 54 55 String[] tabNames = tabs.getElementNames() ; 56 57 log.println("Table names:") ; 58 for (int i =0 ; i < tabNames.length; i++) { 59 log.println(" " + tabNames[i]) ; 60 } 61 62 XServiceInfo info = null ; 63 try { 64 info = (XServiceInfo) UnoRuntime.queryInterface 65 (XServiceInfo.class, tabs.getByName(tabNames[0])) ; 66 } catch (com.sun.star.uno.Exception e) {} 67 68 log.println("Support : " + 69 info.supportsService("com.sun.star.sdbcx.Table")) ; 70 71 72 tRes.tested("getTables()", tabs != null) ; 73 } 74 75 } // finish class _XTablesSupplier 76 77 78