2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
22 import util
.ValueChanger
;
24 import com
.sun
.star
.beans
.PropertyValue
;
25 import com
.sun
.star
.beans
.XPropertySet
;
26 import com
.sun
.star
.util
.XImportable
;
29 * Testing <code>com.sun.star.sheet.DatabaseImportDescriptor</code>
32 * <li><code>DatabaseName</code></li>
33 * <li><code>SourceObject</code></li>
34 * <li><code>SourceType</code></li>
36 * @see com.sun.star.sheet.DatabaseImportDescriptor
38 public class _DatabaseImportDescriptor
extends MultiMethodTest
{
40 public XPropertySet oObj
= null;
41 public XImportable xIMP
= null;
42 public PropertyValue
[] props
= null;
44 public void _DatabaseName() {
45 xIMP
= (XImportable
) tEnv
.getObjRelation("xIMP");
46 props
= xIMP
.createImportDescriptor(true);
47 changeProp("DatabaseName",0);
50 public void _SourceObject() {
51 changeProp("SourceObject",2);
54 public void _SourceType() {
55 changeProp("SourceType",1);
58 public void changeProp(String name
, int nr
) {
62 Object ValueToSet
= null;
64 if ( ! name
.equals(props
[nr
].Name
) ) {
65 log
.println("Property '"+props
[nr
].Name
+"' is tested");
66 log
.println("But the status is for '"+name
+"'");
71 gValue
= props
[nr
].Value
;
72 ValueToSet
= ValueChanger
.changePValue(gValue
);
73 props
[nr
].Value
=ValueToSet
;
74 sValue
= props
[nr
].Value
;
76 //check get-set methods
77 if ( (gValue
.equals(sValue
)) || (sValue
== null) ) {
78 log
.println("Value for '"+name
+"' hasn't changed");
79 tRes
.tested(name
, false);
82 log
.println("Property '"+name
+"' OK");
83 tRes
.tested(name
, true);
85 } catch (Exception e
) {
86 log
.println("Exception occurred while testing property '" +
88 e
.printStackTrace(log
);
89 tRes
.tested(name
, false);
94 } // finish class _DatabaseImportDescriptor