Author: ropalka
Date: 2012-02-28 09:45:28 -0500 (Tue, 28 Feb 2012)
New Revision: 15775
Modified:
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxrpc.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/ClientSideHandler.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryEJBTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryHandler.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryJSETestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServiceRefOverridesTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/application-client.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/jboss-client.xml
stack/native/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3444] enabling appclient tests (WIP)
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxrpc.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxrpc.xml 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxrpc.xml 2012-02-28
14:45:28 UTC (rev 15775)
@@ -298,12 +298,16 @@
<include name="webservices.xml"/>
</metainf>
</jar>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-enventry-client.jar">
+ <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-enventry-appclient.jar">
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxrpc/enventry/EnvEntryTestService.class"/>
<include
name="org/jboss/test/ws/jaxrpc/enventry/ClientSideHandler.class"/>
<include
name="org/jboss/test/ws/jaxrpc/enventry/EnvEntryHandler.class"/>
+ <include
name="org/jboss/test/ws/appclient/AppclientKiller.class"/>
</fileset>
+ <manifest>
+ <attribute name="main-class"
value="org.jboss.test.ws.appclient.AppclientKiller"/>
+ </manifest>
<metainf
dir="${tests.output.dir}/test-resources/jaxrpc/enventry/WEB-INF">
<include name="jaxrpc-mapping.xml"/>
<include name="wsdl/**"/>
@@ -313,7 +317,12 @@
<include name="jboss-client.xml"/>
</metainf>
</jar>
-
+ <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-enventry-appclient.ear">
+ <fileset dir="${tests.output.dir}/test-libs">
+ <include name="jaxrpc-enventry-appclient.jar"/>
+ </fileset>
+ </jar>
+
<!-- jaxrpc-jbas897 -->
<jar destfile="${tests.output.dir}/test-libs/jaxrpc-jbas897.jar">
<fileset dir="${tests.output.dir}/test-classes">
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2012-02-28
14:45:28 UTC (rev 15775)
@@ -768,7 +768,7 @@
<include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointImpl.class" />
</fileset>
</jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure-client.jar">
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure-appclient.jar">
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.class" />
<include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointService.class" />
@@ -779,10 +779,15 @@
<include name="jboss-client.xml" />
</metainf>
<manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.jaxws.samples.webserviceref.SecureEndpointClient"
/>
+ <attribute name="main-class"
value="org.jboss.test.ws.jaxws.webserviceref.SecureEndpointClient" />
</manifest>
</jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-override-webserviceref-client.jar">
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure-appclient.ear">
+ <fileset dir="${tests.output.dir}/test-libs">
+ <include name="jaxws-webserviceref-secure-appclient.jar"/>
+ </fileset>
+ </jar>
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-override-appclient.jar">
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.class" />
<include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointService.class" />
@@ -800,6 +805,11 @@
<attribute name="main-class"
value="org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo" />
</manifest>
</jar>
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-override-appclient.ear">
+ <fileset dir="${tests.output.dir}/test-libs">
+ <include name="jaxws-webserviceref-override-appclient.jar"/>
+ </fileset>
+ </jar>
<!-- jaxws-webserviceref-secure -->
<jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure.jar">
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/ClientSideHandler.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/ClientSideHandler.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/ClientSideHandler.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -21,21 +21,19 @@
*/
package org.jboss.test.ws.jaxrpc.enventry;
+import java.io.IOException;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.jboss.wsf.test.JBossWSTest;
+
public class ClientSideHandler extends EnvEntryHandler
{
- public InitialContext getInitialContext() throws NamingException
+ public InitialContext getInitialContext() throws NamingException, IOException
{
- Properties env = new Properties();
- env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
- env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
- env.setProperty(Context.PROVIDER_URL, "jnp://" + getServerHost() +
":1099");
- env.setProperty("j2ee.clientName", "jbossws-client");
- return new InitialContext(env);
+ return JBossWSTest.getAppclientInitialContext();
}
}
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryEJBTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryEJBTestCase.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryEJBTestCase.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -38,10 +38,11 @@
public class EnvEntryEJBTestCase extends JBossWSTest
{
private static EnvEntryTestService port;
+ private static InitialContext appclientCtx;
public static Test suite()
{
- return new JBossWSTestSetup(EnvEntryEJBTestCase.class, "jaxrpc-enventry.jar,
jaxrpc-enventry-client.jar");
+ return new JBossWSTestSetup(EnvEntryEJBTestCase.class, "jaxrpc-enventry.jar,
jaxrpc-enventry-appclient.ear#jaxrpc-enventry-appclient.jar");
}
protected void setUp() throws Exception
@@ -49,12 +50,22 @@
super.setUp();
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
+ appclientCtx = getAppclientInitialContext();
+ Service service =
(Service)appclientCtx.lookup("java:service/TestService");
port = (EnvEntryTestService)service.getPort(EnvEntryTestService.class);
}
}
+ protected void tearDown() throws Exception
+ {
+ if (appclientCtx != null)
+ {
+ appclientCtx.close();
+ appclientCtx = null;
+ }
+ super.tearDown();
+ }
+
public void testEndpoint() throws Exception
{
String res = port.helloEnvEntry("InitalMessage");
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryHandler.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryHandler.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryHandler.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxrpc.enventry;
+import java.io.IOException;
+
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
@@ -73,12 +75,24 @@
SOAPElement soapElement =
(SOAPElement)soapBodyElement.getChildElements().next();
value = soapElement.getValue();
- InitialContext ic = getInitialContext();
- String strValue = (String)ic.lookup("java:comp/env/jsr109/entry1");
- Integer intValue = (Integer)ic.lookup("java:comp/env/jsr109/entry2");
-
- value = value + ":" + getHandlerName() + ":" + strValue +
":" + intValue;
- soapElement.setValue(value);
+ InitialContext ic = null;
+ try
+ {
+ ic = getInitialContext();
+ String strValue =
(String)ic.lookup("java:comp/env/jsr109/entry1");
+ Integer intValue =
(Integer)ic.lookup("java:comp/env/jsr109/entry2");
+
+ value = value + ":" + getHandlerName() + ":" + strValue +
":" + intValue;
+ soapElement.setValue(value);
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ ic.close();
+ ic = null;
+ }
+ }
}
catch (Exception e)
{
@@ -94,7 +108,7 @@
return handlerName.substring(handlerName.lastIndexOf(".") + 1);
}
- abstract public InitialContext getInitialContext() throws NamingException;
+ abstract public InitialContext getInitialContext() throws NamingException,
IOException;
/**
* Get the JBoss server host from system property "jboss.bind.address"
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryJSETestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryJSETestCase.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/enventry/EnvEntryJSETestCase.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -38,10 +38,11 @@
public class EnvEntryJSETestCase extends JBossWSTest
{
private static EnvEntryTestService port;
+ private static InitialContext appclientCtx;
public static Test suite()
{
- return new JBossWSTestSetup(EnvEntryJSETestCase.class, "jaxrpc-enventry.war,
jaxrpc-enventry-client.jar");
+ return new JBossWSTestSetup(EnvEntryJSETestCase.class, "jaxrpc-enventry.war,
jaxrpc-enventry-appclient.ear#jaxrpc-enventry-appclient.jar");
}
protected void setUp() throws Exception
@@ -49,12 +50,22 @@
super.setUp();
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
+ appclientCtx = getAppclientInitialContext();
+ Service service =
(Service)appclientCtx.lookup("java:service/TestService");
port = (EnvEntryTestService)service.getPort(EnvEntryTestService.class);
}
}
+ protected void tearDown() throws Exception
+ {
+ if (appclientCtx != null)
+ {
+ appclientCtx.close();
+ appclientCtx = null;
+ }
+ super.tearDown();
+ }
+
public void testEndpoint() throws Exception
{
String res = port.helloEnvEntry("InitalMessage");
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -46,6 +46,7 @@
public static void main(String[] args)
{
+ System.out.println("TEST START");
String reqMsg = args[0];
log.info("echo: " + reqMsg);
@@ -76,6 +77,8 @@
{
throw new IllegalArgumentException("Invalid req messge: " + reqMsg);
}
+ System.out.println("TEST END");
+ System.out.println("RESULT [" + retStr + "] RESULT");
}
private static String invokeEndpoint(SecureEndpoint port, String inStr, String
username, String password)
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServiceRefOverridesTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServiceRefOverridesTestCase.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServiceRefOverridesTestCase.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -21,14 +21,13 @@
*/
package org.jboss.test.ws.jaxws.webserviceref;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Map;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
import junit.framework.Test;
-import org.jboss.ejb3.client.ClientLauncher;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.JBossWSTestSetup;
/**
@@ -43,70 +42,77 @@
public static Test suite()
{
- return new JBossWSTestSetup(ServiceRefOverridesTestCase.class,
"jaxws-webserviceref.war, jaxws-override-webserviceref-client.jar");
+ return new JBossWSTestSetup(ServiceRefOverridesTestCase.class,
"jaxws-webserviceref.war");
}
public void testService1() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
public void testService2() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
public void testService3() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName() + getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg + reqMsg, respMsg);
}
public void testService4() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName() + getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg + reqMsg, respMsg);
}
public void testPort1() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
public void testPort2() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName() + getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg + reqMsg, respMsg);
}
public void testPort3() throws Throwable
{
- String resStr = invokeTest(getName());
- assertEquals(getName() + getName(), resStr);
+ final String reqMsg = getName();
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg + reqMsg, respMsg);
}
- @SuppressWarnings("unchecked")
- private String invokeTest(String reqStr) throws Throwable
+ private String executeApplicationClient(final String... appclientArgs) throws
Throwable
{
- new ClientLauncher().launch(TestEndpointClientTwo.class.getName(),
"jbossws-client", new String[] { reqStr });
- Class<?> empty[] = {};
- try
- {
- //Use reflection to compile on AS 5.0.0.CR1 too
- Method getMainClassMethod =
ClientLauncher.class.getMethod("getTheMainClass", empty);
- //At least JBoss AS 5.0.0.CR2
- //Use reflection to prevent double loading of the client class
- Class<?> clientClass = (Class<?>)getMainClassMethod.invoke(null, new
Object[] {});
- Field field = clientClass.getField("testResult");
- return ((Map<String, String>)field.get(clientClass)).get(reqStr);
+ final OutputStream appclientOS = new ByteArrayOutputStream();
+
JBossWSTestHelper.deployAppclient("jaxws-webserviceref-override-appclient.ear#jaxws-webserviceref-override-appclient.jar",
appclientOS, appclientArgs);
+ // wait till appclient stops
+ String appclientLog = appclientOS.toString();
+ while (!appclientLog.contains("stopped in")) {
+ Thread.sleep(100);
+ appclientLog = appclientOS.toString();
}
- catch (NoSuchMethodException e)
- {
- //JBoss AS 5.0.0.CR1
- return TestEndpointClientTwo.testResult.get(reqStr);
- }
+ // assert appclient logs
+ assertTrue(appclientLog.contains("TEST START"));
+ assertTrue(appclientLog.contains("TEST END"));
+ assertTrue(appclientLog.contains("RESULT ["));
+ assertTrue(appclientLog.contains("] RESULT"));
+ int indexOfResultStart = appclientLog.indexOf("RESULT [");
+ int indexOfResultStop = appclientLog.indexOf("] RESULT");
+ assertTrue(indexOfResultStart > 0);
+ assertTrue(indexOfResultStop > 0);
+ return appclientLog.substring(indexOfResultStart + 8, indexOfResultStop);
}
}
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -21,10 +21,10 @@
*/
package org.jboss.test.ws.jaxws.webserviceref;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
-import java.io.InputStream;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -32,15 +32,15 @@
import junit.framework.Test;
-import org.jboss.ejb3.client.ClientLauncher;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Test the JAXWS annotation: javax.xml.ws.WebServiceRef
*
* @author Thomas.Diesler(a)jboss.com
- * @since 23-Oct-2005
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class StubPropertyTestCase extends JBossWSTest
{
@@ -48,7 +48,7 @@
public static Test suite()
{
- return new JBossWSTestSetup(StubPropertyTestCase.class,
"jaxws-webserviceref-secure.jar, jaxws-secure-webserviceref-client.jar");
+ return new JBossWSTestSetup(StubPropertyTestCase.class,
"jaxws-webserviceref-secure.jar", true);
}
public void testWSDLAccess() throws Exception
@@ -78,63 +78,65 @@
public void testExplicitSecureService1() throws Throwable
{
String reqMsg = "SecureService1";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg, "kermit", "thefrog"
});
- assertResult(reqMsg);
+ final String respMsg = executeApplicationClient(reqMsg, "kermit",
"thefrog");
+ assertEquals(reqMsg, respMsg);
}
public void testExplicitSecureService2() throws Throwable
{
String reqMsg = "SecureService2";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg, "kermit", "thefrog"
});
- assertResult(reqMsg);
+ final String respMsg = executeApplicationClient(reqMsg, "kermit",
"thefrog");
+ assertEquals(reqMsg, respMsg);
}
public void testExplicitSecurePort1() throws Throwable
{
String reqMsg = "SecurePort1";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg, "kermit", "thefrog"
});
- assertResult(reqMsg);
+ final String respMsg = executeApplicationClient(reqMsg, "kermit",
"thefrog");
+ assertEquals(reqMsg, respMsg);
}
public void testImplicitSecureService1() throws Throwable
{
String reqMsg = "SecureService1";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg });
- assertResult(reqMsg);
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
public void testImplicitSecureService2() throws Throwable
{
- String reqMsg = "SecureService2";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg });
- assertResult(reqMsg);
+ final String reqMsg = "SecureService2";
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
public void testImplicitSecurePort1() throws Throwable
{
- String reqMsg = "SecurePort1";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg });
- assertResult(reqMsg);
+ final String reqMsg = "SecurePort1";
+ final String respMsg = executeApplicationClient(reqMsg);
+ assertEquals(reqMsg, respMsg);
}
-
- private static void assertResult(String expected) throws Exception
+
+ private String executeApplicationClient(final String... appclientArgs) throws
Throwable
{
- Class<?> empty[] = {};
- try
- {
- //Use reflection to compile on AS 5.0.0.CR1 too
- Method getMainClassMethod =
ClientLauncher.class.getMethod("getTheMainClass", empty);
- //At least JBoss AS 5.0.0.CR2
- //Use reflection to prevent double loading of the client class
- Class<?> clientClass = (Class<?>)getMainClassMethod.invoke(null, new
Object[] {});
- Field field = clientClass.getField("retStr");
- String result = (String)field.get(clientClass);
- assertEquals(expected, result);
+ final OutputStream appclientOS = new ByteArrayOutputStream();
+
JBossWSTestHelper.deployAppclient("jaxws-webserviceref-secure-appclient.ear#jaxws-webserviceref-secure-appclient.jar",
appclientOS, appclientArgs);
+ // wait till appclient stops
+ String appclientLog = appclientOS.toString();
+ while (!appclientLog.contains("stopped in")) {
+ Thread.sleep(100);
+ appclientLog = appclientOS.toString();
}
- catch (NoSuchMethodException e)
- {
- //JBoss AS 5.0.0.CR1
- assertEquals(expected, SecureEndpointClient.retStr);
- }
+ // assert appclient logs
+ assertTrue(appclientLog.contains("TEST START"));
+ assertTrue(appclientLog.contains("TEST END"));
+ assertTrue(appclientLog.contains("RESULT ["));
+ assertTrue(appclientLog.contains("] RESULT"));
+ int indexOfResultStart = appclientLog.indexOf("RESULT [");
+ int indexOfResultStop = appclientLog.indexOf("] RESULT");
+ assertTrue(indexOfResultStart > 0);
+ assertTrue(indexOfResultStop > 0);
+ return appclientLog.substring(indexOfResultStart + 8, indexOfResultStop);
}
+
}
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2012-02-28
14:45:28 UTC (rev 15775)
@@ -21,23 +21,20 @@
*/
package org.jboss.test.ws.jaxws.webserviceref;
-import org.jboss.logging.Logger;
-import org.jboss.test.ws.jaxws.webserviceref.TestEndpoint;
-import org.jboss.test.ws.jaxws.webserviceref.TestEndpointService;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
-import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
+import org.jboss.logging.Logger;
+
@WebServiceRef(name = "Service1", type=TestEndpointService.class)
// Test multiple on type
@WebServiceRefs
@@ -75,16 +72,13 @@
{
if (iniCtx == null)
{
- InitialContext ctx = new InitialContext();
- Hashtable env = ctx.getEnvironment();
- env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
- env.put("j2ee.clientName", "jbossws-client");
- iniCtx = new InitialContext(env);
+ iniCtx = new InitialContext();
}
}
public static void main(String[] args) throws Exception
{
+ System.out.println("TEST START");
String testName = args[0];
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo client = new
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo();
Method method =
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo.class.getMethod(testName, new
Class[] { String.class });
@@ -103,6 +97,8 @@
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo.log.error("Error",
ex);
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo.testResult.put(testName,
ex.toString());
}
+ System.out.println("TEST END");
+ System.out.println("RESULT [" +
org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo.testResult.get(testName) +
"] RESULT");
}
/**
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/application-client.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/application-client.xml 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/application-client.xml 2012-02-28
14:45:28 UTC (rev 15775)
@@ -8,19 +8,19 @@
<display-name>JAXRPC simple tests</display-name>
<env-entry>
- <env-entry-name>jsr109/entry1</env-entry-name>
+
<env-entry-name>java:jboss/exported/comp/env/jsr109/entry1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>appclient</env-entry-value>
</env-entry>
<env-entry>
- <env-entry-name>jsr109/entry2</env-entry-name>
+
<env-entry-name>java:jboss/exported/comp/env/jsr109/entry2</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>8</env-entry-value>
</env-entry>
<service-ref>
- <service-ref-name>service/TestService</service-ref-name>
+
<service-ref-name>java:jboss/exported/service/TestService</service-ref-name>
<service-interface>javax.xml.rpc.Service</service-interface>
<wsdl-file>META-INF/wsdl/TestService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/jboss-client.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/jboss-client.xml 2012-02-28
14:43:04 UTC (rev 15774)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/enventry/META-INF/jboss-client.xml 2012-02-28
14:45:28 UTC (rev 15775)
@@ -3,10 +3,9 @@
<!DOCTYPE jboss-client PUBLIC "-//JBoss//DTD Application Client 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-client_4_0.dtd">
<jboss-client>
- <jndi-name>jbossws-client</jndi-name>
<service-ref>
- <service-ref-name>service/TestService</service-ref-name>
+
<service-ref-name>java:jboss/exported/service/TestService</service-ref-name>
<wsdl-override>http://@jboss.bind.address@:8080/jaxrpc-enventry/EnvEntryBeanEJB?wsdl</wsdl-override>
</service-ref>
Modified: stack/native/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/pom.xml 2012-02-28 14:43:04 UTC (rev 15774)
+++ stack/native/trunk/modules/testsuite/pom.xml 2012-02-28 14:45:28 UTC (rev 15775)
@@ -1127,21 +1127,6 @@
<configuration>
<compilerArgument>-Djava.endorsed.dirs=${endorsed.dirs}</compilerArgument>
</configuration>
- <executions>
- <execution>
- <id>default-testCompile</id>
- <phase>test-compile</phase>
- <configuration>
- <testExcludes>
- <!-- TODO: tests using org.jboss.ejb3.client.ClientLauncher
-->
-
<exclude>org/jboss/test/ws/jaxws/webserviceref/**</exclude>
- </testExcludes>
- </configuration>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
@@ -1171,9 +1156,6 @@
<exclude>org/jboss/test/ws/jaxws/jbws3182/**</exclude>
<exclude>org/jboss/test/ws/jaxws/jbws1988/UsernameAuthTestCase*</exclude>
- <!-- TODO: tests using org.jboss.ejb3.client.ClientLauncher -->
- <exclude>org/jboss/test/ws/jaxws/webserviceref/**</exclude>
-
<!-- JAXR not available -->
<exclude>org/jboss/test/ws/jaxws/samples/jaxr/**</exclude>
@@ -1189,8 +1171,6 @@
<exclude>org/jboss/test/ws/jaxrpc/encoded/href/MarshallTestCase*</exclude>
<exclude>org/jboss/test/ws/jaxrpc/encoded/marshalltest/MarshallTestCase*</exclude>
<exclude>org/jboss/test/ws/jaxrpc/encoded/parametermode/ParameterModeTestCase*</exclude>
-
<exclude>org/jboss/test/ws/jaxrpc/enventry/EnvEntryEJBTestCase*</exclude>
-
<exclude>org/jboss/test/ws/jaxrpc/enventry/EnvEntryJSETestCase*</exclude>
<exclude>org/jboss/test/ws/jaxrpc/jbas897/JBAS897TestCase*</exclude>
<exclude>org/jboss/test/ws/jaxrpc/jbws1011/JBWS1011TestCase*</exclude>
<exclude>org/jboss/test/ws/jaxrpc/jbws1093/JBWS1093TestCase*</exclude>