use of org.geosdi.geoplatform.exception.rs.GPRestExceptionMessage 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.exception.rs.GPRestExceptionMessage in project geo-platform by geosdi.
the class RSLayerTest method testTransactionOnRemoveAndAddLayerRest.
@Test
public void testTransactionOnRemoveAndAddLayerRest() throws IllegalParameterFault, ResourceNotFoundFault {
logger.trace("\n\t@@@ testTransactionOnRemoveAndAddLayerRest @@@");
Map<Long, Integer> map = new HashMap();
GPWebServiceMapData descendantsMapData = new GPWebServiceMapData();
descendantsMapData.setDescendantsMap(map);
map.put(idRootFolderA, 3);
try {
// Delete "rasterLayer1" from "rootFolderA"
boolean erased = gpWSClient.deleteLayer(idRaster1);
Assert.assertTrue("Deletion of the layer rasterLayer1", erased);
GPRasterLayer raster = new GPRasterLayer();
super.createLayer(raster, rootFolderA, null, "", "", 5, spatialReferenceSystem, // Title must be NOT NULL
urlServer);
gpWSClient.saveAddedLayerAndTreeModifications(new WSAddLayerAndTreeModificationsRequest(projectTest.getId(), rootFolderA.getId(), raster, descendantsMapData));
Assert.fail("Add layer must fail because title value is null");
} catch (ClientErrorException ex) {
GPRestExceptionMessage exMess = ex.getResponse().readEntity(GPRestExceptionMessage.class);
logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@{}\n", exMess);
try {
raster1 = gpWSClient.getRasterLayer(idRaster1).getRasterLayer();
Assert.fail("rasterLayer1 must not exist");
} catch (NotFoundException rnf) {
GPRestExceptionMessage rnfMess = rnf.getResponse().readEntity(GPRestExceptionMessage.class);
logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@{}\n", rnfMess);
}
}
}
use of org.geosdi.geoplatform.exception.rs.GPRestExceptionMessage in project geo-platform by geosdi.
the class RSAccountTest method testInsertDuplicateUserWRTEmailRest.
@Test
public void testInsertDuplicateUserWRTEmailRest() throws Exception {
GPUser user = super.createUser("duplicate-email-rs", organizationTest, GPRole.USER);
user.setEmailAddress(super.userTest.getEmailAddress());
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, Boolean.FALSE));
Assert.fail("User already exist wrt email");
} catch (ClientErrorException ex) {
GPRestExceptionMessage exMess = ex.getResponse().readEntity(GPRestExceptionMessage.class);
logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", exMess);
if (!exMess.getMessage().toLowerCase().contains("email")) {
// Must be fail for other reasons
Assert.fail("Not fail for User already exist wrt email, but for: " + ex.getMessage());
}
}
}
use of org.geosdi.geoplatform.exception.rs.GPRestExceptionMessage in project geo-platform by geosdi.
the class RSAccountTest method testInsertIncorrectUserWRTUOrganizationRest.
@Test
public void testInsertIncorrectUserWRTUOrganizationRest() throws Exception {
GPUser user = super.createUser("no-organization-rs", new GPOrganization("organization-inexistent-rs"), GPRole.USER);
try {
gpWSClient.insertAccount(new InsertAccountRequest(user, Boolean.FALSE));
Assert.fail("User incorrect wrt organization");
} catch (ClientErrorException ex) {
GPRestExceptionMessage exMess = ex.getResponse().readEntity(GPRestExceptionMessage.class);
logger.debug("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", exMess);
if (!exMess.getMessage().toLowerCase().contains("organization")) {
// Must be fail for other reasons
Assert.fail("Not fail for User incorrect wrt organization, but for: " + ex.getMessage());
}
}
}
Aggregations