Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / io / _XActiveDataSource.java
blob5cd2dd3efa3d034b9b3777c5deb7438368f1d0df
1 /*
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 .
19 package ifc.io;
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;
28 /**
29 * Testing <code>com.sun.star.io.XActiveDataSource</code>
30 * interface methods:
31 * <ul>
32 * <li><code>setOutputStream()</code></li>
33 * <li><code>getOutputStream()</code></li>
34 * </ul> <p>
36 * This test needs the following object relations :
37 * <ul>
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>
41 * <ul> <p>
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;
53 /**
54 * Take the XOutputStream from the environment for setting and getting.
56 @Override
57 public void before() {
58 XInterface x = (XInterface)tEnv.getObjRelation("OutputStream");
59 oStream = UnoRuntime.queryInterface
60 (XOutputStream.class, x) ;
63 /**
64 * Test calls the method using interface <code>XOutputStream</code>
65 * received in method <code>before()</code> as parameter. <p>
66 * Has <b> OK </b> status if the method successfully returns. <p>
68 public void _setOutputStream() {
69 oObj.setOutputStream(oStream);
70 tRes.tested("setOutputStream()", true);
73 /**
74 * Test calls the method and compares returned value with value that was
75 * set in the method <code>setOutputStream()</code>. <p>
76 * Has <b> OK </b> status if values are equal. <p>
77 * The following method tests are to be completed successfully before :
78 * <ul>
79 * <li> <code> setOutputStream() </code></li>
80 * </ul>
82 public void _getOutputStream() {
83 requiredMethod("setOutputStream()");
85 tRes.tested("getOutputStream()",
86 oStream.equals(oObj.getOutputStream()));
89 /**
90 * Forces object environment recreation.
92 @Override
93 public void after() {
94 this.disposeEnvironment() ;