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

AppClientUnitTestCase

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

Fields Summary
Constructors Summary
public AppClientUnitTestCase(String name)

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

      return getDeploySetup(AppClientUnitTestCase.class, "appclient-test.ear");
      //return getDeploySetup(AppClientUnitTestCase.class, "appclient-test.jar,appclient-test-client.jar");
   
public voidtest1()

      URL url = Thread.currentThread().getContextClassLoader().getResource("appclient/application-client.xml");
      URL jbossClientURL = Thread.currentThread().getContextClassLoader().getResource("appclient/jboss-client.xml");
      ApplicationClientDD xml = ClientLauncher.loadXML(url, jbossClientURL);
      
      String mainClassName = HelloWorldClient.class.getName();
      String applicationClientName = "applicationclient_test"; // must match JNDI name in jboss-client.xml or display-name in application-client.xml
      String name = new Date().toString();
      String args[] = { name };
      
      ClientLauncher.launch(xml, mainClassName, applicationClientName, args);
      
      {
         String actual = HelloWorldClient.getResult();
         String expected = "Hi " + name + ", how are you?";
         assertEquals(expected, actual);
      }
      
      {
         int actual = HelloWorldClient.getPostConstructCalls();
         int expected = 1;
         assertEquals("postConstruct should be called once", expected, actual);
      }