Package com.puppetlabs.geppetto.validation

Examples of com.puppetlabs.geppetto.validation.ValidationService.validate()


    options.setCheckLayout(true);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(false);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    assertNotEquals("There should be  errors", 0, chain.getChildren().size());
    Set<String> fileNames = Sets.newHashSet();
    for(Diagnostic d : chain) {
      if("This is not a boolean".equals(d.getMessage()))
        continue; // skip this error (UGLY)
View Full Code Here


    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(false);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());
  }

  @Test
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(false);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    int hyphenWarning = 0;
    for(Diagnostic e : chain)
      if(IPPDiagnostics.ISSUE__INTERPOLATED_HYPHEN.equals(e.getIssue()) ||
          IPPDiagnostics.ISSUE__HYPHEN_IN_NAME.equals(e.getIssue()))
        hyphenWarning++;
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    options.setSearchPath("modules/*:roles/production/*");
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));

    // Without constraint that only things on path are validated - there should be two redefinition errors
    //
    assertEquals("There should be no errors", 0, countErrors(chain));
    AllModuleReferences exports = buildResult.getAllModuleReferences();
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    // options.setSearchPath("modules/*:roles/production/*");
    vs.validate(chain, root, options, null, SubMonitor.convert(null));

    // Without constraint that only things on path are validated - there should be two redefinition errors
    //
    List<Diagnostic> children = chain.getChildren();
    int count = 0;
View Full Code Here

    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    AllModuleReferences exports = buildResult.getAllModuleReferences();

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
View Full Code Here

    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    AllModuleReferences exports = buildResult.getAllModuleReferences();
    // dumpExports(exports);

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
View Full Code Here

    options.setCheckLayout(false);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(true);
    options.setFileType(FileType.MODULE_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__RESOURCE_AMBIGUOUS_REFERENCE);
    assertTrue(
      "Message text should contain a relative reference",
      chain.getChildren().get(0).getMessage().startsWith("Ambiguous reference to: 'fluff' found in: 1 resource [") &&
          chain.getChildren().get(0).getMessage().contains("manifests/ambigA.pp"));
View Full Code Here

  @Test
  public void validateAString_NotOk() throws Exception {
    String code = "$a = ";
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, code, SubMonitor.convert(null));
    assertTrue("There should be errors", countErrors(chain) != 0);
  }

  @Test
  public void validateAString_ok() throws Exception {
View Full Code Here

  @Test
  public void validateAString_ok() throws Exception {
    String code = "$a = 'a::b'";
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, code, SubMonitor.convert(null));
    assertTrue("There should be no errors", countErrors(chain) == 0);
  }

  @Test
  public void validateManifest_notok() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.