Package com.puppetlabs.geppetto.validation

Examples of com.puppetlabs.geppetto.validation.ValidationOptions


    File root = TestDataProvider.getTestFile(new Path("testData/test-modules/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();

    // Set options like API1 would behave for a validateRepository
    ValidationOptions options = getValidationOptions();
    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()) ||
View Full Code Here


  @Test
  public void validateDuplicateRoleDifferentEnv() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/testRoles3/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    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));
View Full Code Here

  @Test
  public void validateDuplicateRoleDuplicateRole() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/testRoles3/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    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
    //
View Full Code Here

  @Test
  public void validateNodes() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/testRoles/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    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);
View Full Code Here

  @Test
  public void validateNodes2() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/testRoles2/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    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"));
View Full Code Here

    if(!source.exists())
      throw new IllegalArgumentException("source does not exist");
    if(!source.canRead())
      throw new IllegalArgumentException("source can not be read");
    if(options == null) {
      options = new ValidationOptions();
      options.setCheckLayout(false);
      options.setCheckModuleSemantics(false);
      options.setCheckReferences(false);
      options.setFileType(FileType.DETECT);
    }
View Full Code Here

    buildResult.setRakefileInfo(rakefileInfo);
    return buildResult;
  }

  public void validateManifest(Diagnostic diagnostics, File sourceFile, IProgressMonitor monitor) {
    ValidationOptions options = new ValidationOptions();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(false);
    options.setFileType(FileType.SINGLE_SOURCE_FILE);

    validate(diagnostics, sourceFile, options, null, monitor);
  }
View Full Code Here

  public Resource validateManifest(Diagnostic diagnostics, String code, IProgressMonitor monitor) {
    return validate(diagnostics, code, monitor);
  }

  public BuildResult validateModule(Diagnostic diagnostics, File moduleRoot, IProgressMonitor monitor) {
    ValidationOptions options = new ValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(false);
    options.setFileType(FileType.MODULE_ROOT);

    return validate(diagnostics, moduleRoot, options, null, monitor);
  }
View Full Code Here

    runner.compileCatalog(siteFile, catalogRoot, nodeName, factorData, ticker.newChild(1000));
    diagnostics.addChildren(runner.getDiagnostics());
  }

  public BuildResult validateRepository(Diagnostic diagnostics, File catalogRoot, IProgressMonitor monitor) {
    ValidationOptions options = new ValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);

    return validate(diagnostics, catalogRoot, options, null, monitor);
  }
View Full Code Here

  @Test
  public void relativeAmbiguityErrorReport() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/ambiguity/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    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",
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.validation.ValidationOptions

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.