1 package org.jacorb.test.common; 2 3 /* 4 * JacORB - a free Java ORB 5 * 6 * Copyright (C) 1997-2005 Gerald Brose. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public 19 * License along with this library; if not, write to the Free 20 * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 21 * MA 02110-1301, USA. 22 */ 23 24 /** 25 * A special <code>TestCase</code> that provides access to a 26 * <code>ClientServerSetup</code>. For information how to wrap 27 * a <code>ClientServerSetup</code> around a suite of 28 * <code>ClientServerTestCase</code>s, see the class comment of 29 * {@link ClientServerSetup}. 30 * <p> 31 * Each individual test case can access the server object by calling 32 * <code>setup.getServerObject()</code>. However, this returns 33 * a generic CORBA Object. It is usually more convenient to narrow 34 * it to the desired type automatically, which can be done by overriding 35 * the <code>setUp</code> method: 36 * 37 * <p><blockquote><pre> 38 * public class MyTest extends ClientServerTestCase 39 * { 40 * protected MyServer server; 41 * 42 * public void setUp() throws Exception 43 * { 44 * server = MyServerHelper.narrow ( setup.getServerObject() ); 45 * } 46 * 47 * ... 48 * } 49 * </pre></blockquote><p> 50 * 51 * This way, each individual test case can simply use the 52 * <code>server</code> instance variable to access the server 53 * object with correct type information. 54 * 55 * @author Andre Spiegel <spiegel@gnu.org> 56 * @version $Id: ClientServerTestCase.java,v 1.2 2005/05/13 13:23:32 andre.spiegel Exp $ 57 */ 58 public class ClientServerTestCase extends JacORBTestCase 59 { 60 protected ClientServerSetup setup; 61 62 public ClientServerTestCase( String name, ClientServerSetup setup ) 63 { 64 super( name ); 65 this.setup = setup; 66 } 67 68 } 69