use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentActionServiceTest method testDownloadDocument.
// @Test
public void testDownloadDocument() throws IOException {
String vfOid = uploadDocumentsAsAdmin();
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) -> {
downloadDocumentAsUser(request, vfOid);
});
} 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) -> {
downloadDocumentAsUser(request, vfOid);
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 ChangeRequestDocumentActionServiceTest method testDeleteDocument.
// @Test
public void testDeleteDocument() {
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) -> {
testDeleteDocumentAsUser(request);
});
} 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) -> {
testDeleteDocumentAsUser(request);
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentServiceTest method testListDocuments.
@Test
public void testListDocuments() {
uploadDocumentsAsAdmin();
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) -> {
testListDocumentsAsUser(request);
});
} 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) -> {
testListDocumentsAsUser(request);
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentServiceTest method testDeleteDocument.
@Test
public void testDeleteDocument() {
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) -> {
testDeleteDocumentAsUser(request);
});
} 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) -> {
testDeleteDocumentAsUser(request);
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
}
}
use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.
the class ChangeRequestDocumentServiceTest method testDownloadDocument.
@Test
public void testDownloadDocument() throws IOException {
String vfOid = uploadDocumentsAsAdmin();
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) -> {
downloadDocumentAsUser(request, vfOid);
});
} 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) -> {
downloadDocumentAsUser(request, vfOid);
Assert.fail("Expected a permission exception.");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
// Expected
}
TestDataSet.deleteAllVaultFiles();
}
}
Aggregations