Update ooo320-m1
[ooovba.git] / testtools / source / servicetests / TestService.java
blobb0b1dd79f6eb48e4f917c0a4685190856d6701b3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TestService.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package testtools.servicetests;
33 import com.sun.star.lang.NoSupportException;
34 import com.sun.star.lang.XServiceInfo;
35 import com.sun.star.lang.XSingleComponentFactory;
36 /*import com.sun.star.uno.OptionalPropertyException;*/
37 /*import com.sun.star.uno.VoidPropertyException;*/
38 import com.sun.star.uno.XComponentContext;
40 public final class TestService implements XServiceInfo, XSingleComponentFactory
42 public String getImplementationName() {
43 return getClass().getName();
46 public boolean supportsService(String serviceName) {
47 return serviceName.equals(SERVICE_NAME);
50 public String[] getSupportedServiceNames() {
51 return new String[] { SERVICE_NAME };
54 public Object createInstanceWithContext(XComponentContext context)
55 throws com.sun.star.uno.Exception
57 return new Service();
60 public Object createInstanceWithArgumentsAndContext(
61 Object[] arguments, XComponentContext context)
62 throws com.sun.star.uno.Exception
64 throw new NoSupportException(
65 "createInstanceWithArgumentsAndContext", this);
68 private static final class Service implements TestService2, XTestService3 {
69 public int fn1() {
70 return 1;
73 public int getProp1() {
74 return prop1;
77 public void setProp1(int value) {
78 prop1 = value;
81 public int getProp2() {
82 return 2;
85 /*public int getProp3Void() throws VoidPropertyException {
86 throw new VoidPropertyException("Prop3Void", this);
87 }*/
89 public int getProp3Long() /*throws VoidPropertyException*/ {
90 return 3;
93 /*public int getProp4None() throws OptionalPropertyException {
94 throw new OptionalPropertyException("Prop4None", this);
95 }*/
97 public int getProp4Long() /*throws OptionalPropertyException*/ {
98 return 4;
101 /*public int getProp5None()
102 throws OptionalPropertyException, VoidPropertyException
104 throw new OptionalPropertyException("Prop4None", this);
107 /*public int getProp5Void()
108 throws OptionalPropertyException, VoidPropertyException
110 throw new VoidPropertyException("Prop4None", this);
113 public int getProp5Long()
114 /*throws OptionalPropertyException, VoidPropertyException*/
116 return 5;
119 public int getProp6() /*throws VoidPropertyException*/ {
120 /*if (prop6 == null) {
121 throw new VoidPropertyException("Prop6", this);
122 } else {*/
123 return prop6.intValue();
124 /*}*/
127 public void setProp6(int value) {
128 prop6 = new Integer(value);
131 /*public void clearProp6() {
132 prop6 = null;
135 /*public int getProp7None()
136 throws OptionalPropertyException, VoidPropertyException
138 throw new OptionalPropertyException("Prop7None", this);
141 /*public void setProp7None(int value) throws OptionalPropertyException {
142 throw new OptionalPropertyException("Prop7None", this);
145 /*public void clearProp7None() throws OptionalPropertyException {
146 throw new OptionalPropertyException("Prop7None", this);
149 public int getProp7()
150 /*throws OptionalPropertyException, VoidPropertyException*/
152 /*if (prop7 == null) {
153 throw new VoidPropertyException("Prop7", this);
154 } else {*/
155 return prop7.intValue();
156 /*}*/
159 public void setProp7(int value) /*throws OptionalPropertyException*/ {
160 prop7 = new Integer(value);
163 /*public void clearProp7() throws OptionalPropertyException {
164 prop7 = null;
167 /*public int getProp8None() throws OptionalPropertyException {
168 throw new OptionalPropertyException("Prop8None", this);
171 /*public void setProp8None(int value) throws OptionalPropertyException {
172 throw new OptionalPropertyException("Prop8None", this);
175 public int getProp8Long() /*throws OptionalPropertyException*/ {
176 return prop8;
179 public void setProp8Long(int value) /*throws OptionalPropertyException*/
181 prop8 = value;
184 public int fn2() {
185 return 2;
188 public int fn3() {
189 return 3;
192 private int prop1 = 1;
193 private Integer prop6 = new Integer(6);
194 private Integer prop7 = new Integer(7);
195 private int prop8 = 8;
198 private static final String SERVICE_NAME
199 = "testtools.servicetests.TestService2";