protected void setUp() throws Exception {
    super.setUp();
    root = GMFGenFactory.eINSTANCE.createGenAuditRoot();

    root.getCategories().add(topCat = GMFGenFactory.eINSTANCE.createGenAuditContainer());
    topCat.getPath().add(topCat);
    root.getRules().add(rule0 = GMFGenFactory.eINSTANCE.createGenAuditRule());
    rule0.setCategory(topCat);

    root.getCategories().add(child1 = GMFGenFactory.eINSTANCE.createGenAuditContainer());
    child1.getPath().add(topCat);
    child1.getPath().add(child1);
    root.getRules().add(rule1 = GMFGenFactory.eINSTANCE.createGenAuditRule());
    rule1.setCategory(child1);

    root.getCategories().add(child2 = GMFGenFactory.eINSTANCE.createGenAuditContainer());
    child2.getPath().add(topCat);
    child2.getPath().add(child1);
    child2.getPath().add(child2);
    root.getRules().add(rule2 = GMFGenFactory.eINSTANCE.createGenAuditRule());
    rule2.setCategory(child2);
  }
  public void testRulesToContextMap() {
    // setup different kinds of targets and assign to audits
    GenDiagramElementTarget diagramElementTarget1 =
        GMFGenFactory.eINSTANCE.createGenDiagramElementTarget();
    diagramElementTarget1.getElement().add(getSetup().getGenModel().getNodeA());
    GenDiagramElementTarget diagramElementTarget2 =
        GMFGenFactory.eINSTANCE.createGenDiagramElementTarget();
    diagramElementTarget2.getElement().add(getSetup().getGenModel().getLinkC());

    GenDomainElementTarget domainElementTarget =
        GMFGenFactory.eINSTANCE.createGenDomainElementTarget();
    domainElementTarget.setElement(getSetup().getGenModel().getNodeA().getDomainMetaClass());

    GenNotationElementTarget notationElementTarget =
        GMFGenFactory.eINSTANCE.createGenNotationElementTarget();
    notationElementTarget.setElement(getSetup().getGenModel().getLinkC().getDiagramRunTimeClass());

    GenRuleTarget targets[] =
        new GenRuleTarget[] {
          diagramElementTarget1, diagramElementTarget2, domainElementTarget, notationElementTarget
        };

    final int expectedCtxCount = targets.length - 1; // domain and notation share default context
    // ensure sufficient number of audits to be distributed accross contexts
    final int minOfAuditsInCtx = 2;
    final int numberOfAuditsToAdd = expectedCtxCount * minOfAuditsInCtx - root.getRules().size();
    for (int i = 0; i < numberOfAuditsToAdd; i++) {
      GenAuditRule r;
      root.getRules().add(r = GMFGenFactory.eINSTANCE.createGenAuditRule());
      r.setCategory(topCat);
    }

    int i = 0;
    for (GenAuditRule audit : root.getRules()) {
      audit.setTarget((GenAuditable) EcoreUtil.copy(targets[i % targets.length]));

      //			IStatus s =
      // JavaConventions.validateIdentifier(audit.getTarget().getCgetContextSelectorLocalClassName(), javaLevel, javaLevel);
      //			assertTrue("Context selectorClassLocalName must valid java name", s.getSeverity() !=
      // IStatus.ERROR); //$NON-NLS-1$
      //			String ctxID = audit.getTarget().getClientContextID();
      //			s = JavaConventions.validateIdentifier(ctxID, javaLevel, javaLevel);
      //			assertTrue("Context ID must be a valid java identifier", s.getSeverity() !=
      // IStatus.ERROR); //$NON-NLS-1$
      i++;
    }

    assertTargetedModels(targets);
  }