git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17779 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Hardy Ferentschik 2009-10-16 13:22:28 +00:00
parent 6613dce0cb
commit 95285ad109
23 changed files with 20 additions and 14 deletions

View File

@ -16,8 +16,8 @@ public class DuplicateTest extends TestCase {
try { try {
cfg.addAnnotatedClass( Flight.class ); cfg.addAnnotatedClass( Flight.class );
cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class ); cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
cfg.addResource( "org/hibernate/test/annotations/orm.xml"); cfg.addResource( "org/hibernate/test/annotations/orm.xml" );
cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml"); cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml" );
cfg.buildSessionFactory(); cfg.buildSessionFactory();
fail( "Should not be able to map the same entity name twice" ); fail( "Should not be able to map the same entity name twice" );
} }

View File

@ -75,7 +75,8 @@ import org.xml.sax.SAXNotSupportedException;
public class JPAOverridenAnnotationReaderTest extends TestCase { public class JPAOverridenAnnotationReaderTest extends TestCase {
public void testMappedSuperclassAnnotations() throws Exception { public void testMappedSuperclassAnnotations() throws Exception {
XMLContext context = buildContext( XMLContext context = buildContext(
"org/hibernate/test/annotations/reflection/metadata-complete.xml" ); "org/hibernate/test/annotations/reflection/metadata-complete.xml"
);
JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( Organization.class, context ); JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( Organization.class, context );
assertTrue( reader.isAnnotationPresent( MappedSuperclass.class ) ); assertTrue( reader.isAnnotationPresent( MappedSuperclass.class ) );
} }
@ -212,7 +213,8 @@ public class JPAOverridenAnnotationReaderTest extends TestCase {
public void testEntityRelatedAnnotationsMetadataComplete() throws Exception { public void testEntityRelatedAnnotationsMetadataComplete() throws Exception {
XMLContext context = buildContext( XMLContext context = buildContext(
"org/hibernate/test/annotations/reflection/metadata-complete.xml" ); "org/hibernate/test/annotations/reflection/metadata-complete.xml"
);
JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( Administration.class, context ); JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( Administration.class, context );
assertNotNull( reader.getAnnotation( Entity.class ) ); assertNotNull( reader.getAnnotation( Entity.class ) );
assertEquals( assertEquals(
@ -269,7 +271,8 @@ public class JPAOverridenAnnotationReaderTest extends TestCase {
assertEquals( TemporalType.DATE, reader.getAnnotation( Temporal.class ).value() ); assertEquals( TemporalType.DATE, reader.getAnnotation( Temporal.class ).value() );
context = buildContext( context = buildContext(
"org/hibernate/test/annotations/reflection/metadata-complete.xml" ); "org/hibernate/test/annotations/reflection/metadata-complete.xml"
);
method = Administration.class.getDeclaredMethod( "getId" ); method = Administration.class.getDeclaredMethod( "getId" );
reader = new JPAOverridenAnnotationReader( method, context ); reader = new JPAOverridenAnnotationReader( method, context );
assertNotNull( assertNotNull(
@ -295,7 +298,8 @@ public class JPAOverridenAnnotationReaderTest extends TestCase {
public void testBasicRelatedAnnotations() throws Exception { public void testBasicRelatedAnnotations() throws Exception {
XMLContext context = buildContext( XMLContext context = buildContext(
"org/hibernate/test/annotations/reflection/metadata-complete.xml" ); "org/hibernate/test/annotations/reflection/metadata-complete.xml"
);
Field field = BusTrip.class.getDeclaredField( "status" ); Field field = BusTrip.class.getDeclaredField( "status" );
JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( field, context ); JPAOverridenAnnotationReader reader = new JPAOverridenAnnotationReader( field, context );
assertNotNull( reader.getAnnotation( Enumerated.class ) ); assertNotNull( reader.getAnnotation( Enumerated.class ) );
@ -354,7 +358,8 @@ public class JPAOverridenAnnotationReaderTest extends TestCase {
assertEquals( "test", reader.getAnnotation( OneToOne.class ).mappedBy() ); assertEquals( "test", reader.getAnnotation( OneToOne.class ).mappedBy() );
context = buildContext( context = buildContext(
"org/hibernate/test/annotations/reflection/metadata-complete.xml" ); "org/hibernate/test/annotations/reflection/metadata-complete.xml"
);
field = BusTrip.class.getDeclaredField( "players" ); field = BusTrip.class.getDeclaredField( "players" );
reader = new JPAOverridenAnnotationReader( field, context ); reader = new JPAOverridenAnnotationReader( field, context );
assertNotNull( reader.getAnnotation( OneToMany.class ) ); assertNotNull( reader.getAnnotation( OneToMany.class ) );

View File

@ -23,7 +23,8 @@ public class XMLContextTest extends TestCase {
XMLHelper xmlHelper = new XMLHelper(); XMLHelper xmlHelper = new XMLHelper();
ClassLoader cl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream( InputStream is = cl.getResourceAsStream(
"org/hibernate/test/annotations/reflection/orm.xml" ); "org/hibernate/test/annotations/reflection/orm.xml"
);
assertNotNull( "ORM.xml not found", is ); assertNotNull( "ORM.xml not found", is );
XMLContext context = new XMLContext(); XMLContext context = new XMLContext();
List errors = new ArrayList(); List errors = new ArrayList();

View File

@ -8,6 +8,7 @@ import org.hibernate.test.annotations.TestCase;
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
public class HbmWithIdentityTest extends TestCase { public class HbmWithIdentityTest extends TestCase {
public void testManyToOneAndInterface() throws Exception { public void testManyToOneAndInterface() throws Exception {
Session s = openSession(); Session s = openSession();
s.getTransaction().begin(); s.getTransaction().begin();
@ -27,10 +28,8 @@ public class HbmWithIdentityTest extends TestCase {
return super.runForCurrentDialect() && getDialect().supportsIdentityColumns(); return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
} }
protected Class[] getMappings() { protected Class[] getMappings() {
return new Class[]{ return new Class[] {
Sky.class, Sky.class,
ZImpl.class ZImpl.class
@ -39,9 +38,10 @@ public class HbmWithIdentityTest extends TestCase {
@Override @Override
protected String[] getXmlFiles() { protected String[] getXmlFiles() {
return new String[]{ return new String[] {
"org/hibernate/test/annotations/xml/hbm/A.hbm.xml", "org/hibernate/test/annotations/xml/hbm/A.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/B.hbm.xml" "org/hibernate/test/annotations/xml/hbm/B.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/CloudType.hbm.xml"
}; };
} }
} }