Package com.puppetlabs.geppetto.validation.runner

Examples of com.puppetlabs.geppetto.validation.runner.BuildResult


      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");
      builder.append("Diagnostic: A version should be specified.\n");
      builder.append("Diagnostic: Unknown class: 'lsbprovider'\n");
      builder.append("Diagnostic: Can not determine until runtime if this is a valid class reference\n");
      // builder.append("Diagnostic: Ambiguous reference to: 'service' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'postfix::pflogsumm' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'common' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'snmp::files' \n");

      assertEquals("There should be the expected errors", builder.toString(), errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
View Full Code Here


      ValidationOptions options = getValidationOptions();
      options.setCheckLayout(true);
      options.setCheckModuleSemantics(true);
      options.setCheckReferences(true);
      options.setFileType(FileType.PUPPET_ROOT);
      BuildResult br = vs.validate(chain, root, options, new File[] { new File(
        "/Users/henrik/gitrepos/stackhammer-demo/nodes/foo/") }, SubMonitor.convert(null));

      // System.err.println(errorsToString(chain));
      StringBuilder builder = new StringBuilder();
      builder.append("Diagnostic: A version should be specified.\n");
      // builder.append("Diagnostic: Unknown class: 'lsbprovider'\n");
      // builder.append("Diagnostic: Can not determine until runtime if this is a valid class reference\n");
      // builder.append("Diagnostic: Ambiguous reference to: 'service' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'postfix::pflogsumm' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'common' \n");
      // builder.append("Diagnostic: Ambiguous reference to: 'snmp::files' \n");

      assertEquals("There should be the expected errors", builder.toString(), errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
View Full Code Here

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

      assertEquals("There should be the expected errors", "", errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
View Full Code Here

    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();
    assertEquals("Should have found a rakefile", 1, rakefileInfo.getRakefiles().size());
    Rakefile rakefile = rakefileInfo.getRakefiles().get(0);
    assertEquals("Should have a relative path of a/Rakefile", "a/Rakefile", rakefile.getPath().toString());
    assertEquals("Should have found 4 tasks", 4, rakefile.getTasks().size());
    assertTask(rakefile.getTasks().get(0), "outer:myspace:mytask", "this is my task");
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();
    assertEquals("Should have found a rakefile", 1, rakefileInfo.getRakefiles().size());
    Rakefile rakefile = rakefileInfo.getRakefiles().get(0);
    assertEquals(
      "Should have a relative path of smoketest/Rakefile", "smoketest/Rakefile", rakefile.getPath().toString());
    assertEquals("Should have found 4 tasks", 5, rakefile.getTasks().size());
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();
    assertEquals("Should have found one rakefile", 1, rakefileInfo.getRakefiles().size());
    Rakefile rakefile = rakefileInfo.getRakefiles().get(0);
    assertEquals("Should have a relative path of Rakefile", "Rakefile", rakefile.getPath().toString());
    assertEquals("Should have found 8 tasks", 8, rakefile.getTasks().size());
    assertTask(rakefile.getTasks().get(0), "default", "");
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();
    assertEquals("Should have found two rakefiles", 2, rakefileInfo.getRakefiles().size());
    Rakefile rakefile = rakefileInfo.getRakefiles().get(0);
    List<String> rakefilePaths = Lists.newArrayList();
    rakefilePaths.add(rakefile.getPath().toString());
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    options.setSearchPath("modules/*:roles/production/*");
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));

    // Without constraint that only things on path are validated - there should be two redefinition errors
    //
    assertEquals("There should be no errors", 0, countErrors(chain));
    AllModuleReferences exports = buildResult.getAllModuleReferences();
    // dumpExports(exports);

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/production/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
View Full Code Here

    ValidationOptions options = getValidationOptions();
    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    AllModuleReferences exports = buildResult.getAllModuleReferences();

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
    Export exportedb = exports.findExportedClass("b::bclass", visibleExports);
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.validation.runner.BuildResult

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.