HHH-8497 - Fix and test

This commit is contained in:
Lukasz Antoniak 2013-11-06 21:31:30 +01:00
parent fb6d83b828
commit 0fab6a4226
3 changed files with 50 additions and 5 deletions

View File

@ -20,6 +20,7 @@
*/
package org.hibernate.envers.entities;
import org.hibernate.envers.RevisionType;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.service.ServiceRegistry;
@ -32,7 +33,7 @@ public class TypeContributorImpl implements TypeContributor {
@Override
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
typeContributions.contributeType( new RevisionTypeType(),
new String[] { RevisionTypeType.class.getName() } );
new String[] { RevisionType.class.getName() } );
}
}

View File

@ -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() );
}
}

View File

@ -26,6 +26,7 @@ package org.hibernate.envers.test.integration.basic;
import java.util.Arrays;
import javax.persistence.EntityManager;
import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
@ -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 ) );
}
}
}