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 mod._lnn;
25 
26 import java.io.PrintWriter;
27 
28 import lib.StatusException;
29 import lib.TestCase;
30 import lib.TestEnvironment;
31 import lib.TestParameters;
32 
33 import com.sun.star.beans.XPropertySet;
34 import com.sun.star.lang.XMultiServiceFactory;
35 import com.sun.star.uno.UnoRuntime;
36 import com.sun.star.uno.XInterface;
37 
38 /**
39  * Test for object which is represented by service
40  * <code>com.sun.star.linguistic2.Hyphenator</code>. <p>
41  * Object implements the following interfaces :
42  * <ul>
43  *  <li> <code>com::sun::star::lang::XInitialization</code></li>
44  *  <li> <code>com::sun::star::linguistic2::XHyphenator</code></li>
45  *  <li> <code>com::sun::star::lang::XComponent</code></li>
46  *  <li> <code>com::sun::star::linguistic2::XSupportedLocales</code></li>
47  *  <li> <code>com::sun::star::lang::XServiceInfo</code></li>
48  *  <li> <code>com::sun::star::lang::XServiceDisplayName</code></li>
49  *  <li> <code>com::sun::star::linguistic2::XLinguServiceEventBroadcaster</code></li>
50  * </ul> <p>
51  *
52  * This object test <b> is NOT </b> designed to be run in several
53  * threads concurently.
54  *
55  * @see com.sun.star.lang.XInitialization
56  * @see com.sun.star.linguistic2.XHyphenator
57  * @see com.sun.star.lang.XComponent
58  * @see com.sun.star.linguistic2.XSupportedLocales
59  * @see com.sun.star.lang.XServiceInfo
60  * @see com.sun.star.lang.XServiceDisplayName
61  * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
62  * @see ifc.lang._XInitialization
63  * @see ifc.linguistic2._XHyphenator
64  * @see ifc.lang._XComponent
65  * @see ifc.linguistic2._XSupportedLocales
66  * @see ifc.lang._XServiceInfo
67  * @see ifc.lang._XServiceDisplayName
68  * @see ifc.linguistic2._XLinguServiceEventBroadcaster
69  */
70 public class Hyphenator extends TestCase {
71 
72     /**
73      * Creating a Testenvironment for the interfaces to be tested.
74      * Creates an instance of the service
75      * <code>com.sun.star.linguistic2.Hyphenator</code>.
76      * Then a property for using new German rules for hyphenation
77      * is set.
78      */
createTestEnvironment(TestParameters Param, PrintWriter log)79     protected synchronized TestEnvironment createTestEnvironment
80         (TestParameters Param, PrintWriter log) {
81 
82         XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
83         XInterface oObj = null;
84 
85         try {
86             oObj = (XInterface)xMSF.createInstance
87                 ("com.sun.star.linguistic2.Hyphenator");
88             Object LP = xMSF.createInstance
89                 ("com.sun.star.linguistic2.LinguProperties");
90             XPropertySet LProps = (XPropertySet)
91                 UnoRuntime.queryInterface(XPropertySet.class,LP);
92             LProps.setPropertyValue("IsGermanPreReform",new Boolean(true));
93         } catch (com.sun.star.uno.Exception e) {
94             e.printStackTrace(log);
95             throw new StatusException("Unexpected exception", e);
96         }
97 
98         String Iname = util.utils.getImplName(oObj);
99         log.println("Implementation Name: "+Iname);
100         TestEnvironment tEnv = new TestEnvironment(oObj);
101 
102         return tEnv;
103     }
104 
105 
106 }    // finish class Hyphenator
107 
108