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.lang;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.lang.XServiceInfo;
29 
30 /**
31 * Testing <code>com.sun.star.lang.XServiceInfo</code>
32 * interface methods :
33 * <ul>
34 *  <li><code> getImplementationName()</code></li>
35 *  <li><code> supportsService()</code></li>
36 *  <li><code> getSupportedServiceNames()</code></li>
37 * </ul> <p>
38 * Test is multithread compilant. <p>
39 * @see com.sun.star.lang.XServiceInfo
40 */
41 public class _XServiceInfo extends MultiMethodTest {
42     public static XServiceInfo oObj = null;
43     public static String[] names = null;
44 
45     /**
46     * Just calls the method.<p>
47     * Has <b>OK</b> status if no runtime exceptions occured.
48     */
_getImplementationName()49     public void _getImplementationName() {
50         boolean result = true;
51         log.println("testing getImplementationName() ... ");
52 
53         log.println("The ImplementationName ist "+oObj.getImplementationName());
54         result=true;
55 
56         tRes.tested("getImplementationName()", result);
57 
58     } // end getImplementationName()
59 
60 
61     /**
62     * Just calls the method.<p>
63     * Has <b>OK</b> status if no runtime exceptions occured.
64     */
_getSupportedServiceNames()65     public void _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         tRes.tested("getSupportedServiceNames()", 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> methos with this
83     * name. <p>
84     * Has <b>OK</b> status if <code>true</code> value is
85     * returned.
86     */
_supportsService()87     public void _supportsService() {
88         log.println("testing supportsService");
89         names = oObj.getSupportedServiceNames();
90         tRes.tested("supportsService()", oObj.supportsService(names[0]));
91     } // end supportsService()
92 }
93 
94