Package com.manning.siia.kitchen.domain

Examples of com.manning.siia.kitchen.domain.Recipe


  @Autowired
  private PollableChannel test;

  @Test
  public void shouldConvertRecipeIntoIngredients() {
    Recipe recipe = RecipeObjectMother.steak();
    List<Ingredient> needed = RecipeObjectMother.steak().getIngredients();
    recipes.send(MessageBuilder.withPayload(recipe).build());
    receiveAndCheckProductMessage(needed);
    receiveAndCheckProductMessage(needed);
    receiveAndCheckProductMessage(needed);
View Full Code Here


  private PollableChannel meals;

  @Test
  public void shouldPrepareMealFromRecipe() {
    final TimedPollableChannel timed = new TimedPollableChannel(meals);
    Recipe r = RecipeObjectMother.steak();
    recipes.send(MessageBuilder.withPayload(r).build());

    final Message<Meal> message = timed.receive(2500);
    assertThat("Message was null", message, Matchers.is(notNullValue()));
    final Meal meal = message.getPayload();
View Full Code Here

  @Test
  public void shouldHydrateXmlFile() throws IOException {
    final Object o = xstream.fromXML(new ClassPathResource("pilav.xml").getInputStream());
    assertThat(o, instanceOf(Recipe.class));
    Recipe r = (Recipe) o;
    assertThat(r.getIngredients().size(), is(6));
    System.out.println(r.getIngredients());
  }
View Full Code Here

    System.out.println(r.getIngredients());
  }

  @Test
  public void shouldMarshallDomain() {
    Recipe r = new Recipe("Nasi");
    Ingredient i = new Ingredient("Beef", new Amount(500, Unit.GRAMS), Type.Meat);
    r.addIngredient(i);
    r.addIngredient(new Ingredient("Red Sweet Pepper", new Amount(1, Unit.PIECES), Type.Vegetable));

    System.out.println(xstream.toXML(r));
  }
View Full Code Here

* @author Iwein Fuld
*/
public class RecipeObjectMother {

  public static Recipe friedEggRecipe() {
    Recipe recipe = new Recipe("fried egg");
    recipe.addIngredient(new Ingredient("egg", new Amount(1, Amount.Unit.PIECES), Ingredient.Type.Grocery));
    recipe.addIngredient(new Ingredient("butter", new Amount(20, Amount.Unit.GRAMS), Ingredient.Type.Grocery));
    return recipe;
  }
View Full Code Here

    recipe.addIngredient(new Ingredient("butter", new Amount(20, Amount.Unit.GRAMS), Ingredient.Type.Grocery));
    return recipe;
  }

  public static Recipe steak() {
    Recipe recipe = new Recipe("steak");
    recipe.addIngredient(new Ingredient("steak", new Amount(1, Amount.Unit.PIECES), Ingredient.Type.Meat));
    recipe.addIngredient(new Ingredient("pepper", new Amount(2, Amount.Unit.GRAMS), Ingredient.Type.Grocery));
    recipe.addIngredient(new Ingredient("salt", new Amount(2, Amount.Unit.GRAMS), Ingredient.Type.Grocery));
    return recipe;
  }
View Full Code Here

*/
public class Cook {

  @Aggregator
  public Meal prepareMeal(List<Message<Product>> products) {
    Recipe recipe = (Recipe) products.get(0).getHeaders().get("recipe");
    Meal meal = new Meal(recipe);
    for (Message<Product> message : products) {
      meal.cook(message.getPayload());
    }
    return meal;
View Full Code Here

    return message.getHeaders().get("recipe");
  }

  @ReleaseStrategy
  public boolean canCookMeal(List<Message<?>> products) {
    Recipe recipe = (Recipe) products.get(0).getHeaders().get("recipe");
    return recipe.isSatisfiedBy(productsFromMessages(products));
  }
View Full Code Here

TOP

Related Classes of com.manning.siia.kitchen.domain.Recipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.