Exemplo n.º 1
0
 private void copyContent(Scenario source, Scenario target) {
   target.setContent(EcoreUtil.copy(source.getContent()));
   target.setTeslaContent(EcoreUtil.copy(source.getTeslaContent()));
   target.getAttachments().clear();
   target.getAttachments().addAll(EcoreUtil.copyAll(source.getAttachments()));
   target.getContexts().clear();
   target.getContexts().addAll(source.getContexts());
   target.getVerifications().clear();
   target.getVerifications().addAll(source.getVerifications());
   target.setDescription(source.getDescription());
 }
Exemplo n.º 2
0
  private boolean isDirty() {
    ITestCase model = getModel();
    if (model != null && model.exists()) {
      try {
        Scenario saved = (Scenario) model.getNamedElement();
        if (saved != null) {
          if (!EcoreUtil.equals(saved.getContent(), scenario.getContent())) return true;

          // special case when underlying Script model object is still
          // not created
          if (saved.getContent() == null) {
            if (!EcoreUtil.equals(saved.getTeslaContent(), scenario.getTeslaContent())) return true;
          }

          if (saved.getContexts().size() != scenario.getContexts().size()) return true;
          int size = saved.getContexts().size();
          for (int i = 0; i < size; i++) {
            if (!saved.getContexts().get(i).equals(scenario.getContexts().get(i))) return true;
          }

          if (saved.getVerifications().size() != scenario.getVerifications().size()) return true;
          size = saved.getVerifications().size();
          for (int i = 0; i < size; i++) {
            if (!saved.getVerifications().get(i).equals(scenario.getVerifications().get(i)))
              return true;
          }

          String savedDesc = saved.getDescription();
          String desc = scenario.getDescription();
          if (savedDesc == null && desc != null) return true;
          if (savedDesc != null && !savedDesc.equals(desc)) return true;
          return false;
        }
        return model.hasUnsavedChanges();
      } catch (ModelException e) {
        Q7UIPlugin.log(e);
      }
    }
    String content = Scenarios.getScriptContent(scenario);
    return content != null && content.length() > 0;
  }