-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dt-718 changes for reefer #30
Conversation
@@ -237,22 +248,25 @@ private static BookingScenarioListBuilder shipper_GetAmendedBooking404() { | |||
(BookingAction) previousAction)); | |||
} | |||
|
|||
private static BookingScenarioListBuilder uc1_shipper_SubmitBookingRequest() { | |||
private static BookingScenarioListBuilder uc1_shipper_SubmitBookingRequest(String bookingVariant) { |
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.
If you prefer a single value instead of a mix of two booleans (isReeferBooking and isDGBooking), then judging by the way you use this value perhaps an enum BookingVariang { REGULAR, REEFER, DG } would help?
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.
I would rather use the Enums than the Booleans
} | ||
|
||
@Override | ||
public ObjectNode asJsonNode() { | ||
ObjectNode jsonNode = super.asJsonNode(); | ||
jsonNode.set("csp", getCspSupplier().get().toJson()); | ||
jsonNode.set("bookingVariant", new TextNode(bookingVariant.getValue())); |
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.
Use jsonNode.put
in this case rather than manually constructing a text node.
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.
jsonNode.put("csp", getCspSupplier().get().toJson()); is deprecated. hence used .set for csp and bookingVariant. If you would like I will change it .
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.
I was not challenging the use set
for the csp
. I was challenging the use of set
for a regular string for which .put
is a much better (and not deprecated) option.
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.
Ok.. I will change it.. done !
...ava/org/dcsa/conformance/standards/booking/checks/ShipperBookingContentConformanceCheck.java
Show resolved
Hide resolved
JsonNode jsonRequestBody = | ||
JsonToolkit.templateFileToJsonNode( | ||
"/standards/booking/messages/booking-api-v20-request.json", | ||
String fileSuffix = bookingVariant.equals("reefer") ? FILE_SUFFIX_REEFER: ""; |
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.
I would probably put this logic into the enum as each case has its own payload in the booking case.
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.
For simplicity, you could rename the regular
one so they all have suffixes and use bookingVariant.toLower()
to determine the suffix (probably how I would have done it) but other approaches work too (where the enum has a field for this purpose, etc.)
No description provided.