Пример #1
0
 public ResultEnumeration getDefinitionResult(String definitionId) throws NoSuchElementException {
   DefinitionType definitionType = definitionTable.get(definitionId);
   if (definitionType == null) {
     throw new NoSuchElementException(definitionId);
   }
   return definitionType.getResult();
 }
Пример #2
0
 private Collection<String> getTestIds(DefinitionType definition) {
   Collection<String> testIds = new HashSet<String>();
   getTestIds(definition.getCriteria(), testIds);
   return testIds;
 }
Пример #3
0
  public OvalResults getOvalResults() throws OvalException {
    OvalResults or = Factories.results.createOvalResults();
    or.setGenerator(OvalFactory.getGenerator());
    OvalDirectives od = directives.getOvalDirectives();
    or.setDirectives(od.getDirectives());
    or.getClassDirectives().addAll(od.getClassDirectives());
    if (directives.includeSource()) {
      or.setOvalDefinitions(definitions.getOvalDefinitions());
    }
    SystemType systemType = Factories.results.createSystemType();

    //
    // Add definitions (using the Directives-filtered method) and simultaneously track reportable
    // tests.
    //
    Hashtable<String, TestType> reportableTests = new Hashtable<String, TestType>();
    DefinitionsType definitionsType = Factories.results.createDefinitionsType();
    Collection<DefinitionType> defs = new Vector<DefinitionType>();
    for (DefinitionType definition : definitionTable.values()) {
      DirectiveType directive = directives.getDirective(definition);
      if (directive.isReported()) {
        switch (directive.getContent()) {
          case FULL:
            defs.add(definition);
            break;
          case THIN:
            {
              DefinitionType thinDefinition = Factories.results.createDefinitionType();
              thinDefinition.setDefinitionId(definition.getDefinitionId());
              thinDefinition.setClazz(definition.getClazz());
              thinDefinition.setResult(definition.getResult());
              defs.add(thinDefinition);
              break;
            }
        }
      }
    }
    for (DefinitionType definition : defs) {
      definitionsType.getDefinition().add(definition);
      for (String testId : getTestIds(definition)) {
        if (!reportableTests.containsKey(testId)) {
          reportableTests.put(testId, testTable.get(testId));
        }
      }
    }
    systemType.setDefinitions(definitionsType);

    //
    // Add only those tests for which there are fully-reportable definitions.
    //
    TestsType testsType = Factories.results.createTestsType();
    testsType.getTest().addAll(reportableTests.values());
    systemType.setTests(testsType);

    //
    // Add OvalSystemCharacteristics (applying the mask attributes)
    //
    systemType.setOvalSystemCharacteristics(sc.getOvalSystemCharacteristics(true));

    ResultsType resultsType = Factories.results.createResultsType();
    resultsType.getSystem().add(systemType);
    or.setResults(resultsType);
    return or;
  }
Пример #4
0
 public void storeDefinitionResult(DefinitionType definition) {
   definitionTable.put(definition.getDefinitionId(), definition);
 }