use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class WSAccountTest method testRetrieveUser.
@Test
public void testRetrieveUser() throws ResourceNotFoundFault {
// Number of Account Like
long numAccountsLike = gpWSClient.getAccountsCount(new SearchRequest(usernameTest, LikePatternType.CONTENT_EQUALS));
assertEquals("Number of Account Like", 1L, numAccountsLike);
// Get User from Id
// Get UserDTO from Id
UserDTOResponse userDTOResponse = gpWSClient.getShortUser(idUserTest);
UserDTO userDTOFromWS = userDTOResponse.getUserDTO();
assertNotNull(userDTOFromWS);
assertEquals("Error found UserDTO from Id", idUserTest, userDTOFromWS.getId().longValue());
// Get GPUser from Id
GPUser userFromWS = gpWSClient.getUserDetail(idUserTest);
assertNotNull(userFromWS);
assertEquals("Error found GPUser from Id", idUserTest, userFromWS.getId().longValue());
// Get User from Username
// Get UserDTO from Username
userDTOFromWS = gpWSClient.getShortUserByUsername(new SearchRequest(usernameTest, LikePatternType.CONTENT_EQUALS)).getUserDTO();
assertNotNull(userDTOFromWS);
assertEquals("Error found UserDTO from Username", idUserTest, userDTOFromWS.getId().longValue());
// Get GPUser from Username
userFromWS = gpWSClient.getUserDetailByUsername(new SearchRequest(usernameTest, LikePatternType.CONTENT_EQUALS));
assertNotNull(userFromWS);
assertEquals("Error found GPUser from Username", idUserTest, userFromWS.getId().longValue());
}
use of org.geosdi.geoplatform.core.model.GPUser 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());
// }
}
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class WSAccountTest method testAuthorizationCorrectUsername.
@Test
public void testAuthorizationCorrectUsername() throws Exception {
GPUser user = gpWSClient.getUserDetailByUsernameAndPassword(usernameTest, passwordTest);
assertNotNull("User is null", user);
assertEquals(usernameTest, user.getUsername());
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class WSAccountTest method testInsertIncorrectUserWRTUOrganization.
@Test
public void testInsertIncorrectUserWRTUOrganization() {
GPUser user = super.createUser("no-organization", new GPOrganization("organization-inexistent"), USER);
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, FALSE));
fail("User incorrect wrt organization");
} catch (IllegalParameterFault ex) {
if (!ex.getMessage().toLowerCase().contains("organization")) {
// Must be fail for other reasons
fail("Not fail for User incorrect wrt organization, but for: " + ex.getMessage());
}
}
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class WSAccountTest method testAuthorizationCorrectEmail.
@Test
public void testAuthorizationCorrectEmail() throws Exception {
GPUser user = gpWSClient.getUserDetailByUsernameAndPassword(emailTest, passwordTest);
assertNotNull("User is null", user);
assertEquals(emailTest, user.getEmailAddress());
}
Aggregations