merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / io / _XActiveDataSink.java
blobdfa55745753603e1c2317c6ed60450172eeb226b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XActiveDataSink.java,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 package ifc.io;
33 import lib.MultiMethodTest;
35 import com.sun.star.io.XActiveDataSink;
36 import com.sun.star.io.XInputStream;
37 import com.sun.star.uno.UnoRuntime;
38 import com.sun.star.uno.XInterface;
40 /**
41 * Testing <code>com.sun.star.io.XActiveDataSink</code>
42 * interface methods :
43 * <ul>
44 * <li><code> setInputStream()</code></li>
45 * <li><code> getInputStream()</code></li>
46 * </ul> <p>
47 * Test is <b> NOT </b> multithread compilant. <p>
49 * This test needs the following object relations :
50 * <ul>
51 * <li> <code>'InputStream'</code>
52 * (of type <code>com.sun.star.io.XInputStream</code>):
53 * acceptable input stream which can be set by <code>setInputStream</code> </li>
54 * <ul> <p>
56 * After test completion object environment has to be recreated.
57 * @see com.sun.star.io.XActiveDataSink
59 public class _XActiveDataSink extends MultiMethodTest {
61 public XActiveDataSink oObj = null;
63 private XInputStream iStream = null;
65 /**
66 * Take the XInputStream from the environment for setting and getting
68 public void before() {
69 XInterface x = (XInterface)tEnv.getObjRelation("InputStream");
70 iStream = (XInputStream) UnoRuntime.queryInterface
71 (XInputStream.class, x) ;
74 /**
75 * Just sets new input stream. <p>
76 * Has <b>OK</b> status if no runtime exceptions occured.
78 public void _setInputStream() {
79 oObj.setInputStream(iStream) ;
81 tRes.tested("setInputStream()", true) ;
84 /**
85 * First retrieves current input stream, then sets to new
86 * input stream (if old was <code>null</code>) or to null.
87 * Then input stream retrieved again and checked to be not
88 * equal to the old one. <p>
89 * Has <b>OK</b> status if old and new streams retrieved are
90 * not equal. <p>
91 * The following method tests are to be completed successfully before :
92 * <ul>
93 * <li> <code> setInputStream() </code> : to be sure the method
94 * works without exceptions. </li>
95 * </ul>
97 public void _getInputStream() {
98 requiredMethod("setInputStream()") ;
100 Object oldStream = oObj.getInputStream() ;
101 XInputStream newStream = oldStream == null ? iStream : null ;
103 oObj.setInputStream(newStream) ;
104 Object getStream = oObj.getInputStream() ;
106 tRes.tested("getInputStream()", getStream != oldStream) ;
109 public void after() {
110 this.disposeEnvironment() ;