Package com.puppetlabs.geppetto.validation

Examples of com.puppetlabs.geppetto.validation.ValidationOptions


      File root = new File("/Users/henrik/gitrepos/stackhammer-demo");
      // TestDataProvider.getTestFile(new Path(
      // "testData/test-modules/"));
      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 br = vs.validate(chain, root, options, new File[] { new File(
        "/Users/henrik/gitrepos/stackhammer-demo/nodes/foo/") }, SubMonitor.convert(null));

      // System.err.println(errorsToString(chain));
      StringBuilder builder = new StringBuilder();
View Full Code Here


      File root = new File("/Users/henrik/git/khussey-puppetconf-demo");
      // TestDataProvider.getTestFile(new Path(
      // "testData/test-modules/"));
      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 br = vs.validate(chain, root, options, null, SubMonitor.convert(null));

      // System.err.println(errorsToString(chain));
      // StringBuilder builder = new StringBuilder();
View Full Code Here

    }
    if(importedModuleLocations == null)
      importedModuleLocations = Collections.emptyList();

    RubyHelper.setRubyServicesFactory(JRubyServices.FACTORY);
    ValidationOptions options = getValidationOptions(moduleLocations, importedModuleLocations);
    new PPDiagnosticsSetup(complianceLevel, options.getProblemsAdvisor()).createInjectorAndDoEMFRegistration();

    getValidationService().validate(
      result, getModulesDir(), options,
      importedModuleLocations.toArray(new File[importedModuleLocations.size()]), new NullProgressMonitor());
  }
View Full Code Here

    return searchPath.toString();
  }

  private ValidationOptions getValidationOptions(Collection<File> moduleLocations,
      Collection<File> importedModuleLocations) {
    ValidationOptions options = new ValidationOptions();
    options.setCheckLayout(checkLayout);
    options.setCheckModuleSemantics(checkModuleSemantics);
    options.setCheckReferences(checkReferences);

    if(moduleLocations.size() == 1 && getModulesDir().equals(moduleLocations.iterator().next()))
      options.setFileType(FileType.MODULE_ROOT);
    else
      options.setFileType(FileType.PUPPET_ROOT);
    options.setPlatformURI(PuppetTarget.forComplianceLevel(complianceLevel, false).getPlatformURI());
    options.setEncodingProvider(new IEncodingProvider() {
      public String getEncoding(URI file) {
        return UTF_8.name();
      }
    });

    options.setSearchPath(getSearchPath(moduleLocations, importedModuleLocations));
    options.setProblemsAdvisor(potentialProblemsAdvisor);
    return options;
  }
View Full Code Here

  protected ValidationOptions getValidationOptions() {
    return getValidationOptions(ComplianceLevel.PUPPET_3_0);
  }

  protected ValidationOptions getValidationOptions(ComplianceLevel complianceLevel) {
    ValidationOptions options = new ValidationOptions();
    options.setPlatformURI(PuppetTarget.forComplianceLevel(complianceLevel, false).getPlatformURI());
    options.setEncodingProvider(new IEncodingProvider() {
      public String getEncoding(URI file) {
        return "UTF-8";
      }
    });
    options.setProblemsAdvisor(ValidationAdvisor.create(complianceLevel, new DefaultPotentialProblemsAdvisor()));
    return options;
  }
View Full Code Here

  }

  @Before
  public void setUp() {
    RubyHelper.setRubyServicesFactory(JRubyServices.FACTORY);
    ValidationOptions options = getValidationOptions();
    new PPDiagnosticsSetup(options.getComplianceLevel(), options.getProblemsAdvisor()).createInjectorAndDoEMFRegistration();
    injector = Guice.createInjector(GsonModule.INSTANCE, new ForgeModule(), new ValidationModule());
  }
View Full Code Here

    // TestDataProvider.getTestFile(new Path(
    // "testData/test-modules/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    assertEquals("There should be 0 errors", 0, chain.getChildren().size());
  }
View Full Code Here

    File root = TestDataProvider.getTestFile(new Path("testData/circularModules/"));
    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);
    options.setProblemsAdvisor(new DefaultPotentialProblemsAdvisor());

    vs.validate(chain, root, options, null, SubMonitor.convert(null));

    int circularity = 0;
    int otherErrors = 0;
View Full Code Here

    File root = TestDataProvider.getTestFile(new Path("testData/forgeModules/lab42-activemq-0.1.2-withErrors/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();

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

    File root = TestDataProvider.getTestFile(new Path("testData/forgeModules/lab42-activemq-0.1.2/"));
    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));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());
  }
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.