Package com.puppetlabs.geppetto.diagnostic

Examples of com.puppetlabs.geppetto.diagnostic.Diagnostic


    overviewPage.markStale();
    dependenciesPage.markStale();
  }

  private void refreshModel() {
    Diagnostic chain = new Diagnostic();
    IPath path = getPath();
    if(path == null)
      return;
    model.setDocument(getDocument(), path, chain);
    sourcePage.updateDiagnosticAnnotations(chain);
View Full Code Here


  public Collection<File> downloadDependencies(Iterable<Metadata> metadatas, File importedModulesDir,
      Diagnostic result) throws IOException {
    Set<Dependency> unresolvedCollector = new HashSet<Dependency>();
    Set<Metadata> releasesToDownload = resolveDependencies(metadatas, unresolvedCollector);
    for(Dependency unresolved : unresolvedCollector)
      result.addChild(new Diagnostic(WARNING, FORGE, String.format(
        "Unable to resolve dependency: %s:%s", unresolved.getName(),
        unresolved.getVersionRequirement().toString())));

    if(!releasesToDownload.isEmpty()) {
      importedModulesDir.mkdirs();
      List<File> importedModuleLocations = new ArrayList<File>();

      StringBuilder bld = new StringBuilder("Installing dependent module ");
      int pfxLen = bld.length();
      for(Metadata release : releasesToDownload) {
        bld.setLength(pfxLen);
        release.getName().toString(bld);
        bld.append(':');
        release.getVersion().toString(bld);
        result.addChild(new Diagnostic(INFO, FORGE, bld.toString()));

        bld.setLength(0);
        ModuleUtils.buildFileName(release.getName(), release.getVersion(), bld);
        File moduleDir = new File(importedModulesDir, bld.toString());
        install(release, moduleDir, true, false);
        importedModuleLocations.add(moduleDir);
      }
      return importedModuleLocations;
    }

    if(unresolvedCollector.isEmpty())
      result.addChild(new Diagnostic(INFO, FORGE, "No additional dependencies were detected"));
    return Collections.emptyList();
  }
View Full Code Here

      if(e.getStatusCode() != HttpStatus.SC_NOT_FOUND)
        throw new ForgeException("Unable to check module existence on the forge: " + e.getMessage());
    }

    if(dryRun) {
      result.addChild(new Diagnostic(INFO, PUBLISHER, "Module file " + moduleArchive.getName() +
          " would have been uploaded (but wasn't since this is a dry run)"));
      return;
    }

    InputStream gzInput = new FileInputStream(moduleArchive);
    try {
      ModuleName name = metadata.getName();
      releaseService.create(
        name.getOwner(), name.getName(), "Published using GitHub trigger", gzInput, moduleArchive.length());
      result.addChild(new Diagnostic(INFO, PUBLISHER, "Module file " + moduleArchive.getName() +
          " has been uploaded"));
    }
    finally {
      StreamUtil.close(gzInput);
    }
View Full Code Here

        publish(builtModule, dryRun, result);
        noPublishingMade = false;
        continue;
      }
      catch(AlreadyPublishedException e) {
        result.addChild(new Diagnostic(WARNING, PUBLISHER, e.getMessage()));
        continue;
      }
      catch(ForgeException e) {
        result.addChild(new Diagnostic(ERROR, PUBLISHER, e.getMessage()));
      }
      catch(Exception e) {
        result.addChild(new ExceptionDiagnostic(ERROR, PUBLISHER, "Unable to publish module " +
            builtModule.getName(), e));
      }
      return;
    }

    if(noPublishingMade) {
      result.addChild(new Diagnostic(
        INFO, PUBLISHER, "All modules have already been published at their current version"));
    }
  }
View Full Code Here

      return;

    // 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

      "CONFIGURATION ERROR: Testdata directory must be a directory: check test config!", root.isDirectory());
    File theRakefile = new File(root, "a/Rakefile");
    assertTrue("CONFIGURATION ERROR: Testdata a/Rakefile must exist: check test config!", theRakefile.exists());

    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    BuildResult result = vs.validate(chain, root, null, null, SubMonitor.convert(null));
    assertTrue(
      "CONFIGURATION ERROR:: Configuration should include ruby services!!", result.isRubyServicesAvailable());
  }
View Full Code Here

  @Test
  public void oneRakefile4Tasks() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/rakefiledata/simple/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    BuildResult result = vs.validate(chain, root, null, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());

    RakefileInfo rakefileInfo = result.getRakefileInfo();
View Full Code Here

  @Test
  public void oneRakefileWithCode() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/rakefiledata/withcode/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    BuildResult result = vs.validate(chain, root, null, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());

    RakefileInfo rakefileInfo = result.getRakefileInfo();
View Full Code Here

  @Test
  public void rakefileFromJenkinsModule() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/rakefiledata/fromJenkinsModule/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    BuildResult result = vs.validate(chain, root, null, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());

    RakefileInfo rakefileInfo = result.getRakefileInfo();
View Full Code Here

  @Test
  public void twoRakefilesWith4Tasks() throws Exception {
    File root = TestDataProvider.getTestFile(new Path("testData/rakefiledata/twice/"));
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    BuildResult result = vs.validate(chain, root, null, null, SubMonitor.convert(null));
    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertAll(asserter.issue(IPPDiagnostics.ISSUE__STRING_BOOLEAN).optional().greedy());

    RakefileInfo rakefileInfo = result.getRakefileInfo();
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.