Package com.puppetlabs.geppetto.diagnostic

Examples of com.puppetlabs.geppetto.diagnostic.Diagnostic


  @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.validateRepository(chain, root, SubMonitor.convert(null));
    assertNotEquals("There should be errors", 0, chain.getChildren().size());
    for(Diagnostic d : chain)
      if(d instanceof FileDiagnostic) {
        File f = ((FileDiagnostic) d).getFile();
        assertEquals(
          "Reported files should start with 'manifests/'", "manifests/not ok manifest.pp", f.getPath());
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();

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

    // Set options like API1 would behave for a validateRepository
    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
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();

    // 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()) ||
          IPPDiagnostics.ISSUE__HYPHEN_IN_NAME.equals(e.getIssue()))
        hyphenWarning++;
    assertEquals("There should be two errors", 2, chain.getChildren().size() - hyphenWarning);
  }
View Full Code Here

  @Override
  protected void addModules(Diagnostic diagnostic, List<Module> modules) {
    super.addModules(diagnostic, modules);

    if(login == null || login.length() == 0)
      diagnostic.addChild(new Diagnostic(ERROR, FORGE, "login must be specified"));

    if(password == null || password.length() == 0)
      diagnostic.addChild(new Diagnostic(ERROR, FORGE, "password must be specified"));

    if(diagnostic.getSeverity() >= ERROR)
      return;

    modules.add(new OAuthModule(clientID, clientSecret, login, password));
View Full Code Here

    File targetFile = getProject().getArtifact().getFile();
    if(targetFile == null) {
      File builtModulesDir = new File(getBuildDir(), "builtModules");
      builtModules = builtModulesDir.listFiles();
      if(builtModules == null || builtModules.length == 0) {
        result.addChild(new Diagnostic(ERROR, PUBLISHER, "Unable find any packaged modules in " +
            builtModulesDir.getAbsolutePath()));
        return;
      }
    }
    else
View Full Code Here

    if(result == null)
      return md;

    if(md == null) {
      result.addChild(new Diagnostic(ERROR, FORGE, "No Module Metadata found in directory " +
          moduleDirectory.getAbsolutePath()));
      return null;
    }
    return md;
  }
View Full Code Here

        // be derived
        metadataDerived = !metadataResource.exists();
        subMon.worked(1);
      }

      Diagnostic diagnostic = new Diagnostic();
      try {
        // Load metadata, types, checksums etc.
        metadata = forge.createFromModuleDirectory(projectDir, true, null, extractionSource, diagnostic);
      }
      catch(Exception e) {
View Full Code Here

  @Override
  protected void invoke(Diagnostic result) throws IOException {
    Collection<File> moduleRoots = findModuleRoots();
    if(moduleRoots.isEmpty()) {
      result.addChild(new Diagnostic(
        Diagnostic.ERROR, ValidationService.GEPPETTO, "No modules found in repository"));
      return;
    }

    if(checkLayout || checkModuleSemantics || checkReferences)
View Full Code Here

    getLog().debug("Performing puppet lint validation on all modules");
    if(puppetLintOptions == null)
      puppetLintOptions = new PuppetLintRunner.Option[0];
    for(File moduleRoot : moduleLocations) {
      for(PuppetLintRunner.Issue issue : runner.run(moduleRoot, puppetLintOptions)) {
        Diagnostic diag = convertPuppetLintDiagnostic(moduleRoot, issue);
        if(diag != null)
          result.addChild(diag);
      }
    }
  }
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.