Package com.puppetlabs.geppetto.validation

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


  @Test
  public void validateManifest_notok() throws Exception {
    File manifest = TestDataProvider.getTestFile(new Path("testData/manifests/not_ok_manifest.pp"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, manifest, null, null, SubMonitor.convert(null));
    assertTrue("There should be errors", countErrors(chain) != 0);
  }

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


  @Test
  public void validateManifest_ok() throws Exception {
    File manifest = TestDataProvider.getTestFile(new Path("testData/manifests/ok_manifest.pp"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, manifest, null, null, SubMonitor.convert(null));
    assertTrue("There should be no errors", countErrors(chain) == 0);
  }

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

  @Test
  public void validateModule_notok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/broken/broken-module/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, root, null, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertErrors(asserter.messageFragment("unexpected tIDENTIFIER"));
    // optionally accept Unknown variables, and hyphen in name, but no other warnings
    asserter.assertWarnings(
      asserter.issue(IPPDiagnostics.ISSUE__UNKNOWN_VARIABLE).optional().greedy(),
View Full Code Here

  @Test
  public void validateModule_ok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/test-modules/test-module/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, root, null, null, SubMonitor.convert(null));

    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    // no errors
    asserter.assertErrors();
    // optionally accept Unknown variables, and hyphen in name, but no other warnings
View Full Code Here

  @Test
  public void validateModuleWithSpaces_notok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/broken withSpaces/module"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, root, null, null, SubMonitor.convert(null));
    assertNotEquals("There should be errors", 0, countErrors(chain));
    for(Diagnostic d : chain)
      if(d instanceof FileDiagnostic) {
        File f = ((FileDiagnostic) d).getFile();
        assertEquals(
View Full Code Here

    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) {
      if("This is not a boolean".equals(d.getMessage()))
        continue; // skip this (UGLY)
View Full Code Here

  @Test
  public void validateRepository_ok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/forgeModules/lab42-activemq-0.1.2/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, root, null, 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(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)
      if(d instanceof FileDiagnostic && d.getSeverity() >= Diagnostic.ERROR)
        fileNames.add(((FileDiagnostic) d).getFile().getPath());
View Full Code Here

    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));

  }

  @Test
View Full Code Here

  @Test
  public void validateSeveralRepositories_ok() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/test-modules/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validate(chain, root, null, null, SubMonitor.convert(null));

    int hyphenWarning = 0;
    int otherIssues = 0;
    for(Diagnostic e : chain)
      if(IPPDiagnostics.ISSUE__INTERPOLATED_HYPHEN.equals(e.getIssue()) ||
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.