/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id:
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas.jtests.clients.session;

import java.rmi.NoSuchObjectException;

import org.objectweb.jonas.jtests.beans.local.Target;
import org.objectweb.jonas.jtests.beans.local.TargetSLHome;
import org.objectweb.jonas.jtests.util.JTestCase;

/**
 * This Class defines perf Test cases that can be run either SF or SL bean.
 * These tests are related to the "Client View of a Session Bean"
 * A session bean that supports both Local & Remote interface is used 
 * (TargetSL oe TargetSF in beans/local)
 * But here are testcases that can be run via a non remote suite.
 * 
 * @see  EJB2.0 specification Chapter 6.
 * @author Ph Coq, Ph Durieux
 */

public abstract class B_ClientView extends JTestCase {

    public B_ClientView(String name) {
	super(name);
    }

    /**
     * @return TargetSLHome, that can be either SF or SL bean.
     */
    public abstract TargetSLHome getHome() throws Exception;




    /**
     * This test verify we can create, access to the bean via 
     * its remote interface and remove it
     * It verifies we cannot access to the bean after remove
     */
    public void testCreateAccessRemoteRemove() throws Exception {
	Target tr = getHome().create();
	assertEquals(10, tr.getTen());
	tr.remove();
        try {
            tr.method2("Bye");
            fail("NoSuchObjectException must be raised");
            //        } catch (NoSuchObjectException e) {
        } catch (NoSuchObjectException e) {   
        }
        System.out.println("create, access to the bean via its remote interface and remove it");
    }





}
