Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
hibernate-core/src/test/java/org/hibernate/jpa/test/boot/DeprecatedProviderCheckerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.jpa.test.boot; | ||
|
||
|
||
import org.hibernate.internal.HEMLogging; | ||
import org.hibernate.jpa.boot.spi.ProviderChecker; | ||
|
||
import org.hibernate.testing.TestForIssue; | ||
import org.hibernate.testing.logger.LoggerInspectionRule; | ||
import org.hibernate.testing.logger.Triggerable; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* Tests that deprecated (and removed) provider, "org.hibernate.ejb.HibernatePersistence", | ||
* is recognized as a Hibernate persistence provider. | ||
* | ||
* @author Gail Badner | ||
*/ | ||
public class DeprecatedProviderCheckerTest { | ||
final static String DEPRECATED_PROVIDER_NAME = "org.hibernate.ejb.HibernatePersistence"; | ||
|
||
@Rule | ||
public LoggerInspectionRule logInspection = new LoggerInspectionRule( | ||
HEMLogging.messageLogger( ProviderChecker.class.getName() ) | ||
); | ||
|
||
@Test | ||
@TestForIssue( jiraKey = "HHH-13027") | ||
public void testDeprecatedProvider() { | ||
Triggerable triggerable = logInspection.watchForLogMessages( "HHH015016" ); | ||
triggerable.reset(); | ||
assertTrue( ProviderChecker.hibernateProviderNamesContain( DEPRECATED_PROVIDER_NAME ) ); | ||
triggerable.wasTriggered(); | ||
assertEquals( | ||
"HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; [org.hibernate.jpa.HibernatePersistenceProvider] will be used instead.", | ||
triggerable.triggerMessage() | ||
); | ||
} | ||
} | ||
|