1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.io; 25 26 import lib.MultiMethodTest; 27 28 import com.sun.star.io.XConnectable; 29 import com.sun.star.uno.UnoRuntime; 30 import com.sun.star.uno.XInterface; 31 32 /** 33 * Testing <code>com.sun.star.io.XConnectable</code> 34 * interface methods: 35 * <ul> 36 * <li><code>setPredecessor()</code></li> 37 * <li><code>getPredecessor()</code></li> 38 * <li><code>setSuccessor()</code></li> 39 * <li><code>getSuccessor()</code></li> 40 * </ul> <p> 41 * This test needs the following object relations : 42 * <ul> 43 * <li> <code>'Connectable'</code> (supports the <code>XConnectable</code> 44 * interface): 45 * another 0bject to connect </li> 46 * </ul> 47 * After test completion object environment has to be recreated. 48 * @see com.sun.star.io.XConnectable 49 */ 50 public class _XConnectable extends MultiMethodTest { 51 52 public XConnectable oObj = null; 53 54 private XConnectable xConnect = null ; 55 56 /** 57 * Get another connectable object from object relations. 58 */ before()59 public void before() { 60 XInterface x = (XInterface)tEnv.getObjRelation("Connectable"); 61 xConnect = (XConnectable)UnoRuntime.queryInterface( 62 XConnectable.class, x) ; 63 } 64 65 /** 66 * Test calls the method using interface <code>XConnectable</code> 67 * received in method <code>before()</code> as parameter. <p> 68 * Has <b> OK </b> status if the method successfully returns. <p> 69 */ _setPredecessor()70 public void _setPredecessor() { 71 oObj.setPredecessor(xConnect) ; 72 73 tRes.tested("setPredecessor()", true) ; 74 } 75 76 /** 77 * Test calls the method and compares returned value with value that was 78 * set in the method <code>setPredecessor()</code>. <p> 79 * Has <b> OK </b> status if values are equal. <p> 80 * The following method tests are to be completed successfully before : 81 * <ul> 82 * <li> <code> setPredecessor() </code></li> 83 * </ul> 84 */ _getPredecessor()85 public void _getPredecessor() { 86 requiredMethod("setPredecessor()") ; 87 88 XConnectable gConnect = oObj.getPredecessor() ; 89 90 tRes.tested("getPredecessor()", xConnect.equals(gConnect)) ; 91 } 92 93 /** 94 * Test calls the method using interface <code>XConnectable</code> 95 * received in method <code>before()</code> as parameter. <p> 96 * Has <b> OK </b> status if the method successfully returns. <p> 97 */ _setSuccessor()98 public void _setSuccessor() { 99 oObj.setSuccessor(xConnect) ; 100 101 tRes.tested("setSuccessor()", true) ; 102 } 103 104 /** 105 * Test calls the method and compares returned value with value that was 106 * set in the method <code>setSuccessor()</code>. <p> 107 * Has <b> OK </b> status if values are equal. <p> 108 * The following method tests are to be completed successfully before : 109 * <ul> 110 * <li> <code> setSuccessor() </code></li> 111 * </ul> 112 */ _getSuccessor()113 public void _getSuccessor() { 114 requiredMethod("setSuccessor()") ; 115 116 XConnectable gConnect = oObj.getSuccessor() ; 117 118 tRes.tested("getSuccessor()", xConnect.equals(gConnect)) ; 119 } 120 121 /** 122 * Forces object environment recreation. 123 */ after()124 public void after() { 125 this.disposeEnvironment() ; 126 } 127 } 128 129