HHH-10009 - Unable to parse cfg.xml file with explicit xsi:schemaLocation
(cherry picked from commit 74d2d33012
)
This commit is contained in:
parent
cd2c07d3a5
commit
2ba5df5afb
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.test.boot.cfgXml;
|
||||
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.internal.util.config.ConfigurationException;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CfgXmlParsingTest extends BaseUnitTestCase {
|
||||
@Test
|
||||
public void testCfgXmlWithSchemaLocation() {
|
||||
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder()
|
||||
.configure( "org/hibernate/test/boot/cfgXml/hibernate.cfg.xml" )
|
||||
.build();
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
}
|
||||
|
||||
@Test(expected = ConfigurationException.class )
|
||||
public void testCfgXmlWithBadNamespaceAndSchemaLocation() {
|
||||
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder()
|
||||
.configure( "org/hibernate/test/boot/cfgXml/badnamespace.cfg.xml" )
|
||||
.build();
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
fail( "Expecting the bad namespace to fail" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<hibernate-configuration
|
||||
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<session-factory>
|
||||
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
|
@ -0,0 +1,14 @@
|
|||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
-->
|
||||
<hibernate-configuration
|
||||
xmlns="http://www.hibernate.org/xsd/orm/cfg"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/orm/cfg hibernate-configuration-4.0.xsd">
|
||||
<session-factory>
|
||||
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
Loading…
Reference in New Issue