[jboss-cvs] JBossAS SVN: r59955 - in trunk: aspects/src/main/org/jboss/aspects/remoting and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 23 16:33:18 EST 2007
Author: bill.burke at jboss.com
Date: 2007-01-23 16:33:18 -0500 (Tue, 23 Jan 2007)
New Revision: 59955
Added:
trunk/aspects/src/main/org/jboss/aspects/remoting/DispatcherRegistration.java
trunk/embedded/src/main/java/org/jboss/naming/
trunk/embedded/src/main/java/org/jboss/naming/JBossRemotingContextFactory.java
trunk/embedded/src/main/java/org/jboss/naming/SecurityAssociationActions.java
trunk/embedded/src/main/resources/javase/deploy/remoting-service.xml
trunk/embedded/src/test/java/org/jboss/embedded/test/remote/
trunk/embedded/src/test/java/org/jboss/embedded/test/remote/Test.java
trunk/embedded/src/test/java/org/jboss/embedded/test/remote/TestBean.java
trunk/embedded/src/test/java/org/jboss/embedded/test/remote/unit/
trunk/embedded/src/test/java/org/jboss/embedded/test/remote/unit/EjbTestCase.java
Modified:
trunk/aspects/build.xml
trunk/aspects/src/main/org/jboss/aspects/remoting/Remoting.java
trunk/embedded/build-test.xml
trunk/embedded/embedded.bat
trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
Log:
add remoting capabilities
Modified: trunk/aspects/build.xml
===================================================================
--- trunk/aspects/build.xml 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/aspects/build.xml 2007-01-23 21:33:18 UTC (rev 59955)
@@ -97,7 +97,6 @@
<path refid="jboss.system.classpath"/>
<path refid="jboss.cluster.classpath"/>
<path refid="jboss.transaction.classpath"/>
- <path refid="jboss.server.classpath"/>
</path>
<!-- ===== -->
Added: trunk/aspects/src/main/org/jboss/aspects/remoting/DispatcherRegistration.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aspects/remoting/DispatcherRegistration.java (rev 0)
+++ trunk/aspects/src/main/org/jboss/aspects/remoting/DispatcherRegistration.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.aspects.remoting;
+
+import org.jboss.aop.Dispatcher;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class DispatcherRegistration
+{
+ private Object oid;
+ private Object target;
+
+
+ public Object getOid()
+ {
+ return oid;
+ }
+
+ public void setOid(Object oid)
+ {
+ this.oid = oid;
+ }
+
+ public Object getTarget()
+ {
+ return target;
+ }
+
+ public void setTarget(Object target)
+ {
+ this.target = target;
+ }
+
+ public void start()
+ {
+ Dispatcher.singleton.registerTarget(oid, target);
+ }
+
+ public void stop()
+ {
+ Dispatcher.singleton.unregisterTarget(oid);
+ }
+}
Modified: trunk/aspects/src/main/org/jboss/aspects/remoting/Remoting.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aspects/remoting/Remoting.java 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/aspects/src/main/org/jboss/aspects/remoting/Remoting.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -122,6 +122,23 @@
}
/**
+ *
+ * @param oid
+ * @param interfaces
+ * @param uri
+ * @return
+ * @throws Exception
+ */
+ public static Object createPojiProxy(Object oid, Class[] interfaces, String uri, Interceptor[] interceptors) throws Exception
+ {
+ InvokerLocator locator = new InvokerLocator(uri);
+ PojiProxy proxy = new PojiProxy(oid, locator, interceptors);
+ return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
+
+ }
+
+
+ /**
* Create a remote proxy given the advised proxy, locator and Dispatcher.OID.
* This uses a default interceptor stack and AOP substem handler.
*
Modified: trunk/embedded/build-test.xml
===================================================================
--- trunk/embedded/build-test.xml 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/embedded/build-test.xml 2007-01-23 21:33:18 UTC (rev 59955)
@@ -168,6 +168,11 @@
<include name="META-INF/persistence.xml"/>
</fileset>
</jar>
+ <jar jarfile="${build.lib}/remote-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/embedded/test/remote/**/*.class"/>
+ </fileset>
+ </jar>
<war warfile="${build.lib}/war-scan.war"
webxml="${resources}/war-scan/web.xml">
<lib dir="${build.lib}">
Modified: trunk/embedded/embedded.bat
===================================================================
--- trunk/embedded/embedded.bat 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/embedded/embedded.bat 2007-01-23 21:33:18 UTC (rev 59955)
@@ -1,6 +1,8 @@
-set CLASSPATH=output\lib\embedded-jboss\lib\jboss-embedded-all.jar;output\lib\embedded-jboss\lib\hibernate-all.jar;output\lib\embedded-jboss\lib\thirdparty-all.jar;output\lib\embedded-jboss\bootstrap;output\test-classes
+set CLASSPATH=output\lib\embedded-jboss\lib\jboss-embedded-all.jar;output\lib\embedded-jboss\lib\hibernate-all.jar;output\lib\embedded-jboss\lib\thirdparty-all.jar;output\lib\embedded-jboss\bootstrap
-java org.jboss.embedded.test.TimedBootstrap
+set CLASSPATH=%CLASSPATH%;output\test-lib\%1
+java org.jboss.embedded.Bootstrap %1
+
Modified: trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -220,6 +220,13 @@
}
}
+ public void scanClasspath(String path) throws DeploymentException
+ {
+ DeploymentGroup group = createDeploymentGroup();
+ group.addClasspath(path);
+ group.process();
+ }
+
public void deploy(URL url) throws DeploymentException
{
DeploymentGroup group = createDeploymentGroup();
@@ -303,4 +310,17 @@
group.setKernel(kernel);
return group;
}
+
+ public static void main(String[] args) throws Exception
+ {
+ getInstance().bootstrap();
+ for (String arg : args)
+ {
+ getInstance().scanClasspath(arg);
+ }
+ System.out.println("Running...");
+ Thread t = new Thread();
+ t.setDaemon(false);
+ t.start();
+ }
}
\ No newline at end of file
Added: trunk/embedded/src/main/java/org/jboss/naming/JBossRemotingContextFactory.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/naming/JBossRemotingContextFactory.java (rev 0)
+++ trunk/embedded/src/main/java/org/jboss/naming/JBossRemotingContextFactory.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,189 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.naming;
+
+import org.jnp.interfaces.NamingContext;
+import org.jnp.interfaces.Naming;
+import org.jboss.aspects.remoting.Remoting;
+import org.jboss.aspects.remoting.IsLocalInterceptor;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.aspects.remoting.PojiProxy;
+import org.jboss.aspects.security.SecurityClientInterceptor;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.auth.callback.UsernamePasswordHandler;
+import org.jboss.security.jndi.*;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.remoting.InvokerLocator;
+
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.spi.ObjectFactory;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Name;
+import javax.naming.Reference;
+import javax.naming.AuthenticationException;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+import java.util.Hashtable;
+import java.security.Principal;
+import java.lang.reflect.Proxy;
+
+/**
+ * Creating a JNDI connection using JBoss Remoting.
+ *
+ * If Context.SECURITY_PRINCIPAL and Context.SECURITY_CREDENTIALS are set,
+ * this InitialContextFactory implementation combines the
+ * authentication phase with the InitialContext creation. During the
+ * getInitialContext callback from the JNDI naming, layer security context
+ * identity is populated with the username obtained from the
+ * Context.SECURITY_PRINCIPAL env property and the credentials from the
+ * Context.SECURITY_CREDENTIALS env property. There is no actual authentication
+ * of this information. It is merely made available to the jboss transport
+ * layer for incorporation into subsequent invocations. Authentication and
+ * authorization will occur on the server.
+ *
+ * If Context.SECURITY_PROTOCOL is provided as well as the principal and credentials,
+ * then a JAAS login will be performed instead using the security domain provided with the
+ * SECURITY_PROTOCOL variable.
+ *
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:scott at jboss.org">Scott Stark</a>
+ * @version $Revision: 37459 $
+ */
+public class JBossRemotingContextFactory
+ implements InitialContextFactory, ObjectFactory
+{
+
+ static void associateSecurityInformation(Object principal, Object credentials)
+ {
+ Principal securityPrincipal = null;
+ // See if the principal is a Principal or String
+ if( principal instanceof Principal )
+ {
+ securityPrincipal = (Principal) principal;
+ }
+ else
+ {
+ // Simply convert this to a name using toString
+ String username = principal.toString();
+ securityPrincipal = new SimplePrincipal(username);
+ }
+ // Associate this security context
+ SecurityAssociationActions.setPrincipalInfo(securityPrincipal, credentials);
+ }
+
+ static void login(Object principal, Object credentials, Object prop) throws AuthenticationException
+ {
+ String protocol = prop.toString();
+ try
+ {
+ // Get the principal username
+ String username;
+ if( principal instanceof Principal )
+ {
+ Principal p = (Principal) principal;
+ username = p.getName();
+ }
+ else
+ {
+ username = principal.toString();
+ }
+ UsernamePasswordHandler handler = new UsernamePasswordHandler(username,
+ credentials);
+ // Do the JAAS login
+ LoginContext lc = new LoginContext(protocol, handler);
+ lc.login();
+ }
+ catch(LoginException e)
+ {
+ AuthenticationException ex = new AuthenticationException("Failed to login using protocol="+protocol);
+ ex.setRootCause(e);
+ throw ex;
+ }
+
+ }
+ // InitialContextFactory implementation --------------------------
+ public Context getInitialContext(Hashtable env)
+ throws NamingException
+ {
+ Class[] interfaces = {Naming.class};
+ Interceptor[] interceptors = null;
+ Naming naming = null;
+
+ // Get the login principal and credentials from the JNDI env
+ Object credentials = env.get(Context.SECURITY_CREDENTIALS);
+ Object principal = env.get(Context.SECURITY_PRINCIPAL);
+ Object protocol = env.get(Context.SECURITY_PROTOCOL);
+
+ if (principal != null && credentials != null)
+ {
+ if (protocol != null)
+ {
+ login(principal, credentials, protocol);
+ }
+ else
+ {
+ associateSecurityInformation(principal, credentials);
+ }
+ Interceptor[] tmp = {IsLocalInterceptor.singleton, SecurityClientInterceptor.singleton, InvokeRemoteInterceptor.singleton};
+ interceptors = tmp;
+ }
+ else
+ {
+ Interceptor[] tmp = {IsLocalInterceptor.singleton, InvokeRemoteInterceptor.singleton};
+ interceptors = tmp;
+ }
+
+ if (NamingContext.localServer != null) return new NamingContext(env, null, NamingContext.localServer);
+
+ String providerUrl = (String) env.get(Context.PROVIDER_URL);
+ if (providerUrl == null)
+ {
+ throw new RuntimeException("PROVIDER_URL not provided in jndi.properties. Automatic discovery not implemented yet.");
+ }
+ try
+ {
+ naming = (Naming) Remoting.createPojiProxy("JNDI", interfaces, providerUrl, interceptors);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create Naming proxy", e);
+ }
+
+ return new NamingContext(env, null, naming);
+ }
+
+
+ // ObjectFactory implementation ----------------------------------
+ public Object getObjectInstance(Object obj,
+ Name name,
+ Context nameCtx,
+ Hashtable environment)
+ throws Exception
+ {
+ Context ctx = getInitialContext(environment);
+ Reference ref = (Reference) obj;
+ return ctx.lookup((String) ref.get("URL").getContent());
+ }
+
+}
Added: trunk/embedded/src/main/java/org/jboss/naming/SecurityAssociationActions.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/naming/SecurityAssociationActions.java (rev 0)
+++ trunk/embedded/src/main/java/org/jboss/naming/SecurityAssociationActions.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.naming;
+
+import org.jboss.security.SecurityAssociation;
+
+import java.security.PrivilegedAction;
+import java.security.Principal;
+import java.security.AccessController;
+
+/** A PrivilegedAction implementation for setting the SecurityAssociation
+ * principal and credential
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revison:$
+ */
+class SecurityAssociationActions
+{
+ private static class SetPrincipalInfoAction implements PrivilegedAction
+ {
+ Principal principal;
+ Object credential;
+ SetPrincipalInfoAction(Principal principal, Object credential)
+ {
+ this.principal = principal;
+ this.credential = credential;
+ }
+ public Object run()
+ {
+ SecurityAssociation.setCredential(credential);
+ credential = null;
+ SecurityAssociation.setPrincipal(principal);
+ principal = null;
+ return null;
+ }
+ }
+
+ static void setPrincipalInfo(Principal principal, Object credential)
+ {
+ SecurityAssociationActions.SetPrincipalInfoAction action = new SecurityAssociationActions.SetPrincipalInfoAction(principal, credential);
+ AccessController.doPrivileged(action);
+ }
+
+}
Modified: trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml 2007-01-23 21:08:16 UTC (rev 59954)
+++ trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml 2007-01-23 21:33:18 UTC (rev 59955)
@@ -140,6 +140,12 @@
<bean name="Naming" class="org.jnp.server.SingletonNamingServer"/>
<bean name="java:comp" class="org.jboss.naming.JavaCompInitializer"/>
+ <!-- register Naming bean with dispatcher just in case we want to have a remote JNDI connection -->
+ <bean name="JndiRegistration" class="org.jboss.aspects.remoting.DispatcherRegistration">
+ <property name="oid">JNDI</property>
+ <property name="target"><inject bean="Naming"/></property>
+ </bean>
+
<!--
Bootstrap old JMX-based core services
setup deployers
Added: trunk/embedded/src/main/resources/javase/deploy/remoting-service.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deploy/remoting-service.xml (rev 0)
+++ trunk/embedded/src/main/resources/javase/deploy/remoting-service.xml 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Connector for both EJB3 and JNDI
+-->
+<server>
+ <mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
+ <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
+ <attribute name="Configuration">
+ <handlers>
+ <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
+ </handlers>
+ </attribute>
+ </mbean>
+</server>
\ No newline at end of file
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/remote/Test.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/remote/Test.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/remote/Test.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.remote;
+
+import javax.ejb.Remote;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Remote
+public interface Test
+{
+ String echo(String e);
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/remote/TestBean.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/remote/TestBean.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/remote/TestBean.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.remote;
+
+import javax.ejb.Stateless;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class TestBean implements Test
+{
+ public String echo(String e)
+ {
+ return e;
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/remote/unit/EjbTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/remote/unit/EjbTestCase.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/remote/unit/EjbTestCase.java 2007-01-23 21:33:18 UTC (rev 59955)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.remote.unit;
+
+import junit.framework.TestCase;
+import org.jboss.embedded.test.remote.Test;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Hashtable;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 42757 $
+ */
+public class EjbTestCase extends TestCase
+{
+ public EjbTestCase()
+ {
+ super("BootstrapTestCase");
+ }
+
+ public void testRemoteEjb() throws Exception
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.JBossRemotingContextFactory.class.getName());
+ env.put(Context.PROVIDER_URL, "socket://172.16.83.75:3873");
+ InitialContext ctx = new InitialContext(env);
+ Test test = (Test)ctx.lookup("TestBean/remote");
+ assertEquals(test.echo("hello world"), "hello world");
+ }
+
+}
More information about the jboss-cvs-commits
mailing list