Package com.puppetlabs.geppetto.validation

Examples of com.puppetlabs.geppetto.validation.ValidationService


  public void test_ValidateStackhammerDemo() throws Exception {
    {
      File root = new File("/Users/henrik/gitrepos/stackhammer-demo");
      // 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);
      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");
View Full Code Here


  public void test_ValidateStackhammerDemoFiltered() throws Exception {
    {
      File root = new File("/Users/henrik/gitrepos/stackhammer-demo");
      // 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);
      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");
View Full Code Here

  public void test_ValidateStackhammerPuppetConfDemo() throws Exception {
    {
      File root = new File("/Users/henrik/git/khussey-puppetconf-demo");
      // 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);
      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));
View Full Code Here

    if(!root.isDirectory())
      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

    assertTrue(
      "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();
    assertEquals("Should have found a rakefile", 1, rakefileInfo.getRakefiles().size());
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());
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());
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());
View Full Code Here

  }

  @Test
  public void validateAString_NotOk() throws Exception {
    String code = "$a = ";
    ValidationService vs = getValidationService();
    Diagnostic chain = new Diagnostic();
    vs.validateManifest(chain, code, null);
    assertTrue("There should be errors", chain.getChildren().size() != 0);
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.validation.ValidationService

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.