1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.sdb;
25 
26 import lib.MultiMethodTest;
27 import lib.StatusException;
28 
29 import com.sun.star.sdb.XCompletedConnection;
30 import com.sun.star.sdbc.XConnection;
31 import com.sun.star.task.XInteractionHandler;
32 
33 /**
34  * Testing <code>com.sun.star.sdb.XCompletedConnection</code>
35  * interface methods :
36  * <ul>
37  *  <li><code> connectWithCompletion()</code></li>
38  * </ul> <p>
39 *    The following object relations required :
40 * <ul>
41 * <li> <code>'XCompletedConnection.Handler'</code> : passed as parameter
42 * to <code>connectWithCompletion</code> method. </li>
43 * </ul>
44 * @see com.sun.star.sdb.XCompletedConnection
45 * @see com.sun.star.task.XInteractionHandler
46 * @see com.sun.star.sdbc.XConnection
47 */
48 public class _XCompletedConnection extends MultiMethodTest {
49 
50     // oObj filled by MultiMethodTest
51     public XCompletedConnection oObj = null ;
52 
53     /**
54     * Test call the method with handler passed as object relation.
55     * Then value returned is checked.<p>
56     * Has OK status if not null value returned. <&nbsp>
57     * FAILED if exception occured, null value returned or object
58     * relation was not found.
59     */
_connectWithCompletion()60     public void _connectWithCompletion() throws StatusException {
61         XInteractionHandler handler = (XInteractionHandler)
62             tEnv.getObjRelation("XCompletedConnection.Handler") ;
63 
64         if (handler == null) {
65             log.println("Required object relation not found !") ;
66             tRes.tested("connectWithCompletion()", false) ;
67             return ;
68         }
69 
70         XConnection con = null ;
71         try {
72             con = oObj.connectWithCompletion(handler) ;
73         } catch (com.sun.star.sdbc.SQLException e) {
74             throw new StatusException("Exception while method calling", e) ;
75         }
76 
77         tRes.tested("connectWithCompletion()", con != null) ;
78     }
79 }  // finish class _XCompletedConnection
80 
81