1 24 25 package org.objectweb.cjdbc.scenario.tools.testlet; 26 27 import java.io.File ; 28 29 import org.objectweb.cjdbc.scenario.tools.ScenarioUtility; 30 31 37 public class CopyTestLet extends AbstractTestLet 38 { 39 40 43 public CopyTestLet() 44 { 45 super(); 46 } 47 48 51 public void execute() throws Exception 52 { 53 String storeFile = (String )config.get(FILE_NAME); 54 File f1 = new File (storeFile); 55 if(!f1.exists()) 56 f1 = new File (getClass().getResource(storeFile).getFile()); 57 if(!f1.exists()) 58 throw new TestLetException("Cannot find file:"+storeFile); 59 60 boolean ok = true; 61 62 File f2 = new File (f1.getAbsolutePath() + ".copy"); 63 ScenarioUtility.writeBinary(ScenarioUtility.readBinary(f1), f2); 64 if (f1.length() != f2.length()) 65 ok = false; 66 f2.delete(); 67 if(!ok) 68 throw new TestLetException("CopyTestLet failed with:"+storeFile); 69 } 70 71 } 72 | Popular Tags |