/**
   * 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();
  }