[jboss-cvs] JBossAS SVN: r80854 - in projects/ejb3/trunk/core/src: main/java/org/jboss/ejb3/stateful and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 12 12:34:28 EST 2008
Author: wolfc
Date: 2008-11-12 12:34:28 -0500 (Wed, 12 Nov 2008)
New Revision: 80854
Added:
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/Greeter.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterBean.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterHome.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolder.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderBean.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderHome.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/unit/
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/unit/MetaData21TestCase.java
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
Log:
EJBTHREE-1582: using RemoteHomeBinding to find the JNDI name and processing stateless handle functions server side
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java 2008-11-12 17:19:26 UTC (rev 80853)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/impl/EJBMetaDataImpl.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -67,6 +67,7 @@
final boolean statelessSession,
final HomeHandle homeHandle)
{
+ assert homeHandle != null : "homeHandle is null";
this.remote = remote;
this.home = home;
this.pkClass = pkClass;
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-11-12 17:19:26 UTC (rev 80853)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -59,6 +59,7 @@
import org.jboss.ejb3.annotation.Clustered;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
import org.jboss.ejb3.cache.CacheFactoryRegistry;
import org.jboss.ejb3.cache.Ejb3CacheFactory;
import org.jboss.ejb3.cache.StatefulCache;
@@ -1211,11 +1212,11 @@
RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
if (homeAnnotation != null)
home = homeAnnotation.value();
- RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation
- .jndiBinding());
-
+
+ RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+ assert remoteHomeBinding != null : "remoteHomeBinding is null";
+ homeHandle = new HomeHandleImpl(remoteHomeBinding.jndiBinding());
+
EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
true, false, homeHandle);
@@ -1226,12 +1227,10 @@
{
HomeHandleImpl homeHandle = null;
- RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
- if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation
- .jndiBinding());
-
-
+ RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+ assert remoteHomeBinding != null : "remoteHomeBinding is null";
+ homeHandle = new HomeHandleImpl(remoteHomeBinding.jndiBinding());
+
InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
return response;
}
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-11-12 17:19:26 UTC (rev 80853)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -34,6 +34,7 @@
import javax.ejb.EJBLocalObject;
import javax.ejb.EJBObject;
import javax.ejb.Handle;
+import javax.ejb.RemoteHome;
import javax.ejb.Timer;
import javax.ejb.TimerService;
import javax.naming.NamingException;
@@ -55,6 +56,7 @@
import org.jboss.ejb3.annotation.Clustered;
import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
import org.jboss.ejb3.common.lang.SerializableMethod;
import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
@@ -69,6 +71,7 @@
import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionProxyFactoryBase;
import org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory;
import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
+import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
@@ -677,7 +680,8 @@
protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
{
Method unadvisedMethod = info.getUnadvisedMethod();
- if (unadvisedMethod.getName().equals("create"))
+ String methodName = unadvisedMethod.getName();
+ if (methodName.equals("create"))
{
SerializableMethod method = new SerializableMethod(unadvisedMethod);
Object[] arguments = invocation.getArguments();
@@ -685,9 +689,42 @@
Object proxy = this.invokeHomeCreate(method, arguments);
return proxy;
}
+ // TODO: should be handled locally
+ else if(methodName.equals("getEJBMetaData"))
+ {
+ Class<?> remote = null;
+ Class<?> home = null;
+ Class<?> pkClass = Object.class;
+ HomeHandleImpl homeHandle = null;
+
+ Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this);
+ if (remotes != null && remotes.length > 0)
+ {
+ remote = remotes[0];
+ }
+ RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
+ if (homeAnnotation != null)
+ home = homeAnnotation.value();
+
+ RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+ assert remoteHomeBinding != null : "remoteHomeBinding is null";
+ homeHandle = new HomeHandleImpl(remoteHomeBinding.jndiBinding());
+
+ EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
+ true, false, homeHandle);
+
+ return metadata;
+ }
+ // TODO: should be handled locally
+ else if(methodName.equals("getHomeHandle"))
+ {
+ RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+ assert remoteHomeBinding != null : "remoteHomeBinding is null";
+ return new HomeHandleImpl(remoteHomeBinding.jndiBinding());
+ }
else
- // remove
{
+ // remove
return null;
}
}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/Greeter.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/Greeter.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/Greeter.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface Greeter extends EJBObject
+{
+ String sayHi(String name);
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterBean.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterBean.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at RemoteHome(GreeterHome.class)
+ at RemoteHomeBinding(jndiBinding="GreeterBean/home")
+public class GreeterBean
+{
+ public String sayHi(String name)
+ {
+ return "Hi " + name;
+ }
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterHome.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterHome.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/GreeterHome.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface GreeterHome extends EJBHome
+{
+ Greeter create() throws CreateException, RemoteException;
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolder.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolder.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolder.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ValueHolder extends EJBObject
+{
+ String getValue();
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderBean.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderBean.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import javax.ejb.Init;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at RemoteHome(ValueHolderHome.class)
+ at RemoteHomeBinding(jndiBinding="ValueHolderBean/home")
+public class ValueHolderBean
+{
+ private String value;
+
+ @Init
+ public void ejbCreate(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderHome.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderHome.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/ValueHolderHome.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ValueHolderHome extends EJBHome
+{
+ ValueHolder create(String value) throws CreateException, RemoteException;
+}
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/unit/MetaData21TestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/unit/MetaData21TestCase.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1582/unit/MetaData21TestCase.java 2008-11-12 17:34:28 UTC (rev 80854)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.core.test.ejbthree1582.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.rmi.RemoteException;
+import java.util.Date;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBMetaData;
+import javax.ejb.HomeHandle;
+
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.ejbthree1582.Greeter;
+import org.jboss.ejb3.core.test.ejbthree1582.GreeterBean;
+import org.jboss.ejb3.core.test.ejbthree1582.GreeterHome;
+import org.jboss.ejb3.core.test.ejbthree1582.ValueHolder;
+import org.jboss.ejb3.core.test.ejbthree1582.ValueHolderBean;
+import org.jboss.ejb3.core.test.ejbthree1582.ValueHolderHome;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MetaData21TestCase extends AbstractEJB3TestCase
+{
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ AbstractEJB3TestCase.beforeClass();
+
+ deploySessionEjb(ValueHolderBean.class);
+ deploySessionEjb(GreeterBean.class);
+ }
+
+ private void exercise(GreeterHome home) throws RemoteException, CreateException
+ {
+ Greeter bean = home.create();
+ String name = new Date().toString();
+ String actual = bean.sayHi(name);
+ assertEquals("Hi " + name, actual);
+ }
+
+ private void exercise(ValueHolderHome home) throws RemoteException, CreateException
+ {
+ ValueHolder bean = home.create("test");
+ String actual = bean.getValue();
+ assertEquals("test", actual);
+ }
+
+ @Test
+ public void testStatefulGetEJBMetaData() throws Exception
+ {
+ ValueHolderHome home = lookup("ValueHolderBean/home", ValueHolderHome.class);
+ EJBMetaData metaData = home.getEJBMetaData();
+ assertNotNull("metaData is null", metaData);
+ assertTrue(metaData.isSession());
+ assertFalse(metaData.isStatelessSession());
+ Class<?> homeInterfaceClass = metaData.getHomeInterfaceClass();
+ assertEquals(ValueHolderHome.class, homeInterfaceClass);
+ Class<?> remoteInterfaceClass = metaData.getRemoteInterfaceClass();
+ assertEquals(ValueHolder.class, remoteInterfaceClass);
+ ValueHolderHome otherHome = (ValueHolderHome) metaData.getEJBHome();
+ exercise(otherHome);
+ }
+
+ @Test
+ public void testStatefulGetHomeHandle() throws Exception
+ {
+ ValueHolderHome home = lookup("ValueHolderBean/home", ValueHolderHome.class);
+ HomeHandle handle = home.getHomeHandle();
+ assertNotNull("handle is null", handle);
+ ValueHolderHome otherHome = (ValueHolderHome) handle.getEJBHome();
+ exercise(otherHome);
+ }
+
+ @Test
+ public void testStatelessGetEJBMetaData() throws Exception
+ {
+ GreeterHome home = lookup("GreeterBean/home", GreeterHome.class);
+ EJBMetaData metaData = home.getEJBMetaData();
+ assertNotNull("metaData is null", metaData);
+ assertTrue(metaData.isSession());
+ assertFalse(metaData.isStatelessSession());
+ Class<?> homeInterfaceClass = metaData.getHomeInterfaceClass();
+ assertEquals(GreeterHome.class, homeInterfaceClass);
+ Class<?> remoteInterfaceClass = metaData.getRemoteInterfaceClass();
+ assertEquals(Greeter.class, remoteInterfaceClass);
+ GreeterHome otherHome = (GreeterHome) metaData.getEJBHome();
+ exercise(otherHome);
+ }
+
+ @Test
+ public void testStatelessGetHomeHandle() throws Exception
+ {
+ GreeterHome home = lookup("GreeterBean/home", GreeterHome.class);
+ HomeHandle handle = home.getHomeHandle();
+ assertNotNull("handle is null", handle);
+ GreeterHome otherHome = (GreeterHome) handle.getEJBHome();
+ exercise(otherHome);
+ }
+
+
+}
More information about the jboss-cvs-commits
mailing list