Package org.springframework.context.support

Examples of org.springframework.context.support.StaticApplicationContext.registerSingleton()


public class MockWebServiceClientTest {

    @Test
    public void createServerApplicationContext() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("messageDispatcher", SoapMessageDispatcher.class);
        applicationContext.registerSingleton("messageFactory", SaajSoapMessageFactory.class);
        applicationContext.refresh();

        MockWebServiceClient client = MockWebServiceClient.createClient(applicationContext);
        assertNotNull(client);
View Full Code Here


    @Test
    public void createServerApplicationContext() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("messageDispatcher", SoapMessageDispatcher.class);
        applicationContext.registerSingleton("messageFactory", SaajSoapMessageFactory.class);
        applicationContext.refresh();

        MockWebServiceClient client = MockWebServiceClient.createClient(applicationContext);
        assertNotNull(client);
    }
View Full Code Here

    }

    @Test
    public void createServerApplicationContextWebServiceTemplate() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("webServiceTemplate", WebServiceTemplate.class);
        applicationContext.refresh();

        MockWebServiceServer server = MockWebServiceServer.createServer(applicationContext);
        assertNotNull(server);
    }
View Full Code Here

    }

    @Test
    public void createServerApplicationContextWebServiceGatewaySupport() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("myClient", MyClient.class);
        applicationContext.refresh();

        MockWebServiceServer server = MockWebServiceServer.createServer(applicationContext);
        assertNotNull(server);
    }
View Full Code Here

    }

    @Test
    public void one() {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("myBean", MyBean.class);

        MockStrategiesHelper helper = new MockStrategiesHelper(applicationContext);
        assertNotNull(helper.getStrategy(IMyBean.class));
    }
View Full Code Here

    }

    @Test(expected = BeanInitializationException.class)
    public void many() {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("myBean1", MyBean.class);
        applicationContext.registerSingleton("myBean2", MyBean.class);

        MockStrategiesHelper helper = new MockStrategiesHelper(applicationContext);
        helper.getStrategy(IMyBean.class);
    }
View Full Code Here

    @Test(expected = BeanInitializationException.class)
    public void many() {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("myBean1", MyBean.class);
        applicationContext.registerSingleton("myBean2", MyBean.class);

        MockStrategiesHelper helper = new MockStrategiesHelper(applicationContext);
        helper.getStrategy(IMyBean.class);
    }
   
View Full Code Here

        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
            appContext.registerSingleton("messageSender", HttpComponentsMessageSender.class);
            appContext.refresh();

            HttpComponentsMessageSender messageSender = appContext
                    .getBean("messageSender", HttpComponentsMessageSender.class);
            connection = messageSender.createConnection(new URI("http://localhost:" + port));
View Full Code Here

        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
            appContext.registerSingleton("messageSender", CommonsHttpMessageSender.class);
            appContext.refresh();

            CommonsHttpMessageSender messageSender = appContext
                    .getBean("messageSender", CommonsHttpMessageSender.class);
            connection = messageSender.createConnection(new URI("http://localhost:" + port));
View Full Code Here

        strategies.put(Strategy.class.getName(),
                StrategyImpl.class.getName() + "," + ContextAwareStrategyImpl.class.getName());
        DefaultStrategiesHelper helper = new DefaultStrategiesHelper(strategies);

        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("strategy1", StrategyImpl.class);
        applicationContext.registerSingleton("strategy2", ContextAwareStrategyImpl.class);

        List<Strategy> result = helper.getDefaultStrategies(Strategy.class, applicationContext);
        Assert.assertNotNull("No result", result);
        Assert.assertEquals("Invalid amount of strategies", 2, result.size());
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.