From 1ec1254babb900798cb118ca28185b58ec93b055 Mon Sep 17 00:00:00 2001 From: Tair Sabirgaliev Date: Sun, 22 Jul 2012 02:13:54 +0600 Subject: [PATCH] Test: order of affects caching configuration --- .../test/cfg/cache/BaseClass.hbm.xml | 16 +++++++ .../hibernate/test/cfg/cache/BaseClass.java | 23 ++++++++++ .../cfg/cache/CacheConfigurationTest.java | 44 +++++++++++++++++++ .../org/hibernate/test/cfg/cache/Item.hbm.xml | 17 +++++++ .../org/hibernate/test/cfg/cache/Item.java | 24 ++++++++++ .../hibernate/test/cfg/cache/SubClass.hbm.xml | 14 ++++++ .../hibernate/test/cfg/cache/SubClass.java | 17 +++++++ .../test/cfg/cache/hibernate.cfg.xml | 12 +++++ 8 files changed, 167 insertions(+) create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.hbm.xml create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.java create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.hbm.xml create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.java create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.hbm.xml create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.java create mode 100644 hibernate-core/src/test/java/org/hibernate/test/cfg/cache/hibernate.cfg.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.hbm.xml new file mode 100644 index 0000000000..f002a86bca --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.hbm.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.java new file mode 100644 index 0000000000..61ff20ff94 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/BaseClass.java @@ -0,0 +1,23 @@ +package org.hibernate.test.cfg.cache; + +public class BaseClass { + Long id; + String value; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java new file mode 100644 index 0000000000..ece105aacc --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java @@ -0,0 +1,44 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2009-2011, 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.cfg.cache; + +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.testing.junit4.BaseUnitTestCase; +import org.junit.Test; + +/** + * Tests using of cacheable configuration files. + * + * @author Tair Sabirgaliev + */ +public class CacheConfigurationTest extends BaseUnitTestCase { + public static final String CFG_XML = "org/hibernate/test/cfg/cache/hibernate.cfg.xml"; + + @Test + public void testCacheConfiguration() throws Exception { + Configuration cfg = new Configuration().configure(CFG_XML); + SessionFactory sessionFactory = cfg.buildSessionFactory(); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.hbm.xml new file mode 100644 index 0000000000..808831f23d --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.hbm.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.java new file mode 100644 index 0000000000..97ffa83b4e --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/Item.java @@ -0,0 +1,24 @@ +package org.hibernate.test.cfg.cache; + +public class Item { + Long id; + + String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.hbm.xml new file mode 100644 index 0000000000..52fa3c2e7a --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.hbm.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.java new file mode 100644 index 0000000000..a53641874b --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/SubClass.java @@ -0,0 +1,17 @@ +package org.hibernate.test.cfg.cache; + +import java.util.HashSet; +import java.util.Set; + +public class SubClass extends BaseClass { + Set items = new HashSet(); + + public Set getItems() { + return items; + } + + public void setItems(Set items) { + this.items = items; + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/hibernate.cfg.xml b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/hibernate.cfg.xml new file mode 100644 index 0000000000..b1cb10071f --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/hibernate.cfg.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + +