Skip to content

Commit

Permalink
WFLY-3260 Fix WSTestCase
Browse files Browse the repository at this point in the history
- send request to servlet to initialize it
  • Loading branch information
bafco committed Jun 16, 2014
1 parent 993a4d1 commit 6c73d55
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Expand Up @@ -54,10 +54,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
log.info("Received request");

Writer writer = resp.getWriter();
writer.write("Servlet Response\n");
SimpleStatelessSessionLocal bean = session;
String msg = bean.echo("Hello from Servlet");
writer.write(msg);
boolean ok = session.isInjectionOK();
writer.write("" + ok);
writer.close();
}

Expand Down
Expand Up @@ -48,7 +48,8 @@ public void setEndpoint4(EndpointService endpoint) {
endpoint4 = endpoint;
}

public String echo(String msg) {
return "Echo " + msg + " -- Endpoint:" + endpoint1 + " " + endpoint2 + " " + endpoint3 + " " + endpoint4 + ")";
@Override
public boolean isInjectionOK() {
return (endpoint1 != null && endpoint2 != null && endpoint3 != null && endpoint4 != null);
}
}
Expand Up @@ -27,5 +27,5 @@
*
*/
public interface SimpleStatelessSessionLocal {
String echo(String msg);
boolean isInjectionOK();
}
Expand Up @@ -70,7 +70,7 @@ public static Archive<?> getDeployment() {

@Test
public void testWSDL() throws Exception {
String s = performCall("?wsdl");
String s = performCall("ws-example/?wsdl");
Assert.assertNotNull(s);
Assert.assertTrue(s.contains("wsdl:definitions"));
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public void testManagementDescriptionMetrics() throws Exception {
checkCountMetric(endpointResult, managementClient.getControllerClient(), "response-count");
}
}

private void checkCountMetric(final ModelNode endpointResult, final ModelControllerClient client, final String metricName) throws IOException {
final ModelNode readAttribute = new ModelNode();
readAttribute.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION);
Expand All @@ -147,9 +147,13 @@ public void testAccess() throws Exception {
Assert.assertEquals("Foo", port.echo("Foo"));
}

@Test
public void testWSInjection() throws Exception {
Assert.assertEquals("true", performCall("servlet"));
}

private String performCall(String params) throws Exception {
URL url = new URL(this.url.toExternalForm() + "ws-example/" + params);
private String performCall(String urlPattern) throws Exception {
URL url = new URL(this.url.toExternalForm() + urlPattern);
return HttpRequest.get(url.toExternalForm(), 30, TimeUnit.SECONDS);
}
}

0 comments on commit 6c73d55

Please sign in to comment.