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: _XCloseable.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
;
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
;
42 * Testing <code>com.sun.star.sdbc.XCloseable</code>
45 * <li><code> close()</code></li>
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 ;
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
{
67 } catch (SQLException e
) {
68 log
.println("Unexpected SQL Exception occured:" + e
) ;
72 XResultSet resSet
= (XResultSet
)
73 UnoRuntime
.queryInterface(XResultSet
.class, oObj
);
78 log
.println("Expected SQLException not occured !");
80 } catch(SQLException e
) {
81 log
.println("Expected SQLException occured");
86 tRes
.tested("close()", res
);
90 * Forces environment recreation.
93 disposeEnvironment() ;
96 } // finish class _XCloseable