1 package size; 2 40 41 import java.io.*; 42 import javax.xml.parsers.*; 43 import java.util.Properties ; 44 45 import com.sun.japex.*; 46 47 public class XMLSizeDriver extends JapexDriverBase { 48 49 protected String _xmlFile; 50 protected byte[] _xmlFileByteArray; 51 52 public XMLSizeDriver() { 53 } 54 55 public void initializeDriver() { 56 } 57 58 public void prepare(TestCase testCase) { 59 _xmlFile = testCase.getParam("xmlfile"); 60 if (_xmlFile == null) { 61 throw new RuntimeException ("xmlfile not specified"); 62 } 63 64 try { 65 FileInputStream fis = new FileInputStream(new File(_xmlFile)); 66 _xmlFileByteArray = com.sun.japex.Util.streamToByteArray(fis); 67 fis.close(); 68 } 69 catch (IOException e) { 70 e.printStackTrace(); 71 } 72 } 73 74 public void warmup(TestCase testCase) { 75 } 76 77 public void run(TestCase testCase) { 78 } 79 80 public void finish(TestCase testCase) { 81 testCase.setDoubleParam(Constants.RESULT_VALUE, 82 _xmlFileByteArray.length / 1024.0); 83 } 84 85 public void terminateDriver() { 86 } 87 } 88 | Popular Tags |