1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XCachedContentResultSetFactory.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import lib
.StatusException
;
37 import com
.sun
.star
.sdbc
.XResultSet
;
38 import com
.sun
.star
.ucb
.XCachedContentResultSetFactory
;
41 * Testing <code>com.sun.star.ucb.XCachedContentResultSetFactory</code>
44 * <li><code> createCachedContentResultSet()</code></li>
46 * This test needs the following object relations :
48 * <li> <code>'CachedContentResultSetStub'</code> (of type
49 * <code>com.sun.star.sdbc.XResultSet</code>):
50 * this must be an imlementation of <code>
51 * com.sun.star.ucb.CachedContentResultSetStub</code> service.</li>
53 * Test is <b> NOT </b> multithread compilant. <p>
54 * @see com.sun.star.ucb.XCachedContentResultSetFactory
56 public class _XCachedContentResultSetFactory
extends MultiMethodTest
{
59 * Conatins the tested object.
61 public XCachedContentResultSetFactory oObj
;
62 private XResultSet resSetStub
= null ;
65 * Retrieves object relation.
66 * @throws StatusException If relation not found.
68 public void before() {
69 resSetStub
= (XResultSet
)
70 tEnv
.getObjRelation("CachedContentResultSetStub") ;
71 if (resSetStub
== null) {
72 log
.println("!!! Relation not found !!!") ;
73 throw new StatusException
74 (Status
.failed("!!! Relation not found !!!")) ;
79 * Creates result set from result set stub. After that number
80 * of rows from result set created and its stub are retrieved
81 * using their static representations and comared. <p>
82 * Has <b>OK</b> status if numbers of rows are equal and they are
83 * greater then 0 (because JAR file contains at least one entry).
85 public void _createCachedContentResultSet() {
86 boolean result
= true ;
88 XResultSet resSet
= oObj
.createCachedContentResultSet
92 log
.println("!!! Method returned null !!!") ;
97 int stubRowNum
= resSetStub
.getRow() ;
100 int setRowNum
= resSet
.getRow() ;
102 result
= stubRowNum
== setRowNum
&& setRowNum
> 0 ;
104 log
.println("Number of rows : stub=" + stubRowNum
+
105 " set=" + setRowNum
) ;
106 } catch (com
.sun
.star
.sdbc
.SQLException e
) {
107 log
.println("!!! Something wrong with result sets :") ;
108 e
.printStackTrace(log
) ;
113 tRes
.tested("createCachedContentResultSet()", result
) ;