1 22 package org.jboss.ejb3.test.appclient.unit; 23 24 import java.net.URL ; 25 import java.util.Date ; 26 27 import junit.framework.Test; 28 29 import org.jboss.ejb3.client.ClientLauncher; 30 import org.jboss.ejb3.metamodel.ApplicationClientDD; 31 import org.jboss.ejb3.test.appclient.client.HelloWorldClient; 32 import org.jboss.test.JBossTestCase; 33 34 40 public class AppClientUnitTestCase extends JBossTestCase 41 { 42 public AppClientUnitTestCase(String name) 43 { 44 super(name); 45 } 46 47 public void test1() throws Exception 48 { 49 URL url = Thread.currentThread().getContextClassLoader().getResource("appclient/application-client.xml"); 50 URL jbossClientURL = Thread.currentThread().getContextClassLoader().getResource("appclient/jboss-client.xml"); 51 ApplicationClientDD xml = ClientLauncher.loadXML(url, jbossClientURL); 52 53 String mainClassName = HelloWorldClient.class.getName(); 54 String applicationClientName = "applicationclient_test"; String name = new Date ().toString(); 56 String args[] = { name }; 57 58 ClientLauncher.launch(xml, mainClassName, applicationClientName, args); 59 60 String actual = HelloWorldClient.getResult(); 61 String expected = "Hi " + name + ", how are you?"; 62 assertEquals(expected, actual); 63 } 64 65 public static Test suite() throws Exception 66 { 67 return getDeploySetup(AppClientUnitTestCase.class, "appclient-test.ear"); 68 } 70 } 71 | Popular Tags |