Package org.jostraca

Examples of org.jostraca.BasicScriptElementProcessor


  public void testCreate() throws Exception {
    PropertySet                 ps   = new PropertySet();
    ps.load( new File( "../../../../conf/system.conf" ) );
    TemplateActionHandler       tah  = new TemplateActionHandlerStub();
    BasicScriptElementProcessor bsep = create( ps, tah );
  }
View Full Code Here


  public void testProcessScript() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();

    ps.load( new File( "../../../../conf/system.conf" ) );
    BasicScriptElementProcessor bsep = create( ps, tahs );

    // REVIEW: this will have to change
    ps.set( Property.jostraca_old, "yes" );


    tahs.clear();
    String s01 = "foo = bar;";
    Block  b01 = new Block( Block.TYPE_script, s01 );
    assertTrue( bsep.isMatch( b01 ) );
    bsep.process( b01 );
    assertEquals( (s01+BasicTemplateElementProcessor.NEWLINE), tahs.getLastAppendedContent() );

    tahs.clear();
    String s02 = "!foo bar;";
    Block  b02 = new Block( Block.TYPE_script, s02 );
    assertTrue( bsep.isMatch( b02 ) );
    bsep.process( b02 );
    assertTrue( ("foo bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( Section.NAME_declare.equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s03 = " ! foo bar;";
    Block  b03 = new Block( Block.TYPE_script, s03 );
    assertTrue( bsep.isMatch( b03 ) );
    bsep.process( b03 );
    assertTrue( (" foo bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( Section.NAME_declare.equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s04 = "foo! bar;";
    Block  b04 = new Block( Block.TYPE_script, s04 );
    assertTrue( bsep.isMatch( b04 ) );
    bsep.process( b04 );
    assertTrue( (" bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( "foo".equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s05 = "foo ! bar;";
    Block  b05 = new Block( Block.TYPE_script, s05 );
    assertTrue( bsep.isMatch( b05 ) );
    bsep.process( b05 );
    assertTrue( ("foo ! bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertEquals( Section.NAME_body, tahs.getLastSectionName() );

  }
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 testCreate() throws Exception {
    PropertySet                 ps   = new PropertySet();
    ps.load( new File( "conf/system.conf" ) );
    TemplateActionHandler       tah  = new TemplateActionHandlerStub();
    BasicScriptElementProcessor bsep = create( ps, tah );
  }
View Full Code Here

  public void testProcessScript() throws Exception {
    TemplateActionHandlerStub tahs  = new TemplateActionHandlerStub();
    PropertySet               ps    = new PropertySet();

    ps.load( new File( "conf/system.conf" ) );
    BasicScriptElementProcessor bsep = create( ps, tahs );

    // REVIEW: this will have to change
    ps.set( Property.jostraca_old, "yes" );


    tahs.clear();
    String s01 = "foo = bar;";
    Block  b01 = new Block( Block.TYPE_script, s01 );
    assertTrue( bsep.isMatch( b01 ) );
    bsep.process( b01 );
    assertEquals( (s01+BasicTemplateElementProcessor.NEWLINE), tahs.getLastAppendedContent() );

    tahs.clear();
    String s02 = "!foo bar;";
    Block  b02 = new Block( Block.TYPE_script, s02 );
    assertTrue( bsep.isMatch( b02 ) );
    bsep.process( b02 );
    assertTrue( ("foo bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( Section.NAME_declare.equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s03 = " ! foo bar;";
    Block  b03 = new Block( Block.TYPE_script, s03 );
    assertTrue( bsep.isMatch( b03 ) );
    bsep.process( b03 );
    assertTrue( (" foo bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( Section.NAME_declare.equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s04 = "foo! bar;";
    Block  b04 = new Block( Block.TYPE_script, s04 );
    assertTrue( bsep.isMatch( b04 ) );
    bsep.process( b04 );
    assertTrue( (" bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertTrue( "foo".equals( tahs.getLastSectionName() ) );

    tahs.clear();
    String s05 = "foo ! bar;";
    Block  b05 = new Block( Block.TYPE_script, s05 );
    assertTrue( bsep.isMatch( b05 ) );
    bsep.process( b05 );
    assertTrue( ("foo ! bar;"+BasicTemplateElementProcessor.NEWLINE).equals( tahs.getLastAppendedContent() ) );
    assertEquals( Section.NAME_body, tahs.getLastSectionName() );

  }
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

TOP

Related Classes of org.jostraca.BasicScriptElementProcessor

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.