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
.XConnectable
;
33 import com
.sun
.star
.uno
.UnoRuntime
;
34 import com
.sun
.star
.uno
.XInterface
;
37 * Testing <code>com.sun.star.io.XConnectable</code>
40 * <li><code>setPredecessor()</code></li>
41 * <li><code>getPredecessor()</code></li>
42 * <li><code>setSuccessor()</code></li>
43 * <li><code>getSuccessor()</code></li>
45 * This test needs the following object relations :
47 * <li> <code>'Connectable'</code> (supports the <code>XConnectable</code>
49 * another 0bject to connect </li>
51 * After test completion object environment has to be recreated.
52 * @see com.sun.star.io.XConnectable
54 public class _XConnectable
extends MultiMethodTest
{
56 public XConnectable oObj
= null;
58 private XConnectable xConnect
= null ;
61 * Get another connectable object from object relations.
63 public void before() {
64 XInterface x
= (XInterface
)tEnv
.getObjRelation("Connectable");
65 xConnect
= (XConnectable
)UnoRuntime
.queryInterface(
66 XConnectable
.class, x
) ;
70 * Test calls the method using interface <code>XConnectable</code>
71 * received in method <code>before()</code> as parameter. <p>
72 * Has <b> OK </b> status if the method successfully returns. <p>
74 public void _setPredecessor() {
75 oObj
.setPredecessor(xConnect
) ;
77 tRes
.tested("setPredecessor()", true) ;
81 * Test calls the method and compares returned value with value that was
82 * set in the method <code>setPredecessor()</code>. <p>
83 * Has <b> OK </b> status if values are equal. <p>
84 * The following method tests are to be completed successfully before :
86 * <li> <code> setPredecessor() </code></li>
89 public void _getPredecessor() {
90 requiredMethod("setPredecessor()") ;
92 XConnectable gConnect
= oObj
.getPredecessor() ;
94 tRes
.tested("getPredecessor()", xConnect
.equals(gConnect
)) ;
98 * Test calls the method using interface <code>XConnectable</code>
99 * received in method <code>before()</code> as parameter. <p>
100 * Has <b> OK </b> status if the method successfully returns. <p>
102 public void _setSuccessor() {
103 oObj
.setSuccessor(xConnect
) ;
105 tRes
.tested("setSuccessor()", true) ;
109 * Test calls the method and compares returned value with value that was
110 * set in the method <code>setSuccessor()</code>. <p>
111 * Has <b> OK </b> status if values are equal. <p>
112 * The following method tests are to be completed successfully before :
114 * <li> <code> setSuccessor() </code></li>
117 public void _getSuccessor() {
118 requiredMethod("setSuccessor()") ;
120 XConnectable gConnect
= oObj
.getSuccessor() ;
122 tRes
.tested("getSuccessor()", xConnect
.equals(gConnect
)) ;
126 * Forces object environment recreation.
128 public void after() {
129 this.disposeEnvironment() ;