Guest User

Untitled

a guest
Dec 7th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. .choise()
  2. .when()
  3. .simple("${body.messageType} == 105")
  4. .to(...)
  5. .when()
  6. .simple("${body.messageType} == 106")
  7. .to(...)
  8.  
  9. package myPackage;
  10.  
  11. public enum Code {
  12. CODE_A("105"),
  13. CODE_B("106")
  14.  
  15. private String value;
  16.  
  17. Code(String value) {
  18. this.value = value;
  19. }
  20.  
  21. public String value() {
  22. return value;
  23. }
  24. }
  25.  
  26. .simple("${body.messageType} == ${type:myPackage.Code.CODE_A.value()}")
  27.  
  28. .simple("${body.messageType} == ${type:myPackage.Code.CODE_A}")
  29.  
  30. myPackage.Code.value()
  31.  
  32. myPackage.Code.CODE_A
  33.  
  34. .when().groovy("body.messageType == myPackage.CODE_A.value()")
  35.  
  36. .setHeader("codeA",constant(myPackage.Code.CODE_A.value()))
  37. .setHeader("codeB",constant(myPackage.Code.CODE_B.value()))
  38. .choise()
  39. .when()
  40. .simple("${body.messageType} == ${header.codeA}")
  41. .to(...)
  42. .when()
  43. .simple("${body.messageType} == ${header.codeB}")
  44. .to(...)
  45.  
  46. //one value
  47. simple(String.format("${body.key} == '%1s'", Code.CODE_A.value())
  48. // multiple values using 'in' operator
  49. simple(String.format("${body.key} in '%1s,%2s'", Code.CODE_A.value(), Code.CODE_B.value())
Add Comment
Please, Sign In to add comment