1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XColumnLocate.java,v $
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 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import lib
.StatusException
;
37 import com
.sun
.star
.sdbc
.SQLException
;
38 import com
.sun
.star
.sdbc
.XColumnLocate
;
42 * Testing <code>com.sun.star.sdbc.XColumnLocate</code>
45 * <li><code> findColumn()</code></li>
47 * The test required the following relations :
49 * <li> <code> XColumnLocate.ColumnName </code> : The name of the first
52 * @see com.sun.star.sdbc.XColumnLocate
54 public class _XColumnLocate
extends MultiMethodTest
{
56 // oObj filled by MultiMethodTest
57 public XColumnLocate oObj
= null ;
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,
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"));
76 int colIdx
= oObj
.findColumn(colName
) ;
77 result
= colIdx
== 1 ;
78 } catch (SQLException e
) {
79 log
.println("Exception occured:");
80 e
.printStackTrace(log
);
84 tRes
.tested("findColumn()", result
);
87 } // finish class _XColumnLocate