xref: /AOO41X/main/qadevOOo/tests/java/ifc/lang/_XServiceInfo.java (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.lang;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.lang.XServiceInfo;
33 
34 /**
35 * Testing <code>com.sun.star.lang.XServiceInfo</code>
36 * interface methods :
37 * <ul>
38 *  <li><code> getImplementationName()</code></li>
39 *  <li><code> supportsService()</code></li>
40 *  <li><code> getSupportedServiceNames()</code></li>
41 * </ul> <p>
42 * Test is multithread compilant. <p>
43 * @see com.sun.star.lang.XServiceInfo
44 */
45 public class _XServiceInfo extends MultiMethodTest {
46     public static XServiceInfo oObj = null;
47     public static String[] names = null;
48 
49     /**
50     * Just calls the method.<p>
51     * Has <b>OK</b> status if no runtime exceptions occured.
52     */
53     public void _getImplementationName() {
54         boolean result = true;
55         log.println("testing getImplementationName() ... ");
56 
57         log.println("The ImplementationName ist "+oObj.getImplementationName());
58         result=true;
59 
60         tRes.tested("getImplementationName()", result);
61 
62     } // end getImplementationName()
63 
64 
65     /**
66     * Just calls the method.<p>
67     * Has <b>OK</b> status if no runtime exceptions occured.
68     */
69     public void _getSupportedServiceNames() {
70         boolean result = true;
71         log.println("getting supported Services...");
72         names = oObj.getSupportedServiceNames();
73         for (int i=0;i<names.length;i++) {
74            int k = i+1;
75            log.println(k+". Supported Service is "+names[i]);
76         }
77         result=true;
78 
79         tRes.tested("getSupportedServiceNames()", result);
80 
81     } // end getSupportedServiceNames()
82 
83     /**
84     * Gets one of the service names returned by
85     * <code>getSupportedServiceNames</code> method and
86     * calls the <code>supportsService</code> methos with this
87     * name. <p>
88     * Has <b>OK</b> status if <code>true</code> value is
89     * returned.
90     */
91     public void _supportsService() {
92         log.println("testing supportsService");
93         names = oObj.getSupportedServiceNames();
94         tRes.tested("supportsService()", oObj.supportsService(names[0]));
95     } // end supportsService()
96 }
97 
98