Esempio n. 1
0
  public void testSmartClientMode() {
    String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
    String trpUrl = "http://localhost:8280/";

    log.info("Running test: Smart Client mode");
    SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, null, "IBM", null);
    assertResponseReceived(result);
  }
Esempio n. 2
0
  public void testSynapseAsHTTPProxy() {
    String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
    String prxUrl = "http://localhost:8280/";

    log.info("Running test: Using Synapse as a HTTP Proxy");
    SampleClientResult result = client.requestStandardQuote(addUrl, null, prxUrl, "IBM", null);
    assertResponseReceived(result);
  }
Esempio n. 3
0
  public void testErrorHandling() {
    String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
    String trpUrl = "http://localhost:8280";

    log.info("Running test: Introduction to error handling");
    SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, null, "IBM", null);
    assertResponseReceived(result);

    result = client.requestStandardQuote(addUrl, trpUrl, null, "MSFT", null);
    assertFalse("Must not get a response", result.responseReceived());
    Exception resultEx = result.getException();
    assertNotNull("Did not receive expected error", resultEx);
    log.info("Got an error as expected: " + resultEx.getMessage());
    assertTrue("Did not receive expected error", resultEx instanceof AxisFault);

    result = client.requestStandardQuote(addUrl, trpUrl, null, "SUN", null);
    assertFalse("Must not get a response", result.responseReceived());
    Exception resultEx2 = result.getException();
    assertNotNull("Did not receive expected error", resultEx);
    log.info("Got an error as expected: " + resultEx.getMessage());
    assertTrue("Did not receive expected error", resultEx2 instanceof AxisFault);
  }