diff --git a/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/CfgXmlParsingTest.java b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/CfgXmlParsingTest.java new file mode 100644 index 0000000000..a4d3c878bc --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/CfgXmlParsingTest.java @@ -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 . + */ +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" ); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/badnamespace.cfg.xml b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/badnamespace.cfg.xml new file mode 100644 index 0000000000..83262e0ab4 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/badnamespace.cfg.xml @@ -0,0 +1,8 @@ + + + org.hibernate.cache.NoCacheProvider + + \ No newline at end of file diff --git a/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/hibernate.cfg.xml b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/hibernate.cfg.xml new file mode 100644 index 0000000000..cc953fc14f --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/boot/cfgXml/hibernate.cfg.xml @@ -0,0 +1,14 @@ + + + + org.hibernate.cache.NoCacheProvider + + \ No newline at end of file