merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / sdbc / _XCloseable.java
blob098fac1a0674389a07e263efded559b0c79ad87f
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: _XCloseable.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.StatusException;
36 import com.sun.star.sdbc.SQLException;
37 import com.sun.star.sdbc.XCloseable;
38 import com.sun.star.sdbc.XResultSet;
39 import com.sun.star.uno.UnoRuntime;
41 /**
42 * Testing <code>com.sun.star.sdbc.XCloseable</code>
43 * interface methods :
44 * <ul>
45 * <li><code> close()</code></li>
46 * </ul> <p>
47 * After test object must be recreated.
48 * @see com.sun.star.sdbc.XCloseable
50 public class _XCloseable extends MultiMethodTest {
52 // oObj filled by MultiMethodTest
53 public XCloseable oObj = null ;
55 /**
56 * Closes row set. If the component implements the interface
57 * <code>com.sun.star.sdbc.XResutlSet</code> then tries to move
58 * the cursor to the first row in the result set.
59 * Has OK status if no exceptions were thrown during first call and
60 * if expected SQL exception was thrown during cursor moving.
62 public void _close() throws StatusException {
63 boolean res = false;
64 try {
65 oObj.close();
66 res = true;
67 } catch (SQLException e) {
68 log.println("Unexpected SQL Exception occured:" + e) ;
69 res = false;
72 XResultSet resSet = (XResultSet)
73 UnoRuntime.queryInterface(XResultSet.class, oObj);
75 if (resSet != null) {
76 try {
77 resSet.first();
78 log.println("Expected SQLException not occured !");
79 res = false;
80 } catch(SQLException e) {
81 log.println("Expected SQLException occured");
82 res = true;
86 tRes.tested("close()", res);
89 /**
90 * Forces environment recreation.
92 public void after() {
93 disposeEnvironment() ;
96 } // finish class _XCloseable