Search in sources :

Example 6 with Offer

use of org.switchyard.quickstarts.demo.txpropagation.Offer 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());
}
Also used : Car(org.switchyard.quickstarts.demo.txpropagation.Car) Offer(org.switchyard.quickstarts.demo.txpropagation.Offer) MockHandler(org.switchyard.test.MockHandler) Deal(org.switchyard.quickstarts.demo.txpropagation.Deal) Application(org.switchyard.quickstarts.demo.txpropagation.Application) Test(org.junit.Test)

Aggregations

Offer (org.switchyard.quickstarts.demo.txpropagation.Offer)6 Test (org.junit.Test)4 Application (org.switchyard.quickstarts.demo.txpropagation.Application)4 Car (org.switchyard.quickstarts.demo.txpropagation.Car)3 Deal (org.switchyard.quickstarts.demo.txpropagation.Deal)3 RemoteInvoker (org.switchyard.remote.RemoteInvoker)1 RemoteMessage (org.switchyard.remote.RemoteMessage)1 HttpInvoker (org.switchyard.remote.http.HttpInvoker)1 MockHandler (org.switchyard.test.MockHandler)1