Package org.jostraca.transform

Examples of org.jostraca.transform.TextualTransformManagerTable


    PropertySet           ps  = (PropertySet)           Internal.null_arg( pPropertySet );

    iUnitList                     = new BasicUnitList();
    iTemplateActionHandler        = tah;
    iPropertySet                  = ps;
    iTextualTransformManagerTable = new TextualTransformManagerTable( iPropertySet );

    // create the specific template element processors.
    // these all implement BasicGenericElementProcessor which
    // expects non null arguments.
View Full Code Here


  private BasicTextElementProcessor create( PropertySet pPropertySet,
                                            TemplateActionHandler pTemplateActionHandler ) throws Exception {

    BasicUnitList bul = new BasicUnitList();   
    TextualTransformManagerTable ttmt = new TextualTransformManagerTable( pPropertySet );
    BasicTextElementProcessor    btep = new BasicTextElementProcessor( bul, pTemplateActionHandler,
                                                                       pPropertySet, ttmt );
    return btep;
  }
View Full Code Here

  public void testPerform() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();
    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    SectionDirective sd = new SectionDirective();
    assertTrue( "section".equals( sd.getName() ) );
View Full Code Here

  private BasicDirectiveElementProcessor create( PropertySet           pPropertySet,
                                                 TemplateActionHandler pTemplateActionHandler ) throws Exception {

    BasicUnitList bul = new BasicUnitList();
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( pPropertySet );
    BasicDirectiveElementProcessor bdep = new BasicDirectiveElementProcessor( bul, pTemplateActionHandler,
                                                                              pPropertySet, ttmt );
    return bdep;
  }
View Full Code Here

  public void testPerform() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();
    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    ReplaceDirective rd = new ReplaceDirective();
    assertEquals( "replace", rd.getName() );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a b ", bul, tahs, ps, ttmt );
    assertEquals( "xbx", ttmt.getTextTTM().transform( "xax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a b ", bul, tahs, ps, ttmt );
    assertEquals( "xbxax", ttmt.getTextTTM().transform( "xaxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "x1x2x", ttmt.getTextTTM().transform( "xaxbx" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "x1x2xbx1x", ttmt.getTextTTM().transform( "xaxbxbxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "12b1", ttmt.getTextTTM().transform( "abba" ) );


    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "12a", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

  }
View Full Code Here


  private BasicExpressionElementProcessor create( PropertySet pPropertySet,
                                                  TemplateActionHandler pTemplateActionHandler ) throws Exception {
    BasicUnitList bul = new BasicUnitList();
    TextualTransformManagerTable    ttmt = new TextualTransformManagerTable( pPropertySet );
    BasicExpressionElementProcessor beep = new BasicExpressionElementProcessor( bul, pTemplateActionHandler,
                                                                                pPropertySet, ttmt );
    return beep;
  }
View Full Code Here

  private BasicScriptElementProcessor create( PropertySet           pPropertySet,
                                              TemplateActionHandler pTemplateActionHandler ) throws Exception {

    BasicUnitList bul = new BasicUnitList();
    TextualTransformManagerTable ttmt = new TextualTransformManagerTable( pPropertySet );
    BasicScriptElementProcessor  bsep = new BasicScriptElementProcessor( bul, pTemplateActionHandler,
                                                                         pPropertySet, ttmt );
    return bsep;
  }
View Full Code Here

  public void testPerform() throws Exception {
    Template tm = new BasicTemplate();
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();
    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    ReplaceDirective rd = new ReplaceDirective();
    assertEquals( "replace", rd.getName() );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a b ", bul, tahs, ps, ttmt, tm );
    assertEquals( "xbx", ttmt.getTextTTM().transform( "xax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a b ", bul, tahs, ps, ttmt, tm);
    assertEquals( "xbxax", ttmt.getTextTTM().transform( "xaxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "x1x2x", ttmt.getTextTTM().transform( "xaxbx" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "x1x2xbx1x", ttmt.getTextTTM().transform( "xaxbxbxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "12b1", ttmt.getTextTTM().transform( "abba" ) );


    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "12a", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

  }
View Full Code Here

    ps.set( Property.lang_TemplateTextTransforms,       textTransforms );
    ps.set( Property.lang_TemplateScriptTransforms,     scriptTransforms );
    ps.set( Property.lang_TemplateExpressionTransforms, expressionTransforms );
    ps.set( Property.lang_TemplateDirectiveTransforms,  directiveTransforms );

    TextualTransformManagerTable ttmt = null;
    try {
      ttmt = new TextualTransformManagerTable( ps );
    } catch( Exception e ) {
      fail();
    }

    assertTrue( ("Text:[org.jostraca.transform.TextualTransform: "
                 +"org.jostraca.transform.JavaStringEscapeTransform]")
                .equals( ttmt.getTextTTM().toString() ) );
    assertTrue( ("Script:[org.jostraca.transform.TextualTransform: "
                 +"org.jostraca.transform.TrimTransform, org.jostraca.transform.AppendNewLineTransform]")
                .equals( ttmt.getScriptTTM().toString() ) );
    assertTrue( ("Expression:[org.jostraca.transform.TextualTransform: "
                 +"org.jostraca.transform.TrimTransform]")
                .equals( ttmt.getExpressionTTM().toString() ) );
    assertTrue( ("Directive:[org.jostraca.transform.TextualTransform: "
                 +"org.jostraca.transform.TrimTransform]")
                .equals( ttmt.getDirectiveTTM().toString() ) );

  }
View Full Code Here

    Template              tm  = (Template)              Internal.null_arg( pTemplate );
   
    iUnitList                     = new BasicUnitList();
    iTemplateActionHandler        = tah;
    iPropertySet                  = ps;
    iTextualTransformManagerTable = new TextualTransformManagerTable( iPropertySet );
    iTemplate                     = tm;
   
    // create the specific template element processors.
    // these all implement BasicGenericElementProcessor which
    // expects non null arguments.
View Full Code Here

TOP

Related Classes of org.jostraca.transform.TextualTransformManagerTable

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.