-
Notifications
You must be signed in to change notification settings - Fork 14
Add support for struts 2.3 with tests #244
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
Conversation
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.
Nice work, left some comments, mostly related to polishing.
...rc/test/java/io/opentelemetry/javaagent/instrumentation/hypertrace/struts/Struts2Action.java
Outdated
Show resolved
Hide resolved
public static String sample = "{'balance':1000.21,'is_vip':true,'num':100,'name':'foo'}"; | ||
|
||
public String body() throws IOException { | ||
jsonString = sample; |
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.
why do you assign it here?
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 is just a simple logic that whenever this api is called, it assigns jsonString a value(which in our case is same every time for tests), and that jsonString is returned as response. It is defined in struts.xml to take jsonString as result.
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.
It's more idiomatic to return the "sample" directly. Why do we need two properties jsonString
and sample
?
|
||
public static String sample = "{'balance':1000.21,'is_vip':true,'num':100,'name':'foo'}"; | ||
|
||
public String body() throws IOException { |
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.
Add @Override
if the class overrides any method from the parent
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.
It does not override any method. This is our defined method which is an endpoint for /body
calls.
.../io/opentelemetry/javaagent/instrumentation/hypertrace/struts/StrutsInstrumentationTest.java
Outdated
Show resolved
Hide resolved
.../io/opentelemetry/javaagent/instrumentation/hypertrace/struts/StrutsInstrumentationTest.java
Outdated
Show resolved
Hide resolved
@shashank11p in the first comment on the PR add a link to github issue that this PR is fixing e.g. #218. If you prefix it with resolves, fixes it will automatically close the issue once the PR is merged. Could you please also list the struts in the readme? |
resolves #218