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