@Test
  public void testProcess() throws Exception {
    String message = "Hello ABC!";
    String result = service.operation("process").sendInOut(message).getContent(String.class);

    // validate the results
    Assert.assertEquals("Service 3 Service 2 Service 1 Hello ABC!", result);
  }
Exemplo n.º 2
0
  @Test
  public void sanityCheck() throws Exception {

    // Mock providers for services called from IntakeService
    MockHandler lookUpService = testKit.registerInOutService("CustomerLookup").replyWithOut(null);
    MockHandler preQualService = testKit.replaceService("PreQualificationService").forwardInToOut();

    service.operation("intake").sendInOnly(createApplication());

    // validate that our downstream service references were called
    Assert.assertEquals(1, lookUpService.getMessages().size());
    Assert.assertEquals(1, preQualService.getMessages().size());
  }
Exemplo n.º 3
0
  @Test
  public void childrenHaveHorribleCredit() throws Exception {
    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Peter Gibbons");
    applicant.setAge(8);

    // Invoke the service
    service.operation("process").sendInOut(applicant);

    // validate the results
    Assert.assertEquals(160, applicant.getCreditScore());
  }
Exemplo n.º 4
0
  @Test
  public void goodCredit() throws Exception {

    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Bill Lumbergh");
    applicant.setCreditScore(700);

    // Invoke the service
    service.operation("process").sendInOut(applicant);

    // validate the results
    Assert.assertTrue(applicant.isApproved());
  }
Exemplo n.º 5
0
  @Test
  public void lowCredit() throws Exception {

    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Peter Gibbons");
    applicant.setCreditScore(400);

    // Invoke the service
    Applicant reply = service.operation("process").sendInOut(applicant).getContent(Applicant.class);

    // validate the results
    Assert.assertTrue(!reply.isApproved());
  }
Exemplo n.º 6
0
  @Test
  public void adultsAreResponsible() throws Exception {

    // Build the request message
    Applicant request = new Applicant();
    request.setName("Bill Lumbergh");
    request.setAge(39);

    // Invoke the service
    Applicant reply = service.operation("process").sendInOut(request).getContent(Applicant.class);

    // validate the results
    Assert.assertNotSame(780, reply.getCreditScore());
  }
Exemplo n.º 7
0
 @Test
 public void httpGatewayReferenceTest() throws Exception {
   Message responseMsg = _consumerService.operation("sayHello").sendInOut("magesh");
   Assert.assertEquals("magesh", responseMsg.getContent(String.class));
 }