FileDocCategorySizeDatePackage
SimpleResourceUnitTestCase.javaAPI DocJBoss 4.2.13677Fri Jul 13 20:52:44 BST 2007org.jboss.ejb3.test.appclient.unit

SimpleResourceUnitTestCase

public class SimpleResourceUnitTestCase extends org.jboss.test.JBossTestCase
Comment
author
Carlo de Wolf
version
$Revision: $

Fields Summary
Constructors Summary
public SimpleResourceUnitTestCase(String name)

      super(name);
   
Methods Summary
public static junit.framework.Testsuite()

      return getDeploySetup(SimpleResourceUnitTestCase.class, "appclient-simpleresource-client.jar");
   
public voidtestClientLauncher()

      URL url = Thread.currentThread().getContextClassLoader().getResource("appclient/simpleresource/application-client.xml");
      //URL jbossClientURL = Thread.currentThread().getContextClassLoader().getResource("appclient/jboss-client.xml");
      URL jbossClientURL = null;
      ApplicationClientDD xml = ClientLauncher.loadXML(url, jbossClientURL);
      
      String mainClassName = SimpleResourceClient.class.getName();
      String applicationClientName = "appclient-simpleresource-client"; // must match JNDI name in jboss-client.xml or display-name in application-client.xml
      String args[] = { };
      
      ClientLauncher.launch(xml, mainClassName, applicationClientName, args);
   
public voidtestJNDI()
Test to see if the client deployer has setup enc env correctly.

throws
Exception

      String clientName = "appclient-simpleresource-client";
      Context ctx = getInitialContext();
      try
      {
         ctx = (Context) ctx.lookup(clientName);
      }
      catch(NameNotFoundException e)
      {
         fail(clientName + " not bound");
      }
      
      try
      {
         String value = (String) ctx.lookup("env/msg");
         assertEquals("Hello world", value);
      }
      catch(NameNotFoundException e)
      {
         fail("env/msg not bound");
      }
      
      // TODO: shouldn't org.jboss.ejb3.test.appclient.client.SimpleResourceClient/msg be bound?
      
//      NamingEnumeration<NameClassPair> e = ctx.list("env");
//      while(e.hasMore())
//      {
//         NameClassPair ncp = e.next();
//         System.out.println(ncp.getName());
//      }
//      try
//      {
//         
//      }
//      catch(NameNotFoundException e)
//      {
//         
//      }