Skip to content

#750 - AliasToBean failure, test case and fix #1380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2017

Conversation

mazharqayyum
Copy link
Contributor

…ues/750

I have created the unit test to demonstrate exception happening due to AliasToBean result transformer. The related issue is #750

@fredericDelaporte fredericDelaporte self-requested a review October 16, 2017 07:13
{
private int _orderLineId;
private Order _order;
private Product _product;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab/spaces mixup. Needs reformat (like CTRL+K CTRL+D).

{
public class Order
{
private readonly ISet<OrderLine> _orderLines;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space formatted, should be reformatted with tabs for complying with guidelines and general formatting of NHibernate source code.

using NHibernate.Transform;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.NH0750
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hazzik, I think we need to change our naming since the recent switch to GitHub issues from Jira. Otherwise we will have soon conflicts between old Jira test cases and new GitHub ones. I propose to replace NH by GH, since GH- is an alternate to # for referencing issues.

#1382 done for this.

@fredericDelaporte
Copy link
Member

fredericDelaporte commented Oct 16, 2017

Regression introduced by 9491f57, the check on null alias has been removed, causing queries having no (criteria) alias for some of the columns they return to fail. This happens with grouping in criteria by example.

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for test case and report.

Rebased, test adjusted, and trouble fixed.

I have used the proposed naming in #1382 for the issue number, GH0750, in order to avoid mixing up with NH-750.

using System.Threading;

[TestFixture]
public class FixtureAsync : BugTestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its generation was forgotten. See this section of contributing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOPS! It was very hectic to work with VS2017 since it keeps throwing itself into NOT RESPONDING state for my install while I add/edit/rename files in test project. Would keep it in mind if needed to write another one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No troubles. Yes VS2017 is currently quite bad at handling large projects migrated to its new csproj format. That is why I had mentioned Rider, which does quite better. But maybe things will start to be better with changes like dotnet/msbuild#2572.

About writing another one, you will need to clean your master branch. But you should do it only after this PR is closed, otherwise you will need to open a new one from a dedicated branch this time.

For cleaning, in case you need instructions, it could be something like:

  • Branch away changes done on master if you want to keep them. Assuming you are currently on master, git branch newBranch.
  • Still on master, reset it hard git reset --hard head~x, where x is the number of commits to remove (2 currently git reset --hard head~2).
  • Force push it to your remote git push -f.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed instructions. I will wait for this PR to close.

}
}

protected override void OnTearDown()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing. Deleting all data is required by our tests, otherwise it is considered as a teardown failure.

@@ -121,6 +121,10 @@ public override IList TransformList(IList collection)
/// same visibility and inheritance depth.</exception>
private void SetProperty(string alias, object value, object resultObj)
{
if (alias == null)
// Grouping properties in criteria are selected without alias, just ignore them.
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix. Reintroduces the check removed here without us spotting it and questioning it.

@fredericDelaporte fredericDelaporte self-assigned this Oct 16, 2017
@fredericDelaporte fredericDelaporte changed the title Added unit test for issue#750 #750 - AliasToBean failure, test case and fix Oct 16, 2017
Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow missed the rebased, was still stale, re-rebased.

@hazzik hazzik merged commit b1db0b5 into nhibernate:master Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants