use of org.springframework.integration.service.StringConversionService in project spring-integration-samples by spring-projects.
the class StringConversionServiceTest method testConvertStringToUpperCase.
@Test
public void testConvertStringToUpperCase() {
final ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml", StringConversionServiceTest.class);
final StringConversionService service = context.getBean(StringConversionService.class);
final String stringToConvert = "I love Spring Integration";
final String expectedResult = "I LOVE SPRING INTEGRATION";
final String convertedString = service.convertToUpperCase(stringToConvert);
Assert.assertEquals("Expecting that the string is converted to upper case.", expectedResult, convertedString);
}
use of org.springframework.integration.service.StringConversionService in project spring-integration-samples by spring-projects.
the class Main method executeSample1.
private static void executeSample1() {
final Scanner scanner = new Scanner(System.in);
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.load("classpath:META-INF/spring/integration/spring-integration-sample1-context.xml");
context.registerShutdownHook();
context.refresh();
final StringConversionService service = context.getBean(StringConversionService.class);
final String message = "\n=========================================================" + "\n " + "\n Please press 'q + Enter' to quit the application. " + "\n " + "\n=========================================================" + "\n\n Please enter a string and press <enter>: ";
System.out.print(message);
while (!scanner.hasNext("q")) {
String input = scanner.nextLine();
System.out.println("Converting String to Uppcase using Stored Procedure...");
String inputUpperCase = service.convertToUpperCase(input);
System.out.println("Retrieving Numeric value via Sql Function...");
Integer number = service.getNumber();
System.out.println(String.format("Converted '%s' - End Result: '%s_%s'.", input, inputUpperCase, number));
System.out.print("To try again, please enter a string and press <enter>:");
}
scanner.close();
context.close();
System.out.println("Back to main menu.");
}
use of org.springframework.integration.service.StringConversionService in project spring-integration-samples by spring-projects.
the class StringConversionServiceTest method testConvertStringToUpperCase.
@Test
public void testConvertStringToUpperCase() {
final ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml", StringConversionServiceTest.class);
final StringConversionService service = context.getBean(StringConversionService.class);
final String stringToConvert = "I love Spring Integration";
final String expectedResult = "I LOVE SPRING INTEGRATION";
// final String convertedString = service.convertToUpperCase(stringToConvert);
// assertEquals("Expecting that the string is converted to upper case.",
// dd expectedResult, convertedString);
}
Aggregations