Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sdb / _DataAccessDescriptor.java
blobf28f430adcb299500d6293c6572bf0b60290a496
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: _DataAccessDescriptor.java,v $
10 * $Revision: 1.5 $
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 ifc.sdb;
33 import com.sun.star.sdbc.XConnection;
34 import com.sun.star.sdbc.XResultSet;
35 import com.sun.star.uno.UnoRuntime;
36 import lib.MultiPropertyTest;
38 public class _DataAccessDescriptor extends MultiPropertyTest {
40 /**
41 * Tested with custom property tester.
43 public void _ResultSet() {
44 String propName = "ResultSet";
45 try{
47 log.println("try to get value from property...");
48 XResultSet oldValue = (XResultSet) UnoRuntime.queryInterface(XResultSet.class,oObj.getPropertyValue(propName));
50 log.println("try to get value from object relation...");
51 XResultSet newValue = (XResultSet) UnoRuntime.queryInterface(XResultSet.class,tEnv.getObjRelation("DataAccessDescriptor.XResultSet"));
53 log.println("set property to a new value...");
54 oObj.setPropertyValue(propName, newValue);
56 log.println("get the new value...");
57 XResultSet getValue = (XResultSet) UnoRuntime.queryInterface(XResultSet.class,oObj.getPropertyValue(propName));
59 tRes.tested(propName, this.compare(newValue, getValue));
60 } catch (com.sun.star.beans.PropertyVetoException e){
61 log.println("could not set property '"+ propName +"' to a new value!");
62 tRes.tested(propName, false);
63 } catch (com.sun.star.lang.IllegalArgumentException e){
64 log.println("could not set property '"+ propName +"' to a new value!");
65 tRes.tested(propName, false);
66 } catch (com.sun.star.beans.UnknownPropertyException e){
67 if (this.isOptional(propName)){
68 // skipping optional property test
69 log.println("Property '" + propName
70 + "' is optional and not supported");
71 tRes.tested(propName,true);
73 } else {
74 log.println("could not get property '"+ propName +"' from XPropertySet!");
75 tRes.tested(propName, false);
77 } catch (com.sun.star.lang.WrappedTargetException e){
78 log.println("could not get property '"+ propName +"' from XPropertySet!");
79 tRes.tested(propName, false);
83 /**
84 * Tested with custom property tester.
86 public void _ActiveConnection() {
87 String propName = "ActiveConnection";
88 try{
90 log.println("try to get value from property...");
91 XConnection oldValue = (XConnection) UnoRuntime.queryInterface(XConnection.class,oObj.getPropertyValue(propName));
93 log.println("try to get value from object relation...");
94 XConnection newValue = (XConnection) UnoRuntime.queryInterface(XConnection.class,tEnv.getObjRelation("DataAccessDescriptor.XConnection"));
96 log.println("set property to a new value...");
97 oObj.setPropertyValue(propName, newValue);
99 log.println("get the new value...");
100 XConnection getValue = (XConnection) UnoRuntime.queryInterface(XConnection.class,oObj.getPropertyValue(propName));
102 tRes.tested(propName, this.compare(newValue, getValue));
103 } catch (com.sun.star.beans.PropertyVetoException e){
104 log.println("could not set property '"+ propName +"' to a new value! " + e.toString());
105 tRes.tested(propName, false);
106 } catch (com.sun.star.lang.IllegalArgumentException e){
107 log.println("could not set property '"+ propName +"' to a new value! " + e.toString());
108 tRes.tested(propName, false);
109 } catch (com.sun.star.beans.UnknownPropertyException e){
110 if (this.isOptional(propName)){
111 // skipping optional property test
112 log.println("Property '" + propName
113 + "' is optional and not supported");
114 tRes.tested(propName,true);
116 } else {
117 log.println("could not get property '"+ propName +"' from XPropertySet!");
118 tRes.tested(propName, false);
120 } catch (com.sun.star.lang.WrappedTargetException e){
121 log.println("could not get property '"+ propName +"' from XPropertySet!");
122 tRes.tested(propName, false);