Skip to content
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

PipeParser.GetMessageStructureForEvent does not return the correct value #10

Closed
limsbeheer opened this issue Feb 27, 2015 · 5 comments
Closed

Comments

@limsbeheer
Copy link

For example: when PipeParser.GetMessageStructureForEvent("ADT_A04", "2.5") is called, "ADT_A01" is expected, instead "ADT_A04" is returned.

Some debugging yields the following:
In method EventMapper.GetAssemblyEventMapping calling assembly.GetManifestResourceStream(package.EventMappingResourceName) returns null.
This is because EventMappingResourceName contains two dots: one from _packageName and one from the ".EventMapping.EventMap.properties" literal.
The fix could be to remove the first dot in the literal or to remove the trailing dot in the _packageName, but I don't know the impact of the latter.

@duaneedwards
Copy link
Collaborator

Thanks limsbeheer.

I'm pretty sure that this has already been fixed as a part of c0375c7

I haven't been able to reproduce this locally, are you running version 2.4.0.7? This change should be a part of that release.

@limsbeheer
Copy link
Author

I just downloaded the latest sources (which is 2.4.0.7) with the "Download ZIP" button and built it. Now when I call PipeParser.GetMessageStructureForEvent it still gives me value "ADT_A04" instead of "ADT_A01".
The fix you made in the private constructor is needed to get the package name without trailing dot to load the assembly succesfully. But the dot remains in property package.PackageName.
So when method GetAssemblyEventMapping is called in the constructor, package.EventMappingResourceName still contains "NHapi.Model.V25..EventMapping.EventMap.properties" (with two dots) and therefore variable inResource stays null.
Do you not experience such behaviour?

@duaneedwards
Copy link
Collaborator

Strange ... I'm unable to reproduce this however the problem may lie with my test method?

Here's what I'm running locally to verify this:

[Test]
public void TestAdtA04AndA01MessageStructure()
{
    var result = PipeParser.GetMessageStructureForEvent("ADT_A04", "2.5");
    Assert.AreSame("ADT_A04", result);

    result = PipeParser.GetMessageStructureForEvent("ADT_A01", "2.5");
    Assert.AreSame("ADT_A01", result);
}

Does this differ from what you are attempting to run?

@limsbeheer
Copy link
Author

Yes: input value "ADT_A04" should yield "ADT_A01" since A01 is the structure for event A04. So the first Assert should be: Assert.AreSame("ADT_A01", result);
The second assert is correct: A01 is the structure for event A01.
Other events which use the A01 structure are A08 and A13.

@duaneedwards
Copy link
Collaborator

Ahhh... it all makes sense now. I misread it the other way around and as such my tests weren't reporting back any errors as you can tell.

You're right, I'll strip out the prepending '.' from the EventMappingResourceName getter which will make the assembly load as it should.

I'll put this fix in the next release, A04's, A13's and A08's are now returning A01 as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants