Package org.jostraca.transform

Examples of org.jostraca.transform.ReplaceTransform


    String MN = ".generateScript: ";

    try {
      iScriptSource = FileUtil.readFile( pScriptTemplatePath )

      ReplaceTransform rt = new ReplaceTransform();
      rt.addReplacement( "JOSTRACA_HOME", get( CONF_HomeFolder ) );
      iScriptSource = rt.transform( iScriptSource );
      iDonePhrase   = "Generated "+getScriptFileDisplayName();
    }
    catch( Exception e ) {
      throw new SetupException( CN+MN+":", EX_FIND_SCRIPT_FAILURE, e );
    }
View Full Code Here


    assertEquals( t01+t02, rt01.transform( f01+f02 ) );
  }


  public void testReplaceInside() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    String t01 = "t01";
    String f02 = "f02";
    String t02 = "t02";
    rt01.addReplacement( f01, t01 );
    rt01.addReplacement( f02, t02 );
    assertEquals( "a"+t01+"b"+t02+"c", rt01.transform( "a"+f01+"b"+f02+"c" ) );
    assertEquals( t01+"b"+t02+"c",     rt01.transform( f01+"b"+f02+"c" ) );
    assertEquals( t01+"b"+t02,         rt01.transform( f01+"b"+f02 ) );
    assertEquals( "a"+t01+"b",         rt01.transform( "a"+f01+"b" ) );
    assertEquals( t01+"b",             rt01.transform( f01+"b" ) );
  }
View Full Code Here

    assertEquals( t01+"b",             rt01.transform( f01+"b" ) );
  }


  public void testContains() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    String t01 = "t01";
    String f02 = "f-f01-02";
    String t02 = "t02";
    rt01.addReplacement( f01, t01 );
    rt01.addReplacement( f02, t02 );
    assertEquals( "t02", rt01.transform( f02 ) );

    // reverse insert order
    ReplaceTransform rt02 = new ReplaceTransform();
    rt02.addReplacement( f02, t02 );
    rt02.addReplacement( f01, t01 );
    assertEquals( "t02", rt02.transform( f02 ) );

    // after cleaning
    rt02.clean();
    rt02.addReplacement( f02, t02 );
    rt02.addReplacement( f01, t01 );
    assertEquals( "t02", rt02.transform( f02 ) );
   
  }
View Full Code Here

   
  }


  public void testFirst() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    String t01 = "t01";
    String f02 = "f02";
    String t02 = "t02";
    rt01.addReplacement( f01, t01, ReplaceTransform.MODIFIER_first );
    rt01.addReplacement( f02, t02 );
    assertEquals( t01+t02+f01+t02, rt01.transform( f01+f02+f01+f02 ) );
  }
View Full Code Here


  /* Public Methods << */

  public void testNoReplace() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    assertEquals( f01, rt01.transform( f01 ) );
  }
View Full Code Here

    assertEquals( f01, rt01.transform( f01 ) );
  }


  public void testOneReplace() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    String t01 = "t01";
    rt01.addReplacement( f01, t01 );
    assertEquals( t01, rt01.transform( f01 ) );
  }
View Full Code Here

    assertEquals( t01, rt01.transform( f01 ) );
  }


  public void testTwoReplaces() throws Exception {
    ReplaceTransform rt01 = new ReplaceTransform();
    String f01 = "f01";
    String t01 = "t01";
    String f02 = "f02";
    String t02 = "t02";
    rt01.addReplacement( f01, t01 );
    rt01.addReplacement( f02, t02 );
    assertEquals( t01+t02, rt01.transform( f01+f02 ) );
  }
View Full Code Here

    String MN = ".generateScript: ";

    try {
      iScriptSource = FileUtil.readFile( pScriptTemplatePath )

      ReplaceTransform rt = new ReplaceTransform();
      rt.addReplacement( "JOSTRACA_HOME", get( CONF_HomeFolder ) );
      iScriptSource = rt.transform( iScriptSource );
      iDonePhrase   = "Generated "+getScriptFileDisplayName();
    }
    catch( Exception e ) {
      throw new SetupException( CN+MN+":", EX_FIND_SCRIPT_FAILURE, e );
    }
View Full Code Here

TOP

Related Classes of org.jostraca.transform.ReplaceTransform

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.