@Test public void canRegisterComponent() throws ComponentRegistrationException { when(_mockStateService.getByPackageFile(_testPackageName)) .thenReturn(Optional.of(_testModel)); ResponseEntity<?> result = _controller.registerComponentRest(_testPackageName); assertEquals(HttpStatus.OK, result.getStatusCode()); assertCorrectModel((RegisterComponentModel) result.getBody()); verify(_mockAddComponentService) .registerComponent(_testPackageName); }
@RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody public ResponseEntity<?> registerComponentRest( @PathVariable("componentPackageFileName") String componentPackageFileName) { return withWriteLock(() -> { try { _addComponentService.registerComponent(componentPackageFileName); return _componentState.getByPackageFile(componentPackageFileName) .map(ResponseEntity::ok) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } catch (ComponentRegistrationException ex) { return handleAddComponentExceptions(componentPackageFileName, ex); } }); }
AdminComponentRegistrationController extends BasicAdminComponentRegistrationController { @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody public ResponseEntity<?> registerComponentRest( @PathVariable("componentPackageFileName") String componentPackageFileName) { return withWriteLock(() -> { try { _addComponentService.registerComponent(componentPackageFileName); return _componentState.getByPackageFile(componentPackageFileName) .map(ResponseEntity::ok) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } catch (ComponentRegistrationException ex) { return handleAddComponentExceptions(componentPackageFileName, ex); } }); } }
AdminComponentRegistrationController extends BasicAdminComponentRegistrationController { @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody public ResponseEntity<?> registerComponentRest( @PathVariable("componentPackageFileName") String componentPackageFileName) { return withWriteLock(() -> { try { _addComponentService.registerComponent(componentPackageFileName); return _componentState.getByPackageFile(componentPackageFileName) .map(ResponseEntity::ok) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } catch (ComponentRegistrationException ex) { return handleAddComponentExceptions(componentPackageFileName, ex); } }); } @Inject  AdminComponentRegistrationController(
            PropertiesUtil propertiesUtil,
            AddComponentService addComponentService,
            RemoveComponentService removeComponentService,
            ComponentStateService componentState,
            ComponentReRegisterService reRegisterService); }
AdminComponentRegistrationController extends BasicAdminComponentRegistrationController { @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody public ResponseEntity<?> registerComponentRest( @PathVariable("componentPackageFileName") String componentPackageFileName) { return withWriteLock(() -> { try { _addComponentService.registerComponent(componentPackageFileName); return _componentState.getByPackageFile(componentPackageFileName) .map(ResponseEntity::ok) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } catch (ComponentRegistrationException ex) { return handleAddComponentExceptions(componentPackageFileName, ex); } }); } @Inject  AdminComponentRegistrationController(
            PropertiesUtil propertiesUtil,
            AddComponentService addComponentService,
            RemoveComponentService removeComponentService,
            ComponentStateService componentState,
            ComponentReRegisterService reRegisterService); @RequestMapping(value = {"/components/{componentPackageFileName:.+}", "/rest/components/{componentPackageFileName:.+}"}, method = RequestMethod.GET) @ResponseBody ResponseEntity<RegisterComponentModel> getComponentRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> registerComponentRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components", "/rest/components"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> uploadComponentRest(@RequestParam("file") MultipartFile file); @RequestMapping(value = {"/component/registerViaFile", "/rest/component/registerViaFile"}, method = RequestMethod.GET) @ResponseBody ResponseMessage registerViaFileRest(
            /*@ApiParam(required = true, defaultValue = "",
                      value = "The path to the JSON component descriptor file")*/
            @RequestParam String filePath
    ); @RequestMapping(value = {"/component/unregisterViaFile", "/rest/component/unregisterViaFile"}, method = RequestMethod.GET) @ResponseBody ResponseMessage unregisterViaFileRest(
            /*@ApiParam(required = true, value = "The path to the JSON component descriptor file")*/
            @RequestParam String filePath,
            @RequestParam(required = false, defaultValue = "true") boolean deletePackage); @RequestMapping(value = {"/components/packages/{componentPackageFileName:.+}/", "/rest/components/packages/{componentPackageFileName:.+}/"}, method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody void removeComponentPackageRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components/{componentPackageFileName:.+}/reRegister", "/rest/components/{componentPackageFileName:.+}/reRegister"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> reRegisterRest(@PathVariable("componentPackageFileName") String componentPackageFileName); }
AdminComponentRegistrationController extends BasicAdminComponentRegistrationController { @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody public ResponseEntity<?> registerComponentRest( @PathVariable("componentPackageFileName") String componentPackageFileName) { return withWriteLock(() -> { try { _addComponentService.registerComponent(componentPackageFileName); return _componentState.getByPackageFile(componentPackageFileName) .map(ResponseEntity::ok) .orElseGet(() -> new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } catch (ComponentRegistrationException ex) { return handleAddComponentExceptions(componentPackageFileName, ex); } }); } @Inject  AdminComponentRegistrationController(
            PropertiesUtil propertiesUtil,
            AddComponentService addComponentService,
            RemoveComponentService removeComponentService,
            ComponentStateService componentState,
            ComponentReRegisterService reRegisterService); @RequestMapping(value = {"/components/{componentPackageFileName:.+}", "/rest/components/{componentPackageFileName:.+}"}, method = RequestMethod.GET) @ResponseBody ResponseEntity<RegisterComponentModel> getComponentRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components/{componentPackageFileName:.+}/register", "/rest/components/{componentPackageFileName:.+}/register"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> registerComponentRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components", "/rest/components"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> uploadComponentRest(@RequestParam("file") MultipartFile file); @RequestMapping(value = {"/component/registerViaFile", "/rest/component/registerViaFile"}, method = RequestMethod.GET) @ResponseBody ResponseMessage registerViaFileRest(
            /*@ApiParam(required = true, defaultValue = "",
                      value = "The path to the JSON component descriptor file")*/
            @RequestParam String filePath
    ); @RequestMapping(value = {"/component/unregisterViaFile", "/rest/component/unregisterViaFile"}, method = RequestMethod.GET) @ResponseBody ResponseMessage unregisterViaFileRest(
            /*@ApiParam(required = true, value = "The path to the JSON component descriptor file")*/
            @RequestParam String filePath,
            @RequestParam(required = false, defaultValue = "true") boolean deletePackage); @RequestMapping(value = {"/components/packages/{componentPackageFileName:.+}/", "/rest/components/packages/{componentPackageFileName:.+}/"}, method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody void removeComponentPackageRest(
            @PathVariable("componentPackageFileName") String componentPackageFileName); @RequestMapping(value = {"/components/{componentPackageFileName:.+}/reRegister", "/rest/components/{componentPackageFileName:.+}/reRegister"}, method = RequestMethod.POST) @ResponseBody ResponseEntity<?> reRegisterRest(@PathVariable("componentPackageFileName") String componentPackageFileName);  }