re-enable tests

This commit is contained in:
Steve Ebersole 2021-03-19 16:24:59 -05:00
parent cc105596b4
commit 6d49d1c49f
7 changed files with 46 additions and 125 deletions

View File

@ -0,0 +1,11 @@
/*
* 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
*/
/**
* Internal utility classes
*/
package org.hibernate.internal.util;

View File

@ -1,15 +0,0 @@
<!--
~ 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>.
-->
<html>
<head></head>
<body>
<p>
Internal utility classes.
</p>
</body>
</html>

View File

@ -1,91 +0,0 @@
/*
* 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;
import org.hibernate.jpa.spi.JpaCompliance;
/**
* @author Steve Ebersole
*/
public class JpaComplianceTestingImpl implements JpaCompliance {
public static JpaCompliance normal() {
return new JpaComplianceTestingImpl();
}
public static JpaCompliance withTransactionCompliance() {
final JpaComplianceTestingImpl compliance = new JpaComplianceTestingImpl();
compliance.transactionCompliance = true;
return compliance;
}
public static JpaCompliance withQueryCompliance() {
final JpaComplianceTestingImpl compliance = new JpaComplianceTestingImpl();
compliance.queryCompliance = true;
return compliance;
}
public static JpaCompliance withListCompliance() {
final JpaComplianceTestingImpl compliance = new JpaComplianceTestingImpl();
compliance.listCompliance = true;
return compliance;
}
public static JpaCompliance withClosedCompliance() {
final JpaComplianceTestingImpl compliance = new JpaComplianceTestingImpl();
compliance.closedCompliance = true;
return compliance;
}
private boolean queryCompliance;
private boolean transactionCompliance;
private boolean listCompliance;
private boolean closedCompliance;
private boolean proxyCompliance;
private boolean cacheCompliance;
private boolean idGeneratorNameScopeCompliance;
private boolean orderByCompliance;
@Override
public boolean isJpaQueryComplianceEnabled() {
return queryCompliance;
}
@Override
public boolean isJpaTransactionComplianceEnabled() {
return transactionCompliance;
}
@Override
public boolean isJpaListComplianceEnabled() {
return listCompliance;
}
@Override
public boolean isJpaOrderByMappingComplianceEnabled() {
return orderByCompliance;
}
@Override
public boolean isJpaClosedComplianceEnabled() {
return closedCompliance;
}
@Override
public boolean isJpaProxyComplianceEnabled() {
return proxyCompliance;
}
@Override
public boolean isJpaCacheComplianceEnabled() {
return cacheCompliance;
}
@Override
public boolean isGlobalGeneratorScopeEnabled() {
return idGeneratorNameScopeCompliance;
}
}

View File

@ -0,0 +1,12 @@
/*
* 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
*/
/**
* Tests for various "internal" aspects of Hibernate, especially centered
* around its {@link org.hibernate.internal.util} package
*/
package org.hibernate.orm.test.internal;

View File

@ -1,11 +1,14 @@
/*
* 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>.
* 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.internal.util;
package org.hibernate.orm.test.internal.utils;
import org.hibernate.internal.util.MathHelper;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
@ -17,7 +20,7 @@ public class MathHelperTest {
@Test
public void ceilingPowerOfTwo() {
assertEquals( 1, MathHelper.ceilingPowerOfTwo( 1 ) );
Assert.assertEquals( 1, MathHelper.ceilingPowerOfTwo( 1 ) );
assertEquals( 2, MathHelper.ceilingPowerOfTwo( 2 ) );
assertEquals( 4, MathHelper.ceilingPowerOfTwo( 3 ) );
assertEquals( 4, MathHelper.ceilingPowerOfTwo( 4 ) );

View File

@ -1,10 +1,10 @@
/*
* 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>.
* 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.internal.util;
package org.hibernate.orm.test.internal.utils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -13,7 +13,8 @@ import javax.persistence.FetchType;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.util.hib3rnat3.C0nst4nts३;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.testing.TestForIssue;
@ -23,8 +24,8 @@ import org.junit.Test;
import org.mockito.Mockito;
import static java.lang.Integer.valueOf;
import static org.hibernate.internal.util.ReflectHelperTest.Status.OFF;
import static org.hibernate.internal.util.ReflectHelperTest.Status.ON;
import static org.hibernate.orm.test.internal.utils.ReflectHelperTest.Status.OFF;
import static org.hibernate.orm.test.internal.utils.ReflectHelperTest.Status.ON;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@ -171,8 +172,8 @@ public class ReflectHelperTest {
public void test_getConstantValue_enumClass() {
when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.ReflectHelperTest$Status", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status", sessionFactoryImplementorMock);
assertNull(value);
verify(classLoaderServiceMock, never()).classForName( eq("org.hibernate.internal.util") );
}
@ -181,20 +182,20 @@ public class ReflectHelperTest {
public void test_getConstantValue_nestedEnum() {
when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.ReflectHelperTest$Status.ON", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status" ) ).thenReturn( (Class) Status.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status.ON", sessionFactoryImplementorMock);
assertEquals( ON, value );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.ReflectHelperTest$Status") );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.orm.test.internal.utils.ReflectHelperTest$Status") );
}
@Test
public void test_getConstantValue_constant_digits() {
when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३" ) ).thenReturn( (Class) C0nst4nts३.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३.ABC_DEF", sessionFactoryImplementorMock);
when( classLoaderServiceMock.classForName( "org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३" ) ).thenReturn( (Class) C0nst4nts३.class );
Object value = ReflectHelper.getConstantValue( "org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३.ABC_DEF", sessionFactoryImplementorMock);
assertEquals( C0nst4nts३.ABC_DEF, value );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.hib3rnat3.C0nst4nts३") );
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.orm.test.internal.utils.hib3rnat3.C0nst4nts३") );
}
@Test

View File

@ -4,7 +4,7 @@
* 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.internal.util.hib3rnat3;
package org.hibernate.orm.test.internal.utils.hib3rnat3;
/**
* @author Vlad Mihalcea