Skip to content
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

Merged
merged 1 commit into from
Jul 25, 2017

Conversation

suthagar23
Copy link
Member

Implemented REST part for SystemInfo.
https://issues.openmrs.org/browse/RESTWS-665

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 46.078% when pulling 6c75542 on suthagar23:RESTWS-665 into 67deaa3 on openmrs:master.

@dkayiwa
Copy link
Member

dkayiwa commented Jun 26, 2017

Can you squash the commits into one?

@suthagar23 suthagar23 force-pushed the RESTWS-665 branch 2 times, most recently from 740d232 to 54126fc Compare June 26, 2017 15:17
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 46.078% when pulling 54126fc on suthagar23:RESTWS-665 into 67deaa3 on openmrs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 46.078% when pulling 54126fc on suthagar23:RESTWS-665 into 67deaa3 on openmrs:master.

@suthagar23
Copy link
Member Author

@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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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?

@dkayiwa
Copy link
Member

dkayiwa commented Jun 26, 2017

@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? 😊

@dkayiwa
Copy link
Member

dkayiwa commented Jun 26, 2017

In reference to the above, you could take a look at this: https://dzone.com/articles/5-best-practices-commenting

@suthagar23
Copy link
Member Author

@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 👍

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 46.078% when pulling 59c1bee on suthagar23:RESTWS-665 into 67deaa3 on openmrs:master.

public SimpleObject getAll(RequestContext context) throws ResponseException {
SimpleObject rest = new SimpleObject();
try {
//Push System informations to rest object with Key as SystemInfo
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed :-)

@suthagar23
Copy link
Member Author

@dkayiwa Can you please review this PR now 😅 ?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.008%) to 46.11% when pulling b2cbf90 on suthagar23:RESTWS-665 into cb6450d on openmrs:master.

rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation());
}
catch (Exception ex) {
System.out.println(ex.getMessage());
Copy link
Member

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;
Copy link
Member

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();
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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? 😊

Copy link
Member

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?

Copy link
Member Author

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 :-)

Copy link
Member

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. 😊

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 46.147% when pulling eb0565b on suthagar23:RESTWS-665 into cb6450d on openmrs:master.

@suthagar23
Copy link
Member Author

@dkayiwa Can you please review this PR now, I have updated my works

@dkayiwa
Copy link
Member

dkayiwa commented Jul 25, 2017

@suthagar23 can you squash these commits into one as advised at https://wiki.openmrs.org/display/docs/Pull+Request+Tips?

@suthagar23
Copy link
Member Author

@dkayiwa Completed, Now there is one commit for this PR

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 46.147% when pulling 4f6f6c2 on suthagar23:RESTWS-665 into 12efaa5 on openmrs:master.

@Override
public SimpleObject getAll(RequestContext context) throws ResponseException {
SimpleObject rest = new SimpleObject();
rest.put("SystemInfo", Context.getAdministrationService().getSystemInformation());
Copy link
Member

@dkayiwa dkayiwa Jul 25, 2017

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.

Copy link
Member Author

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
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 46.147% when pulling 3fbdfe3 on suthagar23:RESTWS-665 into 12efaa5 on openmrs:master.

@dkayiwa dkayiwa merged commit a148f53 into openmrs:master Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants