Search in sources :

Example 81 with EntityResolver

use of org.xml.sax.EntityResolver in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testSetEntityResolver.

@Test
public void testSetEntityResolver() throws Exception {
    EntityResolver testResolver = new DefaultHandler();
    ConfigurationFacadeImpl facade = (ConfigurationFacadeImpl) configurationFacade;
    Field entityResolverField = ConfigurationFacadeImpl.class.getDeclaredField("entityResolver");
    entityResolverField.setAccessible(true);
    assertNull(entityResolverField.get(facade));
    configurationFacade.setEntityResolver(testResolver);
    assertSame(testResolver, entityResolverField.get(facade));
}
Also used : Field(java.lang.reflect.Field) EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test)

Example 82 with EntityResolver

use of org.xml.sax.EntityResolver in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetEntityResolver.

@Test
public void testGetEntityResolver() {
    EntityResolver testResolver = new DefaultHandler();
    ConfigurationFacadeImpl facade = (ConfigurationFacadeImpl) configurationFacade;
    assertNotSame(testResolver, configurationFacade.getEntityResolver());
    facade.entityResolver = testResolver;
    assertSame(testResolver, configurationFacade.getEntityResolver());
}
Also used : EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Example 83 with EntityResolver

use of org.xml.sax.EntityResolver in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testSetEntityResolver.

@Test
public void testSetEntityResolver() throws Exception {
    EntityResolver testResolver = new DefaultHandler();
    ConfigurationFacadeImpl facade = (ConfigurationFacadeImpl) configurationFacade;
    Field entityResolverField = ConfigurationFacadeImpl.class.getDeclaredField("entityResolver");
    entityResolverField.setAccessible(true);
    assertNull(entityResolverField.get(facade));
    configurationFacade.setEntityResolver(testResolver);
    assertSame(testResolver, entityResolverField.get(facade));
}
Also used : Field(java.lang.reflect.Field) EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test)

Example 84 with EntityResolver

use of org.xml.sax.EntityResolver in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testSetEntityResolver.

@Test
public void testSetEntityResolver() throws Exception {
    EntityResolver testResolver = new DefaultHandler();
    assertNotSame(testResolver, configuration.getEntityResolver());
    configurationFacade.setEntityResolver(testResolver);
    assertSame(testResolver, configuration.getEntityResolver());
}
Also used : EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test)

Example 85 with EntityResolver

use of org.xml.sax.EntityResolver in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetEntityResolver.

@Test
public void testGetEntityResolver() {
    EntityResolver testResolver = new DefaultHandler();
    assertNotSame(testResolver, configurationFacade.getEntityResolver());
    configuration.setEntityResolver(testResolver);
    assertSame(testResolver, configurationFacade.getEntityResolver());
}
Also used : EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test)

Aggregations

EntityResolver (org.xml.sax.EntityResolver)85 InputSource (org.xml.sax.InputSource)41 SAXException (org.xml.sax.SAXException)37 IOException (java.io.IOException)32 DefaultHandler (org.xml.sax.helpers.DefaultHandler)25 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)23 DocumentBuilder (javax.xml.parsers.DocumentBuilder)22 Test (org.junit.jupiter.api.Test)22 Document (org.w3c.dom.Document)18 StringReader (java.io.StringReader)15 Field (java.lang.reflect.Field)14 SAXParseException (org.xml.sax.SAXParseException)14 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)11 NodeList (org.w3c.dom.NodeList)11 ByteArrayInputStream (java.io.ByteArrayInputStream)10 InputStream (java.io.InputStream)10 ArrayList (java.util.ArrayList)9 Node (org.w3c.dom.Node)9 ErrorHandler (org.xml.sax.ErrorHandler)9 Element (org.w3c.dom.Element)8