1 package com.flexiblewebsolutions.xdriveunit.loadtest;
2
3 import java.io.File;
4
5 import org.apache.log4j.Logger;
6
7 import com.flexiblewebsolutions.io.util.FileUtils;
8
9 /***
10 * @author Donavon Buss
11 */
12 public class ThreadTestLoadUtils
13 {
14 static Logger logger = Logger.getLogger( ThreadTestLoadUtils.class.getName() );
15
16 /***
17 * Load configuration file template, and replace placeholder INPUT_FILENAME with
18 * the name of the input file
19 *
20 * @param pConfigTemplate - Location of configuration file template
21 * @param pInputFile - Name of input file to be used with config
22 */
23 public StringBuffer createConfigFile( String pConfigTemplate,
24 String pInputFile )
25 {
26 FileUtils fu = new FileUtils();
27
28 StringBuffer returnData = fu.loadXMLFileToString( new File(
29 pConfigTemplate ) );
30 String placeHolder = "INPUT_FILENAME";
31
32 while( returnData.indexOf( placeHolder ) != -1 )
33 {
34 int startIndex = returnData.indexOf( placeHolder );
35 returnData.delete( startIndex, startIndex + placeHolder.length() );
36 returnData.insert( startIndex, pInputFile );
37 }
38 placeHolder = null;
39 fu = null;
40 return ( returnData );
41 }
42 }