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