Package com.puppetlabs.geppetto.validation

Examples of com.puppetlabs.geppetto.validation.ValidationOptions


  @Test
  public void validateRepository_notok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/forgeModules/lab42-activemq-0.1.2-withErrors/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(false);
    options.setFileType(FileType.MODULE_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    assertNotEquals("There should be  errors", 0, countErrors(chain));
    Set<String> fileNames = Sets.newHashSet();
    for(Diagnostic d : chain) {
View Full Code Here


  @Test
  public void validateRepositoryDependencies() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/dependencyCheckData/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(false);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    assertNotEquals("There should be  errors", 0, countErrors(chain));
    Set<String> fileNames = Sets.newHashSet();
    for(Diagnostic d : chain)
View Full Code Here

  @Test
  public void validateRepositoryDependenciesWithExclude() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/dependencyCheckData/"));
    ValidationService vs = getValidationService();
    ValidationOptions options = getValidationOptions();
    Diagnostic chain = new Diagnostic();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(false);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, new File[] { new File(root, "moduleB/") }, SubMonitor.convert(null));
    assertEquals("There should be no errors", 0, countErrors(chain));

  }
View Full Code Here

  @Test
  public void variationsOfValidateCall() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asmodule/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(false);
    options.setFileType(FileType.MODULE_ROOT);

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

    // Same but using a repository layout
    root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asrepo/"));
    vs = getValidationService();
    chain = new Diagnostic();
    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));
    assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);

    // Use API1 call to do the same as repository layout validation above
    vs = getValidationService();
    chain = new Diagnostic();
    options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validateRepository(chain, root, SubMonitor.convert(null));
    assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);

    // just the manifest
    root = TestDataProvider.getTestFile(new Path(
      "testData/ghbindcases/asmodule/ghoneycutt-bind-1.0.0/manifests/master.pp"));

    vs = getValidationService();
    chain = new Diagnostic();
    options = getValidationOptions();
    options.setCheckLayout(false);
    options.setCheckModuleSemantics(false);
    options.setCheckReferences(false);
    options.setFileType(FileType.SINGLE_SOURCE_FILE);

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

    // Validate single file in context of repo
    root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asrepo/"));
    vs = getValidationService();
    chain = new Diagnostic();
    options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);

    vs.validate(chain, root, options, new File[] { new File(
      root, "modules/ghoneycutt-bind-1.0.0/manifests/master.pp") }, SubMonitor.convert(null));
    assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
View Full Code Here

  @Test
  public void pptpOptionHandling() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/testFor2_7_1/"));
    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.setPlatformURI(PuppetTarget.PUPPET26.getPlatformURI());
    vs.validate(chain, root, options, null, SubMonitor.convert(null));

    assertEquals("There should be 1 errors", 1, chain.getChildren().size());

    chain = new Diagnostic();
    options.setPlatformURI(PuppetTarget.PUPPET27.getPlatformURI());
    vs.validate(chain, root, options, null, SubMonitor.convert(null));
    dumpErrors(chain);
    assertEquals("There should be 0 errors", 0, chain.getChildren().size());

  }
View Full Code Here

      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, null, SubMonitor.convert(null));

      // System.err.println(errorsToString(chain));
      StringBuilder builder = new StringBuilder();
      builder.append("Diagnostic: A version should be specified.\n");
View Full Code Here

  @Test
  public void demoDependencyGraph() throws Exception {
    File root = 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);

    // Write the dot to a file:
    File outputFolder = TestDataProvider.getTestOutputDir();
    FileOutputStream dotStream = new FileOutputStream(new File(outputFolder, "demoGraphSVG.dot"));
View Full Code Here

  @Test
  public void dependencyGraph() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/graphTestData/"));
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();

    ValidationService vs = getValidationService();
    BuildResult result = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    getDependencyGraphProducer().produceGraph(
View Full Code Here

  @Test
  public void dependencyGraph_Include() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/graphDataIncludeRequire/include/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    BuildResult result = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    getDependencyGraphProducer().produceGraph(
      null, "Module dependencies for graphDataIncludeRequire/include", null, stream, result, chain);
View Full Code Here

  @Test
  public void dependencyGraph_Limited() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/graphTestData/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    File[] modules = new File[] { new File(root, "modules/B/Modulefile") };
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    // dumpExports(buildResult.getExportsForAll());
    getDependencyGraphProducer().produceGraph(
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.