update credits
[LibreOffice.git] / testtools / source / servicetests / TestService.java
blob6124aaade59e8a9c21123aba524640d80db89111
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package servicetests;
21 import com.sun.star.lang.NoSupportException;
22 import com.sun.star.lang.XServiceInfo;
23 import com.sun.star.lang.XSingleComponentFactory;
24 /*import com.sun.star.uno.OptionalPropertyException;*/
25 /*import com.sun.star.uno.VoidPropertyException;*/
26 import com.sun.star.uno.XComponentContext;
28 public final class TestService implements XServiceInfo, XSingleComponentFactory
30 public String getImplementationName() {
31 return getClass().getName();
34 public boolean supportsService(String serviceName) {
35 return serviceName.equals(SERVICE_NAME);
38 public String[] getSupportedServiceNames() {
39 return new String[] { SERVICE_NAME };
42 public Object createInstanceWithContext(XComponentContext context)
43 throws com.sun.star.uno.Exception
45 return new Service();
48 public Object createInstanceWithArgumentsAndContext(
49 Object[] arguments, XComponentContext context)
50 throws com.sun.star.uno.Exception
52 throw new NoSupportException(
53 "createInstanceWithArgumentsAndContext", this);
56 private static final class Service implements TestService2, XTestService3 {
57 public int fn1() {
58 return 1;
61 public int getProp1() {
62 return prop1;
65 public void setProp1(int value) {
66 prop1 = value;
69 public int getProp2() {
70 return 2;
73 /*public int getProp3Void() throws VoidPropertyException {
74 throw new VoidPropertyException("Prop3Void", this);
75 }*/
77 public int getProp3Long() /*throws VoidPropertyException*/ {
78 return 3;
81 /*public int getProp4None() throws OptionalPropertyException {
82 throw new OptionalPropertyException("Prop4None", this);
83 }*/
85 public int getProp4Long() /*throws OptionalPropertyException*/ {
86 return 4;
89 /*public int getProp5None()
90 throws OptionalPropertyException, VoidPropertyException
92 throw new OptionalPropertyException("Prop4None", this);
93 }*/
95 /*public int getProp5Void()
96 throws OptionalPropertyException, VoidPropertyException
98 throw new VoidPropertyException("Prop4None", this);
99 }*/
101 public int getProp5Long()
102 /*throws OptionalPropertyException, VoidPropertyException*/
104 return 5;
107 public int getProp6() /*throws VoidPropertyException*/ {
108 /*if (prop6 == null) {
109 throw new VoidPropertyException("Prop6", this);
110 } else {*/
111 return prop6.intValue();
112 /*}*/
115 public void setProp6(int value) {
116 prop6 = new Integer(value);
119 /*public void clearProp6() {
120 prop6 = null;
123 /*public int getProp7None()
124 throws OptionalPropertyException, VoidPropertyException
126 throw new OptionalPropertyException("Prop7None", this);
129 /*public void setProp7None(int value) throws OptionalPropertyException {
130 throw new OptionalPropertyException("Prop7None", this);
133 /*public void clearProp7None() throws OptionalPropertyException {
134 throw new OptionalPropertyException("Prop7None", this);
137 public int getProp7()
138 /*throws OptionalPropertyException, VoidPropertyException*/
140 /*if (prop7 == null) {
141 throw new VoidPropertyException("Prop7", this);
142 } else {*/
143 return prop7.intValue();
144 /*}*/
147 public void setProp7(int value) /*throws OptionalPropertyException*/ {
148 prop7 = new Integer(value);
151 /*public void clearProp7() throws OptionalPropertyException {
152 prop7 = null;
155 /*public int getProp8None() throws OptionalPropertyException {
156 throw new OptionalPropertyException("Prop8None", this);
159 /*public void setProp8None(int value) throws OptionalPropertyException {
160 throw new OptionalPropertyException("Prop8None", this);
163 public int getProp8Long() /*throws OptionalPropertyException*/ {
164 return prop8;
167 public void setProp8Long(int value) /*throws OptionalPropertyException*/
169 prop8 = value;
172 public int fn2() {
173 return 2;
176 public int fn3() {
177 return 3;
180 private int prop1 = 1;
181 private Integer prop6 = new Integer(6);
182 private Integer prop7 = new Integer(7);
183 private int prop8 = 8;
186 private static final String SERVICE_NAME
187 = "testtools.servicetests.TestService2";