Package org.springframework.context.support

Examples of org.springframework.context.support.StaticApplicationContext


        SecurityContextHolder.clearContext();
    }

    @Test
    public void expressionPropertiesAreResolvedAgainsAppContextBeans() throws Exception {
        StaticApplicationContext appContext = new StaticApplicationContext();
        RootBeanDefinition bean = new RootBeanDefinition(SecurityConfig.class);
        bean.getConstructorArgumentValues().addGenericArgumentValue("ROLE_A");
        appContext.registerBeanDefinition("role", bean);
        handler.setApplicationContext(appContext);

        EvaluationContext ctx = handler.createEvaluationContext(mock(Authentication.class), mock(FilterInvocation.class));
        ExpressionParser parser = handler.getExpressionParser();
        assertTrue(parser.parseExpression("@role.getAttribute() == 'ROLE_A'").getValue(ctx, Boolean.class));
View Full Code Here


        foo.foo(new SecurityConfig("A"));
    }

    @Test
    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 testDetectStrategies() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerSingleton("mapping", PayloadRootQNameEndpointMapping.class);
        applicationContext.registerSingleton("adapter", PayloadEndpointAdapter.class);
        applicationContext.registerSingleton("resolver", SimpleSoapExceptionResolver.class);
        dispatcher.setApplicationContext(applicationContext);
        Assert.assertEquals("Invalid amount of mappings detected", 1, dispatcher.getEndpointMappings().size());
        Assert.assertTrue("Invalid mappings detected",
                dispatcher.getEndpointMappings().get(0) instanceof PayloadRootQNameEndpointMapping);
        Assert.assertEquals("Invalid amount of adapters detected", 1, dispatcher.getEndpointAdapters().size());
View Full Code Here

                dispatcher.getEndpointExceptionResolvers().get(0) instanceof SimpleSoapExceptionResolver);
    }

    @Test
    public void testDefaultStrategies() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        dispatcher.setApplicationContext(applicationContext);
    }
View Full Code Here

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

        assertNotNull(client);
    }
   
    @Test
    public void createServerApplicationContextDefaults() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.refresh();

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

        assertNotNull(server);
    }

    @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

        assertNotNull(server);
    }

    @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

        assertNotNull(server);
    }

    @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

public class MockStrategiesHelperTest {

    @Test
    public void none() {
        StaticApplicationContext applicationContext = new StaticApplicationContext();

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

TOP

Related Classes of org.springframework.context.support.StaticApplicationContext

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.