protected void setUp() throws Exception {
   super.setUp();
   final Mapping m = getMapping();
   myTransformer = new DiagramGenModelTransformer(myDiagramModelHelper);
   myTransformer.setEMFGenModel(Utils.createGenModel(m.getDiagram().getDomainModel()));
   myTransformer.transform(m);
   myTransformationResult = myTransformer.getResult();
 }
  public void _testAntScriptEmitsSameStructure() throws Exception {
    Mapping mapping = myMapSource.getMapping();
    //
    // metrics
    MetricContainer mc = GMFMapFactory.eINSTANCE.createMetricContainer();
    MetricRule mr = GMFMapFactory.eINSTANCE.createMetricRule();
    mr.setKey("metric.rule1"); // $NON-NLS-1$
    // Note: use characters that need to be escaped in java source string literals
    mr.setName("Name of " + mr.getKey()); // $NON-NLS-1$
    mr.setDescription("Description of " + mr.getKey()); // $NON-NLS-1$
    mr.setRule(GMFMapFactory.eINSTANCE.createValueExpression());
    mr.getRule().setBody("'aaa'.size() + 2");
    mr.setLowLimit(new Double(2));
    mr.setHighLimit(new Double(6));
    DiagramElementTarget diagramElementTarget =
        GMFMapFactory.eINSTANCE.createDiagramElementTarget();
    diagramElementTarget.setElement(mapping.getNodes().get(0).getChild());
    mr.setTarget(diagramElementTarget);
    mc.getMetrics().add(mr);
    mapping.setMetrics(mc);
    //
    // audits
    AuditContainer ac = GMFMapFactory.eINSTANCE.createAuditContainer();
    ac.setId("ac1"); // $NON-NLS-1$
    ac.setName(ac.getId());
    AuditRule ar = GMFMapFactory.eINSTANCE.createAuditRule();
    String ar_id = "audit.rule1";
    ar.setId(ar_id);
    ar.setName("Name of " + ar_id); // $NON-NLS-1$
    ar.setMessage("Violation of " + ar_id); // $NON-NLS-1$
    ar.setDescription("Description of " + ar_id); // $NON-NLS-1$
    DomainElementTarget classLibrary = GMFMapFactory.eINSTANCE.createDomainElementTarget();
    classLibrary.setElement(mapping.getDiagram().getDomainMetaElement());
    ar.setTarget(classLibrary);
    Constraint rule = GMFMapFactory.eINSTANCE.createConstraint();
    // body is not essential, just to look nice
    rule.setBody("Library.allInstances()->size() > 0"); // $NON-NLS-1$
    ar.setRule(rule);
    ar.setSeverity(Severity.ERROR_LITERAL);
    ar.setUseInLiveMode(true);
    ac.getAudits().add(ar);
    mapping.setAudits(ac);
    DiaGenSource s = new GenASetup(mapping, myViewmapProducer, false);
    //
    // validation
    s.getGenDiagram()
        .setValidationEnabled(true); // although presence of audits effectively does the same
    //
    // shortcuts
    s.getGenDiagram().getContainsShortcutsTo().add("ecore");
    s.getGenDiagram().getShortcutsProvidedFor().add("ecore");
    s.getGenDiagram().eResource().save(null);

    testAntScriptEmitsSameStructure(s);
  }