finish both 'loader' and 'HQL' testing

This commit is contained in:
Nathan Xu 2020-03-12 16:24:55 -04:00 committed by Steve Ebersole
parent a3dce5f00a
commit e2ddd800ac
2 changed files with 16 additions and 5 deletions

View File

@ -291,9 +291,13 @@ public class EntityGraphLoadPlanBuilderTest {
); );
// Check the from-clause // Check the from-clause
assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> {
assertThat( tableGroup.getTableGroupJoins(), isEmpty() ) assertThat( tableGroup.getTableGroupJoins(), hasSize( 1 ) );
);
final TableGroup compositeTableGroup = CollectionUtils.getOnlyElement( tableGroup.getTableGroupJoins() ).getJoinedGroup();
assertThat( compositeTableGroup, instanceOf( CompositeTableGroup.class ) );
assertThat( compositeTableGroup.getTableGroupJoins(), isEmpty() );
} );
} }
); );

View File

@ -54,6 +54,7 @@ import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.CollectionUtils;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
@ -294,7 +295,13 @@ public class HqlEntityGraphTest {
); );
// Check the from-clause // Check the from-clause
assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> assertThat( tableGroup.getTableGroupJoins(), isEmpty() ) ); assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> {
assertThat( tableGroup.getTableGroupJoins(), hasSize( 1 ) );
final TableGroup compositeTableGroup = CollectionUtils.getOnlyElement( tableGroup.getTableGroupJoins() ).getJoinedGroup();
assertThat( compositeTableGroup, instanceOf( CompositeTableGroup.class ) );
assertThat( compositeTableGroup.getTableGroupJoins(), isEmpty() );
} );
} }
); );
@ -390,7 +397,7 @@ public class HqlEntityGraphTest {
); );
final HqlQueryImplementor<String> hqlQuery = (HqlQueryImplementor<String>) query; final HqlQueryImplementor<String> hqlQuery = (HqlQueryImplementor<String>) query;
final SqmSelectStatement<T> sqmStatement = (SqmSelectStatement<T>) hqlQuery.getSqmStatement(); final SqmSelectStatement sqmStatement = (SqmSelectStatement) hqlQuery.getSqmStatement();
final StandardSqmSelectTranslator sqmConverter = new StandardSqmSelectTranslator( final StandardSqmSelectTranslator sqmConverter = new StandardSqmSelectTranslator(
hqlQuery.getQueryOptions(), hqlQuery.getQueryOptions(),