Package org.jostraca.unit

Examples of org.jostraca.unit.BasicUnit


      if( iPropertySet.isYes( Property.jostraca_old ) ) {
        String script = iTextualTransform.transform( match.content );
        iTemplateActionHandler.append( match.sectionName, script );
      }

      BasicUnit bu = new BasicUnit( BasicUnitProcessor.TYPE_script, match.sectionName, match.content );
      iUnitList.add( bu );

      return null;
    }
    catch( Exception e ) {
View Full Code Here


    // parse expression element using regular expression
    try {
      match = doRegExpMatchExpression( content );
      String    section = iTemplateActionHandler.getDefaultSection();
      BasicUnit bu      = new BasicUnit( BasicUnitProcessor.TYPE_expr, section, match );
      iUnitList.add( bu );
    }
    catch( Exception e ) {
      throw new TemplateElementProcessorException
        ( TemplateElementProcessorException.CODE_unexpected_regexp_mismatch, e.getMessage(),
View Full Code Here

  /* Public Methods << */

  public void testList() throws Exception {
    BasicUnitList bus = new BasicUnitList();

    bus.add( new BasicUnit( "text",    "init", "it01" ) );
    bus.add( new BasicUnit( "script""init", "is01" ) );
    bus.add( new BasicUnit( "text",    "init", "it02" ) );
    bus.add( new BasicUnit( "script""init", "is02" ) );

    bus.add( new BasicUnit( "text",    "foo", "foot01" ) );
    bus.add( new BasicUnit( "script""foo", "foos01" ) );

    Hashtable isattr = new Hashtable();
    isattr.put( InsertSectionTransform.ATTR_unit_source_section, "foo" );

    bus.add( new BasicUnit( "text",    "body", "12345678901234567890123456789012345678901234567890" ) );
    bus.add( new BasicUnit( "text",    "body", "bt01" ) );
    bus.add( new BasicUnit( "script""body", "bs01" ) );
    bus.add( new BasicUnit( "insert-section", "body", "", new BasicUnitOrigin(), isattr ) );
    bus.add( new BasicUnit( "text",    "body", "bt02" ) );
    bus.add( new BasicUnit( "script""body", "bs02" ) );

    bus.add( new BasicUnit( "text",    "foo", "foot02" ) );
    bus.add( new BasicUnit( "script""foo", "foos02" ) );


    PropertySet ps = new PropertySet();
    ps.load( Tools.findRelativeSystemPath("src/org/jostraca/unit/test/test.conf") );

View Full Code Here

  /* Public Methods << */

  public void testList() throws Exception {
    BasicUnitList bus = new BasicUnitList();

    bus.add( new BasicUnit( "text",    "init", "it01" ) );
    bus.add( new BasicUnit( "script""init", "is01" ) );
    bus.add( new BasicUnit( "text",    "init", "it02" ) );
    bus.add( new BasicUnit( "script""init", "is02" ) );

    bus.add( new BasicUnit( "text",    "foo", "foot01" ) );
    bus.add( new BasicUnit( "script""foo", "foos01" ) );

    Hashtable isattr = new Hashtable();
    isattr.put( InsertSectionTransform.ATTR_unit_source_section, "foo" );

    bus.add( new BasicUnit( "text",    "body", "12345678901234567890123456789012345678901234567890" ) );
    bus.add( new BasicUnit( "text",    "body", "bt01" ) );
    bus.add( new BasicUnit( "script""body", "bs01" ) );
    bus.add( new BasicUnit( "insert-section", "body", "", new BasicUnitOrigin(), isattr ) );
    bus.add( new BasicUnit( "text",    "body", "bt02" ) );
    bus.add( new BasicUnit( "script""body", "bs02" ) );

    bus.add( new BasicUnit( "text",    "foo", "foot02" ) );
    bus.add( new BasicUnit( "script""foo", "foos02" ) );


    DebugUnitProcessor dup = new DebugUnitProcessor();
    SectionSet ss = dup.process( bus );

View Full Code Here

  public void testCreate() {
    String t01 = "t01";
    String s01 = "s01";
    String c01 = "c01";

    BasicUnit bu01 = new BasicUnit( t01, s01, c01 );
    assertEquals( t01, bu01.getType() );
    assertEquals( s01, bu01.getSection() );
    assertEquals( c01, bu01.getContent() );

    try {
      bu01 = new BasicUnit( null, s01, c01 );
      fail();
    } catch( IllegalArgumentException iae ) {}

    try {
      bu01 = new BasicUnit( t01, null, c01 );
      fail();
    } catch( IllegalArgumentException iae ) {}

    UnitOrigin uo = new BasicUnitOrigin();
    bu01 = new BasicUnit( t01, s01, c01, uo );
    assertEquals( uo, bu01.getOrigin() );

    try {
      bu01 = new BasicUnit( t01, s01, c01, null );
      fail();
    } catch( IllegalArgumentException iae ) {}

    Hashtable ht = new Hashtable();
    bu01 = new BasicUnit( t01, s01, c01, uo, ht );
    assertEquals( ht, bu01.getAttributes() );

    try {
      bu01 = new BasicUnit( t01, s01, c01, uo, null );
      fail();
    } catch( IllegalArgumentException iae ) {}

  }
View Full Code Here

  public void testEmpty() {
    String t01 = "t01";
    String s01 = "s01";
    String c01 = "c01";

    BasicUnit bu01 = new BasicUnit( t01, s01, c01 );

    UnitOrigin uo = bu01.getOrigin();
    assertEquals( Standard.UNKNOWN, uo.getReference() );

    Hashtable ht = bu01.getAttributes();
    assertEquals( 0, bu01.getAttributes().size() );

    BasicUnit bu02 = new BasicUnit( t01, c01, uo );
    assertEquals( t01, bu02.getType() );
    assertEquals( c01, bu02.getContent() );
    assertEquals( Standard.EMPTY, bu02.getSection() );
    assertEquals( uo,  bu02.getOrigin() );
  }
View Full Code Here

  public void testList() {
    String bu01s = "bu01";
    String bu02s = "bu02";
    String bu03s = "bu03";

    BasicUnit bu01 = new BasicUnit( bu01s, bu01s, bu01s );
    BasicUnit bu02 = new BasicUnit( bu02s, bu02s, bu02s );
    BasicUnit bu03 = new BasicUnit( bu03s, bu03s, bu03s );

    BasicUnitList bus = new BasicUnitList();
    assertEquals( 0, bus.getNumUnits() );
    bus.add( bu01 );
    assertEquals( 1, bus.getNumUnits() );
View Full Code Here

TOP

Related Classes of org.jostraca.unit.BasicUnit

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.