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