Package org.openiaml.verification.crocopat

Examples of org.openiaml.verification.crocopat.VerificationEngine


  public void test1() throws Exception {
    // load model
    EObject model = loadModelDirectly("src/org/openiaml/verification/crocopat/tests/BigInfiniteLoop-10.iaml");
   
    VerificationEngine engine = new VerificationEngine();
    IStatus result = engine.verify(model, new NullProgressMonitor());
    ModelInferenceTestCase.assertStatusIsNotOK(result);
 
    // there should be violations
    List<VerificationViolation> violations = engine.getViolations();
    assertNotNull("Violations should not be null", violations);
   
    // there should be ten
    assertEquals("there should be 10 violations", 10, violations.size());
   
View Full Code Here


    // we only want to deal with InternetApplications (root)   
    if (!eClass.equals(ModelPackage.eINSTANCE.getInternetApplication())) {
      return true;
    }
   
    VerificationEngine verify = new VerificationEngine();
    try {
      IStatus result = verify.verify(eObject, new NullProgressMonitor());
     
      if (result.isOK()) {
        // everything was fine
        return true;
      }
     
      // add diagnoses to all of the failing objects
      for (VerificationViolation violation : verify.getViolations()) {
        diagnostics.add(new BasicDiagnostic(
            Diagnostic.WARNING, /* severity */
            "org.openiaml.model.actions", /* source */
            0, /* code */
            violation.getMessage(), /* message */
 
View Full Code Here

    // do inference on the model
    model = resource.getContents().get(0);
    monitor.worked(1);

    // do verification
    VerificationEngine verify = new VerificationEngine();
    IStatus status;
    try {
      status = verify.verify(model, new SubProgressMonitor(monitor, 9));
    } catch (VerificationException e) {
      return errorStatus(e);
    }
   
    // check for violation exceptions
    if (!verify.getViolations().isEmpty()) {     
      StringBuffer buf = new StringBuffer();
     
      for (int i = 0; i < 5 && i < verify.getViolations().size(); i++) {
        VerificationViolation violation = verify.getViolations().get(i);
        if (i != 0)
          buf.append("\n");
       
        buf.append(violation.getMessage())
          .append(": ");
       
        for (int j = 0; j < violation.getObjects().size(); j++) {
          if (j != 0)
            buf.append("; ");
          buf.append(IamlBreadcrumb.breadcrumb(violation.getObjects().get(j)));
        }
      }
     
      if (verify.getViolations().size() > 5) {
        // there are more
        buf.append("\n(...")
          .append(verify.getViolations().size() - 5)
          .append(" more)");       
      }
     
      // return the error
      return errorStatus("Verification failed:\n\n" + buf.toString());
View Full Code Here

TOP

Related Classes of org.openiaml.verification.crocopat.VerificationEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.