Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _DatabaseImportDescriptor.java
blob6a8f402e741f30208240dd72bc0ea713d3aa6507
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 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);
81 else {
82 log.println("Property '"+name+"' OK");
83 tRes.tested(name, true);
85 } catch (Exception e) {
86 log.println("Exception occurred while testing property '" +
87 name + "'");
88 e.printStackTrace(log);
89 tRes.tested(name, false);
91 }// end of changeProp
94 } // finish class _DatabaseImportDescriptor