-
Notifications
You must be signed in to change notification settings - Fork 523
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
RESTWS-665 : SystemInfo REST implementation #285
Conversation
Can you squash the commits into one? |
740d232
to
54126fc
Compare
@dkayiwa I have squashed into One. Can you check it? |
// Initilize rest as a SinmpleObject | ||
SimpleObject rest = new SimpleObject(); | ||
try { | ||
//getAdministrationService().getSystemInformation() will give all System informations |
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.
Do we need these comments?
catch (Exception ex) { | ||
System.out.println("SystemInfo Resource is getting Error"); | ||
} | ||
// return the rest object |
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.
Do we need this comment?
|
||
@Test | ||
public void testGetAll() throws Exception { | ||
// Manually retrive the System Information |
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.
Do we need this comment?
@suthagar23 i see many comments which do not seem to add value. When the code is self explanatory, it is not advisable to comment the obvious. Do you agree? 😊 |
In reference to the above, you could take a look at this: https://dzone.com/articles/5-best-practices-commenting |
@dkayiwa I just developed it for the first time, So used those comments 😄 . Anyway, I will manage that and make it better in the future. Thanks for the guide 👍 |
public SimpleObject getAll(RequestContext context) throws ResponseException { | ||
SimpleObject rest = new SimpleObject(); | ||
try { | ||
//Push System informations to rest object with Key as SystemInfo |
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.
Do we need the above comment?
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.
Removed :-)
import org.apache.struts.mock.MockHttpServletResponse; | ||
import org.apache.commons.beanutils.PropertyUtils; | ||
import org.junit.Assert; | ||
//import org.junit.Before; |
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.
What about these two commented out lines?
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.
Removed :-)
SimpleObject rest = new SimpleObject(); | ||
rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation()); | ||
|
||
// Retrive the System Information using HTTP GET Request |
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.
Do we need the above comment?
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.
Removed :-)
@dkayiwa Can you please review this PR now 😅 ? |
rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation()); | ||
} | ||
catch (Exception ex) { | ||
System.out.println(ex.getMessage()); |
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.
Did you look at our java conventions in regards to the above line? https://wiki.openmrs.org/display/docs/Java+Conventions
System.out.println(ex.getMessage()); | ||
} | ||
finally { | ||
return rest; |
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.
What is the use of the finally block here? Are you trying to clean up resources or something?
public void testGetAll() throws Exception { | ||
SimpleObject rest = new SimpleObject(); | ||
rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation()); | ||
MockHttpServletResponse response = new MockHttpServletResponse(); |
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.
Can you do a test like those in SystemSettingController1_9Test that do a real GET request?
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.
@suthagar23 are you still working on this?
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.
@dkayiwa I am working with test cases, I couldn't implement those type of test cases here, Give me one more day to finalize
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.
@suthagar23 how did this go? 😊
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.
@suthagar23 people cannot test the system info app locally because this pull request is not yet done. Can you prioritize it please?
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.
@dkayiwa I completed REST Resource part, but struggling with TEST code :-(
I will complete that within today :-)
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.
Thanks for the update! I anxiously look forward to it. 😊
@dkayiwa Can you please review this PR now, I have updated my works |
@suthagar23 can you squash these commits into one as advised at https://wiki.openmrs.org/display/docs/Pull+Request+Tips? |
@dkayiwa Completed, Now there is one commit for this PR |
@Override | ||
public SimpleObject getAll(RequestContext context) throws ResponseException { | ||
SimpleObject rest = new SimpleObject(); | ||
rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation()); |
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.
Our convention is to start with lowercase for keys or properties.
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.
updated 👍
Delete SystemInfomationResource1_8.java SystemInfo REST Implementation REST Implementation for SystemInfo Delete SystemInfomationResource1_8.java SystemInfo REST - Comments removal REST SystemInfo - Comments Reviewed SystemInformation REST updates SysInfo REST Implemenation & Convention updated
Implemented REST part for SystemInfo.
https://issues.openmrs.org/browse/RESTWS-665