Package org.mule.api.transformer

Examples of org.mule.api.transformer.Transformer


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


        assertEquals("xmpp://CHAT/sender@jabberhost", endpoint.getEndpointURI().toString());
    }
   
    public void testTransformers() throws Exception
    {
        Transformer transformer = lookupTransformer("ObjectToXmpp");
        assertNotNull(transformer);
        assertEquals(ObjectToXmppPacket.class, transformer.getClass());

        transformer = lookupTransformer("XmppToObject");
        assertNotNull(transformer);
        assertEquals(XmppPacketToObject.class, transformer.getClass());
    }
View Full Code Here

        return endpointBuilder;
    }
   
    private Transformer lookupTransformer(String name)
    {
        Transformer transformer = muleContext.getRegistry().lookupTransformer(name);
        assertNotNull(transformer);
        return transformer;
    }
View Full Code Here

    protected Latch configureService(File inFile, boolean streaming, boolean filePayload) throws Exception
    {
        Service service = new SedaService(muleContext);
        service.setName("moveDeleteBridgeService");
        String url = fileToUrl(inFile.getParentFile()) + "?connector=moveDeleteConnector";
        Transformer transformer = null;
        if (streaming)
        {
            if (filePayload)
            {
                fail("Inconsistant test case: streaming and file payload are not compatible");
View Full Code Here

public class TransformerDiscoveryTestCase extends AbstractMuleTestCase
{
    public void testLookup() throws Exception
    {
        Transformer t = muleContext.getRegistry().lookupTransformer(DataTypeFactory.create(DataInputStream.class), DataTypeFactory.create(SyndFeed.class));
        assertNotNull(t);
        t = muleContext.getRegistry().lookupTransformer(DataTypeFactory.create(DataInputStream.class), DataTypeFactory.create(SyndFeed.class));
        assertNotNull(t);
    }
View Full Code Here

        assertFalse(filter.isAcceptWithoutUpdateDate());
    }

    public void testObjectToFeedTransformer() throws Exception
    {
        Transformer transformer = muleContext.getRegistry().lookupTransformer("ObjectToFeed");
        assertNotNull(transformer);
        assertTrue(transformer instanceof ObjectToRssFeed);
    }
View Full Code Here

        {
            muleDT = new org.mule.transformer.types.SimpleDataType(
                    as.getType(),
                    as.getMimeType());
        }
        Transformer t = muleContext.getRegistry().lookupTransformer(org.mule.transformer.types.DataTypeFactory.create(data.getClass()), muleDT);
        return (T)t.transform(data);
    }
View Full Code Here

            finalResult = handleReturnAnnotation(returnExpression, result, invocationContext);

            DataType finalType = DataTypeFactory.createFromObject(finalResult);
            if (!requiredType.isCompatibleWith(finalType))
            {
                Transformer transformer = muleContext.getRegistry().lookupTransformer( finalType, requiredType);
                finalResult = transformer.transform(finalResult);
            }
        }
        else
        {

            if (requiredType.getType().equals(MuleMessage.class))
            {
                finalResult = result.getMessage();
            }
            else if (requiredType.getType().equals(Response.class))
            {
                finalResult = result;
            }
            else
            {
                DataType sourceType = DataTypeFactory.createFromObject(result.getMessage());
                if(requiredType.isCompatibleWith(sourceType))
                {
                    finalResult = result.getPayload();
                }
                else
                {
                    Transformer transformer = muleContext.getRegistry().lookupTransformer(sourceType, requiredType);
                    finalResult = transformer.transform(result.getPayload());
                }
            }


        }
View Full Code Here

        assertFalse(filter.isAcceptWithoutUpdateDate());
    }

    public void testObjectToFeedTransformer() throws Exception
    {
        Transformer transformer = muleContext.getRegistry().lookupTransformer("ObjectToFeed");
        assertNotNull(transformer);
        assertTrue(transformer instanceof ObjectToFeed);
    }
View Full Code Here

        if (defaultInboundTransformer != null)
        {
            logger.info("Loading default inbound transformer: " + defaultInboundTransformer);
            try
            {
                Transformer newTransformer = createTransformer(defaultInboundTransformer, endpoint);
                return CollectionUtils.singletonList(newTransformer);
            }
            catch (Exception e)
            {
                throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("inbound",
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.