Package org.apache.cxf.systest.ws.policy.javafirst

Examples of org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService


        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();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no client cert and password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here


        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();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here

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

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

        try {
            simpleService.doStuff();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no client cert and password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
       
        clientContext.close();
    }
View Full Code Here

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

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

        try {
            simpleService.doStuff();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
       
        clientContext.close();
    }
View Full Code Here

        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();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        simpleService.doStuff();

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here

        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();
            fail("Expected exception as no credentials");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        WSS4JOutInterceptor wssOut = addToClient(simpleService);

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no password and no client cert");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        try {
            simpleService.doStuff();
            fail("Expected exception as no client cert and password not allowed");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getNoPasswordProperties("alice"));
        try {
            simpleService.ping();
            fail("Expected exception as no password");
        } catch (SOAPFaultException e) {
            assertTrue(true);
        }

        wssOut.setProperties(getPasswordProperties("alice", "password"));
        simpleService.ping();
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.systest.ws.policy.javafirst.NoAlternativesOperationSimpleService

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.