Package org.mule.expression

Examples of org.mule.expression.RegistryExpressionEvaluator


    public void testSimpleRegistryLookup() throws Exception
    {

        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);

        o = eval.evaluate("XXbowlToBasket*", message);
        assertNull(o);


    }
View Full Code Here


    }

    public void testRegistryLookupWithProperties() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("bowlToBasket.returnClass", message);
        assertNotNull(o);
        assertTrue(o instanceof Class);
        assertEquals(FruitBasket.class, o);

        o = eval.evaluate("XXbowlToBasket*.returnClass", message);
        assertNull(o);

        o = eval.evaluate("bowlToBasket.returnClass.name", message);
        assertNotNull(o);
        assertEquals(FruitBasket.class.getName(), o);

        o = eval.evaluate("bowlToBasket.returnClass.xname*", message);
        assertNull(o);

        try
        {
            o = eval.evaluate("bowlToBasket.returnClass.xname", message);
            fail("property xname is not valid and is not optional");
        }
        catch (Exception e)
        {
            //Expected
View Full Code Here

    public void testGlobalEndpointRegistryLookupWithProperties() throws Exception
    {

        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("myendpoint.toString", message);
        assertNotNull(o);
        assertTrue(o instanceof String);
        assertEquals("test://foo", o);

        //This doesn't work yet
View Full Code Here

    public void testLookUpbyType() throws Exception
    {
        Apple apple = new Apple();
        muleContext.getRegistry().registerObject("apple", apple);
        MuleMessage message = new DefaultMuleMessage("foo", muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("type:org.mule.tck.testmodels.fruit.Apple", message);
        assertNotNull(o);
        assertEquals(apple, o);


        try
        {
            o = eval.evaluate("banana", message);
            fail("No banana in the registry");
        }
        catch (Exception e)
        {
            //Expected
View Full Code Here

    @Test
    public void testSimpleRegistryLookup() throws Exception
    {
        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);

        o = eval.evaluate("XXbowlToBasket*", message);
        assertNull(o);
    }
View Full Code Here

    @Test(expected = ExpressionRuntimeException.class)
    public void testRegistryLookupWithProperties() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("bowlToBasket.returnClass", message);
        assertNotNull(o);
        assertTrue(o instanceof Class);
        assertEquals(FruitBasket.class, o);

        o = eval.evaluate("XXbowlToBasket*.returnClass", message);
        assertNull(o);

        o = eval.evaluate("bowlToBasket.returnClass.name", message);
        assertNotNull(o);
        assertEquals(FruitBasket.class.getName(), o);

        o = eval.evaluate("bowlToBasket.returnClass.xname*", message);
        assertNull(o);


        o = eval.evaluate("bowlToBasket.returnClass.xname", message);
    }
View Full Code Here

    @Test
    public void testGlobalEndpointRegistryLookupWithProperties() throws Exception
    {
        MuleMessage message = new DefaultMuleMessage(new Apple(), muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("myendpoint.toString", message);
        assertNotNull(o);
        assertTrue(o instanceof String);
        assertEquals("test://foo", o);

        //This doesn't work yet
View Full Code Here

    public void testLookUpbyType() throws Exception
    {
        Apple apple = new Apple();
        muleContext.getRegistry().registerObject("apple", apple);
        MuleMessage message = new DefaultMuleMessage("foo", muleContext);
        RegistryExpressionEvaluator eval = new RegistryExpressionEvaluator();
        eval.setMuleContext(muleContext);
        Object o = eval.evaluate("type:org.mule.tck.testmodels.fruit.Apple", message);
        assertNotNull(o);
        assertEquals(apple, o);

        o = eval.evaluate("banana", message);
    }
View Full Code Here

TOP

Related Classes of org.mule.expression.RegistryExpressionEvaluator

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.