Examples of AbstractTCLNode


Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    public void testAcceptPostOrder() throws Exception
    {
        for (int x = 0; x < visitorTestExpressions_.length; ++x)
        {
            AbstractTCLNode _root = TCLParser.parse(visitorTestExpressions_[x]);
            _root.acceptPostOrder(new TCLCleanUp());
            ETCLComponentName _n = (ETCLComponentName) _root.left();

            assertEquals(visitorTestExpressions_[x] + " failed", "$.value", _n.getComponentName());
        }
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    public void testAcceptInOrder() throws Exception
    {
        for (int x = 0; x < visitorTestExpressions_.length; ++x)
        {
            AbstractTCLNode _root = TCLParser.parse(visitorTestExpressions_[x]);
            _root.acceptInOrder(new TCLCleanUp());
            ETCLComponentName _n = (ETCLComponentName) _root.left();

            assertEquals(visitorTestExpressions_[x] + " failed", "$.value", _n.getComponentName());
        }
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    public void testAcceptPreOrder() throws Exception
    {
        for (int x = 0; x < visitorTestExpressions_.length; ++x)
        {
            AbstractTCLNode _root = TCLParser.parse(visitorTestExpressions_[x]);
            _root.acceptPreOrder(new TCLCleanUp());
            ETCLComponentName _n = (ETCLComponentName) _root.left();

            assertEquals(visitorTestExpressions_[x] + " failed", "$.value", _n.getComponentName());
        }
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        runEvaluation(_event, expr, expect);
    }

    private void runEvaluation(Message event, String expr, String expect) throws Exception
    {
        AbstractTCLNode _root = TCLParser.parse(expr);
        AbstractTCLNode _expect = TCLParser.parse(expect);

        FilterConstraint _evaluator = new ETCLFilterConstraint(_root);
        EvaluationResult _res;
        _root.acceptPostOrder(new TCLCleanUp());

        EvaluationContext _context = new EvaluationContext(getEvaluator());

        _res = _evaluator.evaluate(_context, event);

        assertEquals("expected " + _root.toStringTree() + " == " + _expect.toStringTree(), _expect
                .evaluate(null), _res);
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

*/
public class IdentValueTest extends TestCase
{
    public void testIsStatic() throws Exception
    {
        AbstractTCLNode node = TCLParser.parse("'identifier'");

        assertTrue(node.isStatic());
    }
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        }

        EvaluationResult _result = null;
        Any _any = null;

        AbstractTCLNode _currentOperator = expr;
        Any _currentAny = any;

        StringBuffer _currentPath = new StringBuffer(rootName);

        while (_currentOperator != null)
        {
            _currentPath.append(_currentOperator.toString());

            if (logger_.isDebugEnabled())
            {
                logger_.debug("current path=" + _currentPath.toString());
                logger_.debug("current operator=" + _currentOperator.toString());
                logger_.debug("current any=" + _currentAny);
            }

            // lookup result in cache
            _any = lookupAny(_currentPath.toString());

            if (_any == null)
            {
                // cache MISS
                switch (_currentOperator.getType()) {
                case TCLParserTokenTypes.DOT:
                    // dots are skipped
                    break;

                case TCLParserTokenTypes.UNION_POS:
                    logger_.debug("evaluate union by position");
                    UnionPositionOperator _upo = (UnionPositionOperator) _currentOperator;

                    // default union
                    if (_upo.isDefault())
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny);
                    }
                    else
                    {
                        _any = getETCLEvaluator().evaluateUnion(_currentAny,
                                _upo.getPosition());
                    }

                    break;

                case TCLParserTokenTypes.IDENTIFIER:
                    String _identifer = ((IdentValue) _currentOperator).getIdentifier();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _identifer);

                    break;

                case TCLParserTokenTypes.NUMBER:
                    int _pos = ((NumberValue) _currentOperator).getNumber().intValue();

                    _any = getETCLEvaluator().evaluateIdentifier(_currentAny, _pos);

                    break;

                case TCLParserTokenTypes.IMPLICIT:
                    ImplicitOperator _op = ((ImplicitOperatorNode) _currentOperator).getOperator();

                    _any = _op.evaluateImplicit(getETCLEvaluator(), _currentAny);

                    _result = EvaluationResult.fromAny(_any);

                    _result.addAny(_currentAny);

                    return _result;

                case TCLParserTokenTypes.ARRAY:
                    int _arrayIndex = ((ArrayOperator) _currentOperator).getArrayIndex();

                    _any = getETCLEvaluator().evaluateArrayIndex(_currentAny, _arrayIndex);

                    break;

                case TCLParserTokenTypes.ASSOC:
                    String _assocName = ((AssocOperator) _currentOperator).getAssocName();

                    _any = getETCLEvaluator().evaluateNamedValueList(_currentAny, _assocName);

                    break;

                default:
                    throw new RuntimeException("unexpected operator: "
                            + AbstractTCLNode.getNameForType(_currentOperator.getType()));
                }
            }

            if (_any != null)
            {
                storeAny(_currentPath.toString(), _any);
                _currentAny = _any;
            }

            _currentOperator = (AbstractTCLNode) _currentOperator.getNextSibling();
        }

        // Create the EvaluationResult
        _result = EvaluationResult.fromAny(_any);
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }


    public void testEvaluateCachesResult() throws Exception
    {
        AbstractTCLNode _root = TCLParser.parse( "$.first_name" );
        _root.acceptPreOrder( new TCLCleanUp() );

        Message _event = messageFactory_.newMessage(testUtils_.getTestPersonAny());
        _event.extractValue( context_, ( ETCLComponentName ) _root );

        assertNotNull( context_.lookupResult( "$.first_name" ) );
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }


    public void testEvaluateCachesAny() throws Exception
    {
        AbstractTCLNode _root = TCLParser.parse( "$.home_address.street" );
        _root.acceptPreOrder( new TCLCleanUp() );

        Message _event = messageFactory_.newMessage(testUtils_.getTestPersonAny());

        _event.extractValue(context_, ( ETCLComponentName ) _root );
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

        assertTrue(_event.getType() == Message.TYPE_ANY);
    }

    public void testEvaluate_Any() throws Exception {
        String _expr = "$.first_name";
        AbstractTCLNode _root = TCLParser.parse(_expr);

        _root.acceptPreOrder(new TCLCleanUp());

        Message _event = factory_.newMessage(testPerson_);

        EvaluationResult _result =
            _event.extractValue(evaluationContext_,
View Full Code Here

Examples of org.jacorb.notification.filter.etcl.AbstractTCLNode

    }

    public void testEvaluate_Structured() throws Exception {
        String _expr = "$.header.fixed_header.event_type.domain_name";
        Message _event = factory_.newMessage(testStructured_);
        AbstractTCLNode _root = TCLParser.parse(_expr);

        _root.acceptPreOrder(new TCLCleanUp());

        EvaluationResult _result =
            _event.extractValue(evaluationContext_,
                                (ETCLComponentName) _root);
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.