HHH-7500 Using BaseAnnotationBindingTest as base for the test. This way @FailureExpectedWithNewMetamodel takes effect

This commit is contained in:
Hardy Ferentschik 2012-08-03 13:19:57 +02:00
parent 39f509e886
commit bdd8d49b6a
11 changed files with 279 additions and 63 deletions

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
@ -11,7 +34,7 @@ public class A {
@Id
private int id;
@OneToMany( mappedBy = "parent" )
@OneToMany(mappedBy = "parent")
List<C> children;
public A() {

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Entity;

View File

@ -26,20 +26,21 @@ package org.hibernate.test.annotations.idmanytoone.alphabetical;
import org.junit.Test;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase;
import org.hibernate.testing.junit4.Resources;
import static junit.framework.Assert.assertNotNull;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel
public class AlphabeticalIdManyToOneTest extends BaseCoreFunctionalTestCase {
public class AlphabeticalIdManyToOneTest extends BaseAnnotationBindingTestCase {
@Test
@Resources(annotatedClasses = { B.class, C.class, A.class })
public void testAlphabeticalTest() throws Exception {
//test through deployment
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { B.class, C.class, A.class };
for ( Class<?> annotatedClass : getAnnotatedClasses() ) {
assertNotNull( "The Binding for A should exist", getEntityBinding( annotatedClass ) );
}
}
}

View File

@ -25,24 +25,20 @@ package org.hibernate.test.annotations.idmanytoone.alphabetical;
import org.junit.Test;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase;
import org.hibernate.testing.junit4.Resources;
import static junit.framework.Assert.assertNotNull;
/**
* @author Emmanuel Bernard
*/
public class AlphabeticalManyToOneTest extends BaseCoreFunctionalTestCase {
public class AlphabeticalManyToOneTest extends BaseAnnotationBindingTestCase {
@Test
@Resources(annotatedClasses = { Acces.class, Droitacces.class, Benefserv.class, Service.class })
public void testAlphabeticalTest() throws Exception {
//test through deployment
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {
Acces.class,
Droitacces.class,
Benefserv.class,
Service.class
};
for ( Class<?> annotatedClass : getAnnotatedClasses() ) {
assertNotNull( "The Binding for A should exist", getEntityBinding( annotatedClass ) );
}
}
}

View File

@ -1,11 +1,34 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
@Entity
@IdClass( BId.class )
@IdClass(BId.class)
public class B {
@Id

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
@ -10,10 +33,10 @@ import javax.persistence.ManyToOne;
public class BId implements Serializable {
@ManyToOne
@JoinColumns( {
@JoinColumn( name = "aId", nullable = false ),
@JoinColumn( name = "bSequenceNumber", nullable = false )
} )
@JoinColumns({
@JoinColumn(name = "aId", nullable = false),
@JoinColumn(name = "bSequenceNumber", nullable = false)
})
private C parent;
private int sequenceNumber;
@ -48,21 +71,27 @@ public class BId implements Serializable {
@Override
public boolean equals(Object obj) {
if ( this == obj )
if ( this == obj ) {
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
final BId other = (BId) obj;
if ( parent == null ) {
if ( other.parent != null )
return false;
}
else if ( !parent.equals( other.parent ) )
if ( obj == null ) {
return false;
if ( sequenceNumber != other.sequenceNumber )
}
if ( getClass() != obj.getClass() ) {
return false;
}
final BId other = ( BId ) obj;
if ( parent == null ) {
if ( other.parent != null ) {
return false;
}
}
else if ( !parent.equals( other.parent ) ) {
return false;
}
if ( sequenceNumber != other.sequenceNumber ) {
return false;
}
return true;
}
}

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
@ -7,7 +30,7 @@ import javax.persistence.IdClass;
import javax.persistence.OneToMany;
@Entity
@IdClass( CId.class )
@IdClass(CId.class)
public class C {
@Id
@ -16,7 +39,7 @@ public class C {
@Id
private int sequenceNumber;
@OneToMany( mappedBy = "parent" )
@OneToMany(mappedBy = "parent")
List<B> children;
public C() {

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
@ -9,7 +32,7 @@ import javax.persistence.ManyToOne;
public class CId implements Serializable {
@ManyToOne
@JoinColumn( name = "aId", nullable = false )
@JoinColumn(name = "aId", nullable = false)
private A parent;
private int sequenceNumber;
@ -44,21 +67,27 @@ public class CId implements Serializable {
@Override
public boolean equals(Object obj) {
if ( this == obj )
if ( this == obj ) {
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
final CId other = (CId) obj;
if ( parent == null ) {
if ( other.parent != null )
return false;
}
else if ( !parent.equals( other.parent ) )
if ( obj == null ) {
return false;
if ( sequenceNumber != other.sequenceNumber )
}
if ( getClass() != obj.getClass() ) {
return false;
}
final CId other = ( CId ) obj;
if ( parent == null ) {
if ( other.parent != null ) {
return false;
}
}
else if ( !parent.equals( other.parent ) ) {
return false;
}
if ( sequenceNumber != other.sequenceNumber ) {
return false;
}
return true;
}

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -1,5 +1,28 @@
//$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.idmanytoone.alphabetical;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;
@ -7,6 +30,6 @@ import javax.persistence.Id;
@Entity
public class Service {
@Id
private BigInteger idpk;
@Id
private BigInteger idpk;
}