@Test public void testAddUserAdminPage() { setUpMockRoleDataService(); setUpMockUserDataService(false, false, false); setUpMockAuthenticationContext(); HttpServletResponse response = new MockHttpServletResponse(); MockHttpServletRequest request = new MockHttpServletRequest(); Model model = new ExtendedModelMap(); String result = instance.displayAddUserAdminPage(request, response, model); assertEquals(ADD_USER_VIEW_NAME, result); assertEquals(1, model.asMap().size()); CreateUserCommand cuc = ((CreateUserCommand)model.asMap().get(CREATE_USER_COMMAND_KEY)); assertNotNull(cuc); assertFalse(cuc.getActivated()); assertFalse(cuc.getAdmin()); assertNull(cuc.getEmail()); assertEquals("http: assertNull(cuc.getPhoneNumber()); assertNull(cuc.getLastName()); assertNull(cuc.getFirstName()); assertNull(cuc.getPassword()); assertNull(cuc.getConfirmPassword()); }
@RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) public String displayAddUserAdminPage( HttpServletRequest request, HttpServletResponse response, Model model) { return prepateDataAndReturnCreateUserView( model, null, TgolKeyStore.ADD_USER_VIEW_NAME); }
UserManagementController extends AbstractUserAndContractsController { @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) public String displayAddUserAdminPage( HttpServletRequest request, HttpServletResponse response, Model model) { return prepateDataAndReturnCreateUserView( model, null, TgolKeyStore.ADD_USER_VIEW_NAME); } }
UserManagementController extends AbstractUserAndContractsController { @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) public String displayAddUserAdminPage( HttpServletRequest request, HttpServletResponse response, Model model) { return prepateDataAndReturnCreateUserView( model, null, TgolKeyStore.ADD_USER_VIEW_NAME); } UserManagementController(ContractDataService contractDataService,
                                    CreateUserCommandFactory createUserCommandFactory); }
UserManagementController extends AbstractUserAndContractsController { @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) public String displayAddUserAdminPage( HttpServletRequest request, HttpServletResponse response, Model model) { return prepateDataAndReturnCreateUserView( model, null, TgolKeyStore.ADD_USER_VIEW_NAME); } UserManagementController(ContractDataService contractDataService,
                                    CreateUserCommandFactory createUserCommandFactory); @RequestMapping(value = TgolKeyStore.ADMIN_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.EDIT_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayEditUserAdminPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAddUserAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserConfirmation(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_AUDITS_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserAuditsPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_AUDITS_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserAuditsConfirmationPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_CONTRACT_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAddContractAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_CONTRACT_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String submitAddContractAdminPage(
            @ModelAttribute(TgolKeyStore.CREATE_CONTRACT_COMMAND_KEY) CreateContractCommand ccc,
            BindingResult result,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); }
UserManagementController extends AbstractUserAndContractsController { @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) public String displayAddUserAdminPage( HttpServletRequest request, HttpServletResponse response, Model model) { return prepateDataAndReturnCreateUserView( model, null, TgolKeyStore.ADD_USER_VIEW_NAME); } UserManagementController(ContractDataService contractDataService,
                                    CreateUserCommandFactory createUserCommandFactory); @RequestMapping(value = TgolKeyStore.ADMIN_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.EDIT_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayEditUserAdminPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAddUserAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserConfirmation(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_AUDITS_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserAuditsPage(
            @RequestParam(TgolKeyStore.USER_ID_KEY) String userId,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.DELETE_USER_AUDITS_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayDeleteUserAuditsConfirmationPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_CONTRACT_URL, method = RequestMethod.GET) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String displayAddContractAdminPage(
            HttpServletRequest request,
            HttpServletResponse response,
            Model model); @RequestMapping(value = TgolKeyStore.ADD_CONTRACT_URL, method = RequestMethod.POST) @Secured(TgolKeyStore.ROLE_ADMIN_KEY) String submitAddContractAdminPage(
            @ModelAttribute(TgolKeyStore.CREATE_CONTRACT_COMMAND_KEY) CreateContractCommand ccc,
            BindingResult result,
            HttpServletRequest request,
            HttpServletResponse response,
            Model model);  }