use of net.geoprism.registry.test.TestUserInfo 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 net.geoprism.registry.test.TestUserInfo 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 net.geoprism.registry.test.TestUserInfo 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 net.geoprism.registry.test.TestUserInfo 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();
}
}
use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testComplexUpdateGeoObjectCR.
/**
* This usecase tests the create and delete actions for value over time objects.
*/
@Test
public void testComplexUpdateGeoObjectCR() throws Exception {
String[] data = testComplexUpdateGeoObjectCR_applyCR();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RA };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testComplexUpdateGeoObjectCR(data, request);
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected exception was thrown on user [" + user.getUsername() + "].");
}
}
}
Aggregations