use of org.hibernate.cfg.annotations.reflection.XMLContext in project hibernate-orm by hibernate.
the class XMLContextTest method testAll.
@Test
public void testAll() throws Exception {
final XMLHelper xmlHelper = new XMLHelper(ClassLoaderServiceTestingImpl.INSTANCE);
final XMLContext context = new XMLContext(ClassLoaderAccessTestingImpl.INSTANCE);
InputStream is = ClassLoaderServiceTestingImpl.INSTANCE.locateResourceStream("org/hibernate/test/annotations/reflection/orm.xml");
Assert.assertNotNull("ORM.xml not found", is);
final ErrorLogger errorLogger = new ErrorLogger();
final SAXReader saxReader = xmlHelper.createSAXReader(errorLogger, EJB3DTDEntityResolver.INSTANCE);
try {
saxReader.setFeature("http://apache.org/xml/features/validation/schema", true);
} catch (SAXNotSupportedException e) {
saxReader.setValidation(false);
}
org.dom4j.Document doc;
try {
doc = saxReader.read(new InputSource(new BufferedInputStream(is)));
} finally {
try {
is.close();
} catch (IOException ioe) {
//log.warn( "Could not close input stream", ioe );
}
}
Assert.assertFalse(errorLogger.hasErrors());
context.addDocument(doc);
}
use of org.hibernate.cfg.annotations.reflection.XMLContext in project hibernate-orm by hibernate.
the class Ejb3XmlTestCase method getReader.
protected JPAOverriddenAnnotationReader getReader(Class<?> entityClass, String fieldName, String ormResourceName) throws Exception {
AnnotatedElement el = getAnnotatedElement(entityClass, fieldName);
XMLContext xmlContext = getContext(ormResourceName);
return new JPAOverriddenAnnotationReader(el, xmlContext, ClassLoaderAccessTestingImpl.INSTANCE);
}
use of org.hibernate.cfg.annotations.reflection.XMLContext in project hibernate-orm by hibernate.
the class Ejb3XmlTestCase method getContext.
protected XMLContext getContext(InputStream is) throws Exception {
XMLContext xmlContext = new XMLContext(ClassLoaderAccessTestingImpl.INSTANCE);
Document doc = new SAXReader().read(is);
xmlContext.addDocument(doc);
return xmlContext;
}
Aggregations