1ef39d40dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3ef39d40dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4ef39d40dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5ef39d40dSAndrew Rist * distributed with this work for additional information 6ef39d40dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7ef39d40dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8ef39d40dSAndrew Rist * "License"); you may not use this file except in compliance 9ef39d40dSAndrew Rist * with the License. You may obtain a copy of the License at 10ef39d40dSAndrew Rist * 11ef39d40dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12ef39d40dSAndrew Rist * 13ef39d40dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14ef39d40dSAndrew Rist * software distributed under the License is distributed on an 15ef39d40dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ef39d40dSAndrew Rist * KIND, either express or implied. See the License for the 17ef39d40dSAndrew Rist * specific language governing permissions and limitations 18ef39d40dSAndrew Rist * under the License. 19ef39d40dSAndrew Rist * 20ef39d40dSAndrew Rist *************************************************************/ 21ef39d40dSAndrew Rist 22ef39d40dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package ifc.sheet; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import lib.MultiMethodTest; 27cdf0e10cSrcweir import util.ValueChanger; 28cdf0e10cSrcweir 29cdf0e10cSrcweir import com.sun.star.beans.PropertyValue; 30cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 31cdf0e10cSrcweir import com.sun.star.util.XImportable; 32cdf0e10cSrcweir 33cdf0e10cSrcweir /** 34cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.DatabaseImportDescriptor</code> 35cdf0e10cSrcweir * service properties: 36cdf0e10cSrcweir * <ul> 37cdf0e10cSrcweir * <li><code>DatabaseName</code></li> 38cdf0e10cSrcweir * <li><code>SourceObject</code></li> 39cdf0e10cSrcweir * <li><code>SourceType</code></li> 40cdf0e10cSrcweir * </ul> <p> 41cdf0e10cSrcweir * @see com.sun.star.sheet.DatabaseImportDescriptor 42cdf0e10cSrcweir */ 43cdf0e10cSrcweir public class _DatabaseImportDescriptor extends MultiMethodTest { 44cdf0e10cSrcweir 45cdf0e10cSrcweir public XPropertySet oObj = null; 46cdf0e10cSrcweir public XImportable xIMP = null; 47cdf0e10cSrcweir public PropertyValue[] props = null; 48cdf0e10cSrcweir _DatabaseName()49cdf0e10cSrcweir public void _DatabaseName() { 50cdf0e10cSrcweir xIMP = (XImportable) tEnv.getObjRelation("xIMP"); 51cdf0e10cSrcweir props = xIMP.createImportDescriptor(true); 52cdf0e10cSrcweir changeProp("DatabaseName",0); 53cdf0e10cSrcweir } 54cdf0e10cSrcweir _SourceObject()55cdf0e10cSrcweir public void _SourceObject() { 56cdf0e10cSrcweir changeProp("SourceObject",2); 57cdf0e10cSrcweir } 58cdf0e10cSrcweir _SourceType()59cdf0e10cSrcweir public void _SourceType() { 60cdf0e10cSrcweir changeProp("SourceType",1); 61cdf0e10cSrcweir } 62cdf0e10cSrcweir changeProp(String name, int nr)63cdf0e10cSrcweir public void changeProp(String name, int nr) { 64cdf0e10cSrcweir 65cdf0e10cSrcweir Object gValue = null; 66cdf0e10cSrcweir Object sValue = null; 67cdf0e10cSrcweir Object ValueToSet = null; 68cdf0e10cSrcweir 69cdf0e10cSrcweir if ( ! name.equals(props[nr].Name) ) { 70cdf0e10cSrcweir log.println("Property '"+props[nr].Name+"' is tested"); 71cdf0e10cSrcweir log.println("But the status is for '"+name+"'"); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir 75cdf0e10cSrcweir try { 76cdf0e10cSrcweir //waitForAllThreads(); 77cdf0e10cSrcweir gValue = props[nr].Value; 78cdf0e10cSrcweir //waitForAllThreads(); 79cdf0e10cSrcweir ValueToSet = ValueChanger.changePValue(gValue); 80cdf0e10cSrcweir //waitForAllThreads(); 81cdf0e10cSrcweir props[nr].Value=ValueToSet; 82cdf0e10cSrcweir sValue = props[nr].Value; 83cdf0e10cSrcweir 84cdf0e10cSrcweir //check get-set methods 85cdf0e10cSrcweir if ( (gValue.equals(sValue)) || (sValue == null) ) { 86cdf0e10cSrcweir log.println("Value for '"+name+"' hasn't changed"); 87cdf0e10cSrcweir tRes.tested(name, false); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir else { 90cdf0e10cSrcweir log.println("Property '"+name+"' OK"); 91cdf0e10cSrcweir tRes.tested(name, true); 92cdf0e10cSrcweir } 93cdf0e10cSrcweir } catch (Exception e) { 94bb6af6bcSPedro Giffuni log.println("Exception occurred while testing property '" + 95cdf0e10cSrcweir name + "'"); 96cdf0e10cSrcweir e.printStackTrace(log); 97cdf0e10cSrcweir tRes.tested(name, false); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir }// end of changeProp 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir } // finish class _DatabaseImportDescriptor 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105