HHH-8497 - Fix and test
This commit is contained in:
parent
3b85ae8658
commit
e65abd026c
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.envers.internal.entities;
|
||||
|
||||
import org.hibernate.envers.RevisionType;
|
||||
import org.hibernate.metamodel.spi.TypeContributions;
|
||||
import org.hibernate.metamodel.spi.TypeContributor;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
@ -37,7 +38,7 @@ public class TypeContributorImpl implements TypeContributor {
|
|||
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
typeContributions.contributeType(
|
||||
new RevisionTypeType(),
|
||||
new String[] { RevisionTypeType.class.getName() }
|
||||
new String[] { RevisionType.class.getName() }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2013, 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.envers.test.integration.basic;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
/**
|
||||
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||
*/
|
||||
@TestForIssue(jiraKey = "HHH-8497")
|
||||
public class ClassicQueryTranslatorFactoryTest extends Simple {
|
||||
@Override
|
||||
protected void addConfigOptions(Map options) {
|
||||
super.addConfigOptions( options );
|
||||
options.put( Environment.QUERY_TRANSLATOR, ClassicQueryTranslatorFactory.class.getName() );
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
|||
import org.hibernate.envers.test.Priority;
|
||||
import org.hibernate.envers.test.entities.IntTestEntity;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +62,7 @@ public class Simple extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
@Test
|
||||
public void testRevisionsCounts() {
|
||||
assert Arrays.asList( 1, 2 ).equals( getAuditReader().getRevisions( IntTestEntity.class, id1 ) );
|
||||
Assert.assertEquals( Arrays.asList( 1, 2 ), getAuditReader().getRevisions( IntTestEntity.class, id1 ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -69,7 +70,7 @@ public class Simple extends BaseEnversJPAFunctionalTestCase {
|
|||
IntTestEntity ver1 = new IntTestEntity( 10, id1 );
|
||||
IntTestEntity ver2 = new IntTestEntity( 20, id1 );
|
||||
|
||||
assert getAuditReader().find( IntTestEntity.class, id1, 1 ).equals( ver1 );
|
||||
assert getAuditReader().find( IntTestEntity.class, id1, 2 ).equals( ver2 );
|
||||
Assert.assertEquals( ver1, getAuditReader().find( IntTestEntity.class, id1, 1 ) );
|
||||
Assert.assertEquals( ver2, getAuditReader().find( IntTestEntity.class, id1, 2 ) );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue