You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2006/11/21 18:38:14 UTC
svn commit: r477775 - in
/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless:
StatelessPojoHandleTests.java StatelessTestSuite.java
Author: dblevins
Date: Tue Nov 21 09:38:14 2006
New Revision: 477775
URL: http://svn.apache.org/viewvc?view=rev&rev=477775
Log:
Patch from Manu George OPENEJB-155: iTest: StatelessHandleTests
Thanks Manu!
Added:
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java
Modified:
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java?view=auto&rev=477775
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessPojoHandleTests.java Tue Nov 21 09:38:14 2006
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.stateless;
+
+import java.rmi.NoSuchObjectException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ * @author <a href="mailto:manu.t.george@gmail.com">Manu George</a>
+ */
+public class StatelessPojoHandleTests extends BasicStatelessTestClient {
+
+ public StatelessPojoHandleTests() {
+ super("PojoHandle.");
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHome");
+ ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class);
+ ejbObject = ejbHome.create();
+ ejbHandle = ejbObject.getHandle();
+ }
+
+ protected void tearDown() throws Exception{
+ super.tearDown();
+ }
+
+ //=================================
+ // Test handle methods
+ //
+ public void test01_getEJBObject(){
+
+ try{
+ EJBObject object = ejbHandle.getEJBObject();
+ assertNotNull( "The EJBObject is null", object );
+ assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+
+ /**
+ * <B>3.6.6 Client view of session objects life cycle</B>
+ * <P>
+ * ....It is invalid to reference a session object that does
+ * not exist. Attempted invocations on a session object
+ * that does not exist result in java.rmi.NoSuchObjectException.
+ * </P>
+ *
+ * <P>
+ * This remove method of the EJBHome is placed hear as it
+ * is more a test on the handle then on the remove method
+ * itself.
+ * </P>
+ */
+ public void test02_EJBHome_remove(){
+ try{
+ ejbHome.remove(ejbHandle);
+ try{
+ ejbObject.businessMethod("Should throw an exception");
+ assertTrue( "Calling business method after removing the EJBObject does not throw an exception", false );
+ } catch (NoSuchObjectException e){
+ assertTrue( true );
+ return;
+ }
+ } catch (Exception e){
+ fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+ }
+ }
+ //
+ // Test handle methods
+ //=================================
+
+}
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java?view=diff&rev=477775&r1=477774&r2=477775
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java Tue Nov 21 09:38:14 2006
@@ -46,6 +46,7 @@
suite.addTest(new StatelessHomeHandleTests());
suite.addTest(new StatelessPojoHomeHandleTests());
suite.addTest(new StatelessHandleTests());
+ suite.addTest(new StatelessPojoHandleTests());
suite.addTest(new StatelessEjbMetaDataTests());
suite.addTest(new StatelessPojoEjbMetaDataTests());
suite.addTest(new StatelessAllowedOperationsTests());