示例#1
0
 /**
  * Load the properties from the XML file specified.
  *
  * @param propFile the properties file.
  */
 private void loadProp(String propFile) {
   VMprop = new Properties();
   try {
     logger.section("Loading VM test case properties...");
     VMpropFile = propFile;
     FileInputStream in = new FileInputStream(VMpropFile);
     VMprop.loadFromXML(in);
     in.close();
   } catch (FileNotFoundException ex) {
     logger.fatal(ex.toString());
   } catch (InvalidPropertiesFormatException ex) {
     logger.fatal(ex.toString());
   } catch (IOException ex) {
     logger.fatal(ex.toString());
   }
 }
示例#2
0
  private void doValidateValuesProp(VMForm vmdata) {
    try {
      // check if test data is avialable
      if (VMprop != null) {
        String sProp = VMprop.getProperty("vm0");
        System.out.println("got the key " + sProp);
        // open teh cadsr connection
        Connection conn = varCon.openConnection();
        vmdata.setDBConnection(conn);
        // loop through the data to test one by one
        for (int i = 1; true; ++i) {
          // setting up the data
          VM_Bean vm = new VM_Bean();
          VM_Bean selvm = new VM_Bean();

          // edited value meaning from the page
          String curvmname = VMprop.getProperty("current.vmname." + i);
          if (curvmname == null || curvmname.equals("")) break;

          if (curvmname != null) vm.setVM_LONG_NAME(curvmname);
          String curvmdesc = VMprop.getProperty("current.vmdesc." + i);
          if (curvmdesc != null) vm.setVM_PREFERRED_DEFINITION(curvmdesc);
          String curvmln = VMprop.getProperty("current.vmlongname." + i);
          if (curvmln != null) vm.setVM_LONG_NAME(curvmln);

          // concept associated with the edited value meaning
          String connm = VMprop.getProperty("current.conname." + i);
          if (connm != null) {
            Vector<EVS_Bean> conList = new Vector<EVS_Bean>();
            EVS_Bean vmCon = new EVS_Bean();
            vmCon.setLONG_NAME(connm);
            String conid = VMprop.getProperty("current.conid." + i);
            if (conid != null) vmCon.setCONCEPT_IDENTIFIER(conid);
            String condefn = VMprop.getProperty("current.condefn." + i);
            if (condefn != null) vmCon.setPREFERRED_DEFINITION(condefn);
            String conorgn = VMprop.getProperty("current.conorigin." + i);
            if (conorgn != null) vmCon.setEVS_ORIGIN(conorgn);
            String consrc = VMprop.getProperty("current.consrc." + i);
            if (consrc != null) vmCon.setEVS_DEF_SOURCE(consrc);
            String conidseq = VMprop.getProperty("current.conidseq." + i);
            if (conidseq != null) vmCon.setIDSEQ(conidseq);
            // add the concept bean to conlist vector and to the vm bean
            conList.addElement(vmCon);
            vm.setVM_CONCEPT_LIST(conList);
          }
          // selected value meaning before the change
          String selvmname = VMprop.getProperty("selected.vmname." + i);
          if (selvmname != null) {
            selvm.setVM_LONG_NAME(selvmname);
            String selvmdesc = VMprop.getProperty("selected.vmdesc." + i);
            if (selvmdesc != null) selvm.setVM_PREFERRED_DEFINITION(selvmdesc);
            String selvmln = VMprop.getProperty("selected.vmlongname." + i);
            if (selvmln != null) selvm.setVM_LONG_NAME(selvmln);
            String selvmid = VMprop.getProperty("selected.vmidseq." + i);
            if (selvmid != null) selvm.setVM_IDSEQ(selvmid);
            String selvmcondr = VMprop.getProperty("selected.vmcondr." + i);
            if (selvmcondr != null) selvm.setVM_CONDR_IDSEQ(selvmcondr);

            // add teh selected vm to the vm data
            vmdata.setSelectVM(selvm);
          }

          // add the beans to data object
          vmdata.setVMBean(vm);
          logger.info(
              i
                  + " Validating VM for "
                  + vm.getVM_LONG_NAME()
                  + " : desc : "
                  + vm.getVM_PREFERRED_DEFINITION()
                  + " conlist "
                  + vm.getVM_CONCEPT_LIST().size());

          // do the search;
          VMAction vmact = new VMAction();
          vmact.validateVMData(vmdata); // doChangeVM(vmdata);
        }
      }
      varCon.closeConnection(); // close the connection

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }