use of org.switchyard.quickstarts.demo.txpropagation.Application in project quickstarts by jboss-switchyard.
the class RemoteClient method createOffer.
public static Offer createOffer(boolean acceptable) {
Application app = new Application();
app.setName("John Smith");
app.setCreditScore(acceptable ? 700 : 300);
Car car = new Car();
car.setPrice(18000);
car.setVehicleId("Honda");
Offer offer = new Offer();
offer.setApplication(app);
offer.setCar(car);
offer.setAmount(17000);
return offer;
}
use of org.switchyard.quickstarts.demo.txpropagation.Application in project quickstarts by jboss-switchyard.
the class CreditCheckTest method creditDenied.
// Verify that credit scores below 600 are denied
@Test
public void creditDenied() throws Exception {
Application app = new Application();
app.setName("bill whatwhatwhat");
app.setCreditScore(400);
Offer offer = new Offer();
offer.setApplication(app);
Application result = service.operation("checkCredit").sendInOut(offer).getContent(Application.class);
// validate the results
Assert.assertFalse(result.isApproved());
}
use of org.switchyard.quickstarts.demo.txpropagation.Application in project quickstarts by jboss-switchyard.
the class CreditCheckTest method creditApproved.
// Verify that credit scores at or above 600 are approved
@Test
public void creditApproved() throws Exception {
Application app = new Application();
app.setName("phil garfield");
app.setCreditScore(600);
Offer offer = new Offer();
offer.setApplication(app);
Application result = service.operation("checkCredit").sendInOut(offer).getContent(Application.class);
// validate the results
Assert.assertTrue(result.isApproved());
}
use of org.switchyard.quickstarts.demo.txpropagation.Application in project quickstarts by jboss-switchyard.
the class DealerTest method acceptValidOffer.
@Test
public void acceptValidOffer() throws Exception {
Car car = new Car();
car.setPrice(500.00);
Application app = new Application();
app.setCreditScore(650);
Offer offer = new Offer();
offer.setCar(car);
offer.setApplication(app);
offer.setAmount(450.00);
// configure our proxy for the service reference
testKit.replaceService("DealLogger");
MockHandler creditService = testKit.replaceService("CreditCheckService");
Application reply = new Application();
reply.setApproved(true);
creditService.replyWithOut(reply);
// Invoke the service
Deal deal = service.operation("offer").sendInOut(offer).getContent(Deal.class);
// verify the deal is rejected
Assert.assertTrue(deal.isAccepted());
}
Aggregations