Examples of CoffeeService


Examples of org.springframework.integration.samples.storedprocedure.service.CoffeeService

        context.registerShutdownHook();

        final Scanner scanner = new Scanner(System.in);

        final CoffeeService service = context.getBean(CoffeeService.class);

        LOGGER.info(LINE
                  + NEWLINE
                  + "\n    Please press 'q + Enter' to quit the application.    "
                  + NEWLINE
                  + LINE);

        System.out.print("Please enter 'list' and press <enter> to get a list of coffees.");
        System.out.print("Enter a coffee id, e.g. '1' and press <enter> to get a description.\n\n");

        while (!scanner.hasNext("q")) {

          String input = scanner.nextLine();

          if ("list".equalsIgnoreCase(input)) {
            List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();

            for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
              System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
                                                      coffeeBeverage.getName()));
            }

          } else {
            System.out.println("Retrieving coffee information...");
                String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));

              System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
                System.out.print("To try again, please enter another coffee beaverage and press <enter>:\n\n");
          }
View Full Code Here

Examples of org.springframework.integration.samples.storedprocedure.service.CoffeeService

    public void testFindCoffee() {
        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  CoffeeServiceFindAllTest.class);

        final CoffeeService service = context.getBean(CoffeeService.class);

        List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();

        assertTrue(coffeeBeverages.size() == 4);

    }
View Full Code Here

Examples of org.springframework.integration.samples.storedprocedure.service.CoffeeService

    public void testFindCoffee() {
        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  CoffeeServiceFindCoffeeTest.class);

        final CoffeeService service = context.getBean(CoffeeService.class);

        String description = service.findCoffeeBeverage(3);

        assertEquals("Mmmmh, chocolate.", description);

    }
View Full Code Here

Examples of org.springframework.integration.samples.storedprocedure.service.CoffeeService

    context.registerShutdownHook();

    final Scanner scanner = new Scanner(System.in);

    final CoffeeService service = context.getBean(CoffeeService.class);

    LOGGER.info(LINE
        + NEWLINE
        + "\n    Please press 'q + Enter' to quit the application."
        + NEWLINE
        + LINE);

    System.out.print("Please enter 'list' and press <enter> to get a list of coffees.");
    System.out.print("Enter a coffee id, e.g. '1' and press <enter> to get a description.\n\n");

    while (!scanner.hasNext("q")) {

      String input = scanner.nextLine();

      if ("list".equalsIgnoreCase(input)) {
        List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();

        for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
          System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
                                coffeeBeverage.getName()));
        }

      } else {
        System.out.println("Retrieving coffee information...");
        String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));

        System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
        System.out.print("To try again, please enter another coffee beverage and press <enter>:\n\n");
      }
View Full Code Here

Examples of org.springframework.integration.samples.storedprocedure.service.CoffeeService

    final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
    context.load("classpath:META-INF/spring/integration/spring-integration-sample2-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final CoffeeService service = context.getBean(CoffeeService.class);

    final String message = "\n\n" +
      "* Please enter 'list' and press <enter> to get a list of coffees.\n" +
      "* Enter a coffee id, e.g. '1' and press <enter> to get a description.\n" +
      "* Please press 'q + Enter' to quit the application.\n";

    System.out.println(message);

    while (!scanner.hasNext("q")) {

      String input = scanner.nextLine();

      if ("list".equalsIgnoreCase(input)) {
        List<CoffeeBeverage> coffeeBeverages = service.findAllCoffeeBeverages();

        for (CoffeeBeverage coffeeBeverage : coffeeBeverages) {
          System.out.println(String.format("%s - %s", coffeeBeverage.getId(),
                                coffeeBeverage.getName()));
        }

      } else {
        System.out.println("Retrieving coffee information...");
        String coffeeDescription = service.findCoffeeBeverage(Integer.valueOf(input));

        System.out.println(String.format("Searched for '%s' - Found: '%s'.", input, coffeeDescription));
        System.out.print("To try again, please enter another coffee beverage and press <enter>:\n\n");
      }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.