use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testIcu.
// JENA-1537
// Character encoding checks removed due to lack of support in JDK XML parser APIs.
// public void testLatin1() throws IOException {
// Model m = createMemModel();
// RDFReader rdr = m.getReader();
// InputStream r = new FileInputStream(
// "testing/arp/i18n/latin1.rdf");
//
// rdr.setErrorHandler(this);
// expected = new int[] { WARN_NONCANONICAL_IANA_NAME };
// rdr.read(m, r, "http://example.org/");
// checkExpected();
// }
// JENA-1537
// Character encoding checks removed due to lack of support in JDK XML parser APIs.
// public void testARPMacRoman() throws IOException {
// Model m = createMemModel();
// RDFReader rdr = m.getReader();
// InputStream r = new FileInputStream(
// "testing/arp/i18n/macroman.rdf");
//
// rdr.setErrorHandler(this);
// expected = new int[] { WARN_UNSUPPORTED_ENCODING, WARN_NON_IANA_ENCODING };
// expected[Charset.isSupported("MacRoman")?0:1]=0;
// // Only one of the warnings is expected, which depends on Java version
//
// rdr.read(m, r, "http://example.org/");
// checkExpected();
// }
// public void testARPMacArabic() throws IOException {
// Model m = createMemModel();
// RDFReader rdr = m.getReader();
// InputStream r = new FileInputStream(
// "testing/arp/i18n/arabic-macarabic.rdf");
//
// rdr.setErrorHandler(this);
// expected = new int[] { WARN_UNSUPPORTED_ENCODING, WARN_NON_IANA_ENCODING };
// expected[Charset.isSupported("MacArabic")?0:1]=0;
// // Only one of the warnings is expected, which depends on Java version
// rdr.read(m, r, "http://example.org/");
// checkExpected();
// }
//
//
// public void testEncodingMismatch1() throws IOException {
// Model m = createMemModel();
// RDFReader rdr = m.getReader();
// try ( FileReader r = new FileReader("testing/wg/rdfms-syntax-incomplete/test001.rdf") ) {
// if (r.getEncoding().startsWith("UTF")) {
// //logger.warn("Encoding mismatch tests not executed on platform with default UTF encoding.");
// r.close() ;
// return;
// }
// rdr.setErrorHandler(this);
// expected = new int[] { WARN_ENCODING_MISMATCH };
// rdr.read(m, r, "http://example.org/");
// //System.err.println(m.size() + " triples read.");
// checkExpected();
// }
// }
public void testIcu() throws IOException {
// "\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
// Normalizer. isNormalized(
// "\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
// ,Normalizer.NFC,0);
Model m = createMemModel();
RDFReaderI rdr = m.getReader();
try (FileInputStream r = new FileInputStream("testing/arp/i18n/icubug.rdf")) {
rdr.setErrorHandler(this);
expected = new int[] { WARN_STRING_COMPOSING_CHAR };
rdr.read(m, r, "http://example.org/");
}
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class MoreTests method testIRIRules_2a.
public void testIRIRules_2a() {
Model model = ModelFactory.createDefaultModel();
RDFReaderI r = model.getReader("RDF/XML");
r.setErrorHandler(this);
expected = new int[] {};
model.read(new StringReader(RDF_TEXT), "http://example/");
checkExpected();
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testDefaultPromotedWarning.
public void testDefaultPromotedWarning() {
RDFDefaultErrorHandler.silent = true;
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setProperty("WARN_BAD_NAME", "EM_FATAL");
rdr.read(m, "file:testing/arp/qname-in-ID/bug74_0.rdf");
fail("Promoted warning did not throw exception");
} catch (JenaException e) {
} finally {
RDFDefaultErrorHandler.silent = false;
}
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testDefaultDemotedFatal.
public void testDefaultDemotedFatal() {
RDFDefaultErrorHandler.silent = true;
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setProperty("ERR_SAX_FATAL_ERROR", "EM_ERROR");
rdr.read(m, "file:testing/arp/error-msgs/test06.rdf");
} catch (JenaException e) {
System.err.println(e.getMessage());
e.printStackTrace();
fail("Demoted.error error threw an exception");
} finally {
RDFDefaultErrorHandler.silent = false;
}
}
use of org.apache.jena.rdf.model.RDFReaderI in project jena by apache.
the class ExceptionTests method testNonExceptionFatal.
public void testNonExceptionFatal() {
try {
Model m = ModelFactory.createDefaultModel();
RDFReaderI rdr = m.getReader();
rdr.setErrorHandler(this);
rdr.read(m, "file:testing/arp/error-msgs/test06.rdf");
} catch (JenaException e) {
fail("Fatal error threw an exception with non-exception handler");
}
}
Aggregations