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 ************************************************************************/
30 import lib
.MultiMethodTest
;
31 import util
.ValueChanger
;
33 import com
.sun
.star
.beans
.PropertyValue
;
34 import com
.sun
.star
.beans
.XPropertySet
;
35 import com
.sun
.star
.util
.XImportable
;
38 * Testing <code>com.sun.star.sheet.DatabaseImportDescriptor</code>
41 * <li><code>DatabaseName</code></li>
42 * <li><code>SourceObject</code></li>
43 * <li><code>SourceType</code></li>
45 * @see com.sun.star.sheet.DatabaseImportDescriptor
47 public class _DatabaseImportDescriptor
extends MultiMethodTest
{
49 public XPropertySet oObj
= null;
50 public XImportable xIMP
= null;
51 public PropertyValue
[] props
= null;
53 public void _DatabaseName() {
54 xIMP
= (XImportable
) tEnv
.getObjRelation("xIMP");
55 props
= xIMP
.createImportDescriptor(true);
56 changeProp("DatabaseName",0);
59 public void _SourceObject() {
60 changeProp("SourceObject",2);
63 public void _SourceType() {
64 changeProp("SourceType",1);
67 public void changeProp(String name
, int nr
) {
71 Object ValueToSet
= null;
73 if ( ! name
.equals(props
[nr
].Name
) ) {
74 log
.println("Property '"+props
[nr
].Name
+"' is tested");
75 log
.println("But the status is for '"+name
+"'");
80 //waitForAllThreads();
81 gValue
= props
[nr
].Value
;
82 //waitForAllThreads();
83 ValueToSet
= ValueChanger
.changePValue(gValue
);
84 //waitForAllThreads();
85 props
[nr
].Value
=ValueToSet
;
86 sValue
= props
[nr
].Value
;
88 //check get-set methods
89 if ( (gValue
.equals(sValue
)) || (sValue
== null) ) {
90 log
.println("Value for '"+name
+"' hasn't changed");
91 tRes
.tested(name
, false);
94 log
.println("Property '"+name
+"' OK");
95 tRes
.tested(name
, true);
97 } catch (Exception e
) {
98 log
.println("Exception occurred while testing property '" +
100 e
.printStackTrace(log
);
101 tRes
.tested(name
, false);
103 }// end of changeProp
106 } // finish class _DatabaseImportDescriptor