use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testExceptionError.
public void testExceptionError() {
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setErrorHandler(this);
rdr.read(m, "file:testing/wg/rdfms-abouteach/error002.rdf");
fail("Error did not throw exception with non-standard handler");
} catch (JenaException e) {
}
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testExceptionWarning.
public void testExceptionWarning() {
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setErrorHandler(this);
rdr.read(m, "file:testing/arp/qname-in-ID/bug74_0.rdf");
fail("Warning did not throw exception with non-standard handler");
} catch (JenaException e) {
}
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testDefaultPromotedError.
public void testDefaultPromotedError() {
RDFDefaultErrorHandler.silent = true;
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setProperty("ERR_BAD_RDF_ATTRIBUTE", "EM_FATAL");
rdr.read(m, "file:testing/wg/rdfms-abouteach/error002.rdf");
fail("Promoted error did not throw exception");
} catch (JenaException e) {
// System.err.println(e.getMessage());
} finally {
RDFDefaultErrorHandler.silent = false;
}
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class TestReaderEvents method testReaderEvent.
public void testReaderEvent(final String language, final String emptyModel) {
final RecordingModelListener L = new RecordingModelListener();
model.register(L);
final RDFReaderI r = model.getReader(language);
final StringReader stringReader = new StringReader(emptyModel);
r.read(model, stringReader, "");
L.assertHasStart(new Object[] { "someEvent", model, GraphEvents.startRead });
L.assertHasEnd(new Object[] { "someEvent", model, GraphEvents.finishRead });
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testBadBaseParamError.
public void testBadBaseParamError() throws IOException {
Model m = createMemModel();
RDFReaderI rdr = m.getReader();
try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-difference-between-ID-and-about/test1.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_MALFORMED_URI, WARN_MALFORMED_URI, // WARN_RELATIVE_URI, ERR_RESOLVING_AGAINST_MALFORMED_BASE};
ERR_RESOLVING_AGAINST_MALFORMED_BASE };
rdr.read(m, fin, "http://jjc^3.org/demo.mp3");
}
Model m1 = createMemModel();
assertTrue("Bad base URI should produce no URIs in model.[" + m.toString() + "]", m.isIsomorphicWith(m1));
checkExpected();
}
Aggregations