jl165 merging heads
[LibreOffice.git] / testtools / source / servicetests / TestService.java
blob279aaabe4b707eb9259ec5cfebae1c0da6e3534b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 package testtools.servicetests;
30 import com.sun.star.lang.NoSupportException;
31 import com.sun.star.lang.XServiceInfo;
32 import com.sun.star.lang.XSingleComponentFactory;
33 /*import com.sun.star.uno.OptionalPropertyException;*/
34 /*import com.sun.star.uno.VoidPropertyException;*/
35 import com.sun.star.uno.XComponentContext;
37 public final class TestService implements XServiceInfo, XSingleComponentFactory
39 public String getImplementationName() {
40 return getClass().getName();
43 public boolean supportsService(String serviceName) {
44 return serviceName.equals(SERVICE_NAME);
47 public String[] getSupportedServiceNames() {
48 return new String[] { SERVICE_NAME };
51 public Object createInstanceWithContext(XComponentContext context)
52 throws com.sun.star.uno.Exception
54 return new Service();
57 public Object createInstanceWithArgumentsAndContext(
58 Object[] arguments, XComponentContext context)
59 throws com.sun.star.uno.Exception
61 throw new NoSupportException(
62 "createInstanceWithArgumentsAndContext", this);
65 private static final class Service implements TestService2, XTestService3 {
66 public int fn1() {
67 return 1;
70 public int getProp1() {
71 return prop1;
74 public void setProp1(int value) {
75 prop1 = value;
78 public int getProp2() {
79 return 2;
82 /*public int getProp3Void() throws VoidPropertyException {
83 throw new VoidPropertyException("Prop3Void", this);
84 }*/
86 public int getProp3Long() /*throws VoidPropertyException*/ {
87 return 3;
90 /*public int getProp4None() throws OptionalPropertyException {
91 throw new OptionalPropertyException("Prop4None", this);
92 }*/
94 public int getProp4Long() /*throws OptionalPropertyException*/ {
95 return 4;
98 /*public int getProp5None()
99 throws OptionalPropertyException, VoidPropertyException
101 throw new OptionalPropertyException("Prop4None", this);
104 /*public int getProp5Void()
105 throws OptionalPropertyException, VoidPropertyException
107 throw new VoidPropertyException("Prop4None", this);
110 public int getProp5Long()
111 /*throws OptionalPropertyException, VoidPropertyException*/
113 return 5;
116 public int getProp6() /*throws VoidPropertyException*/ {
117 /*if (prop6 == null) {
118 throw new VoidPropertyException("Prop6", this);
119 } else {*/
120 return prop6.intValue();
121 /*}*/
124 public void setProp6(int value) {
125 prop6 = new Integer(value);
128 /*public void clearProp6() {
129 prop6 = null;
132 /*public int getProp7None()
133 throws OptionalPropertyException, VoidPropertyException
135 throw new OptionalPropertyException("Prop7None", this);
138 /*public void setProp7None(int value) throws OptionalPropertyException {
139 throw new OptionalPropertyException("Prop7None", this);
142 /*public void clearProp7None() throws OptionalPropertyException {
143 throw new OptionalPropertyException("Prop7None", this);
146 public int getProp7()
147 /*throws OptionalPropertyException, VoidPropertyException*/
149 /*if (prop7 == null) {
150 throw new VoidPropertyException("Prop7", this);
151 } else {*/
152 return prop7.intValue();
153 /*}*/
156 public void setProp7(int value) /*throws OptionalPropertyException*/ {
157 prop7 = new Integer(value);
160 /*public void clearProp7() throws OptionalPropertyException {
161 prop7 = null;
164 /*public int getProp8None() throws OptionalPropertyException {
165 throw new OptionalPropertyException("Prop8None", this);
168 /*public void setProp8None(int value) throws OptionalPropertyException {
169 throw new OptionalPropertyException("Prop8None", this);
172 public int getProp8Long() /*throws OptionalPropertyException*/ {
173 return prop8;
176 public void setProp8Long(int value) /*throws OptionalPropertyException*/
178 prop8 = value;
181 public int fn2() {
182 return 2;
185 public int fn3() {
186 return 3;
189 private int prop1 = 1;
190 private Integer prop6 = new Integer(6);
191 private Integer prop7 = new Integer(7);
192 private int prop8 = 8;
195 private static final String SERVICE_NAME
196 = "testtools.servicetests.TestService2";