Skip to content

Commit

Permalink
HHH-7503 Formatting, no functional changes. Adding missing license he…
Browse files Browse the repository at this point in the history
…ader and removing '//$Id$'
  • Loading branch information
hferentschik committed Aug 23, 2012
1 parent 8e8d681 commit 088990c
Show file tree
Hide file tree
Showing 33 changed files with 858 additions and 294 deletions.
@@ -1,5 +1,28 @@
//$Id$
/*
* 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;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
Expand All @@ -15,9 +38,7 @@
* @author Emmanuel Bernard
*/
@Entity()
@Inheritance(
strategy = InheritanceType.JOINED
)
@Inheritance(strategy = InheritanceType.JOINED)
public class Boat implements Serializable {
private Integer id;
private int size;
Expand Down
@@ -1,5 +1,28 @@
//$Id$
/*
* 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;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -24,17 +47,20 @@
*/
public class ConfigurationTest {
private ServiceRegistry serviceRegistry;
@Before

@Before
public void setUp() {
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() );
}
@After

@After
public void tearDown() {
if ( serviceRegistry != null ) {
ServiceRegistryBuilder.destroy( serviceRegistry );
}
}
@Test

@Test
public void testDeclarativeMix() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand All @@ -51,7 +77,8 @@ public void testDeclarativeMix() throws Exception {
s.close();
sf.close();
}
@Test

@Test
public void testIgnoringHbm() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand All @@ -66,7 +93,7 @@ public void testIgnoringHbm() throws Exception {
s.createQuery( "from Boat" ).list();
fail( "Boat should not be mapped" );
}
catch (HibernateException e) {
catch ( HibernateException e ) {
//all good
}
q = s.createQuery( "from Plane" );
Expand All @@ -75,7 +102,8 @@ public void testIgnoringHbm() throws Exception {
s.close();
sf.close();
}
@Test

@Test
public void testPrecedenceHbm() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand All @@ -92,15 +120,16 @@ public void testPrecedenceHbm() throws Exception {
s.getTransaction().commit();
s.clear();
Transaction tx = s.beginTransaction();
boat = (Boat) s.get( Boat.class, boat.getId() );
boat = ( Boat ) s.get( Boat.class, boat.getId() );
assertTrue( "Annotation has precedence", 34 != boat.getWeight() );
s.delete( boat );
//s.getTransaction().commit();
tx.commit();
s.close();
sf.close();
}
@Test

@Test
public void testPrecedenceAnnotation() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand All @@ -118,14 +147,15 @@ public void testPrecedenceAnnotation() throws Exception {
s.getTransaction().commit();
s.clear();
Transaction tx = s.beginTransaction();
boat = (Boat) s.get( Boat.class, boat.getId() );
boat = ( Boat ) s.get( Boat.class, boat.getId() );
assertTrue( "Annotation has precedence", 34 == boat.getWeight() );
s.delete( boat );
tx.commit();
s.close();
sf.close();
}
@Test

@Test
public void testHbmWithSubclassExtends() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand All @@ -143,7 +173,8 @@ public void testHbmWithSubclassExtends() throws Exception {
s.close();
sf.close();
}
@Test

@Test
public void testAnnReferencesHbm() throws Exception {
Configuration cfg = new Configuration();
cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
Expand Down
@@ -1,5 +1,28 @@
//$Id$
/*
* 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.inheritance;

import javax.persistence.Entity;

/**
Expand Down
@@ -1,5 +1,28 @@
//$Id$
/*
* 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.inheritance;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
Expand All @@ -15,9 +38,10 @@
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@PrimaryKeyJoinColumns(
{@PrimaryKeyJoinColumn(name = "carrot_farmer", referencedColumnName = "farmer"),
@PrimaryKeyJoinColumn(name = "harvest", referencedColumnName = "harvestDate")
})
{
@PrimaryKeyJoinColumn(name = "carrot_farmer", referencedColumnName = "farmer"),
@PrimaryKeyJoinColumn(name = "harvest", referencedColumnName = "harvestDate")
})
@OnDelete(action = OnDeleteAction.CASCADE)
public class Carrot extends Vegetable {
private int length;
Expand Down
@@ -1,5 +1,28 @@
//$Id$
/*
* 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.inheritance;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
Expand Down
Expand Up @@ -55,6 +55,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
protected boolean isCleanupTestDataRequired() {
return true;
}

@Test
public void testPolymorphism() throws Exception {
Session s = openSession();
Expand All @@ -76,7 +77,7 @@ public void testPolymorphism() throws Exception {
assertNotNull( a320s );
assertEquals( 1, a320s.size() );
assertTrue( a320s.get( 0 ) instanceof A320 );
assertEquals( "5.0", ( (A320) a320s.get( 0 ) ).getJavaEmbeddedVersion() );
assertEquals( "5.0", ( ( A320 ) a320s.get( 0 ) ).getJavaEmbeddedVersion() );
q = s.createQuery( "from " + Plane.class.getName() );
List planes = q.list();
assertNotNull( planes );
Expand Down Expand Up @@ -123,7 +124,7 @@ public void testEmbeddedSuperclass() throws Exception {

s = openSession();
tx = s.beginTransaction();
p = (Plane) s.get( Plane.class, p.getId() );
p = ( Plane ) s.get( Plane.class, p.getId() );
assertNotNull( p );
assertEquals( true, p.isAlive() );
assertEquals( 150, p.getNbrOfSeats() );
Expand Down Expand Up @@ -158,7 +159,7 @@ public void testFormula() throws Exception {
List result = s.createCriteria( Noise.class ).list();
assertNotNull( result );
assertEquals( 1, result.size() );
white = (Noise) result.get( 0 );
white = ( Noise ) result.get( 0 );
assertNull( white.getType() );
s.delete( white );
result = s.createCriteria( Rock.class ).list();
Expand All @@ -173,7 +174,7 @@ public void testFormula() throws Exception {

@Override
protected Class[] getAnnotatedClasses() {
return new Class[]{
return new Class[] {
A320b.class, //subclasses should be properly reordered
Plane.class,
A320.class,
Expand Down
@@ -1,5 +1,28 @@
//$Id$
/*
* 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.inheritance;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
Expand All @@ -21,7 +44,7 @@
public class Tomato extends Vegetable {
private int size;

@Column(name="tom_size")
@Column(name = "tom_size")
public int getSize() {
return size;
}
Expand Down

0 comments on commit 088990c

Please sign in to comment.