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: _XActiveDataSource.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 com
.sun
.star
.io
.XActiveDataSource
;
36 import com
.sun
.star
.io
.XOutputStream
;
37 import com
.sun
.star
.uno
.UnoRuntime
;
38 import com
.sun
.star
.uno
.XInterface
;
41 * Testing <code>com.sun.star.io.XActiveDataSource</code>
44 * <li><code>setOutputStream()</code></li>
45 * <li><code>getOutputStream()</code></li>
48 * This test needs the following object relations :
50 * <li> <code>'OutputStream'</code>
51 * (of type <code>com.sun.star.io.OutputStream</code>):
52 * acceptable output stream which can be set by <code>setOutputStream</code> </li>
55 * After test completion object environment has to be recreated.
56 * @see com.sun.star.io.XActiveDataSource
57 * @see com.sun.star.io.XOutputStream
59 public class _XActiveDataSource
extends MultiMethodTest
{
61 public XActiveDataSource oObj
= null;
63 private XOutputStream oStream
= null;
66 * Take the XOutputStream from the environment for setting and getting.
68 public void before() {
69 XInterface x
= (XInterface
)tEnv
.getObjRelation("OutputStream");
70 oStream
= (XOutputStream
) UnoRuntime
.queryInterface
71 (XOutputStream
.class, x
) ;
75 * Test calls the method using interface <code>XOutputStream</code>
76 * received in method <code>before()</code> as parameter. <p>
77 * Has <b> OK </b> status if the method successfully returns. <p>
79 public void _setOutputStream() {
80 oObj
.setOutputStream(oStream
);
81 tRes
.tested("setOutputStream()", true);
85 * Test calls the method and compares returned value with value that was
86 * set in the method <code>setOutputStream()</code>. <p>
87 * Has <b> OK </b> status if values are equal. <p>
88 * The following method tests are to be completed successfully before :
90 * <li> <code> setOutputStream() </code></li>
93 public void _getOutputStream() {
94 requiredMethod("setOutputStream()");
96 tRes
.tested("getOutputStream()",
97 oStream
.equals(oObj
.getOutputStream()));
101 * Forces object environment recreation.
103 public void after() {
104 this.disposeEnvironment() ;