Re-enabled additional tests

This commit is contained in:
Andrea Boriero 2021-09-27 12:47:46 +02:00
parent aa514f7cfc
commit 33a2c88279
7 changed files with 3538 additions and 1707 deletions

View File

@ -32,9 +32,9 @@ public class AliasToEntityMapResultTransformer extends AliasedTupleSubsetResultT
@Override @Override
public Object transformTuple(Object[] tuple, String[] aliases) { public Object transformTuple(Object[] tuple, String[] aliases) {
Map result = CollectionHelper.mapOfSize( tuple.length ); Map result = CollectionHelper.mapOfSize( tuple.length );
for ( int i=0; i<tuple.length; i++ ) { for ( int i = 0; i < tuple.length; i++ ) {
String alias = aliases[i]; String alias = aliases[i];
if ( alias!=null ) { if ( alias != null ) {
result.put( alias, tuple[i] ); result.put( alias, tuple[i] );
} }
} }

View File

@ -0,0 +1,64 @@
/*
* 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.orm.test.querycache;
import org.hibernate.CacheMode;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
/**
* @author Gail Badner
*/
public class CriteriaQueryCacheIgnoreResultTransformerTest extends AbstractQueryCacheResultTransformerTest {
@Override
protected CacheMode getQueryCacheMode() {
return CacheMode.IGNORE;
}
@Override
protected void runTest(
HqlExecutor hqlExecutor,
CriteriaExecutor criteriaExecutor,
ResultChecker checker,
boolean isSingleResult,
SessionFactoryScope scope)
throws Exception {
createData( scope );
try {
if ( criteriaExecutor != null ) {
runTest( criteriaExecutor, checker, isSingleResult, scope );
}
}
finally {
deleteData( scope );
}
}
@Test
@Override
@FailureExpected(jiraKey = "N/A", reason = "Using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
public void testAliasToEntityMapNoProjectionList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionList( scope );
}
@Test
@Override
@FailureExpected(jiraKey = "N/A", reason = "Using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
public void testAliasToEntityMapNoProjectionMultiAndNullList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionMultiAndNullList( scope );
}
@Test
@Override
@FailureExpected(jiraKey = "N/A", reason = "Using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
public void testAliasToEntityMapNoProjectionNullAndNonNullAliasList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionNullAndNonNullAliasList( scope );
}
}

View File

@ -0,0 +1,19 @@
/*
* 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.orm.test.querycache;
import org.hibernate.CacheMode;
/**
* @author Gail Badner
*/
public class CriteriaQueryCacheNormalResultTransformerTest extends CriteriaQueryCachePutResultTransformerTest {
@Override
protected CacheMode getQueryCacheMode() {
return CacheMode.NORMAL;
}
}

View File

@ -0,0 +1,24 @@
/*
* 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.orm.test.querycache;
import org.hibernate.CacheMode;
/**
* @author Gail Badner
*/
public class CriteriaQueryCachePutResultTransformerTest extends CriteriaQueryCacheIgnoreResultTransformerTest {
@Override
protected CacheMode getQueryCacheMode() {
return CacheMode.PUT;
}
@Override
protected boolean areDynamicNonLazyAssociationsChecked() {
return false;
}
}

View File

@ -6,47 +6,55 @@
*/ */
package org.hibernate.orm.test.querycache; package org.hibernate.orm.test.querycache;
import org.junit.Test;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.orm.test.querycache.AbstractHqlQueryCacheResultTransformerTest;
import org.hibernate.testing.FailureExpected; import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
/** /**
* @author Gail Badner * @author Gail Badner
*/ */
public class HqlQueryCacheIgnoreResultTransformerTest extends AbstractHqlQueryCacheResultTransformerTest { public class HqlQueryCacheIgnoreResultTransformerTest extends AbstractQueryCacheResultTransformerTest {
@Override @Override
protected CacheMode getQueryCacheMode() { protected CacheMode getQueryCacheMode() {
return CacheMode.IGNORE; return CacheMode.IGNORE;
} }
@Test
@Override @Override
@FailureExpected( jiraKey = "N/A", message = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection" ) protected void runTest(
public void testAliasToEntityMapNoProjectionList() throws Exception { HqlExecutor hqlExecutor,
super.testAliasToEntityMapNoProjectionList(); CriteriaExecutor criteriaExecutor,
ResultChecker checker,
boolean isSingleResult,
SessionFactoryScope scope)
throws Exception {
createData( scope );
if ( hqlExecutor != null ) {
runTest( hqlExecutor, checker, isSingleResult, scope );
}
deleteData( scope );
} }
@Test @Test
@Override @Override
@FailureExpected( jiraKey = "N/A", message = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection" ) @FailureExpected(jiraKey = "N/A", reason = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
public void testAliasToEntityMapNoProjectionMultiAndNullList() throws Exception { public void testAliasToEntityMapNoProjectionList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionMultiAndNullList(); super.testAliasToEntityMapNoProjectionList( scope );
} }
@Test @Test
@Override @Override
@FailureExpected( jiraKey = "N/A", message = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection" ) @FailureExpected(jiraKey = "N/A", reason = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
public void testAliasToEntityMapNoProjectionNullAndNonNullAliasList() throws Exception { public void testAliasToEntityMapNoProjectionMultiAndNullList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionNullAndNonNullAliasList(); super.testAliasToEntityMapNoProjectionMultiAndNullList( scope );
} }
@Test @Test
@Override @Override
public void testMultiSelectNewMapUsingAliasesWithFetchJoinList() throws Exception { @FailureExpected(jiraKey = "N/A", reason = "HQL query using Transformers.ALIAS_TO_ENTITY_MAP with no projection")
super.testMultiSelectNewMapUsingAliasesWithFetchJoinList(); public void testAliasToEntityMapNoProjectionNullAndNonNullAliasList(SessionFactoryScope scope) throws Exception {
super.testAliasToEntityMapNoProjectionNullAndNonNullAliasList( scope );
} }
} }