Package com.puppetlabs.geppetto.diagnostic

Examples of com.puppetlabs.geppetto.diagnostic.Diagnostic


  @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);
  }
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);
  }
View Full Code Here

  @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);
  }
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);
  }
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(),
      asserter.issue(IPPDiagnostics.ISSUE__HYPHEN_IN_NAME).optional().greedy());

    assertEquals("There should be two diagnostic entries", 2, chain.getChildren().size());
  }
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
    asserter.assertWarnings(
      asserter.issue(IPPDiagnostics.ISSUE__UNKNOWN_VARIABLE).optional().greedy(),
      asserter.issue(IPPDiagnostics.ISSUE__HYPHEN_IN_NAME).optional().greedy());

    assertEquals("There should be one diagnostic entriy", 1, chain.getChildren().size());

  }
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();
View Full Code Here

  @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);
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());
  }
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);
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.diagnostic.Diagnostic

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.