xref: /trunk/main/ucb/qa/complex/tdoc/_XServiceInfo.java (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
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 package complex.tdoc;
23 
24 import lib.MultiMethodTest;
25 
26 import com.sun.star.lang.XServiceInfo;
27 import share.LogWriter;
28 
29 /**
30 * Testing <code>com.sun.star.lang.XServiceInfo</code>
31 * interface methods :
32 * <ul>
33 *  <li><code> getImplementationName()</code></li>
34 *  <li><code> supportsService()</code></li>
35 *  <li><code> getSupportedServiceNames()</code></li>
36 * </ul> <p>
37 * Test is multithread compliant. <p>
38 * @see com.sun.star.lang.XServiceInfo
39 */
40 public class _XServiceInfo {
41     public static XServiceInfo oObj = null;
42     public static String[] names = null;
43     public LogWriter log = null;
44 
45     /**
46     * Just calls the method.<p>
47     * Has <b>OK</b> status if no runtime exceptions occurred.
48     */
49     public boolean _getImplementationName() {
50         boolean result = true;
51         log.println("testing getImplementationName() ... ");
52 
53         log.println("The ImplementationName ist "+oObj.getImplementationName());
54         result=true;
55 
56         return result;
57 
58     } // end getImplementationName()
59 
60 
61     /**
62     * Just calls the method.<p>
63     * Has <b>OK</b> status if no runtime exceptions occurred.
64     */
65     public boolean _getSupportedServiceNames() {
66         boolean result = true;
67         log.println("getting supported Services...");
68         names = oObj.getSupportedServiceNames();
69         for (int i=0;i<names.length;i++) {
70            int k = i+1;
71            log.println(k+". Supported Service is "+names[i]);
72         }
73         result=true;
74 
75         return result;
76 
77     } // end getSupportedServiceNames()
78 
79     /**
80     * Gets one of the service names returned by
81     * <code>getSupportedServiceNames</code> method and
82     * calls the <code>supportsService</code> method with this
83     * name. <p>
84     * Has <b>OK</b> status if <code>true</code> value is
85     * returned.
86     */
87     public boolean _supportsService() {
88         log.println("testing supportsService");
89         names = oObj.getSupportedServiceNames();
90         return oObj.supportsService(names[0]);
91     } // end supportsService()
92 }
93