Package org.springframework.context.support

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


    public void runAsManagerIsSetCorrectly() throws Exception {
        StaticApplicationContext parent = new StaticApplicationContext();
        MutablePropertyValues props = new MutablePropertyValues();
        props.addPropertyValue("key", "blah");
        parent.registerSingleton("runAsMgr", RunAsManagerImpl.class, props);
        parent.refresh();

        setContext("<global-method-security run-as-manager-ref='runAsMgr'/>" + AUTH_PROVIDER_XML, parent);
        RunAsManagerImpl ram = (RunAsManagerImpl) appContext.getBean("runAsMgr");
        MethodSecurityMetadataSourceAdvisor msi = (MethodSecurityMetadataSourceAdvisor)
            appContext.getBeansOfType(MethodSecurityMetadataSourceAdvisor.class).values().toArray()[0];
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 createServerApplicationContextDefaults() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        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(expected = IllegalArgumentException.class)
    public void createServerApplicationContextEmpty() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.refresh();

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

        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

        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

    ac.registerSingleton("configurer1", PropertyOverrideConfigurer.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "tb2.age=99\ntb2.name=test2");
    pvs.addPropertyValue("order", "0");
    ac.registerSingleton("configurer2", PropertyOverrideConfigurer.class, pvs);
    ac.refresh();
    TestBean tb1 = (TestBean) ac.getBean("tb1");
    TestBean tb2 = (TestBean) ac.getBean("tb2");
    assertEquals(99, tb1.getAge());
    assertEquals(99, tb2.getAge());
    assertEquals(null, tb1.getName());
View Full Code Here

    StaticApplicationContext ac = new StaticApplicationContext();
    ac.registerSingleton("tb", IndexedTestBean.class);
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "tb.array[0].age=99\ntb.list[1].name=test");
    ac.registerSingleton("configurer", PropertyOverrideConfigurer.class, pvs);
    ac.refresh();
    IndexedTestBean tb = (IndexedTestBean) ac.getBean("tb");
    assertEquals(99, tb.getArray()[0].getAge());
    assertEquals("test", ((TestBean) tb.getList().get(1)).getName());
  }
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.