Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ExpressionEvaluator


        verify();
    }

    public void test_Set_Object()
    {
        ExpressionEvaluator ev = newMock(ExpressionEvaluator.class);
        ExpressionCache ec = newMock(ExpressionCache.class);
        Location l = fabricateLocation(1);
       
        IComponent component = newComponent();
        Node compiled = newMock(Node.class);
        ValueConverter vc = newValueConverter();
       
        expect(ec.getCompiledExpression("exp")).andReturn(compiled);

        expect(ev.isConstant("exp")).andReturn(false);

        Object newValue = new Object();

        ev.writeCompiled(component, compiled, newValue);

        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);

        expect(compiled.getAccessor()).andReturn(null);
View Full Code Here


        verify();
    }

    public void test_Set_Object_Invariant()
    {
        ExpressionEvaluator ev = newMock(ExpressionEvaluator.class);
        ExpressionCache ec = newMock(ExpressionCache.class);
        Location l = fabricateLocation(1);
       
        IComponent component = newComponent();
        Node compiled = newMock(Node.class);
        //ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
       
        ValueConverter vc = newValueConverter();

        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
       
       // expect(compiled.getAccessor()).andReturn(accessor);
       
        expect(ev.isConstant("exp")).andReturn(true);

        expect(component.getExtendedId()).andReturn("Foo/bar.baz");

        replay();
View Full Code Here

        verify();
    }

    public void test_Set_Object_Failure()
    {
        ExpressionEvaluator ev = newMock(ExpressionEvaluator.class);
        ExpressionCache ec = newMock(ExpressionCache.class);
        Location l = fabricateLocation(1);
       
        IComponent component = newComponent();
        Node compiled = newMock(Node.class);

        ValueConverter vc = newValueConverter();

        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
       
        expect(ev.isConstant("exp")).andReturn(false);

        Object newValue = new Object();

        RuntimeException innerException = new RuntimeException("Failure");
       
        ev.writeCompiled(component, compiled, newValue);
        expectLastCall().andThrow(innerException);

        replay();

        ExpressionBinding b = new ExpressionBinding("param", l, vc, component,
View Full Code Here

        verify();
    }

    public void test_Compile_Expression_Failure()
    {
        ExpressionEvaluator ev = newMock(ExpressionEvaluator.class);
        ExpressionCache ec = newMock(ExpressionCache.class);
        Location l = fabricateLocation(1);
       
        IComponent component = newComponent();
        ValueConverter vc = newValueConverter();
View Full Code Here

        verify();
    }

    public void test_Resolve_Expression_Failure()
    {
        ExpressionEvaluator ev = newMock(ExpressionEvaluator.class);
        ExpressionCache ec = newMock(ExpressionCache.class);
        Location l = fabricateLocation(1);
       
        IComponent component = newComponent();
        Node compiled = newMock(Node.class);
        ValueConverter vc = newValueConverter();

        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
       
        expect(ev.isConstant("exp")).andReturn(false);

        Throwable innerException = new RuntimeException("Failure");

        ec.getCompiledExpression(component, "exp");
        expectLastCall().andThrow(innerException);
View Full Code Here

{

    public void testInvariant()
    {
        MockControl evc = newControl(ExpressionEvaluator.class);
        ExpressionEvaluator ev = (ExpressionEvaluator) evc.getMock();

        MockControl ecc = newControl(ExpressionCache.class);
        ExpressionCache ec = (ExpressionCache) ecc.getMock();

        MockControl cc = newControl(IComponent.class);
        IComponent component = (IComponent) cc.getMock();

        Object compiled = new Object();

        Object expressionValue = "EXPRESSION-VALUE";

        ValueConverter vc = newValueConverter();

        ec.getCompiledExpression("exp");
        ecc.setReturnValue(compiled);

        ev.isConstant("exp");
        evc.setReturnValue(true);

        ev.readCompiled(component, compiled);
        evc.setReturnValue(expressionValue);

        component.getExtendedId();
        cc.setReturnValue("Foo/bar.baz");
View Full Code Here

    }

    public void testVariant()
    {
        MockControl evc = newControl(ExpressionEvaluator.class);
        ExpressionEvaluator ev = (ExpressionEvaluator) evc.getMock();

        MockControl ecc = newControl(ExpressionCache.class);
        ExpressionCache ec = (ExpressionCache) ecc.getMock();

        IComponent component = newComponent();
        Object compiled = new Object();

        Object expressionValue1 = new Object();
        Object expressionValue2 = new Object();

        ValueConverter vc = newValueConverter();

        ec.getCompiledExpression("exp");
        ecc.setReturnValue(compiled);

        ev.isConstant("exp");
        evc.setReturnValue(false);

        ev.readCompiled(component, compiled);
        evc.setReturnValue(expressionValue1);

        ev.readCompiled(component, compiled);
        evc.setReturnValue(expressionValue2);

        replayControls();

        ExpressionBinding b = new ExpressionBinding("param", fabricateLocation(1), vc, component,
View Full Code Here

    }

    public void testSetObject()
    {
        MockControl evc = newControl(ExpressionEvaluator.class);
        ExpressionEvaluator ev = (ExpressionEvaluator) evc.getMock();

        MockControl ecc = newControl(ExpressionCache.class);
        ExpressionCache ec = (ExpressionCache) ecc.getMock();

        IComponent component = newComponent();
        Object compiled = new Object();

        ValueConverter vc = newValueConverter();

        ec.getCompiledExpression("exp");
        ecc.setReturnValue(compiled);

        ev.isConstant("exp");
        evc.setReturnValue(false);

        Object newValue = new Object();

        ev.writeCompiled(component, compiled, newValue);

        replayControls();

        ExpressionBinding b = new ExpressionBinding("param", fabricateLocation(1), vc, component,
                "exp", ev, ec);
View Full Code Here

    }

    public void testSetObjectInvariant()
    {
        MockControl evc = newControl(ExpressionEvaluator.class);
        ExpressionEvaluator ev = (ExpressionEvaluator) evc.getMock();

        MockControl ecc = newControl(ExpressionCache.class);
        ExpressionCache ec = (ExpressionCache) ecc.getMock();

        IComponent component = newComponent("Foo/bar.baz");
        Object compiled = new Object();

        ValueConverter vc = newValueConverter();

        ec.getCompiledExpression("exp");
        ecc.setReturnValue(compiled);

        ev.isConstant("exp");
        evc.setReturnValue(true);

        replayControls();

        ExpressionBinding b = new ExpressionBinding("parameter foo", fabricateLocation(1), vc, component,
View Full Code Here

    }

    public void testSetObjectFailure()
    {
        MockControl evc = newControl(ExpressionEvaluator.class);
        ExpressionEvaluator ev = (ExpressionEvaluator) evc.getMock();

        MockControl ecc = newControl(ExpressionCache.class);
        ExpressionCache ec = (ExpressionCache) ecc.getMock();

        IComponent component = newComponent();
        Object compiled = new Object();

        ValueConverter vc = newValueConverter();

        ec.getCompiledExpression("exp");
        ecc.setReturnValue(compiled);

        ev.isConstant("exp");
        evc.setReturnValue(false);

        Object newValue = new Object();

        RuntimeException innerException = new RuntimeException("Failure");

        ev.writeCompiled(component, compiled, newValue);
        evc.setThrowable(innerException);

        replayControls();

        ExpressionBinding b = new ExpressionBinding("param", fabricateLocation(1), vc, component,
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.ExpressionEvaluator

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.