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 lib
.StatusException
;
25 import com
.sun
.star
.sdbc
.XResultSet
;
26 import com
.sun
.star
.ucb
.XCachedContentResultSetStubFactory
;
29 * Testing <code>com.sun.star.ucb.XCachedContentResultSetStubFactory</code>
32 * <li><code> createCachedContentResultSetStub()</code></li>
34 * This test needs the following object relations :
36 * <li> <code>'ContentResultSet'</code> (of type
37 * <code>com.sun.star.sdbc.XResultSet</code>):
38 * this must be an imlementation of <code>
39 * com.sun.star.ucb.ContentResultSet</code> service.</li>
41 * Test is <b> NOT </b> multithread compliant. <p>
42 * @see com.sun.star.ucb.XCachedContentResultSetStubFactory
44 public class _XCachedContentResultSetStubFactory
extends MultiMethodTest
{
47 * Conatins the tested object.
49 public XCachedContentResultSetStubFactory oObj
;
50 private XResultSet resSet
= null ;
53 * Retrieves object relation.
54 * @throws StatusException If relation not found.
57 public void before() {
58 resSet
= (XResultSet
) tEnv
.getObjRelation("ContentResultSet") ;
60 log
.println("!!! Relation not found !!!") ;
61 throw new StatusException(Status
.failed("!!! Relation not found !!!")) ;
66 * Creates cached result set stub from static result set. After that number
67 * of rows in cached result set created and its source set are retrieved
69 * Has <b>OK</b> status if numbers of rows are equal and they are
70 * greater then 0 (because JAR file contains at least one entry).
72 public void _createCachedContentResultSetStub() {
73 boolean result
= true ;
75 XResultSet resSetStub
= oObj
.createCachedContentResultSetStub
78 if (resSetStub
== null) {
79 log
.println("!!! Method returned null !!!") ;
84 int stubRowNum
= resSetStub
.getRow() ;
87 int setRowNum
= resSet
.getRow() ;
89 result
= stubRowNum
== setRowNum
&& setRowNum
> 0 ;
91 log
.println("Number of rows : set=" + setRowNum
+
92 " stub=" + stubRowNum
) ;
93 } catch (com
.sun
.star
.sdbc
.SQLException e
) {
94 log
.println("!!! Something wrong with result sets :") ;
95 e
.printStackTrace(log
) ;
100 tRes
.tested("createCachedContentResultSetStub()", result
) ;