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-688: Enable installation of modules through rest calls #316

Merged
merged 1 commit into from
Jan 3, 2018

Conversation

malmike
Copy link
Contributor

@malmike malmike commented Dec 21, 2017

JIRA TICKET NAME:

RESTWS-688: Enable installation of modules through rest calls

SUMMARY:

Currently a module could not be installed through a REST call. When a REST call is made the module is to be downloaded on to the server, loaded and started.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 40.246% when pulling 854de20 on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@mkiterian
Copy link

Looks good 👍

@Annettesunday
Copy link
Contributor

Looks good:)

@Charpell
Copy link

Hello @malmike, why are the test failing?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 40.246% when pulling 53da780 on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@malmike
Copy link
Contributor Author

malmike commented Dec 21, 2017

The tests pass, just the coverage that dropped by 0.1

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 40.246% when pulling 05a94bf on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 41.128% when pulling 3d8f3f6 on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@patlub
Copy link

patlub commented Dec 21, 2017

Looks good now.

return tempModule;
}
catch (MalformedURLException e) {
throw new RuntimeException(e.getMessage());
Copy link
Member

@dkayiwa dkayiwa Dec 21, 2017

Choose a reason for hiding this comment

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

It is not good good to throw RuntimeException in this case. Throw an APIException
But also remember to pass on the original exception as the second parameter.

throw new RuntimeException(e.getMessage());
}
catch (IOException e) {
throw new RuntimeException(e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

Same here as above.

throw new RuntimeException(e.getMessage());
}
finally {
if (tempModule == null && moduleFile != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Since it is moduleFile that you are deleting, isn't it enough to just check for it alone?

@malmike malmike force-pushed the RESTWS-688_2 branch 2 times, most recently from d6580a5 to 9bb73f2 Compare December 21, 2017 13:29
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 41.128% when pulling 9bb73f2 on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@@ -109,17 +127,63 @@ public Object create(SimpleObject post, RequestContext context) throws ResponseE
case UNLOAD:
unloadModules(modules, servletContext);
break;
case INSTALL:
Module module = installModule(modules, installUri, servletContext);
List<Module> listModule = new ArrayList<Module>();
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why you do not just call listModule.add(module)?



private Module installModule(Collection<Module> modules, String installUri, ServletContext servletContext) {
List<Module> moduleList = new ArrayList<Module>(modules);
Copy link
Member

Choose a reason for hiding this comment

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

What happens if modules is empty?

File moduleFile = null;

try {
//Module existingModule = moduleFactoryWrapper.getModuleById(module.getModuleId());
Copy link
Member

Choose a reason for hiding this comment

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

@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 41.136% when pulling 9bb73f2 on malmike:RESTWS-688_2 into 4f9abc0 on openmrs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 41.136% when pulling bd91ed3 on malmike:RESTWS-688_2 into 575efe3 on openmrs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 41.136% when pulling c5f8d4e on malmike:RESTWS-688_2 into 575efe3 on openmrs:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants