2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.sdbc
.XConnection
;
24 import com
.sun
.star
.sdbc
.XDataSource
;
27 * Testing <code>com.sun.star.sdbc.XDataSource</code>
30 * <li><code>getConnection()</code></li>
31 * <li><code>setLoginTimeout()</code></li>
32 * <li><code>getLoginTimeout()</code></li>
34 * @see com.sun.star.sdbc.XDataSource
36 public class _XDataSource
extends MultiMethodTest
{
37 // oObj filled by MultiMethodTest
38 public XDataSource oObj
= null;
41 * Calls the method and checks returned value.
42 * Has OK status if exception wasn't thrown and
43 * if returned value isn't null.
45 public void _getConnection() {
49 XConnection connection
= oObj
.getConnection("", "");
50 res
= connection
!= null;
51 } catch(com
.sun
.star
.sdbc
.SQLException e
) {
52 log
.println("Unexpected exception:");
53 e
.printStackTrace(log
);
57 tRes
.tested("getConnection()", res
);
61 * Sets new timeout, compares with timeout returned by the method
62 * <code>getLoginTimeout()</code>.
63 * Has OK status if exception wasn't thrown and if timeout values are equal.
65 public void _setLoginTimeout() {
66 requiredMethod("getLoginTimeout()");
71 log
.println("setLoginTimeout(" + TO
+ ")");
72 oObj
.setLoginTimeout(TO
);
73 int timeout
= oObj
.getLoginTimeout();
75 log
.println("getLoginTimeout(): " + timeout
);
76 } catch(com
.sun
.star
.sdbc
.SQLException e
) {
77 log
.println("Unexpected exception:");
78 e
.printStackTrace(log
);
82 tRes
.tested("setLoginTimeout()", res
);
86 * Calls the method and checks returned value.
87 * Has OK status if exception wasn't thrown and
88 * if returned value is equal to zero.
90 public void _getLoginTimeout() {
94 int timeout
= oObj
.getLoginTimeout();
95 log
.println("getLoginTimeout(): " + timeout
);
97 } catch(com
.sun
.star
.sdbc
.SQLException e
) {
98 log
.println("Unexpected exception:");
99 e
.printStackTrace(log
);
103 tRes
.tested("getLoginTimeout()", res
);