@Test
public void variationsOfValidateCall() throws Exception {
File root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asmodule/"));
ValidationService vs = getValidationService();
Diagnostic chain = new Diagnostic();
ValidationOptions options = getValidationOptions();
options.setCheckLayout(false);
options.setCheckModuleSemantics(false);
options.setCheckReferences(false);
options.setFileType(FileType.MODULE_ROOT);
vs.validate(chain, root, options, null, SubMonitor.convert(null));
assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
// Same but using a repository layout
root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asrepo/"));
vs = getValidationService();
chain = new Diagnostic();
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));
assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
// Use API1 call to do the same as repository layout validation above
vs = getValidationService();
chain = new Diagnostic();
options = getValidationOptions();
options.setCheckLayout(true);
options.setCheckModuleSemantics(true);
options.setCheckReferences(true);
options.setFileType(FileType.PUPPET_ROOT);
vs.validateRepository(chain, root, SubMonitor.convert(null));
assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
// just the manifest
root = TestDataProvider.getTestFile(new Path(
"testData/ghbindcases/asmodule/ghoneycutt-bind-1.0.0/manifests/master.pp"));
vs = getValidationService();
chain = new Diagnostic();
options = getValidationOptions();
options.setCheckLayout(false);
options.setCheckModuleSemantics(false);
options.setCheckReferences(false);
options.setFileType(FileType.SINGLE_SOURCE_FILE);
vs.validate(chain, root, options, null, SubMonitor.convert(null));
assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
// Validate single file in context of repo
root = TestDataProvider.getTestFile(new Path("testData/ghbindcases/asrepo/"));
vs = getValidationService();
chain = new Diagnostic();
options = getValidationOptions();
options.setCheckLayout(true);
options.setCheckModuleSemantics(true);
options.setCheckReferences(true);
options.setFileType(FileType.PUPPET_ROOT);
vs.validate(chain, root, options, new File[] { new File(
root, "modules/ghoneycutt-bind-1.0.0/manifests/master.pp") }, SubMonitor.convert(null));
assertContainsErrorCode(chain, IPPDiagnostics.ISSUE__MISSING_COMMA);
DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);