Skip to content

Commit

Permalink
finish both 'loader' and 'HQL' testing
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanQingyangXu authored and sebersole committed Mar 19, 2020
1 parent a3dce5f commit e2ddd80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Expand Up @@ -291,9 +291,13 @@ void testEmbeddedCollectionFetchGraph(SessionFactoryScope scope) {
);

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

}
);
Expand Down
Expand Up @@ -54,6 +54,7 @@
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.CollectionUtils;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
Expand Down Expand Up @@ -294,7 +295,13 @@ void testEmbeddedCollectionFetchGraph(SessionFactoryScope scope) {
);

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

}
);
Expand Down Expand Up @@ -390,7 +397,7 @@ private <T> SelectStatement buildSqlSelectAst(
);
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(
hqlQuery.getQueryOptions(),
Expand Down

0 comments on commit e2ddd80

Please sign in to comment.