User: stark
Date: 01/03/14 16:42:44
Added: src/main/org/jboss/test/jrmp/test Deploy.java
TestCustomSockets.java
Log:
Tests of the JRMPContainerInvoker custom socket configuration capability.
Revision Changes Path
1.1 jbosstest/src/main/org/jboss/test/jrmp/test/Deploy.java
Index: Deploy.java
===================================================================
package org.jboss.test.jrmp.test;
/** A singleton for deploying the common security.jar
@author [EMAIL PROTECTED]
@version $Revision: 1.1 $
*/
public class Deploy
{
public static boolean deployed;
/** Deploy the security ejb jar one time
*/
static void deploy(String jarName) throws Exception
{
String noDeploy = System.getProperty("no-deploy");
if( noDeploy != null || deployed )
return;
String deployDir = System.getProperty("jbosstest.deploy.dir");
if( deployDir == null )
deployDir = "../deploy";
System.out.println("Deploying: "+ jarName);
new org.jboss.jmx.client.Deployer().deploy(deployDir+'/' + jarName);
deployed = true;
}
}
1.1
jbosstest/src/main/org/jboss/test/jrmp/test/TestCustomSockets.java
Index: TestCustomSockets.java
===================================================================
package org.jboss.test.jrmp.test;
import java.io.IOException;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.test.jrmp.interfaces.StatelessSession;
import org.jboss.test.jrmp.interfaces.StatelessSessionHome;
/** Test of using custom RMI socket factories with the JRMP ejb
container invoker.
@author [EMAIL PROTECTED]
@version $Revision: 1.1 $
*/
public class TestCustomSockets extends junit.framework.TestCase
{
public TestCustomSockets(String name)
{
super(name);
}
protected void setUp() throws Exception
{
Deploy.deploy("jrmp-comp.jar");
}
public void testCustomAccess() throws Exception
{
InitialContext jndiContext = new InitialContext();
System.out.println("Lookup StatelessSession");
Object obj = jndiContext.lookup("StatelessSession");
StatelessSessionHome home = (StatelessSessionHome) obj;
System.out.println("Found StatelessSession Home");
StatelessSession bean = home.create();
System.out.println("Created StatelessSession");
// Test that the Entity bean sees username as its principal
String echo = bean.echo("jrmp-comp");
System.out.println("bean.echo(jrmp-comp) = "+echo);
bean.remove();
}
public void testAccess() throws Exception
{
InitialContext jndiContext = new InitialContext();
System.out.println("Lookup StatefulSession");
Object obj = jndiContext.lookup("StatefulSession");
StatelessSessionHome home = (StatelessSessionHome) obj;
System.out.println("Found StatefulSession Home");
StatelessSession bean = home.create();
System.out.println("Created StatefulSession");
// Test that the Entity bean sees username as its principal
String echo = bean.echo("jrmp");
System.out.println("bean.echo(jrmp) = "+echo);
bean.remove();
}
}