Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sdbc / _XColumnLocate.java
blob1866db552716b2076dbd2b67fac179cc1e101b11
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XColumnLocate.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.sdbc;
33 import lib.MultiMethodTest;
34 import lib.Status;
35 import lib.StatusException;
37 import com.sun.star.sdbc.SQLException;
38 import com.sun.star.sdbc.XColumnLocate;
40 /**
41 /**
42 * Testing <code>com.sun.star.sdbc.XColumnLocate</code>
43 * interface methods :
44 * <ul>
45 * <li><code> findColumn()</code></li>
46 * </ul> <p>
47 * The test required the following relations :
48 * <ul>
49 * <li> <code> XColumnLocate.ColumnName </code> : The name of the first
50 * column. </li>
51 * </ul>
52 * @see com.sun.star.sdbc.XColumnLocate
54 public class _XColumnLocate extends MultiMethodTest {
56 // oObj filled by MultiMethodTest
57 public XColumnLocate oObj = null ;
59 /**
60 * Using column name from object relation trying to find out
61 * the index of this column. <p>
62 * Has OK status if column index returned by method equals to 1,
63 * FAILED otherwise.
65 public void _findColumn() {
66 boolean result = false ;
67 String colName = (String) tEnv.getObjRelation("XColumnLocate.ColumnName") ;
69 if (colName == null) {
70 throw new StatusException(
71 Status.failed("Object relation 'XColumnLocate.ColumnName' " +
72 "for this interface not found"));
75 try {
76 int colIdx = oObj.findColumn(colName) ;
77 result = colIdx == 1 ;
78 } catch (SQLException e) {
79 log.println("Exception occured:");
80 e.printStackTrace(log);
81 result = false;
84 tRes.tested("findColumn()", result);
87 } // finish class _XColumnLocate