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: _XCachedContentResultSetStubFactory.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
.XCachedContentResultSetStubFactory
;
41 * Testing <code>com.sun.star.ucb.XCachedContentResultSetStubFactory</code>
44 * <li><code> createCachedContentResultSetStub()</code></li>
46 * This test needs the following object relations :
48 * <li> <code>'ContentResultSet'</code> (of type
49 * <code>com.sun.star.sdbc.XResultSet</code>):
50 * this must be an imlementation of <code>
51 * com.sun.star.ucb.ContentResultSet</code> service.</li>
53 * Test is <b> NOT </b> multithread compilant. <p>
54 * @see com.sun.star.ucb.XCachedContentResultSetStubFactory
56 public class _XCachedContentResultSetStubFactory
extends MultiMethodTest
{
59 * Conatins the tested object.
61 public XCachedContentResultSetStubFactory oObj
;
62 private XResultSet resSet
= null ;
65 * Retrieves object relation.
66 * @throws StatusException If relation not found.
68 public void before() {
69 resSet
= (XResultSet
) tEnv
.getObjRelation("ContentResultSet") ;
71 log
.println("!!! Relation not found !!!") ;
72 throw new StatusException(Status
.failed("!!! Relation not found !!!")) ;
77 * Creates cached result set stub from static result set. After that number
78 * of rows in cached result set created and its source set are retrieved
80 * Has <b>OK</b> status if numbers of rows are equal and they are
81 * greater then 0 (because JAR file contains at least one entry).
83 public void _createCachedContentResultSetStub() {
84 boolean result
= true ;
86 XResultSet resSetStub
= oObj
.createCachedContentResultSetStub
89 if (resSetStub
== null) {
90 log
.println("!!! Method returned null !!!") ;
95 int stubRowNum
= resSetStub
.getRow() ;
98 int setRowNum
= resSet
.getRow() ;
100 result
= stubRowNum
== setRowNum
&& setRowNum
> 0 ;
102 log
.println("Number of rows : set=" + setRowNum
+
103 " stub=" + stubRowNum
) ;
104 } catch (com
.sun
.star
.sdbc
.SQLException e
) {
105 log
.println("!!! Something wrong with result sets :") ;
106 e
.printStackTrace(log
) ;
111 tRes
.tested("createCachedContentResultSetStub()", result
) ;