/** Test for {@link SimulinkBlockTypeAssessor}. */
  public void test() throws Exception {
    ISimulinkResource resource = readSimulinkElement();

    executeProcessor(
        SimulinkBlockTypeAssessor.class, "(input=(ref=", resource, "), prohibit=(type=Sum))");

    ISimulinkElement modelElement = getModelElement(resource);
    FindingsList findings = NodeUtils.getFindingsList(modelElement, SimulinkBlockTypeAssessor.KEY);

    assertNotNull(findings);
    assertEquals(4, findings.size());
  }
Ejemplo n.º 2
0
  /** Obtain findings for a specific tool and rule-id. */
  private FindingCollection obtainFindings(String tool, String ruleIdentifier) {
    FindingReport report = NodeUtils.getFindingReport(scope);

    FindingCollection result = new FindingCollection();

    for (FindingCategory category : report.getChildren()) {
      if (!category.getName().equals(tool)) {
        continue;
      }
      for (FindingGroup group : category.getChildren()) {
        if (ruleIdentifier.equals(group.getValue(NodeConstants.RULE_IDENTIFIER_KEY))) {
          List<Finding> findings = Arrays.asList(group.getChildren());
          result.addAll(findings);
        }
      }
    }

    return result;
  }
Ejemplo n.º 3
0
 /** {@inheritDoc} */
 @Override
 protected void setUp(ITokenResource root) {
   NodeUtils.addToDisplayList(root, writeKey);
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 @Override
 protected void setUp(IConQATNode root) {
   NodeUtils.addToDisplayList(root, KEY);
 }
 /** {@inheritDoc} */
 @Override
 protected void setUp(ITokenResource root) throws ConQATException {
   super.setUp(root);
   findingReport = NodeUtils.getFindingReport(root);
 }