2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.io
.XActiveDataSource
;
24 import com
.sun
.star
.io
.XOutputStream
;
25 import com
.sun
.star
.uno
.UnoRuntime
;
26 import com
.sun
.star
.uno
.XInterface
;
29 * Testing <code>com.sun.star.io.XActiveDataSource</code>
32 * <li><code>setOutputStream()</code></li>
33 * <li><code>getOutputStream()</code></li>
36 * This test needs the following object relations :
38 * <li> <code>'OutputStream'</code>
39 * (of type <code>com.sun.star.io.OutputStream</code>):
40 * acceptable output stream which can be set by <code>setOutputStream</code> </li>
43 * After test completion object environment has to be recreated.
44 * @see com.sun.star.io.XActiveDataSource
45 * @see com.sun.star.io.XOutputStream
47 public class _XActiveDataSource
extends MultiMethodTest
{
49 public XActiveDataSource oObj
= null;
51 private XOutputStream oStream
= null;
54 * Take the XOutputStream from the environment for setting and getting.
56 public void before() {
57 XInterface x
= (XInterface
)tEnv
.getObjRelation("OutputStream");
58 oStream
= UnoRuntime
.queryInterface
59 (XOutputStream
.class, x
) ;
63 * Test calls the method using interface <code>XOutputStream</code>
64 * received in method <code>before()</code> as parameter. <p>
65 * Has <b> OK </b> status if the method successfully returns. <p>
67 public void _setOutputStream() {
68 oObj
.setOutputStream(oStream
);
69 tRes
.tested("setOutputStream()", true);
73 * Test calls the method and compares returned value with value that was
74 * set in the method <code>setOutputStream()</code>. <p>
75 * Has <b> OK </b> status if values are equal. <p>
76 * The following method tests are to be completed successfully before :
78 * <li> <code> setOutputStream() </code></li>
81 public void _getOutputStream() {
82 requiredMethod("setOutputStream()");
84 tRes
.tested("getOutputStream()",
85 oStream
.equals(oObj
.getOutputStream()));
89 * Forces object environment recreation.
92 this.disposeEnvironment() ;