Package org.mule.api.transformer

Examples of org.mule.api.transformer.Transformer


        if (defaultOutboundTransformer != null)
        {
            logger.info("Loading default outbound transformer: " + defaultOutboundTransformer);
            try
            {
                Transformer newTransformer = createTransformer(defaultOutboundTransformer, endpoint);
                return CollectionUtils.singletonList(newTransformer);
            }
            catch (Exception e)
            {
                throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("outbound",
View Full Code Here


        if (defaultResponseTransformer != null)
        {
            logger.info("Loading default response transformer: " + defaultResponseTransformer);
            try
            {
                Transformer newTransformer = createTransformer(defaultResponseTransformer, endpoint);
                return CollectionUtils.singletonList(newTransformer);
            }
            catch (Exception e)
            {
                throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("response",
View Full Code Here

        return Collections.emptyList();
    }

    protected Transformer createTransformer(String className, ImmutableEndpoint endpoint) throws Exception
    {
        Transformer newTransformer = (Transformer) ClassUtils.instanciateClass(className,
            ClassUtils.NO_ARGS, classLoader);
        newTransformer.setMuleContext(muleContext);
        newTransformer.setName(newTransformer.getName() + "#" + newTransformer.hashCode());
        newTransformer.setEndpoint(endpoint);
        return newTransformer;
    }
View Full Code Here

        if (--running == 0) this.notify();
    }

    public void testParallelTransformation() throws Exception
    {
        final Transformer transformer = getTransformer();

        long startTime = System.currentTimeMillis();

        for (int i = 0; i < getParallelThreadCount(); ++i)
        {
            new Thread(new Runnable()
            {
                public void run()
                {
                    try
                    {
                        RequestContext.setEvent(getTestEvent("test"));
                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                        return;
                    }

                    signalStarted();
                    for (int j = 0; j < getCallsPerThread(); ++j)
                    {
                        try
                        {
                            actualResults.add(transformer.transform(srcData));
                        }
                        catch (TransformerException e)
                        {
                            actualResults.add(e);
                        }
View Full Code Here

    }

    @Override
    public Transformer getRoundTripTransformer()
    {
        Transformer t = new Base64Decoder();
        // our input is a String so we expect a String as output
        t.setReturnDataType(DataTypeFactory.STRING);
        return t;
    }
View Full Code Here

        assertEquals("test://orange.exceptions", ep.getEndpointURI().toString());
    }

    public void testTransformerConfig()
    {
        Transformer t = muleContext.getRegistry().lookupTransformer("TestCompressionTransformer");
        assertNotNull(t);
        assertTrue(t instanceof TestCompressionTransformer);
        assertEquals(t.getReturnDataType(), DataTypeFactory.STRING);
        assertNotNull(((TestCompressionTransformer) t).getContainerProperty());
    }
View Full Code Here

    @Override
    public void testTransformerConfig()
    {
        super.testTransformerConfig();

        Transformer t = muleContext.getRegistry().lookupTransformer("TestCompressionTransformer");
        assertNotNull(t);
        assertTrue(t instanceof TestCompressionTransformer);
        assertEquals(t.getReturnDataType(), DataTypeFactory.STRING);
        assertNotNull(((TestCompressionTransformer) t).getContainerProperty());
    }
View Full Code Here

        }
    }

    public static Transformer getTestTransformer() throws Exception
    {
        final Transformer t = new TestCompressionTransformer();
        t.initialise();
        return t;
    }
View Full Code Here

    }

    @Test
    public void testParallelTransformation() throws Exception
    {
        final Transformer transformer = getTransformer();

        long startTime = System.currentTimeMillis();

        for (int i = 0; i < getParallelThreadCount(); ++i)
        {
            new Thread(new Runnable()
            {
                @Override
                public void run()
                {
                    try
                    {
                        RequestContext.setEvent(getTestEvent("test"));
                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                        return;
                    }

                    signalStarted();
                    for (int j = 0; j < getCallsPerThread(); ++j)
                    {
                        try
                        {
                            actualResults.add(transformer.transform(srcData));
                        }
                        catch (TransformerException e)
                        {
                            actualResults.add(e);
                        }
View Full Code Here

        return "xslt-transformer-wth-uri-resolver-config.xml";
    }

    @Test
    public void configuresUriResolver() throws Exception  {
        Transformer transformer = muleContext.getRegistry().lookupTransformer("testTransformer");
        assertTrue(transformer instanceof XsltTransformer);
        XsltTransformer xsltTransformer = (XsltTransformer) transformer;

        URIResolver uriResolver = muleContext.getRegistry().lookupObject("testResolver");
        assertEquals(uriResolver, xsltTransformer.getUriResolver());
View Full Code Here

TOP

Related Classes of org.mule.api.transformer.Transformer

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.