@Test public void shouldRemove() throws Exception { doNothing().when(service).removeVendorUserAssociation(2L, 3L); ResponseEntity<OpenLmisResponse> response = controller.remove(2L, 3L); assertThat(response.getBody().getSuccessMsg(), is(notNullValue())); }
@RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove (@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId){ try { vendorUserService.removeVendorUserAssociation(vendorId,userId); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return OpenLmisResponse.success("message.equipment.vendor.removed.associated.user"); }
VendorUserController extends BaseController { @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove (@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId){ try { vendorUserService.removeVendorUserAssociation(vendorId,userId); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return OpenLmisResponse.success("message.equipment.vendor.removed.associated.user"); } }
VendorUserController extends BaseController { @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove (@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId){ try { vendorUserService.removeVendorUserAssociation(vendorId,userId); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return OpenLmisResponse.success("message.equipment.vendor.removed.associated.user"); }  }
VendorUserController extends BaseController { @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove (@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId){ try { vendorUserService.removeVendorUserAssociation(vendorId,userId); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return OpenLmisResponse.success("message.equipment.vendor.removed.associated.user"); }  @RequestMapping(value = "getAllUsersForVendor/{vendorId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllUsersForVendor(@PathVariable(value = "vendorId") Long vendorId); @RequestMapping(value = "getAllUsersAvailableForVendor", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllUsersAvailableForVendor(); @RequestMapping(value="saveNewUserForVendor", method = RequestMethod.POST,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> saveVendorUsers(@RequestBody VendorUser vendorUser, HttpServletRequest request); @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId); }
VendorUserController extends BaseController { @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove (@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId){ try { vendorUserService.removeVendorUserAssociation(vendorId,userId); } catch (DataException e) { return error(e, HttpStatus.BAD_REQUEST); } return OpenLmisResponse.success("message.equipment.vendor.removed.associated.user"); }  @RequestMapping(value = "getAllUsersForVendor/{vendorId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllUsersForVendor(@PathVariable(value = "vendorId") Long vendorId); @RequestMapping(value = "getAllUsersAvailableForVendor", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllUsersAvailableForVendor(); @RequestMapping(value="saveNewUserForVendor", method = RequestMethod.POST,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> saveVendorUsers(@RequestBody VendorUser vendorUser, HttpServletRequest request); @RequestMapping(value="remove/{vendorId}/{userId}", method = RequestMethod.GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value="vendorId") Long vendorId, @PathVariable(value="userId") Long userId); static final String VENDOR_USER; static final String USERS; }