1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.io
.XActiveDataSource
;
33 import com
.sun
.star
.io
.XOutputStream
;
34 import com
.sun
.star
.uno
.UnoRuntime
;
35 import com
.sun
.star
.uno
.XInterface
;
38 * Testing <code>com.sun.star.io.XActiveDataSource</code>
41 * <li><code>setOutputStream()</code></li>
42 * <li><code>getOutputStream()</code></li>
45 * This test needs the following object relations :
47 * <li> <code>'OutputStream'</code>
48 * (of type <code>com.sun.star.io.OutputStream</code>):
49 * acceptable output stream which can be set by <code>setOutputStream</code> </li>
52 * After test completion object environment has to be recreated.
53 * @see com.sun.star.io.XActiveDataSource
54 * @see com.sun.star.io.XOutputStream
56 public class _XActiveDataSource
extends MultiMethodTest
{
58 public XActiveDataSource oObj
= null;
60 private XOutputStream oStream
= null;
63 * Take the XOutputStream from the environment for setting and getting.
65 public void before() {
66 XInterface x
= (XInterface
)tEnv
.getObjRelation("OutputStream");
67 oStream
= (XOutputStream
) UnoRuntime
.queryInterface
68 (XOutputStream
.class, x
) ;
72 * Test calls the method using interface <code>XOutputStream</code>
73 * received in method <code>before()</code> as parameter. <p>
74 * Has <b> OK </b> status if the method successfully returns. <p>
76 public void _setOutputStream() {
77 oObj
.setOutputStream(oStream
);
78 tRes
.tested("setOutputStream()", true);
82 * Test calls the method and compares returned value with value that was
83 * set in the method <code>setOutputStream()</code>. <p>
84 * Has <b> OK </b> status if values are equal. <p>
85 * The following method tests are to be completed successfully before :
87 * <li> <code> setOutputStream() </code></li>
90 public void _getOutputStream() {
91 requiredMethod("setOutputStream()");
93 tRes
.tested("getOutputStream()",
94 oStream
.equals(oObj
.getOutputStream()));
98 * Forces object environment recreation.
100 public void after() {
101 this.disposeEnvironment() ;