HHH-12508 : test cases

(cherry picked from commit 66d7196168)
This commit is contained in:
Gail Badner 2018-04-19 16:44:29 -07:00
parent 01a87d4abd
commit c2d98d78ea
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package org.hibernate.test.cache;
import org.hibernate.cache.internal.NoCachingRegionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
/**
* @author Gail Badner.
*/
public class NoCachingRegionFactoryTest extends BaseCoreFunctionalTestCase {
@Override
protected void configure(Configuration configuration) {
configuration.setProperty( AvailableSettings.CACHE_REGION_FACTORY, NoCachingRegionFactory.class.getName() );
}
@Test
@TestForIssue( jiraKey = "HHH-12508" )
public void testSessionFactoryOptionsConsistent() {
assertFalse( sessionFactory().getSessionFactoryOptions().isSecondLevelCacheEnabled() );
}
}

View File

@ -0,0 +1,34 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.stats;
import org.hibernate.cache.internal.NoCachingRegionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.stat.Statistics;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Gail Badner
*/
public class StatisticsWithNoCachingTest extends BaseCoreFunctionalTestCase {
@Override
protected void configure(Configuration configuration) {
configuration.setProperty( AvailableSettings.CACHE_REGION_FACTORY, NoCachingRegionFactory.class.getName() );
}
@Test
@TestForIssue( jiraKey = "HHH-12508")
public void testUncachedRegion() {
final Statistics statistics = sessionFactory().getStatistics();
statistics.getSecondLevelCacheStatistics( "hibernate.test.unknown" );
}
}