bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _DatabaseImportDescriptor.java
blob4ddeae4db611309e7b179a3eb514b81896633dc2
1 /*
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 .
19 package ifc.sheet;
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;
28 /**
29 * Testing <code>com.sun.star.sheet.DatabaseImportDescriptor</code>
30 * service properties:
31 * <ul>
32 * <li><code>DatabaseName</code></li>
33 * <li><code>SourceObject</code></li>
34 * <li><code>SourceType</code></li>
35 * </ul> <p>
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) {
60 Object gValue = null;
61 Object sValue = null;
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+"'");
70 try {
71 //waitForAllThreads();
72 gValue = props[nr].Value;
73 //waitForAllThreads();
74 ValueToSet = ValueChanger.changePValue(gValue);
75 //waitForAllThreads();
76 props[nr].Value=ValueToSet;
77 sValue = props[nr].Value;
79 //check get-set methods
80 if ( (gValue.equals(sValue)) || (sValue == null) ) {
81 log.println("Value for '"+name+"' hasn't changed");
82 tRes.tested(name, false);
84 else {
85 log.println("Property '"+name+"' OK");
86 tRes.tested(name, true);
88 } catch (Exception e) {
89 log.println("Exception occurred while testing property '" +
90 name + "'");
91 e.printStackTrace(log);
92 tRes.tested(name, false);
94 }// end of changeProp
97 } // finish class _DatabaseImportDescriptor