use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentActionServiceTest method testUploadDocument.
// @Test
public void testUploadDocument() {
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
new ChangeRequestService().uploadFileCR(request.getSessionId(), this.cr.getOid(), "parent-test.xlsx", ChangeRequestDocumentActionServiceTest.class.getResourceAsStream("/parent-test.xlsx"));
TestDataSet.deleteAllVaultFiles();
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
}
}
TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
new ChangeRequestService().uploadFileCR(request.getSessionId(), this.cr.getOid(), "parent-test.xlsx", ChangeRequestDocumentActionServiceTest.class.getResourceAsStream("/parent-test.xlsx"));
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
TestDataSet.deleteAllVaultFiles();
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentServiceTest method testUploadDocument.
@Test
public void testUploadDocument() {
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
new ChangeRequestService().uploadFileCR(request.getSessionId(), this.crOid, "parent-test.xlsx", ChangeRequestDocumentServiceTest.class.getResourceAsStream("/parent-test.xlsx"));
TestDataSet.deleteAllVaultFiles();
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
}
}
TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
new ChangeRequestService().uploadFileCR(request.getSessionId(), this.crOid, "parent-test.xlsx", ChangeRequestDocumentServiceTest.class.getResourceAsStream("/parent-test.xlsx"));
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
TestDataSet.deleteAllVaultFiles();
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testImplementParentDecisions.
@Test
public void testImplementParentDecisions() {
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testImplementParentDecisions(request, createTestChangeRequest(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME));
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected exception was thrown on user [" + user.getUsername() + "].");
}
tearDown();
setUp();
}
TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testImplementParentDecisions(request, createTestChangeRequest(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME));
Assert.fail("Expected a permission exception to be thrown on user [" + user.getUsername() + "].");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(e.getType(), CGRPermissionException.CLASS);
}
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectLocalizedValueCR.
/**
* Update Localized Value Test
*/
@Test
public void testUpdateGeoObjectLocalizedValueCR() throws Exception {
String[] data = testUpdateGeoObjectLocalizedValueCR_applyCR();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RA };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testUpdateGeoObjectLocalizedValueCR(data, request);
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected exception was thrown on user [" + user.getUsername() + "].");
}
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectGeometryCR.
/**
* Update Geometry Test
*/
@Test
public void testUpdateGeoObjectGeometryCR() throws Exception {
String[] data = testUpdateGeoObjectGeometryCR_applyCR();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RA };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testUpdateGeoObjectGeometryCR(data, request);
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected exception was thrown on user [" + user.getUsername() + "].");
}
}
}
Aggregations