?????????“???”????????????

????A.“?????????”??“?????????”??“????????”??“??”??????

?????????????л???

????B.???“???”???????A?????в??裬????“???URL”??“?????”??“????”??????????

????????????????B??????????“?????????????????????????????漰?????п???????????????????”??????????????????????????÷????????????????????????????

???????????????????????????????????????????????????????????С????????£?

????/*****************************************????????*****************************************/

????/**

????* ?????

????* @author leizang.cs

????*

????*/

????public interface ActionCommand {

????/**

????* ??????

????* @param url ???url

????* @param nick ?????

????* @param passWord ????

????*/

????public void login(String url?? String nick?? String passWord);

????/**

????* ???

????*/

????public void loginOut();

????/**

????* ??ж???

????* @param subOption ???????

????*/

????public void doSub(SubOption subOption);

????/**

????* ?????????У???????

????* @param dbCheckOption У?????

????* @param needCheckedTables ???У?????

????*/

????public void checkSubDB(SubDbCheckOption dbCheckOption?? TableEnum...needCheckedTables);

????/**

????* ????????????

????* @param sql ?????е?sql

????*/

????public void dbExecute(String... sqls);

????}

????/*****************************************????????*****************************************/

??????????????????????????????????????????

????<!--[if !supportLists]-->2?? <!--[endif]-->?????????????——??????????

????????????????????????????????????????????????????????????????????????????????е?????????????????????????????????й????????????????????????????ο???

????/*****************************************????????*****************************************/

????public class ActionCommandImpl implements ActionCommand{

????private WebDriver driver;

????private JdbcTemplate jdbc;

????@Override

????public void dbExecute(String... sqls){

????for(String sql: sqls){

????jdbc= CommonUtil.getJdbcFromSql(sql);

????jdbc.execute(sql);

????}

????}

????@Override

????public void login(String url?? String nick?? String passWord){

????try{

????driver= new HtmlUnitDriver();

????driver.get(url);

????WebElement userName= driver.findElement(By.id("TPL_username_1"));

????userName.sendKeys(nick);

????WebElement passWd= driver.findElement(By.name("TPL_password"));

????passWd.sendKeys(passWord);

????WebElement submit= driver.findElement(By.className("J_Submit"));

????submit.click();

????}finally{

????writePage();

????}

????}

????@Override

????public void loginOut(){

????driver.quit();

????}

????/**

????* @dscription ???????

????* @param subOption ????????

????* @throws ITestException

????*/

????@Override

????public void doSub(SubOption subOption)throws ITestException{

????if(subOption== null){

????Assert.fail("???????????????!");

????}

????String subUrl= subOption.getSubUrl();

????CycleEnum cycle= subOption.getCycle();

????log("??????????");

????look(subOption);

????if(subUrl== null || subUrl.isEmpty()){

????Assert.fail("????Url???????!");

????}

????if(cycle== null){

????Assert.fail("??????????????!");

????}

????try{

????driver.get(subUrl);

????log(" ??????:"+ subUrl);

????WebElement period= null;

????switch(cycle){

????case ONE_MONTH:

????period=driver.findElement(By.id("p-month"));

????period.setSelected();

????break;

????case ONE_SEASON:

????period=driver.findElement(By.id("p-season"));

????period.setSelected();

????break;

????case HALF_YEAR:

????period=driver.findElement(By.id("p-half"));

????period.setSelected();

????break;