Package org.mule.tck.testmodels.fruit

Examples of org.mule.tck.testmodels.fruit.Apple


            props.put("baz", "maz");
        }

    public void teststring() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Apple(), props, muleContext);
        StringExpressionEvaluator extractor = new StringExpressionEvaluator();
        extractor.setMuleContext(muleContext);
        Object o = extractor.evaluate("payload is #[function:shortPayloadClass] and has foo=#[header:foo] header", message);
        assertNotNull(o);
        assertEquals("payload is Apple and has foo=moo header", o.toString());
View Full Code Here


    }


    public void testStringUsingManager() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Apple(), props, muleContext);
        Object o = muleContext.getExpressionManager().evaluate("#[string:payload is #[function:shortPayloadClass] and has foo=#[header:foo] header]", message);
        assertNotNull(o);
        assertEquals("payload is Apple and has foo=moo header", o.toString());

        o = muleContext.getExpressionManager().evaluate("#[string:literal string]", message);
View Full Code Here

    public void testMessagePayloadWithMoreComplexTransform() throws Exception
    {
        MuleExpressionEvaluator eval = new MuleExpressionEvaluator();
        eval.setMuleContext(muleContext);
        MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), muleContext);

        //Lets register our transformer so Mule can find it
        muleContext.getRegistry().registerTransformer(new FruitBowlToFruitBasket());

        //i.e. ${payload:org.mule.tck.testmodels.fruit.FruitBasket}
View Full Code Here

        assertTrue(fb.hasApple());
    }

    public void testMessagePayloadWithMoreComplexTransformUsingManager() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), muleContext);

        //Lets register our transformer so Mule can find it
        muleContext.getRegistry().registerTransformer(new FruitBowlToFruitBasket());

        //i.e. ${payload:org.mule.tck.testmodels.fruit.FruitBasket}
View Full Code Here

    {
        FruitBowlToFruitBasket trans = new FruitBowlToFruitBasket();
        trans.setName("bowlToBasket");
        muleContext.getRegistry().registerTransformer(trans);

        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("bowlToBasket", message);
        assertNotNull(o);
        assertTrue(o instanceof Transformer);
View Full Code Here

    {
        FruitBowlToFruitBasket trans = new FruitBowlToFruitBasket();
        trans.setName("bowlToBasket");
        muleContext.getRegistry().registerTransformer(trans);

        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        Object o = muleContext.getExpressionManager().evaluate("#[mule:registry.bowlToBasket]", message);
        assertNotNull(o);
        assertTrue(o instanceof Transformer);

        o = muleContext.getExpressionManager().evaluate("#[mule:registry.XXbowlToBasket*]", message);
View Full Code Here

    }


    public void testSingleHeaderWithType() throws Exception
    {
        Apple apple = new Apple();
        props.put("apple", apple);

        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://headerWithType", null, props);
        assertNotNull("return message from MuleClient.send() should not be null", message);
View Full Code Here

        assertEquals(apple, message.getPayload());
    }

    public void testSingleHeaderWithBaseType() throws Exception
    {
        Apple apple = new Apple();
        props.put("apple", apple);

        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://headerWithBaseType", null, props);
        assertNotNull("return message from MuleClient.send() should not be null", message);
View Full Code Here

    }

    public void testMapHeadersWithGenerics() throws Exception
    {
        props.put("apple", new Apple());
        props.put("banana", new Banana());
        props.put("orange", new Orange());

        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://headersWithGenerics", null, props);
        assertNotNull("return message from MuleClient.send() should not be null", message);
        assertTrue("Message payload should be a Map", message.getPayload() instanceof Map);
        Map<?, ?> result = (Map<?, ?>) message.getPayload();
        //Will match all Mule headers
        assertEquals(2, result.size());

        assertEquals(new Apple(), result.get("apple"));
        assertEquals(new Orange(), result.get("orange"));
        assertNull(result.get("banana"));
    }
View Full Code Here

        assertTrue(result.contains("bazValue"));
    }

    public void testListHeadersWithGenerics() throws Exception
    {
        Apple apple = new Apple();
        Banana banana = new Banana();
        Orange orange = new Orange();
        props.put("apple", apple);
        props.put("banana", banana);
        props.put("orange", orange);
View Full Code Here

TOP

Related Classes of org.mule.tck.testmodels.fruit.Apple

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.