1*5c44d1b3SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5c44d1b3SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5c44d1b3SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5c44d1b3SAndrew Rist * distributed with this work for additional information 6*5c44d1b3SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5c44d1b3SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5c44d1b3SAndrew Rist * "License"); you may not use this file except in compliance 9*5c44d1b3SAndrew Rist * with the License. You may obtain a copy of the License at 10*5c44d1b3SAndrew Rist * 11*5c44d1b3SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5c44d1b3SAndrew Rist * 13*5c44d1b3SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5c44d1b3SAndrew Rist * software distributed under the License is distributed on an 15*5c44d1b3SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5c44d1b3SAndrew Rist * KIND, either express or implied. See the License for the 17*5c44d1b3SAndrew Rist * specific language governing permissions and limitations 18*5c44d1b3SAndrew Rist * under the License. 19*5c44d1b3SAndrew Rist * 20*5c44d1b3SAndrew Rist *************************************************************/ 21*5c44d1b3SAndrew Rist 22*5c44d1b3SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package testtools.servicetests; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.lang.NoSupportException; 27cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo; 28cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory; 29cdf0e10cSrcweir /*import com.sun.star.uno.OptionalPropertyException;*/ 30cdf0e10cSrcweir /*import com.sun.star.uno.VoidPropertyException;*/ 31cdf0e10cSrcweir import com.sun.star.uno.XComponentContext; 32cdf0e10cSrcweir 33cdf0e10cSrcweir public final class TestService implements XServiceInfo, XSingleComponentFactory 34cdf0e10cSrcweir { getImplementationName()35cdf0e10cSrcweir public String getImplementationName() { 36cdf0e10cSrcweir return getClass().getName(); 37cdf0e10cSrcweir } 38cdf0e10cSrcweir supportsService(String serviceName)39cdf0e10cSrcweir public boolean supportsService(String serviceName) { 40cdf0e10cSrcweir return serviceName.equals(SERVICE_NAME); 41cdf0e10cSrcweir } 42cdf0e10cSrcweir getSupportedServiceNames()43cdf0e10cSrcweir public String[] getSupportedServiceNames() { 44cdf0e10cSrcweir return new String[] { SERVICE_NAME }; 45cdf0e10cSrcweir } 46cdf0e10cSrcweir createInstanceWithContext(XComponentContext context)47cdf0e10cSrcweir public Object createInstanceWithContext(XComponentContext context) 48cdf0e10cSrcweir throws com.sun.star.uno.Exception 49cdf0e10cSrcweir { 50cdf0e10cSrcweir return new Service(); 51cdf0e10cSrcweir } 52cdf0e10cSrcweir createInstanceWithArgumentsAndContext( Object[] arguments, XComponentContext context)53cdf0e10cSrcweir public Object createInstanceWithArgumentsAndContext( 54cdf0e10cSrcweir Object[] arguments, XComponentContext context) 55cdf0e10cSrcweir throws com.sun.star.uno.Exception 56cdf0e10cSrcweir { 57cdf0e10cSrcweir throw new NoSupportException( 58cdf0e10cSrcweir "createInstanceWithArgumentsAndContext", this); 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir private static final class Service implements TestService2, XTestService3 { fn1()62cdf0e10cSrcweir public int fn1() { 63cdf0e10cSrcweir return 1; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir getProp1()66cdf0e10cSrcweir public int getProp1() { 67cdf0e10cSrcweir return prop1; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir setProp1(int value)70cdf0e10cSrcweir public void setProp1(int value) { 71cdf0e10cSrcweir prop1 = value; 72cdf0e10cSrcweir } 73cdf0e10cSrcweir getProp2()74cdf0e10cSrcweir public int getProp2() { 75cdf0e10cSrcweir return 2; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir /*public int getProp3Void() throws VoidPropertyException { 79cdf0e10cSrcweir throw new VoidPropertyException("Prop3Void", this); 80cdf0e10cSrcweir }*/ 81cdf0e10cSrcweir getProp3Long()82cdf0e10cSrcweir public int getProp3Long() /*throws VoidPropertyException*/ { 83cdf0e10cSrcweir return 3; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir /*public int getProp4None() throws OptionalPropertyException { 87cdf0e10cSrcweir throw new OptionalPropertyException("Prop4None", this); 88cdf0e10cSrcweir }*/ 89cdf0e10cSrcweir getProp4Long()90cdf0e10cSrcweir public int getProp4Long() /*throws OptionalPropertyException*/ { 91cdf0e10cSrcweir return 4; 92cdf0e10cSrcweir } 93cdf0e10cSrcweir 94cdf0e10cSrcweir /*public int getProp5None() 95cdf0e10cSrcweir throws OptionalPropertyException, VoidPropertyException 96cdf0e10cSrcweir { 97cdf0e10cSrcweir throw new OptionalPropertyException("Prop4None", this); 98cdf0e10cSrcweir }*/ 99cdf0e10cSrcweir 100cdf0e10cSrcweir /*public int getProp5Void() 101cdf0e10cSrcweir throws OptionalPropertyException, VoidPropertyException 102cdf0e10cSrcweir { 103cdf0e10cSrcweir throw new VoidPropertyException("Prop4None", this); 104cdf0e10cSrcweir }*/ 105cdf0e10cSrcweir getProp5Long()106cdf0e10cSrcweir public int getProp5Long() 107cdf0e10cSrcweir /*throws OptionalPropertyException, VoidPropertyException*/ 108cdf0e10cSrcweir { 109cdf0e10cSrcweir return 5; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir getProp6()112cdf0e10cSrcweir public int getProp6() /*throws VoidPropertyException*/ { 113cdf0e10cSrcweir /*if (prop6 == null) { 114cdf0e10cSrcweir throw new VoidPropertyException("Prop6", this); 115cdf0e10cSrcweir } else {*/ 116cdf0e10cSrcweir return prop6.intValue(); 117cdf0e10cSrcweir /*}*/ 118cdf0e10cSrcweir } 119cdf0e10cSrcweir setProp6(int value)120cdf0e10cSrcweir public void setProp6(int value) { 121cdf0e10cSrcweir prop6 = new Integer(value); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir /*public void clearProp6() { 125cdf0e10cSrcweir prop6 = null; 126cdf0e10cSrcweir }*/ 127cdf0e10cSrcweir 128cdf0e10cSrcweir /*public int getProp7None() 129cdf0e10cSrcweir throws OptionalPropertyException, VoidPropertyException 130cdf0e10cSrcweir { 131cdf0e10cSrcweir throw new OptionalPropertyException("Prop7None", this); 132cdf0e10cSrcweir }*/ 133cdf0e10cSrcweir 134cdf0e10cSrcweir /*public void setProp7None(int value) throws OptionalPropertyException { 135cdf0e10cSrcweir throw new OptionalPropertyException("Prop7None", this); 136cdf0e10cSrcweir }*/ 137cdf0e10cSrcweir 138cdf0e10cSrcweir /*public void clearProp7None() throws OptionalPropertyException { 139cdf0e10cSrcweir throw new OptionalPropertyException("Prop7None", this); 140cdf0e10cSrcweir }*/ 141cdf0e10cSrcweir getProp7()142cdf0e10cSrcweir public int getProp7() 143cdf0e10cSrcweir /*throws OptionalPropertyException, VoidPropertyException*/ 144cdf0e10cSrcweir { 145cdf0e10cSrcweir /*if (prop7 == null) { 146cdf0e10cSrcweir throw new VoidPropertyException("Prop7", this); 147cdf0e10cSrcweir } else {*/ 148cdf0e10cSrcweir return prop7.intValue(); 149cdf0e10cSrcweir /*}*/ 150cdf0e10cSrcweir } 151cdf0e10cSrcweir setProp7(int value)152cdf0e10cSrcweir public void setProp7(int value) /*throws OptionalPropertyException*/ { 153cdf0e10cSrcweir prop7 = new Integer(value); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir /*public void clearProp7() throws OptionalPropertyException { 157cdf0e10cSrcweir prop7 = null; 158cdf0e10cSrcweir }*/ 159cdf0e10cSrcweir 160cdf0e10cSrcweir /*public int getProp8None() throws OptionalPropertyException { 161cdf0e10cSrcweir throw new OptionalPropertyException("Prop8None", this); 162cdf0e10cSrcweir }*/ 163cdf0e10cSrcweir 164cdf0e10cSrcweir /*public void setProp8None(int value) throws OptionalPropertyException { 165cdf0e10cSrcweir throw new OptionalPropertyException("Prop8None", this); 166cdf0e10cSrcweir }*/ 167cdf0e10cSrcweir getProp8Long()168cdf0e10cSrcweir public int getProp8Long() /*throws OptionalPropertyException*/ { 169cdf0e10cSrcweir return prop8; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir setProp8Long(int value)172cdf0e10cSrcweir public void setProp8Long(int value) /*throws OptionalPropertyException*/ 173cdf0e10cSrcweir { 174cdf0e10cSrcweir prop8 = value; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir fn2()177cdf0e10cSrcweir public int fn2() { 178cdf0e10cSrcweir return 2; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir fn3()181cdf0e10cSrcweir public int fn3() { 182cdf0e10cSrcweir return 3; 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir private int prop1 = 1; 186cdf0e10cSrcweir private Integer prop6 = new Integer(6); 187cdf0e10cSrcweir private Integer prop7 = new Integer(7); 188cdf0e10cSrcweir private int prop8 = 8; 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir private static final String SERVICE_NAME 192cdf0e10cSrcweir = "testtools.servicetests.TestService2"; 193cdf0e10cSrcweir } 194