コード例 #1
0
  /** Odre d'edition du test */
  public void editTest(
      String testScript,
      org.objectweb.salome_tmf.data.AutomaticTest pTest,
      Hashtable arg,
      String plugParam)
      throws Exception {
    try {
      File pFile = new File(testScript);
      FileInputStream pFileInputStream = new FileInputStream(pFile);
      Properties test_prop = new Properties();
      test_prop.load(pFileInputStream);
      // Utile.getPropertiesFile(testScript);
      String strID = test_prop.getProperty("attachment_id");
      String strAttachment = test_prop.getProperty("attachment_name");
      String strClass = test_prop.getProperty("junit_class");
      String meth = test_prop.getProperty("test_meth");
      String version = test_prop.getProperty("junit_version");
      pFileInputStream.close();

      File script =
          ChoiceOrEdit(pTest, false, pFile, strID, strAttachment, strClass, meth, version);
      if (script != null) {
        Script pScript = pTest.getScriptFromModel();
        pScript.updateInDB(script);
      }

    } catch (Exception e) {
      e.printStackTrace();
      Tools.ihmExceptionView(e);
    }
  }
コード例 #2
0
  public String updateTestScript(
      String testScript, org.objectweb.salome_tmf.data.AutomaticTest pTest) {
    String strNewId = "";
    try {

      File pFile = new File(testScript);
      FileInputStream pFileInputStream = new FileInputStream(pFile);
      Properties test_prop = new Properties();
      test_prop.load(pFileInputStream);
      // Utile.getPropertiesFile(testScript);
      String strID = test_prop.getProperty("attachment_id");
      String strAttachment = test_prop.getProperty("attachment_name");
      String strClass = test_prop.getProperty("junit_class");
      String meth = test_prop.getProperty("test_meth");
      String version = test_prop.getProperty("junit_version");
      pFileInputStream.close();

      Hashtable tabAttach =
          new Hashtable(DataModel.getCurrentProject().getAttachmentMapFromModel());
      Enumeration e = tabAttach.elements();
      boolean trouve = false;
      while (e.hasMoreElements() && !trouve) {
        Attachment pAttach = (Attachment) e.nextElement();
        if (pAttach.getDescriptionFromModel().equals(JMeterTester.jMeterDescAttach)
            && pAttach.getNameFromModel().equals(strAttachment)) {
          strNewId = "" + pAttach.getIdBdd();
          trouve = true;
        }
      }
      // ADD PROJECT PATH

      String toWrite = "attachment_id = " + strNewId + "\n";
      toWrite += "attachment_name = " + strAttachment + "\n";
      toWrite += "junit_class = " + strClass + "\n";
      toWrite += "test_meth = " + meth + "\n";
      toWrite += "junit_version = " + version + "\n";
      File newFile = writeJunitFile(pFile, pTest, toWrite);
      Script pScript = pTest.getScriptFromModel();
      pScript.updateInDB(newFile);

    } catch (Exception e) {

    }
    return strNewId;
  }