Skip to content

Commit

Permalink
CAMEL-19870 Camel AS2: Should accept MDN field name Disposition as ca…
Browse files Browse the repository at this point in the history
…se insensitive (#11431)
  • Loading branch information
isakkirajan authored and davsclaus committed Sep 18, 2023
1 parent 8b06937 commit d241730
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public String toString() {
}

public static DispositionMode parseDispositionMode(String dispositionModeString) {
switch (dispositionModeString) {
case "manual-action/MDN-sent-manually":
switch (dispositionModeString.toLowerCase()) {
case "manual-action/mdn-sent-manually":
return MANUAL_ACTION_MDN_SENT_MANUALLY;
case "manual-actionMDN-sent-automatically":
case "manual-action/mdn-sent-automatically":
return MANUAL_ACTION_MDN_SENT_AUTOMATICALLY;
case "automatic-action/MDN-sent-manually":
case "automatic-action/mdn-sent-manually":
return AUTOMATIC_ACTION_MDN_SENT_MANUALLY;
case "automatic-action/MDN-sent-automatically":
case "automatic-action/mdn-sent-automatically":
return AUTOMATIC_ACTION_MDN_SENT_AUTOMATICALLY;
default:
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,18 @@ public void test() throws Exception {
"Unexpected Digest Algorithm ID");
}

@Test
public void testDispoistionTypeCaseSensitivity() throws Exception {
String dispoistionTypeMixedCase = "automatic-action/MDN-Sent-automatically";
String dispoistionTypeLowerCase = "automatic-action/mdn-sent-automatically";

DispositionMode resultMixedCase = DispositionMode.parseDispositionMode(dispoistionTypeMixedCase);
DispositionMode resultLowerCase = DispositionMode.parseDispositionMode(dispoistionTypeLowerCase);

assertEquals(DispositionMode.AUTOMATIC_ACTION_MDN_SENT_AUTOMATICALLY, resultMixedCase,
"DispositionMode should be case insensitive");
assertEquals(DispositionMode.AUTOMATIC_ACTION_MDN_SENT_AUTOMATICALLY, resultLowerCase,
"DispositionMode should be case insensitive");
}

}

0 comments on commit d241730

Please sign in to comment.