bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / ucb / _XCachedContentResultSetFactory.java
blobb1bcd89c20911f9fba3903fb7c6aa21bf8d7c870
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.XCachedContentResultSetFactory;
28 /**
29 * Testing <code>com.sun.star.ucb.XCachedContentResultSetFactory</code>
30 * interface methods :
31 * <ul>
32 * <li><code> createCachedContentResultSet()</code></li>
33 * </ul> <p>
34 * This test needs the following object relations :
35 * <ul>
36 * <li> <code>'CachedContentResultSetStub'</code> (of type
37 * <code>com.sun.star.sdbc.XResultSet</code>):
38 * this must be an imlementation of <code>
39 * com.sun.star.ucb.CachedContentResultSetStub</code> service.</li>
40 * <ul> <p>
41 * Test is <b> NOT </b> multithread compilant. <p>
42 * @see com.sun.star.ucb.XCachedContentResultSetFactory
44 public class _XCachedContentResultSetFactory extends MultiMethodTest {
46 /**
47 * Conatins the tested object.
49 public XCachedContentResultSetFactory oObj;
50 private XResultSet resSetStub = null ;
52 /**
53 * Retrieves object relation.
54 * @throws StatusException If relation not found.
56 public void before() {
57 resSetStub = (XResultSet)
58 tEnv.getObjRelation("CachedContentResultSetStub") ;
59 if (resSetStub == null) {
60 log.println("!!! Relation not found !!!") ;
61 throw new StatusException
62 (Status.failed("!!! Relation not found !!!")) ;
66 /**
67 * Creates result set from result set stub. After that number
68 * of rows from result set created and its stub are retrieved
69 * using their static representations and comared. <p>
70 * Has <b>OK</b> status if numbers of rows are equal and they are
71 * greater then 0 (because JAR file contains at least one entry).
73 public void _createCachedContentResultSet() {
74 boolean result = true ;
76 XResultSet resSet = oObj.createCachedContentResultSet
77 (resSetStub, null) ;
79 if (resSet == null) {
80 log.println("!!! Method returned null !!!") ;
81 result = false ;
82 } else {
83 try {
84 resSetStub.last() ;
85 int stubRowNum = resSetStub.getRow() ;
87 resSet.last() ;
88 int setRowNum = resSet.getRow() ;
90 result = stubRowNum == setRowNum && setRowNum > 0 ;
92 log.println("Number of rows : stub=" + stubRowNum +
93 " set=" + setRowNum) ;
94 } catch (com.sun.star.sdbc.SQLException e) {
95 log.println("!!! Something wrong with result sets :") ;
96 e.printStackTrace(log) ;
97 result = false ;
101 tRes.tested("createCachedContentResultSet()", result) ;