Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365422 - Add RDF model validation to the OSLC JUnits.
Summary: Add RDF model validation to the OSLC JUnits.
Status: CLOSED FIXED
Alias: None
Product: Lyo
Classification: Technology
Component: TestSuite (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Michael Fiedler CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 07:59 EST by Paul Slauenwhite CLA
Modified: 2011-12-10 08:42 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2011-12-02 07:59:39 EST
Validate the model after reading (GET) and before creating/updating (PUT/POST).  For example:

protected void validateModel(Model model) throws Exception {

		InfModel infmodel = ModelFactory.createRDFSModel(model);
		ValidityReport validityReport = infmodel.validate();

		if (!validityReport.isClean()) {

			StringBuffer errorMessage = new StringBuffer();
			errorMessage.append("Invalid model:"); //$NON-NLS-1$

			Iterator<ValidityReport.Report> reports = validityReport.getReports();

			while(reports.hasNext()){

				errorMessage.append('\n');
				errorMessage.append(reports.next().toString());
			}

			Assert.fail(errorMessage.toString());
		}
	}
Comment 2 Paul Slauenwhite CLA 2011-12-10 08:42:30 EST
Thanks Mike.

Closing.