Package org.springframework.context

Examples of org.springframework.context.ApplicationContext


*/
public class CoffeeServiceFindAllTest {

    @Test
    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


*/
public class CoffeeServiceFindCoffeeTest {

    @Test
    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

*/
public class CoffeeServiceStartupTest {

    @Test
    public void testStartupOfSpringInegrationContext() throws Exception{
        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  CoffeeServiceStartupTest.class);
        Thread.sleep(2000);
    }
View Full Code Here

public class SpringObjectFactory implements AtmosphereObjectFactory {
    private static final Logger logger = LoggerFactory.getLogger(SpringObjectFactory.class);

    @Override
    public <T, U extends T> U newClassInstance(AtmosphereFramework framework, Class<T> classType, Class<U> classToInstantiate) throws InstantiationException, IllegalAccessException {
        ApplicationContext context =
            new AnnotationConfigApplicationContext(classToInstantiate);
        U t = context.getBean(classToInstantiate);
        if (t == null) {
            logger.info("Unable to find {}. Creating the object directly.", classToInstantiate.getName());
            return classToInstantiate.newInstance();
        }
        return t;
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/http-outbound-config.xml");
    Resource s2logo = new ClassPathResource(resourcePath);
    Map<String, Object> multipartMap = new HashMap<String, Object>();
    multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
    multipartMap.put("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    MultipartRequestGateway requestGateway = context.getBean("requestGateway", MultipartRequestGateway.class);
    HttpStatus reply = requestGateway.postMultipartRequest(multipartMap);
    System.out.println("Replied with HttpStatus code: " + reply);
  }
View Full Code Here

*/
public class UserServiceTest {

    @Test
    public void testStartupOfSpringInegrationContext() throws Exception{
        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  UserServiceTest.class);
        Thread.sleep(2000);
    }
View Full Code Here

    }

    @Test
    public void testExecuteFindUser() {

        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  UserServiceTest.class);

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

        User user = new User("foo", null, null);
        final User fullUser = service.findUser(user);

        assertEquals("foo", fullUser.getUsername());
View Full Code Here

    }

    @Test
    public void testExecuteFindUserByUsername() {

        final ApplicationContext context
            = new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml",
                                                  UserServiceTest.class);

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

        User user = new User("foo", null, null);
        final User fullUser = service.findUserByUsername(user);

        assertEquals("foo", fullUser.getUsername());
View Full Code Here

    Thread.sleep(2000);
  }

  @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);
View Full Code Here

*
*/
public class NotificationListener {

  public static void main(String[] args) throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/integration/remote-monitor-context.xml");
    Gateway gw = ctx.getBean(Gateway.class);
    int cmd = 0;
    while (cmd != 'q') {
      cmd = System.in.read();
      gw.send((char) cmd);
    }
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationContext

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.