/**
   * Script Name : <b>Cust_API_Native_InputEvent_1_E2E</b> Generated : <b>Mar 28, 2012 2:25:54
   * AM</b> Description : Functional Test Script Original Host : WinNT Version 5.1 Build 2600 (S)
   *
   * @since 2012/03/28
   * @author ffan
   */
  public void testMain(Object[] args) {
    // TODO Insert code here
    WN.useProject(Cfg.projectName);
    WN.createWorkFlow(
        new WorkFlow()
            .startParameter(Cfg.projectName)
            .name(Cfg.wfName)
            .option(WorkFlow.SP_CLIENT_INIT));
    MainMenu.saveAll();

    WFCustomizer.runTest(
        new WorkFlowPackage()
            .startParameter(WN.filePath(Cfg.projectName, "myWF"))
            .assignToUser(Cfg.deviceUser)
            .unwiredServer("My Unwired Server")
            .deployToServer("true"),
        customJsTestScript(),
        Cfg.tplanScript_client_1);

    // 1.used to BB6: passed
    WFCustomizer.verifyResult(new WFClientResult().data("PassScreenToShow=Start"));
  }
  /**
   * Script Name : <b>S675478_SentByServerKey_Following_Client</b> Generated : <b>Mar 12, 2012
   * 4:15:49 AM</b> Description : Functional Test Script Original Host : WinNT Version 5.1 Build
   * 2600 (S)
   *
   * @since 2012/03/12
   * @author ffan
   */
  public void testMain(Object[] args) {
    // TODO Insert code here
    WN.useProject(Cfg.projectName);
    EE.dnd("Database Connections->My Sample Database->sampledb->Tables->department (dba)", 10, 10);

    WN.createWorkFlow(
        new WorkFlow()
            .startParameter(Cfg.projectName)
            .name("myWF")
            .option(WorkFlow.SP_CLIENT_INIT));

    WorkFlowEditor.dragMbo(Cfg.projectName, "Department");
    WorkFlowEditor.addMenuItem(
        "Start",
        new WFScreenMenuItem()
            .name("findall")
            .project(Cfg.projectName)
            .type("Online Request")
            .mbo("Department")
            .objectQuery("findAll")
            .defaultSuccessScreen("DepartmentDetail"));
    MainMenu.saveAll();
    vpManual("noerror", 0, Problems.getErrors().size()).performTest();
  }
  /**
   * Script Name : <b>EMailTriggering_E2E_05</b> Generated : <b>Oct 19, 2011 9:03:19 PM</b>
   * Description : Functional Test Script Original Host : WinNT Version 5.1 Build 2600 (S)
   *
   * @since 2011/10/19
   * @author ffan
   */
  public void testMain(Object[] args) {
    // TODO Insert code here
    // restore the initial table record
    String sqldelete = "delete from Mbo1 where C1=1";
    try {
      DBUtil.runSQL((IDBResource) RC.getResource(ASA.class), sqldelete);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    String sqlcreate = "insert into Mbo1 values (1,'one')";
    try {
      DBUtil.runSQL((IDBResource) RC.getResource(ASA.class), sqlcreate);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    WN.useProject(Cfg.projectName);
    EE.dnd("Database Connections->My Sample Database->sampledb->Tables->mbo1 (dba)");
    WN.deployProject(
        new DeployOption()
            .startParameter(Cfg.projectName)
            .server("My Unwired Server")
            .mode(DeployOption.MODE_REPLACE)
            .serverConnectionMapping("My Sample Database,sampledb"));

    WN.createWorkFlow(
        new WorkFlow()
            .startParameter(Cfg.projectName)
            .name(Cfg.wfName)
            .option(WorkFlow.SP_SERVER_INIT));

    PropertiesView.jumpStart(
        new WorkFlow()
            .mbo("Mbo1")
            .objectQuery("findByPrimaryKey")
            .from("imo@localhost")
            .subject("<id>2</id>")
            .fromMatchingRule("imo")
            .setParameterValue("C1,Subject,<id>,</id>"));

    WorkFlowEditor.dragMbo(Cfg.projectName, "Mbo1");
    WorkFlowEditor.removeScreen("Mbo1");
    WorkFlowEditor.removeScreen("Mbo1updateinstance");
    WorkFlowEditor.removeScreen("Mbo1create");
    WorkFlowEditor.removeScreen("Mbo1deleteinstance");
    sleep(1);
    MainMenu.saveAll();
    WorkFlowEditor.addScreen("MyUpdate");
    WorkFlowEditor.link(WorkFlow.SP_SERVER_INIT, "Mbo1Detail");
    WorkFlowEditor.addMenuItem(
        "Mbo1Detail", new WFScreenMenuItem().name("Open MyUpdate").type("Open").screen("MyUpdate"));
    sleep(1);
    MainMenu.saveAll();

    WorkFlowEditor.removeMenuItem("Mbo1Detail", "Back");
    WorkFlowEditor.addMenuItem(
        "Mbo1Detail",
        new WFScreenMenuItem()
            .name("submit")
            .type("Submit Workflow")
            .project(Cfg.projectName)
            .mbo("Mbo1"));
    sleep(1);
    MainMenu.saveAll();

    WorkFlowEditor.addWidget(
        "MyUpdate", new WFEditBox().label("C1:").key("Mbo1_C1_attribKey").ifReadonly(true));
    sleep(1);
    MainMenu.saveAll();
    WorkFlowEditor.addWidget("MyUpdate", new WFEditBox().label("C2:").key("Mbo1_C2_attribKey"));
    sleep(1);
    MainMenu.saveAll();
    WorkFlowEditor.addMenuItem(
        "MyUpdate",
        new WFScreenMenuItem()
            .name("update")
            .type("Online Request")
            .project(Cfg.projectName)
            .mbo("Mbo1")
            .operation("update")
            .submitErrMsg("this is my submit error message")
            .defaultSuccessScreen("Mbo1Detail")
            .parametermapping("C1,Mbo1_C1_attribKey")
            .parametermapping("C2,Mbo1_C2_attribKey"));

    MainMenu.saveAll();
    vpManual("hasError", 0, Problems.getErrors().size()).performTest();

    WFCustomizer.runTest(
        new WorkFlowPackage()
            .startParameter(WN.filePath(Cfg.projectName, Cfg.wfName))
            .assignToUser(Cfg.deviceUser)
            .unwiredServer("My Unwired Server")
            .deployToServer("true"),
        customTestScript(),
        //			"tplan.Workflow.iconcommon.BB.server_dt_icon.Script",
        new CallBackMethod()
            .receiver(WorkFlowEditor.class)
            .methodName("sendNotification")
            .parameter(new Email().from("imo@localhost").subject("<id>1</id>")));

    WFCustomizer.verifyResult(
        new WFClientResult()
            .data("id=Mbo1_C1_attribKey,value=1|" + "id=Mbo1_C2_attribKey,value=one"));

    // vp: the new record is added in the datebase:
    java.util.List<String> clause = new ArrayList<String>();
    clause.add("C1=1");
    clause.add("C2='newone'");
    vpManual("dbresult", 1, CDBUtil.getRecordCount("localhost", "wf", "Mbo1", clause))
        .performTest();
  }
 /**
  * Script Name : <b>S665751_Loneline_in_ResultData_2_Android</b> Generated : <b>Nov 4, 2011
  * 7:29:58 AM</b> Description : Functional Test Script Original Host : WinNT Version 5.1 Build
  * 2600 (S)
  *
  * @since 2011/11/04
  * @author flvxp
  */
 public void testMain(Object[] args) {
   WN.useProject(Cfg.projectName);
   EE.runSQL(
       new ScrapbookCP().database("sampledb").type("Sybase_txt_12.x").name("My Sample Database"),
       GlobalConfig.getRFTProjectRoot() + "/testscript/Workflow/Actions/conf/txt_ddl.sql");
   EE.runSQL(
       new ScrapbookCP().database("sampledb").type("Sybase_txt_12.x").name("My Sample Database"),
       GlobalConfig.getRFTProjectRoot() + "/testscript/Workflow/Actions/conf/txt_data.sql");
   //		 MBO
   EE.dnd("Database Connections->My Sample Database->sampledb->Tables->txt (dba)");
   WN.deployProject(
       new DeployOption()
           .startParameter(Cfg.projectName)
           .mode(DeployOption.MODE_REPLACE)
           .server("My Unwired Server")
           .serverConnectionMapping("My Sample Database,sampledb"));
   //		 WF
   WN.createWorkFlow(
       new WorkFlow()
           .startParameter(Cfg.projectName)
           .name("myWF")
           .option(WorkFlow.SP_CLIENT_INIT));
   WorkFlowEditor.dragMbo(Cfg.projectName, "Txt");
   WorkFlowEditor.addEditBox(
       Cfg.projectName,
       "myWF.xbw",
       "Start Screen",
       new WFEditBox().label("id").logicalType("TEXT").newKey("id,int").setDefaultValue("2"));
   WorkFlowEditor.addMenuItem(
       "Start Screen",
       new WFScreenMenuItem()
           .name("findByPrimaryKey")
           .type("Online Request")
           .project(Cfg.projectName)
           .mbo("Txt")
           .objectQuery("findByPrimaryKey")
           .parametermapping("id,id")
           .defaultSuccessScreen("TxtDetail"));
   sleep(1);
   MainMenu.saveAll();
   WorkFlowEditor.addEditBox(
       Cfg.projectName,
       "myWF.xbw",
       "TxtDetail",
       new WFEditBox()
           .label("text")
           .logicalType("TEXT")
           .ifReadonly(true)
           .key("Txt_content_attribKey")
           .lines("3"));
   MainMenu.saveAll();
   //
   vpManual("error", 0, Problems.getErrors().size()).performTest();
   //
   WFCustomizer.runTest(
       new WorkFlowPackage()
           .startParameter(WN.filePath(Cfg.projectName, Cfg.wfName))
           .assignToUser("supAdmin")
           .unwiredServer("My Unwired Server")
           .deployToServer("true")
           .verifyResult("Assigning workflow myWF to supAdmin", true),
       customTestScript(),
       "tplan.Workflow.common.StartWF_android");
   WFCustomizer.verifyResult(
       new WFClientResult().data("id=Txt_content_attribKey,value=format2\r\ntest"));
 }
  /**
   * Script Name : <b>CdtnScr_Request_CRUD_01_Create_E2E</b> Generated : <b>Feb 29, 2012 9:11:46
   * PM</b> Description : Functional Test Script Original Host : WinNT Version 5.1 Build 2600 (S)
   *
   * @since 2012/02/29
   * @author ffan
   */
  public void testMain(Object[] args) {
    // TODO Insert code here
    //		create:
    // delete the date which will be created in the following code
    try {
      DBUtil.runSQL(
          (IDBResource) RC.getResource(ASA.class), "delete from States where state_id='CH'");
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    WN.useProject(Cfg.projectName);
    EE.dnd("Database Connections->My Sample Database->sampledb->Tables->states (dba)");
    WN.deployProject(
        new DeployOption()
            .startParameter(Cfg.projectName)
            .server("My Unwired Server")
            .mode(DeployOption.MODE_REPLACE)
            .serverConnectionMapping("My Sample Database,sampledb"));

    WN.createWorkFlow(
        new WorkFlow()
            .startParameter(Cfg.projectName)
            .name("myWF")
            .option(WorkFlow.SP_CLIENT_INIT));
    WorkFlowEditor.dragMbo(Cfg.projectName, "States");
    WorkFlowEditor.link("StatesDetail", "Statescreate");

    WorkFlowEditor.addWidget("Start", new WFEditBox().label("id:").newKey("id,string"));
    WorkFlowEditor.addMenuItem(
        "Start",
        new WFScreenMenuItem()
            .name("findByPK")
            .type("Online Request")
            .mbo("States")
            .objectQuery("findByPrimaryKey")
            .project(Cfg.projectName)
            .defaultSuccessScreen("StatesDetail")
            .parametermapping("state_id,id"));

    PropertiesView.set(
        new WFScreen().name("Statescreate"),
        new Modifications()
            .mod(
                "create",
                new WFScreenMenuItem()
                    .name("Create")
                    .type("Online Request")
                    .defaultSuccessScreen("StatesDetail")));

    PropertiesView.addConditionTableOfMenuItem("c1", "Start");
    MainMenu.saveAll();
    WFCustomizer.runTest(
        new WorkFlowPackage()
            .startParameter(WN.filePath(Cfg.projectName, Cfg.wfName))
            .assignToUser(testscript.Workflow.cfg.Cfg.deviceUser)
            .deployToServer("true")
            .unwiredServer("My Unwired Server"),
        script()
        //			,
        //			testscript.Workflow.cfg.Cfg.tplanScript_client_1
        );

    // vp:data in device
    WFCustomizer.verifyResult(
        new WFClientResult().data("id=States_state_id_attribKey,value=AB|" + "id=id,value=AB"));

    // vp2:verify the update record  has added into backend db in state
    vpManual(
            "db",
            1,
            DBUtil.getDB("select * from states where state_id='CH' and state_name='China'"))
        .performTest();
  }