fix some warnings in a couple of tests
This commit is contained in:
parent
56232a0159
commit
135216b0a9
|
@ -38,7 +38,7 @@ import static org.junit.Assert.fail;
|
||||||
public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultValue() {
|
public void testDefaultValue() {
|
||||||
Join join = (Join) metadata().getEntityBinding( Life.class.getName() ).getJoinClosureIterator().next();
|
Join join = metadata().getEntityBinding( Life.class.getName() ).getJoinClosureIterator().next();
|
||||||
assertEquals( "ExtendedLife", join.getTable().getName() );
|
assertEquals( "ExtendedLife", join.getTable().getName() );
|
||||||
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
|
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
|
||||||
owner.setName( "LIFE_ID" );
|
owner.setName( "LIFE_ID" );
|
||||||
|
@ -62,8 +62,8 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompositePK() throws Exception {
|
public void testCompositePK() {
|
||||||
Join join = (Join) metadata().getEntityBinding( Dog.class.getName() ).getJoinClosureIterator().next();
|
Join join = metadata().getEntityBinding( Dog.class.getName() ).getJoinClosureIterator().next();
|
||||||
assertEquals( "DogThoroughbred", join.getTable().getName() );
|
assertEquals( "DogThoroughbred", join.getTable().getName() );
|
||||||
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
|
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
|
||||||
owner.setName( "OWNER_NAME" );
|
owner.setName( "OWNER_NAME" );
|
||||||
|
@ -91,7 +91,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExplicitValue() throws Exception {
|
public void testExplicitValue() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction tx = s.beginTransaction();
|
Transaction tx = s.beginTransaction();
|
||||||
Death death = new Death();
|
Death death = new Death();
|
||||||
|
@ -152,7 +152,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
SysGroupsOrm g=new SysGroupsOrm();
|
SysGroupsOrm g=new SysGroupsOrm();
|
||||||
SysUserOrm u=new SysUserOrm();
|
SysUserOrm u=new SysUserOrm();
|
||||||
u.setGroups( new ArrayList<SysGroupsOrm>() );
|
u.setGroups( new ArrayList<>() );
|
||||||
u.getGroups().add( g );
|
u.getGroups().add( g );
|
||||||
s.save( g );
|
s.save( g );
|
||||||
s.save( u );
|
s.save( u );
|
||||||
|
@ -161,7 +161,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUniqueConstaintOnSecondaryTable() throws Exception {
|
public void testUniqueConstaintOnSecondaryTable() {
|
||||||
Cat cat = new Cat();
|
Cat cat = new Cat();
|
||||||
cat.setStoryPart2( "My long story" );
|
cat.setStoryPart2( "My long story" );
|
||||||
Cat cat2 = new Cat();
|
Cat cat2 = new Cat();
|
||||||
|
@ -189,7 +189,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFetchModeOnSecondaryTable() throws Exception {
|
public void testFetchModeOnSecondaryTable() {
|
||||||
Cat cat = new Cat();
|
Cat cat = new Cat();
|
||||||
cat.setStoryPart2( "My long story" );
|
cat.setStoryPart2( "My long story" );
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
|
@ -207,7 +207,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomSQL() throws Exception {
|
public void testCustomSQL() {
|
||||||
Cat cat = new Cat();
|
Cat cat = new Cat();
|
||||||
String storyPart2 = "My long story";
|
String storyPart2 = "My long story";
|
||||||
cat.setStoryPart2( storyPart2 );
|
cat.setStoryPart2( storyPart2 );
|
||||||
|
@ -218,7 +218,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
s.flush();
|
s.flush();
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
Cat c = (Cat) s.get( Cat.class, cat.getId() );
|
Cat c = s.get( Cat.class, cat.getId() );
|
||||||
assertEquals( storyPart2.toUpperCase(Locale.ROOT), c.getStoryPart2() );
|
assertEquals( storyPart2.toUpperCase(Locale.ROOT), c.getStoryPart2() );
|
||||||
|
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
|
@ -226,7 +226,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMappedSuperclassAndSecondaryTable() throws Exception {
|
public void testMappedSuperclassAndSecondaryTable() {
|
||||||
Session s = openSession( );
|
Session s = openSession( );
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
C c = new C();
|
C c = new C();
|
||||||
|
@ -236,7 +236,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
s.persist( c );
|
s.persist( c );
|
||||||
s.flush();
|
s.flush();
|
||||||
s.clear();
|
s.clear();
|
||||||
c= (C) s.get( C.class, c.getId() );
|
c= s.get( C.class, c.getId() );
|
||||||
assertNotNull( c.getCreateDate() );
|
assertNotNull( c.getCreateDate() );
|
||||||
assertNotNull( c.getName() );
|
assertNotNull( c.getName() );
|
||||||
s.getTransaction().rollback();
|
s.getTransaction().rollback();
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
*/
|
*/
|
||||||
public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testEagerFetching() throws Exception {
|
public void testEagerFetching() {
|
||||||
final String clientName = "Emmanuel";
|
final String clientName = "Emmanuel";
|
||||||
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||||
Client c = new Client();
|
Client c = new Client();
|
||||||
|
@ -67,7 +67,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultOneToOne() throws Exception {
|
public void testDefaultOneToOne() {
|
||||||
//test a default one to one and a mappedBy in the other side
|
//test a default one to one and a mappedBy in the other side
|
||||||
Long customerId = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
Long customerId = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||||
Customer c = new Customer();
|
Customer c = new Customer();
|
||||||
|
@ -94,7 +94,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOneToOneWithExplicitFk() throws Exception {
|
public void testOneToOneWithExplicitFk() {
|
||||||
final Client c = new Client();
|
final Client c = new Client();
|
||||||
Address a = new Address();
|
Address a = new Address();
|
||||||
a.setCity( "Paris" );
|
a.setCity( "Paris" );
|
||||||
|
@ -115,7 +115,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOneToOneWithExplicitSecondaryTableFk() throws Exception {
|
public void testOneToOneWithExplicitSecondaryTableFk() {
|
||||||
final Client c = new Client();
|
final Client c = new Client();
|
||||||
Address a = new Address();
|
Address a = new Address();
|
||||||
a.setCity( "Paris" );
|
a.setCity( "Paris" );
|
||||||
|
@ -136,7 +136,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnidirectionalTrueOneToOne() throws Exception {
|
public void testUnidirectionalTrueOneToOne() {
|
||||||
final Body b = new Body();
|
final Body b = new Body();
|
||||||
final Heart h = new Heart();
|
final Heart h = new Heart();
|
||||||
b.setHeart( h );
|
b.setHeart( h );
|
||||||
|
@ -157,7 +157,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompositePk() throws Exception {
|
public void testCompositePk() {
|
||||||
final ComputerPk cid = new ComputerPk();
|
final ComputerPk cid = new ComputerPk();
|
||||||
final SerialNumber sn = new SerialNumber();
|
final SerialNumber sn = new SerialNumber();
|
||||||
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||||
|
@ -184,7 +184,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBidirectionalTrueOneToOne() throws Exception {
|
public void testBidirectionalTrueOneToOne() {
|
||||||
try (Session s = openSession()) {
|
try (Session s = openSession()) {
|
||||||
Party party = new Party();
|
Party party = new Party();
|
||||||
PartyAffiliate affiliate = new PartyAffiliate();
|
PartyAffiliate affiliate = new PartyAffiliate();
|
||||||
|
@ -234,7 +234,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBidirectionalFkOneToOne() throws Exception {
|
public void testBidirectionalFkOneToOne() {
|
||||||
try (Session s = openSession()) {
|
try (Session s = openSession()) {
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
Trousers trousers = new Trousers();
|
Trousers trousers = new Trousers();
|
||||||
|
@ -303,13 +303,13 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
@TestForIssue( jiraKey = "HHH-4606" )
|
@TestForIssue( jiraKey = "HHH-4606" )
|
||||||
public void testJoinColumnConfiguredInXml() {
|
public void testJoinColumnConfiguredInXml() {
|
||||||
PersistentClass pc = metadata().getEntityBinding( Son.class.getName() );
|
PersistentClass pc = metadata().getEntityBinding( Son.class.getName() );
|
||||||
Iterator iter = pc.getJoinIterator();
|
Iterator<Join> iter = pc.getJoinIterator();
|
||||||
Table table = ( ( Join ) iter.next() ).getTable();
|
Table table = iter.next().getTable();
|
||||||
Iterator columnIter = table.getColumnIterator();
|
Iterator<Column> columnIter = table.getColumnIterator();
|
||||||
boolean fooFound = false;
|
boolean fooFound = false;
|
||||||
boolean barFound = false;
|
boolean barFound = false;
|
||||||
while ( columnIter.hasNext() ) {
|
while ( columnIter.hasNext() ) {
|
||||||
Column column = ( Column ) columnIter.next();
|
Column column = columnIter.next();
|
||||||
if ( column.getName().equals( "foo" ) ) {
|
if ( column.getName().equals( "foo" ) ) {
|
||||||
fooFound = true;
|
fooFound = true;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-5757")
|
@TestForIssue(jiraKey = "HHH-5757")
|
||||||
public void testHqlQuery() throws Exception {
|
public void testHqlQuery() {
|
||||||
//test a default one to one and a mappedBy in the other side
|
//test a default one to one and a mappedBy in the other side
|
||||||
final Passport passport = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
final Passport passport = TransactionUtil.doInHibernate( this::sessionFactory, session -> {
|
||||||
Customer c = new Customer();
|
Customer c = new Customer();
|
||||||
|
|
Loading…
Reference in New Issue