Package org.milyn.payload

Examples of org.milyn.payload.StringSource


            } else if ( object instanceof Reader ) {
                source =  new StreamSource( ( Reader ) object );
            } else if ( object instanceof Resource ) {
                source =  new StreamSource( ( ( Resource ) object).getReader() );
            } else if ( object instanceof String ) {
                source =  new StringSource( (String) object);
            } else {
                throw new IllegalArgumentException( "signal object must be instance of Source, InputStream, Reader, Resource or String" );
            }
           
            this.smooks.filter( source,
View Full Code Here


            } else if ( object instanceof Reader ) {               
                source =  new StreamSource( ( Reader ) object );
            } else if ( object instanceof Resource ) {               
                source =  new StreamSource( ( ( Resource ) object).getReader() );
            } else if ( object instanceof String ) {                
                source =  new StringSource( (String) object);
            } else {
                throw new IllegalArgumentException( "signal object must be instance of Source, InputStream, Reader, Resource or String" );
            }
           
            this.smooks.filter( source,
View Full Code Here

                } else {
                    executionContext = smooks.createExecutionContext(messageProfile);
                }
               
                StringResult result = new StringResult();
                smooks.filterSource(executionContext, new StringSource((String) payload), result);

                HashMap beanHash = new HashMap(executionContext.getBeanContext().getBeanMap());
              if(beanHash != null) {
                message.getBody().add(EXTRACTED_BEANS_HASH, beanHash); // Backward compatibility.
              } else {
View Full Code Here

    @Test
    public void addAssertionToEmptySecurityHeader() throws Exception
    {
        final Smooks smooks = createSmooks("Envelope/Header/Security");

        final StringSource source = new StringSource("<Envelope><Header>" + SECURITY_START + "</t:Security></Header></Envelope>");
        final StringResult result = new StringResult();

        final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
        final Subject subject = new Subject();
        subject.getPublicCredentials().add(samlPrincipal);
View Full Code Here

    public void addNoAssertionToEmptySecurityHeader() throws Exception
    {
        final Smooks smooks = createSmooks("Envelope/Header/Security");

        final String expected = "<Envelope><Header>" + SECURITY_START + "</t:Security></Header></Envelope>";
        final StringSource source = new StringSource(expected);
        final StringResult result = new StringResult();

        smooks.filterSource(source, result);

        final String actual = result.toString();
View Full Code Here

    public void addAssertionToSOAPHeader() throws Exception
    {
        final Smooks smooks = createSmooks("Envelope/Header");

        final String soap = "<Envelope>" + HEADER_START + "</h:Header></Envelope>";
        final StringSource source = new StringSource(soap);
        final StringResult result = new StringResult();
       
        final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
        final Subject subject = new Subject();
        subject.getPublicCredentials().add(samlPrincipal);
View Full Code Here

    public void configFromFileWithSecurityHeader() throws Exception
    {
        final Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-saml-injector.xml"));
       
        final String soap = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject.xml"), "UTF-8");
        final StringSource source = new StringSource(soap);
        final StringResult result = new StringResult();
       
        final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
        final Subject subject = new Subject();
        subject.getPublicCredentials().add(samlPrincipal);
View Full Code Here

    public void configFromFileWithoutSecurityHeader() throws Exception
    {
        final Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-saml-injector.xml"));
       
        final String soap = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-no-security-header.xml"), "UTF-8");
        final StringSource source = new StringSource(soap);
        final StringResult result = new StringResult();
       
        final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
        final Subject subject = new Subject();
        subject.getPublicCredentials().add(samlPrincipal);
View Full Code Here

        }

        public boolean evaluate(Object objectToTest) throws MessageRouterException {
            try {
                if(objectToTest instanceof String) {
                    final XMLEventReader reader = XMLHelper.getXMLEventReader(new StringSource((String)objectToTest)) ;
                    final Document doc = XMLHelper.createDocument(reader) ;
                    return (Boolean) xpathExpression.evaluate(doc, XPathConstants.BOOLEAN);
                } else if(objectToTest instanceof byte[]) {
                    final XMLEventReader reader = XMLHelper.getXMLEventReader(new ByteArrayInputStream((byte[])objectToTest)) ;
                    final Document doc = XMLHelper.createDocument(reader) ;
View Full Code Here

            } else if ( object instanceof Reader ) {               
                source =  new StreamSource( ( Reader ) object );
            } else if ( object instanceof Resource ) {               
                source =  new StreamSource( ( ( Resource ) object).getReader() );
            } else if ( object instanceof String ) {                
                source =  new StringSource( (String) object);
            } else {
                throw new IllegalArgumentException( "signal object must be instance of Source, InputStream, Reader, Resource or String" );
            }
           
            this.smooks.filter( source,
View Full Code Here

TOP

Related Classes of org.milyn.payload.StringSource

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.