-
Notifications
You must be signed in to change notification settings - Fork 0
Fix whitespace handling in ProcessSystem stream references #62
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,28 @@ void testBuildWithSeparatorAndCompressor() { | |||||||||||
| assertNotNull(process.getUnit("Comp")); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @Test | ||||||||||||
| void testBuildWithWhitespaceAroundStreamReference() { | ||||||||||||
|
||||||||||||
| void testBuildWithWhitespaceAroundStreamReference() { | |
| void testResolveStreamReferenceTrimsWhitespace() { |
Copilot
AI
Apr 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test currently only asserts the dot-notation lookup is non-null. Because ProcessSystem.resolveStreamReference falls back to the unit’s default outlet (and for Separator that default is typically the gas outlet), the assertion can still pass even if whitespace around the port token isn’t handled correctly. To actually regression-test trimming of the port token, assert the resolved stream equals the expected port stream (e.g., use a liquidOut reference with surrounding spaces and assert it resolves to separator.getLiquidOutStream()), not just non-null.
| StreamInterface gasOutWithWhitespace = process.resolveStreamReference(" HP Sep. gasOut "); | |
| assertNotNull(gasOutWithWhitespace, | |
| StreamInterface liquidOutWithWhitespace = | |
| process.resolveStreamReference(" HP Sep. liquidOut "); | |
| assertEquals(separator.getLiquidOutStream(), liquidOutWithWhitespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonProcessBuilderhas its ownresolveStreamReference(String)implementation (inJsonProcessBuilder.java) that still parses the rawrefwithout trimming. As a result, JSON process definitions with surrounding whitespace in inlet refs will still fail to wire even after this change. To match the PR motivation, either (a) apply the sametrim()/token-trim normalization inJsonProcessBuilder.resolveStreamReference, or (b) remove the duplicated logic and delegate toProcessSystem.resolveStreamReferenceafter the units are registered.