Package com.bazaarvoice.jolt.common.pathelement

Examples of com.bazaarvoice.jolt.common.pathelement.MatchablePathElement


    }

    @Test
    public void calculateOutputTest_refsOnly() {

        MatchablePathElement pe1 = (MatchablePathElement) ShiftrSpec.parseSingleKeyLHS( "tuna-*-marlin-*" );
        MatchablePathElement pe2 = (MatchablePathElement) ShiftrSpec.parseSingleKeyLHS( "rating-*" );

        LiteralPathElement lpe = pe1.match( "tuna-marlin", new WalkedPath() );
        AssertJUnit.assertNull( lpe );

        lpe = pe1.match( "tuna-A-marlin-AAA", new WalkedPath() );
        AssertJUnit.assertEquals"tuna-A-marlin-AAA", lpe.getRawKey() );
        AssertJUnit.assertEquals"tuna-A-marlin-AAA", lpe.getSubKeyRef( 0 ) );
        AssertJUnit.assertEquals( 3, lpe.getSubKeyCount() );
        AssertJUnit.assertEquals( "A" , lpe.getSubKeyRef( 1 ) );
        AssertJUnit.assertEquals( "AAA" , lpe.getSubKeyRef( 2 ) );

        LiteralPathElement lpe2 = pe2.match( "rating-BBB", new WalkedPath( null, lpe ) );
        AssertJUnit.assertEquals"rating-BBB", lpe2.getRawKey() );
        AssertJUnit.assertEquals"rating-BBB", lpe2.getSubKeyRef( 0 ) );
        AssertJUnit.assertEquals( 2, lpe2.getSubKeyCount() );
        AssertJUnit.assertEquals( "BBB" , lpe2.getSubKeyRef( 1 ) );

View Full Code Here


    @Test
    public void calculateOutputTest_arrayIndexes() {

        // simulate Shiftr LHS specs
        MatchablePathElement pe1 = (MatchablePathElement) ShiftrSpec.parseSingleKeyLHS( "tuna-*-marlin-*" );
        MatchablePathElement pe2 = (MatchablePathElement) ShiftrSpec.parseSingleKeyLHS( "rating-*" );

        // match them against some data to get LiteralPathElements with captured values
        LiteralPathElement lpe = pe1.match( "tuna-2-marlin-3", new WalkedPath() );
        AssertJUnit.assertEquals( "2" , lpe.getSubKeyRef( 1 ) );
        AssertJUnit.assertEquals( "3" , lpe.getSubKeyRef( 2 ) );

        LiteralPathElement lpe2 = pe2.match( "rating-BBB", new WalkedPath( null, lpe ) );
        AssertJUnit.assertEquals( 2, lpe2.getSubKeyCount() );
        AssertJUnit.assertEquals( "BBB" , lpe2.getSubKeyRef( 1 ) );

        // Build an write path path
        ShiftrWriter shiftrWriter = new ShiftrWriter( "tuna[&(1,1)].marlin[&(1,2)].&(0,1)" );
View Full Code Here

TOP

Related Classes of com.bazaarvoice.jolt.common.pathelement.MatchablePathElement

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.