-
Notifications
You must be signed in to change notification settings - Fork 68
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
PW-1462: Parse refactor to support Any inner content in xsys messages #97
Open
ptorres-prowide
wants to merge
1
commit into
main
Choose a base branch
from
CU-85ztm247h_PW-1462--PMH-Bottomline-GTX-extension-test-case-fails-to-parse-xsys002
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
iso20022-core/src/test/java/com/prowidesoftware/issues/Jira1462Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.prowidesoftware.issues; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import com.prowidesoftware.swift.model.MxId; | ||
import com.prowidesoftware.swift.model.mx.AbstractMX; | ||
import com.prowidesoftware.swift.model.mx.AppHdr; | ||
import com.prowidesoftware.swift.model.mx.AppHdrParser; | ||
import com.prowidesoftware.swift.model.mx.sys.MxXsys00200101; | ||
import com.prowidesoftware.swift.model.mx.sys.dic.SwAny; | ||
import com.prowidesoftware.swift.utils.Lib; | ||
import java.io.IOException; | ||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class Jira1462Test { | ||
|
||
@Test | ||
void test() throws IOException { | ||
String xml = Lib.readResource("sample_hvcs_xsys.002_pacs.008.xml"); | ||
final AbstractMX read = AbstractMX.parse(xml, new MxId("xsys", "002", "001", "01")); | ||
assertNotNull(read, "read object null "); | ||
assertTrue(read instanceof MxXsys00200101); | ||
|
||
final MxXsys00200101 mx = (MxXsys00200101) read; | ||
assertNotNull(mx); | ||
assertNotNull(mx.getMessageStandardType()); | ||
assertNotNull(mx.getAppHdr()); | ||
assertEquals( | ||
"swi00003-2023-07-19T04:56:40.63614.012852Z", | ||
mx.getXsys00200101().getAuthstnNtfctn().getSnFRef()); | ||
|
||
SwAny thirdPartyToSenderInformation = | ||
mx.getXsys00200101().getAuthstnNtfctn().getThirdPartyToSenderInformation(); | ||
assertNotNull(thirdPartyToSenderInformation); | ||
assertFalse(thirdPartyToSenderInformation.getAny().isEmpty()); | ||
System.out.println("MxXsys00200101 WITH TEXT: " + mx.message()); | ||
} | ||
|
||
@Test | ||
void testWithNamespaces() throws IOException { | ||
String xml = Lib.readResource("sample_hvcs_xsys.002_pacs.008_namespaces.xml"); | ||
Optional<AppHdr> parse = AppHdrParser.parse(xml); | ||
assertTrue(parse.isPresent()); | ||
|
||
final AbstractMX read = AbstractMX.parse(xml, new MxId("xsys", "002", "001", "01")); | ||
assertNotNull(read, "read object null "); | ||
assertTrue(read instanceof MxXsys00200101); | ||
|
||
final MxXsys00200101 mx = (MxXsys00200101) read; | ||
assertNotNull(mx); | ||
assertNotNull(mx.getMessageStandardType()); | ||
assertEquals( | ||
"swi00003-2023-07-19T04:56:40.63614.012852Z", | ||
mx.getXsys00200101().getAuthstnNtfctn().getSnFRef()); | ||
|
||
SwAny thirdPartyToSenderInformation = | ||
mx.getXsys00200101().getAuthstnNtfctn().getThirdPartyToSenderInformation(); | ||
assertNotNull(thirdPartyToSenderInformation); | ||
assertFalse(thirdPartyToSenderInformation.getAny().isEmpty()); | ||
System.out.println("MxXsys00200101 WITH TEXT: " + mx.message()); | ||
} | ||
|
||
@Test | ||
void withoutNoSwAny() throws IOException { | ||
final AbstractMX read = AbstractMX.parse( | ||
Lib.readResource("sample_hvcs_xsys.002_pacs.008_noSw.xml"), new MxId("xsys", "002", "001", "01")); | ||
assertNotNull(read, "read object null "); | ||
assertTrue(read instanceof MxXsys00200101); | ||
|
||
final MxXsys00200101 mx = (MxXsys00200101) read; | ||
assertNotNull(mx); | ||
assertNotNull(mx.getMessageStandardType()); | ||
assertEquals( | ||
"swi00003-2023-07-19T04:56:40.63614.012852Z", | ||
mx.getXsys00200101().getAuthstnNtfctn().getSnFRef()); | ||
|
||
SwAny thirdPartyToSenderInformation = | ||
mx.getXsys00200101().getAuthstnNtfctn().getThirdPartyToSenderInformation(); | ||
assertNotNull(thirdPartyToSenderInformation); | ||
// assertFalse(thirdPartyToSenderInformation.getAny().isEmpty()); | ||
// System.out.println("MxXsys00200101 WITH TEXT: " + mx.message()); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
iso20022-core/src/test/resources/sample_hvcs_xsys.002_pacs.008.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<RequestPayload> | ||
<Ah:AppHdr xmlns:Ah="urn:swift:xsd:$ahV10"> | ||
<Ah:MsgRef>2023-07-19T04:57:05Z</Ah:MsgRef> | ||
<Ah:CrDate>2023-07-19T04:57:05Z</Ah:CrDate> | ||
</Ah:AppHdr> | ||
<Doc:Document xmlns:Doc="urn:swift:xsd:xsys.002.001.01" xmlns:Sw="urn:swift:snl:ns.Sw" | ||
xmlns:SwInt="urn:swift:snl:ns.SwInt" | ||
xmlns:SwSec="urn:swift:snl:ns.SwSec"> | ||
<Doc:xsys.002.001.01> | ||
<Doc:AuthstnNtfctn> | ||
<Sw:SnFRef>swi00003-2022-07-19T04:56:40.63614.012852Z</Sw:SnFRef> | ||
<SwInt:RequestHeader> | ||
<SwInt:Requestor>ou=xxx,o=rabcdu2s,o=swift</SwInt:Requestor> | ||
<SwInt:Responder>ou=xxx,o=wvcxzsr,o=swift</SwInt:Responder> | ||
<SwInt:Service>apn.hvcs!p</SwInt:Service> | ||
<SwInt:RequestType>pacs.004.001.10</SwInt:RequestType> | ||
<SwInt:Priority>Normal</SwInt:Priority> | ||
<SwInt:RequestRef>201207190001100005007HV0</SwInt:RequestRef> | ||
</SwInt:RequestHeader> | ||
<Sw:ThirdPartyToSenderInformation> | ||
<Sw:ESABal Ccy="AUD">999999.99</Sw:ESABal> | ||
<Sw:RcvdDtTm>2023-07-19T14:56:42.000+10:00</Sw:RcvdDtTm> | ||
<Sw:IntrBkSttlmDtTm>2023-07-19T14:56:46.000+10:00</Sw:IntrBkSttlmDtTm> | ||
<Sw:IntrBkSttlmAmt Ccy="AUD">99.99</Sw:IntrBkSttlmAmt> | ||
</Sw:ThirdPartyToSenderInformation> | ||
<SwSec:SignatureValue>SignatureContent</SwSec:SignatureValue> | ||
</Doc:AuthstnNtfctn> | ||
</Doc:xsys.002.001.01> | ||
</Doc:Document> | ||
</RequestPayload> |
32 changes: 32 additions & 0 deletions
32
iso20022-core/src/test/resources/sample_hvcs_xsys.002_pacs.008_namespaces.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<RequestPayload xmlns:Doc="urn:swift:xsd:xsys.002.001.01" xmlns:Sw="urn:swift:snl:ns.Sw" | ||
xmlns:SwInt="urn:swift:snl:ns.SwInt" | ||
xmlns:SwSec="urn:swift:snl:ns.SwSec" | ||
xmlns:Ah="urn:swift:xsd:$ahV10"> | ||
<Ah:AppHdr> | ||
<Ah:MsgRef>2023-07-19T04:57:05Z</Ah:MsgRef> | ||
<Ah:CrDate>2023-07-19T04:57:05Z</Ah:CrDate> | ||
</Ah:AppHdr> | ||
<Doc:Document> | ||
<Doc:xsys.002.001.01> | ||
<Doc:AuthstnNtfctn> | ||
<Sw:SnFRef>swi00003-2022-07-19T04:56:40.63614.012852Z</Sw:SnFRef> | ||
<SwInt:RequestHeader> | ||
<SwInt:Requestor>ou=xxx,o=rabcdu2s,o=swift</SwInt:Requestor> | ||
<SwInt:Responder>ou=xxx,o=wvcxzsr,o=swift</SwInt:Responder> | ||
<SwInt:Service>apn.hvcs!p</SwInt:Service> | ||
<SwInt:RequestType>pacs.004.001.10</SwInt:RequestType> | ||
<SwInt:Priority>Normal</SwInt:Priority> | ||
<SwInt:RequestRef>201207190001100005007HV0</SwInt:RequestRef> | ||
ptorres-prowide marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</SwInt:RequestHeader> | ||
<Sw:ThirdPartyToSenderInformation> | ||
<Sw:ESABal Ccy="AUD">999999.99</Sw:ESABal> | ||
<Sw:RcvdDtTm>2023-07-19T14:56:42.000+10:00</Sw:RcvdDtTm> | ||
<Sw:IntrBkSttlmDtTm>2023-07-19T14:56:46.000+10:00</Sw:IntrBkSttlmDtTm> | ||
<Sw:IntrBkSttlmAmt Ccy="AUD">99.99</Sw:IntrBkSttlmAmt> | ||
</Sw:ThirdPartyToSenderInformation> | ||
<SwSec:SignatureValue>SignatureContent</SwSec:SignatureValue> | ||
</Doc:AuthstnNtfctn> | ||
</Doc:xsys.002.001.01> | ||
</Doc:Document> | ||
</RequestPayload> |
31 changes: 31 additions & 0 deletions
31
iso20022-core/src/test/resources/sample_hvcs_xsys.002_pacs.008_noSw.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<RequestPayload> | ||
<Ah:AppHdr xmlns:Ah="urn:swift:xsd:$ahV10"> | ||
<Ah:MsgRef>2023-07-19T04:57:05Z</Ah:MsgRef> | ||
<Ah:CrDate>2023-07-19T04:57:05Z</Ah:CrDate> | ||
</Ah:AppHdr> | ||
<Doc:Document xmlns:Doc="urn:swift:xsd:xsys.002.001.01" xmlns:Sw="urn:swift:snl:ns.Sw" | ||
xmlns:SwInt="urn:swift:snl:ns.SwInt" | ||
xmlns:SwSec="urn:swift:snl:ns.SwSec"> | ||
<Doc:xsys.002.001.01> | ||
<Doc:AuthstnNtfctn> | ||
<Sw:SnFRef>swi00003-2022-07-19T04:56:40.63614.012852Z</Sw:SnFRef> | ||
<SwInt:RequestHeader> | ||
<SwInt:Requestor>ou=xxx,o=rabcdu2s,o=swift</SwInt:Requestor> | ||
<SwInt:Responder>ou=xxx,o=wvcxzsr,o=swift</SwInt:Responder> | ||
<SwInt:Service>apn.hvcs!p</SwInt:Service> | ||
<SwInt:RequestType>pacs.004.001.10</SwInt:RequestType> | ||
<SwInt:Priority>Normal</SwInt:Priority> | ||
<SwInt:RequestRef>201207190001100005007HV0</SwInt:RequestRef> | ||
</SwInt:RequestHeader> | ||
<Sw:ThirdPartyToSenderInformation> | ||
<ESABal Ccy="AUD">999999.99</ESABal> | ||
<RcvdDtTm>2023-07-19T14:56:42.000+10:00</RcvdDtTm> | ||
<IntrBkSttlmDtTm>2023-07-19T14:56:46.000+10:00</IntrBkSttlmDtTm> | ||
<IntrBkSttlmAmt Ccy="AUD">99.99</IntrBkSttlmAmt> | ||
</Sw:ThirdPartyToSenderInformation> | ||
<SwSec:SignatureValue>SignatureContent</SwSec:SignatureValue> | ||
</Doc:AuthstnNtfctn> | ||
</Doc:xsys.002.001.01> | ||
</Doc:Document> | ||
</RequestPayload> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Este metodo no se usa por lo que veo. Es el intento por lo de Any? En general hay que evitar usar DOM, es muy lento, por eso usamos Sax
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.
La llamada a este método está comentada. Habíamos quedado en que lo subía así y vos revisabas si no encontrabas una solución mejor. Este branch fue una 1era idea que no te convencía.