Package org.mule.el.mvel

Examples of org.mule.el.mvel.MVELExpressionLanguage.evaluate()


    public void testShortcutVariable() throws RegistrationException, InitialisationException
    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        Assert.assertEquals(muleContext.getConfiguration().getId(), mvel.evaluate("appShortcut.name"));
    }

    @Test
    public void testVariableAlias() throws RegistrationException, InitialisationException
    {
View Full Code Here


        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        MuleMessage message = new DefaultMuleMessage("foo", muleContext);

        Assert.assertEquals("foo", mvel.evaluate("p", message));
    }

    @Test
    public void testAssignValueToVariableAlias() throws RegistrationException, InitialisationException
    {
View Full Code Here

        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        MuleMessage message = new DefaultMuleMessage("foo", muleContext);

        mvel.evaluate("p='bar'", message);
        Assert.assertEquals("bar", message.getPayload());
    }

    @Test
    public void testMuleMessageAvailableAsVariable() throws Exception
View Full Code Here

    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        MuleMessage message = new DefaultMuleMessage("foo", muleContext);
        mvel.evaluate("p=m.uniqueId",message);
        Assert.assertEquals(message.getUniqueId(),message.getPayload());
    }

    @Test
    public void testFunction() throws RegistrationException, InitialisationException
View Full Code Here

    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        Assert.assertEquals("called param[0]=one,param[1]=two,app.name="
                            + muleContext.getConfiguration().getId(), mvel.evaluate("f('one','two')"));
    }

    @Test
    public void testMuleContextAvailableInFunction() throws RegistrationException, InitialisationException
    {
View Full Code Here

    public void testMuleContextAvailableInFunction() throws RegistrationException, InitialisationException
    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();

        Assert.assertEquals(muleContext, mvel.evaluate("muleContext()"));
    }

    @Test
    public void testMuleMessageAvailableInFunction() throws RegistrationException, InitialisationException
    {
View Full Code Here

    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();
        MuleMessage message = Mockito.mock(MuleMessage.class);

        Assert.assertEquals(message, mvel.evaluate("muleMessage()", message));
    }

    @Test(expected = ExpressionRuntimeException.class)
    public void testFunctionInvalidParams() throws RegistrationException, InitialisationException
    {
View Full Code Here

    @Test(expected = ExpressionRuntimeException.class)
    public void testFunctionInvalidParams() throws RegistrationException, InitialisationException
    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();
        mvel.evaluate("f('one')");
    }

    @Test
    public void testParserContextThreadLocalCleared() throws RegistrationException, InitialisationException
    {
View Full Code Here

    {
        MVELExpressionLanguage mvel = new MVELExpressionLanguage(muleContext);
        mvel.initialise();
        // Ensure ParserContext ThreadLocal is cleared after initialization (occurs in deployment thread)
        assertThat(AbstractParser.contextControl(2, null, null), is(nullValue()));
        mvel.evaluate("f('one','two')");
        // Ensure ParserContext ThreadLocal is cleared after evaluation (occurs in receiver/flow/dispatcher thread)
        assertThat(AbstractParser.contextControl(2, null, null), is(nullValue()));
    }

    class TestExtension implements ExpressionLanguageExtension
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.