Package org.springframework.context.support

Examples of org.springframework.context.support.ClassPathXmlApplicationContext


    @org.junit.Test
    public void testUsernameTokenPolicyValidatorNoPasswordValidation() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.2", PORT2);

        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
            "org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");

        SslUsernamePasswordAttachmentService svc = ctx.getBean("SslUsernamePasswordAttachmentServiceClient",
                                                               SslUsernamePasswordAttachmentService.class);

        WSS4JOutInterceptor wssOut = addToClient(svc);

        // just some basic sanity tests first to make sure that auth is working where password is provided.
View Full Code Here


    @Test
    public void testBindingNoClientCertAlternativePolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer", PORT);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml"
        });

        BindingSimpleService simpleService = clientContext.getBean("BindingSimpleServiceClient",
                                                                         BindingSimpleService.class);

        try {
            simpleService.doStuff();
            fail("Expected exception as no credentials");
View Full Code Here

    @Test
    public void testBindingClientCertAlternativePolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslcertclient.xml"
        });

        BindingSimpleService simpleService = clientContext.getBean("BindingSimpleServiceClient",
                                                                         BindingSimpleService.class);

        try {
            simpleService.doStuff();
            fail("Expected exception as no credentials");
View Full Code Here

    @Test
    public void testNoAltOperationNoClientCertPolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml"
        });

        NoAlternativesOperationSimpleService simpleService = clientContext
            .getBean("NoAlternativesOperationSimpleServiceClient",
                     NoAlternativesOperationSimpleService.class);

        try {
            simpleService.doStuff();
View Full Code Here

    @Test
    public void testNoAltOperationClientCertPolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslcertclient.xml"
        });

        NoAlternativesOperationSimpleService simpleService = clientContext
            .getBean("NoAlternativesOperationSimpleServiceClient",
                     NoAlternativesOperationSimpleService.class);

        try {
            simpleService.doStuff();
View Full Code Here

    @Test
    public void testOperationNoClientCertAlternativePolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslnocertclient.xml"
        });

        OperationSimpleService simpleService = clientContext
            .getBean("OperationSimpleServiceClient", OperationSimpleService.class);

        // no security on ping!
        simpleService.ping();
       
View Full Code Here

    @Test
    public void testOperationClientCertAlternativePolicy() {
        System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);

        ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
            "org/apache/cxf/systest/ws/policy/client/sslcertclient.xml"
        });

        OperationSimpleService simpleService = clientContext
            .getBean("OperationSimpleServiceClient", OperationSimpleService.class);

        // no security on ping!
        simpleService.ping();
       
View Full Code Here

        assertTrue("bean injected into test feature has not been initialised", tf.testBean.initialised);
    }
   
    @Test
    public void testBusConfigure() {
        ClassPathXmlApplicationContext context = null;
        try {
            context = new ClassPathXmlApplicationContext("org/apache/cxf/bus/spring/customerBus.xml");
            Bus cxf1 = (Bus)context.getBean("cxf1");
           
            assertTrue(cxf1.getOutInterceptors().size() == 1);
            assertTrue(cxf1.getInInterceptors().size() == 0);
           
            Bus cxf2 = (Bus)context.getBean("cxf2");
            assertTrue(cxf2.getInInterceptors().size() == 1);
            assertTrue(cxf2.getOutInterceptors().size() == 0);
        } finally {
            if (context != null) {
                context.close();
            }
        }
    }
View Full Code Here

            }
        }
    }
    @Test
    public void testBusConfigureCreateBus() {
        ClassPathXmlApplicationContext context = null;
        final AtomicBoolean b = new AtomicBoolean();
        try {
            context = new ClassPathXmlApplicationContext("org/apache/cxf/bus/spring/customerBus2.xml");
            Bus cxf1 = (Bus)context.getBean("cxf1");
           
            assertTrue(cxf1.getOutInterceptors().size() == 1);
            assertTrue(cxf1.getInInterceptors().size() == 0);
           
            Bus cxf2 = (Bus)context.getBean("cxf2");
           
            assertTrue(cxf2.getInInterceptors().size() == 1);
            assertTrue(cxf2.getOutInterceptors().size() == 0);
           
            cxf2.getExtension(BusLifeCycleManager.class)
                .registerLifeCycleListener(new BusLifeCycleListener() {
                    public void initComplete() {
                    }

                    public void preShutdown() {
                    }

                    public void postShutdown() {
                        b.set(true);
                    }
                   
                });
        } finally {
            if (context != null) {
                context.close();
            }
        }
        assertTrue("postShutdown not called", b.get());
    }
View Full Code Here

        }
    }
   
    @Test
    public void testConnectionsWithinSpring() throws Exception {
        ClassPathXmlApplicationContext ctx =
            new ClassPathXmlApplicationContext(
                new String[] {"/org/apache/cxf/systest/jms/JMSClients.xml"});
              
        HelloWorldPortType greeter = (HelloWorldPortType)ctx.getBean("jmsRPCClient");
        assertNotNull(greeter);
       
        String response1 = new String("Hello Milestone-");
        String response2 = new String("Bonjour");
        try {
           
            for (int idx = 0; idx < 5; idx++) {
                String greeting = greeter.greetMe("Milestone-" + idx);
                assertNotNull("no response received from service", greeting);
                String exResponse = response1 + idx;
                assertEquals(exResponse, greeting);

                String reply = greeter.sayHi();
                assertNotNull("no response received from service", reply);
                assertEquals(response2, reply);
               
                try {
                    greeter.testRpcLitFault("BadRecordLitFault");
                    fail("Should have thrown BadRecoedLitFault");
                } catch (BadRecordLitFault ex) {
                    assertNotNull(ex.getFaultInfo());
                }
               
                try {
                    greeter.testRpcLitFault("NoSuchCodeLitFault");
                    fail("Should have thrown NoSuchCodeLitFault exception");
                } catch (NoSuchCodeLitFault nslf) {
                    assertNotNull(nslf.getFaultInfo());
                    assertNotNull(nslf.getFaultInfo().getCode());
                }
            }
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
        }
       
        HelloWorldOneWayPort greeter1 = (HelloWorldOneWayPort)ctx.getBean("jmsQueueOneWayServiceClient");
        assertNotNull(greeter1);
        try {
            greeter1.greetMeOneWay("hello");
        } catch (Exception ex) {
            fail("There should not throw the exception" + ex);
View Full Code Here

TOP

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

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.