@Test public void testExecuteWithNullPassword() { ReflectionTestUtils.setField(createUserCmd, "password", null); try { createUserCmd.execute(); Assert.fail("should throw exception for a null password"); } catch (final ServerApiException e) { Assert.assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode()); Assert.assertEquals("Empty passwords are not allowed", e.getMessage()); } Mockito.verify(accountService, Mockito.never()).createUser(null, null, null, null, null, null, null, null, null); }
@Override public void execute() { validateParams(); CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); final User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) { final UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } }
CreateUserCmd extends BaseCmd { @Override public void execute() { validateParams(); CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); final User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) { final UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } } }
CreateUserCmd extends BaseCmd { @Override public void execute() { validateParams(); CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); final User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) { final UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } }  }
CreateUserCmd extends BaseCmd { @Override public void execute() { validateParams(); CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); final User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) { final UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } }  @Override void execute(); @Override String getCommandName(); @Override long getEntityOwnerId(); String getUserName(); String getFirstName(); String getLastName(); String getPassword(); String getEmail(); String getTimezone(); String getAccountName(); Long getDomainId(); String getUserUUID(); }
CreateUserCmd extends BaseCmd { @Override public void execute() { validateParams(); CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); final User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID()); if (user != null) { final UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } }  @Override void execute(); @Override String getCommandName(); @Override long getEntityOwnerId(); String getUserName(); String getFirstName(); String getLastName(); String getPassword(); String getEmail(); String getTimezone(); String getAccountName(); Long getDomainId(); String getUserUUID(); static final Logger s_logger; }