1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XConnectable.java,v $
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 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import com
.sun
.star
.io
.XConnectable
;
36 import com
.sun
.star
.uno
.UnoRuntime
;
37 import com
.sun
.star
.uno
.XInterface
;
40 * Testing <code>com.sun.star.io.XConnectable</code>
43 * <li><code>setPredecessor()</code></li>
44 * <li><code>getPredecessor()</code></li>
45 * <li><code>setSuccessor()</code></li>
46 * <li><code>getSuccessor()</code></li>
48 * This test needs the following object relations :
50 * <li> <code>'Connectable'</code> (supports the <code>XConnectable</code>
52 * another 0bject to connect </li>
54 * After test completion object environment has to be recreated.
55 * @see com.sun.star.io.XConnectable
57 public class _XConnectable
extends MultiMethodTest
{
59 public XConnectable oObj
= null;
61 private XConnectable xConnect
= null ;
64 * Get another connectable object from object relations.
66 public void before() {
67 XInterface x
= (XInterface
)tEnv
.getObjRelation("Connectable");
68 xConnect
= (XConnectable
)UnoRuntime
.queryInterface(
69 XConnectable
.class, x
) ;
73 * Test calls the method using interface <code>XConnectable</code>
74 * received in method <code>before()</code> as parameter. <p>
75 * Has <b> OK </b> status if the method successfully returns. <p>
77 public void _setPredecessor() {
78 oObj
.setPredecessor(xConnect
) ;
80 tRes
.tested("setPredecessor()", true) ;
84 * Test calls the method and compares returned value with value that was
85 * set in the method <code>setPredecessor()</code>. <p>
86 * Has <b> OK </b> status if values are equal. <p>
87 * The following method tests are to be completed successfully before :
89 * <li> <code> setPredecessor() </code></li>
92 public void _getPredecessor() {
93 requiredMethod("setPredecessor()") ;
95 XConnectable gConnect
= oObj
.getPredecessor() ;
97 tRes
.tested("getPredecessor()", xConnect
.equals(gConnect
)) ;
101 * Test calls the method using interface <code>XConnectable</code>
102 * received in method <code>before()</code> as parameter. <p>
103 * Has <b> OK </b> status if the method successfully returns. <p>
105 public void _setSuccessor() {
106 oObj
.setSuccessor(xConnect
) ;
108 tRes
.tested("setSuccessor()", true) ;
112 * Test calls the method and compares returned value with value that was
113 * set in the method <code>setSuccessor()</code>. <p>
114 * Has <b> OK </b> status if values are equal. <p>
115 * The following method tests are to be completed successfully before :
117 * <li> <code> setSuccessor() </code></li>
120 public void _getSuccessor() {
121 requiredMethod("setSuccessor()") ;
123 XConnectable gConnect
= oObj
.getSuccessor() ;
125 tRes
.tested("getSuccessor()", xConnect
.equals(gConnect
)) ;
129 * Forces object environment recreation.
131 public void after() {
132 this.disposeEnvironment() ;