gdamour 2005/03/11 23:12:13
Modified:
modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql
EJBQLTest.java
Added:
modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql
AHome.java ARemote.java
Log:
Test that finders can be successfully invoked on EJBHome and EJBLocalHome.
Revision Changes Path
1.7 +19 -12
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql/EJBQLTest.java
Index: EJBQLTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql/EJBQLTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- EJBQLTest.java 23 Feb 2005 18:13:28 -0000 1.6
+++ EJBQLTest.java 12 Mar 2005 04:12:13 -0000 1.7
@@ -125,16 +125,22 @@
private EJBSchema ejbSchema;
private SQL92Schema sqlSchema;
private GlobalSchema cacheSchema;
- private ALocalHome ahome;
+ private AHome aHome;
+ private ALocalHome aLocalHome;
private TransactionManager tm;
- public void testFindTest() throws Exception {
- ALocal a = ahome.findTest("test");
+ public void testHomeFindTest() throws Exception {
+ ARemote a = aHome.findTest("test");
+ assertEquals(new Integer(1), a.getField1());
+ }
+
+ public void testLocalHomeFindTest() throws Exception {
+ ALocal a = aLocalHome.findTest("test");
assertEquals(new Integer(1), a.getField1());
}
public void testSelectTest() throws Exception {
- ALocal a = ahome.selectTest("test");
+ ALocal a = aLocalHome.selectTest("test");
assertEquals(new Integer(1), a.getField1());
}
@@ -214,25 +220,26 @@
kernel.loadGBean(connectionProxyFactoryGBean,
this.getClass().getClassLoader());
kernel.startGBean(connectionProxyFactoryObjectName);
- setUpContainer(ejbSchema.getEJB("A"), ABean.class,
ALocalHome.class, ALocal.class, C_NAME_A, tmDelegate);
+ setUpContainer(ejbSchema.getEJB("A"), ABean.class, AHome.class,
ARemote.class, ALocalHome.class, ALocal.class, C_NAME_A, tmDelegate);
- ahome = (ALocalHome) kernel.getAttribute(C_NAME_A,
"ejbLocalHome");
+ aLocalHome = (ALocalHome) kernel.getAttribute(C_NAME_A,
"ejbLocalHome");
+ aHome = (AHome) kernel.getAttribute(C_NAME_A, "ejbHome");
} finally {
DeploymentUtil.recursiveDelete(tempDir);
}
}
- private void setUpContainer(EJB ejb, Class beanClass, Class homeClass,
Class localClass, ObjectName containerName, TransactionManagerDelegate
tmDelegate) throws Exception {
+ private void setUpContainer(EJB ejb, Class beanClass, Class homeClass,
Class remoteClass, Class localHomeClass, Class localClass, ObjectName
containerName, TransactionManagerDelegate tmDelegate) throws Exception {
CMPContainerBuilder builder = new CMPContainerBuilder();
builder.setClassLoader(this.getClass().getClassLoader());
builder.setContainerId(containerName.getCanonicalName());
builder.setEJBName(ejb.getName());
builder.setBeanClassName(beanClass.getName());
- builder.setHomeInterfaceName(null);
- builder.setLocalHomeInterfaceName(homeClass.getName());
- builder.setRemoteInterfaceName(null);
- builder.setLocalInterfaceName(localClass.getName());
+ builder.setHomeInterfaceName(homeClass.getName());
+ builder.setLocalHomeInterfaceName(localHomeClass.getName());
+ builder.setRemoteInterfaceName(remoteClass.getName());
+ builder.setLocalInterfaceName(localHomeClass.getName());
builder.setPrimaryKeyClassName(ejb.getPrimaryKeyClass().getName());
builder.setJndiNames(new String[0]);
1.1
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql/AHome.java
Index: AHome.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment.entity.cmp.ejbql;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.FinderException;
import org.openejb.deployment.entity.cmp.cmr.CompoundPK;
/**
*
* @version $Revision: 1.1 $ $Date: 2005/03/12 04:12:13 $
*/
public interface AHome extends EJBHome {
// Create
public ARemote create(Integer field1) throws CreateException,
RemoteException;
public ARemote create(CompoundPK primaryKey) throws CreateException,
RemoteException;
// Finder
public ARemote findByPrimaryKey(Integer primaryKey) throws
FinderException, RemoteException;
public ARemote findTest(String value) throws FinderException,
RemoteException;
}
1.1
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/ejbql/ARemote.java
Index: ARemote.java
===================================================================
/* ====================================================================
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce this list of
* conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the OpenEJB Project. For more information
* please see <http://openejb.org/>.
*
* ====================================================================
*/
package org.openejb.deployment.entity.cmp.ejbql;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
/**
*
* @version $Revision: 1.1 $ $Date: 2005/03/12 04:12:13 $
*/
public interface ARemote extends EJBObject {
// CMP
public Integer getField1() throws RemoteException;
public void setField1(Integer field1) throws RemoteException;
public String getField2() throws RemoteException;
public void setField2(String field2) throws RemoteException;
}