Search in sources :

Example 1 with Car

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

Example 2 with Car

use of org.switchyard.quickstarts.demo.txpropagation.Car in project quickstarts by jboss-switchyard.

the class DealerTest method rejectLowBallOffer.

@Test
public void rejectLowBallOffer() throws Exception {
    Car car = new Car();
    car.setPrice(500.00);
    Offer offer = new Offer();
    offer.setCar(car);
    offer.setAmount(100.00);
    Deal deal = service.operation("offer").sendInOut(offer).getContent(Deal.class);
    // verify the deal is rejected
    Assert.assertFalse(deal.isAccepted());
}
Also used : Car(org.switchyard.quickstarts.demo.txpropagation.Car) Offer(org.switchyard.quickstarts.demo.txpropagation.Offer) Deal(org.switchyard.quickstarts.demo.txpropagation.Deal) Test(org.junit.Test)

Example 3 with Car

use of org.switchyard.quickstarts.demo.txpropagation.Car 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

Car (org.switchyard.quickstarts.demo.txpropagation.Car)3 Offer (org.switchyard.quickstarts.demo.txpropagation.Offer)3 Test (org.junit.Test)2 Application (org.switchyard.quickstarts.demo.txpropagation.Application)2 Deal (org.switchyard.quickstarts.demo.txpropagation.Deal)2 MockHandler (org.switchyard.test.MockHandler)1