tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / ucb / _XCachedDynamicResultSetFactory.java
blob6ac08147a78e9de8da700ca0f7d5ee47f18b99a4
1 /*
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 .
19 package ifc.ucb;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.sdbc.XResultSet;
26 import com.sun.star.ucb.XCachedDynamicResultSetFactory;
27 import com.sun.star.ucb.XDynamicResultSet;
29 /**
30 * Testing <code>com.sun.star.ucb.XCachedDynamicResultSetFactory</code>
31 * interface methods :
32 * <ul>
33 * <li><code> createCachedDynamicResultSet()</code></li>
34 * </ul> <p>
35 * This test needs the following object relations :
36 * <ul>
37 * <li> <code>'CachedDynamicResultSetStub'</code> (of type
38 * <code>com.sun.star.sdbc.XDynamicResultSet</code>):
39 * this must be an implementation of <code>
40 * com.sun.star.ucb.CachedDynamicResultSetStub</code> service.</li>
41 * <ul> <p>
42 * Test is <b> NOT </b> multithread compliant. <p>
43 * @see com.sun.star.ucb.XCachedDynamicResultSetFactory
45 public class _XCachedDynamicResultSetFactory extends MultiMethodTest {
47 /**
48 * Contains the tested object.
50 public XCachedDynamicResultSetFactory oObj;
51 private XDynamicResultSet resSetStub = null ;
53 /**
54 * Retrieves object relation.
55 * @throws StatusException If relation not found.
57 @Override
58 public void before() {
59 resSetStub = (XDynamicResultSet)
60 tEnv.getObjRelation("CachedDynamicResultSetStub") ;
61 if (resSetStub == null) {
62 log.println("!!! Relation not found !!!") ;
63 throw new StatusException
64 (Status.failed("!!! Relation not found !!!")) ;
68 /**
69 * Creates result set from result set stub. After that number
70 * of rows from result set created and its stub are retrieved
71 * using their static representations and compared. <p>
72 * Has <b>OK</b> status if numbers of rows are equal and they are
73 * greater than 0 (because JAR file contains at least one entry).
75 public void _createCachedDynamicResultSet() {
76 boolean result = true ;
78 XDynamicResultSet resSet = oObj.createCachedDynamicResultSet
79 (resSetStub, null) ;
81 if (resSet == null) {
82 log.println("!!! Method returned null !!!") ;
83 result = false ;
84 } else {
85 try {
86 XResultSet resSetS = resSet.getStaticResultSet() ;
87 XResultSet resSetStubS = resSetStub.getStaticResultSet() ;
89 resSetStubS.last() ;
90 int stubRowNum = resSetStubS.getRow() ;
92 resSetS.last() ;
93 int setRowNum = resSetS.getRow() ;
95 result = stubRowNum == setRowNum && setRowNum > 0 ;
97 log.println("Number of rows : stub=" + stubRowNum +
98 " set=" + setRowNum) ;
99 } catch (com.sun.star.sdbc.SQLException e) {
100 log.println("!!! Something wrong with result sets :") ;
101 e.printStackTrace(log) ;
102 result = false ;
103 } catch (com.sun.star.ucb.ListenerAlreadySetException e) {
104 log.println("!!! Can't get static result sets :") ;
105 e.printStackTrace(log) ;
106 result = false ;
110 tRes.tested("createCachedDynamicResultSet()", result) ;