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);
}