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