xref: /aoo42x/main/ure/source/uretest/JavaTest.java (revision 87e37ca8)
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 test.java.javatest;
25 
26 import com.sun.star.comp.loader.FactoryHelper;
27 import com.sun.star.lang.XMultiServiceFactory;
28 import com.sun.star.lang.XSingleServiceFactory;
29 import com.sun.star.registry.XRegistryKey;
30 import test.types.TestException;
31 import test.types.XTest;
32 
33 public final class JavaTest implements XTest {
JavaTest()34     public JavaTest() {}
35 
throwException()36     public void throwException() throws TestException {
37         throw new TestException("test", this);
38     }
39 
__writeRegistryServiceInfo(XRegistryKey key)40     public static boolean __writeRegistryServiceInfo(XRegistryKey key) {
41         return
42             FactoryHelper.writeRegistryServiceInfo(
43                 IMPLEMENTATION_NAME, SERVICE_NAME, key);
44     }
45 
__getServiceFactory( String name, XMultiServiceFactory factory, XRegistryKey key)46     public static XSingleServiceFactory __getServiceFactory(
47         String name, XMultiServiceFactory factory, XRegistryKey key)
48     {
49         if (name.equals(IMPLEMENTATION_NAME)) {
50             return FactoryHelper.getServiceFactory(
51                 JavaTest.class, SERVICE_NAME, factory, key);
52         } else {
53             return null;
54         }
55     }
56 
57     private static final String IMPLEMENTATION_NAME
58     = "test.java.javatest.Component";
59     private static final String SERVICE_NAME = "test.types.JavaTest";
60 }
61