use of org.geosdi.geoplatform.request.InsertAccountRequest in project geo-platform by geosdi.
the class RSAccountTest method testInsertDuplicateUserWRTUsernameRest.
@Test
public void testInsertDuplicateUserWRTUsernameRest() throws Exception {
GPUser user = super.createUser(usernameTest, organizationTest, GPRole.USER);
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, Boolean.FALSE));
Assert.fail("User already exist wrt username");
} catch (ClientErrorException ex) {
GPRestExceptionMessage exMess = ex.getResponse().readEntity(GPRestExceptionMessage.class);
logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", exMess);
if (!exMess.getMessage().toLowerCase().contains("username")) {
// Must be fail for other reasons
Assert.fail("Not fail for User already exist wrt username, but for: " + ex.getMessage());
}
}
}
use of org.geosdi.geoplatform.request.InsertAccountRequest in project geo-platform by geosdi.
the class WSAccountTest method testInsertDuplicateUserWRTEmail.
@Test
public void testInsertDuplicateUserWRTEmail() {
GPUser user = super.createUser("duplicate-email", organizationTest, USER);
user.setEmailAddress(super.userTest.getEmailAddress());
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, FALSE));
fail("User already exist wrt email");
} catch (IllegalParameterFault ex) {
if (!ex.getMessage().toLowerCase().contains("email")) {
// Must be fail for other reasons
fail("Not fail for User already exist wrt email, but for: " + ex.getMessage());
}
}
}
use of org.geosdi.geoplatform.request.InsertAccountRequest in project geo-platform by geosdi.
the class GPJacksonAccountSupportTest method insertAccountRequestMapperTest.
@Test
public void insertAccountRequestMapperTest() throws Exception {
InsertAccountRequest insertAccountRequest = jacksonSupport.getDefaultMapper().readValue(Thread.currentThread().getContextClassLoader().getResourceAsStream(INSERT_ACCOUNT_REQUEST_DATA_JSON), InsertAccountRequest.class);
logger.info("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@INSERT_ACCOUNT_REQUEST" + " : {}\n\n", insertAccountRequest);
super.marshall(insertAccountRequest);
}
use of org.geosdi.geoplatform.request.InsertAccountRequest in project geo-platform by geosdi.
the class UserService method insertUser.
@Override
public Long insertUser(IGPUserManageDetail userDetail, String organization, HttpServletRequest httpServletRequest, boolean checkUserSession, boolean sendEmail) throws GeoPlatformException {
if (checkUserSession) {
this.getCheckLoggedUser(httpServletRequest);
}
logger.debug("\nUser to INSERT (of the organization \"{}\"):\n{}", organization, userDetail);
Long iserId = null;
try {
GPUser user = this.dtoUserConverter.convertToGPUser(userDetail);
user.setOrganization(new GPOrganization(organization));
iserId = geoPlatformServiceClient.insertAccount(new InsertAccountRequest(user, sendEmail));
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
}
return iserId;
}
use of org.geosdi.geoplatform.request.InsertAccountRequest in project geo-platform by geosdi.
the class WSAccountTest method testInsertDuplicateUserWRTUsername.
@Test
public void testInsertDuplicateUserWRTUsername() {
GPUser user = super.createUser(usernameTest, organizationTest, USER);
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, FALSE));
fail("User already exist wrt username");
} catch (IllegalParameterFault ex) {
ex.printStackTrace();
// if (!ex.getMessage().toLowerCase().contains("username")) { // Must be fail for other reasons
// fail("Not fail for User already exist wrt username, but for: " + ex.getMessage());
// }
}
}
Aggregations