use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectDateCR.
/**
* Update Date Attr Test
*/
@Test
public void testUpdateGeoObjectDateCR() throws Exception {
Object[] data = testUpdateGeoObjectDateCR_applyCR();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RA };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testUpdateGeoObjectDateCR(data, request);
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected exception was thrown on user [" + user.getUsername() + "].");
}
}
}
use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectCR.
@Test
public void testUpdateGeoObjectCR() throws Exception {
String json = testUpdateGeoObjectCR_Json();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RC };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testUpdateGeoObjectCR(json, request);
});
} 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_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testUpdateGeoObjectCR(json, request);
Assert.fail("Expected a permission exception to be thrown on user [" + user.getUsername() + "].");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(e.getType(), CGRPermissionException.CLASS);
}
}
}
use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testImplementDecisions.
@Test
public void testImplementDecisions() {
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) -> {
testImplementDecisions(request, createTestChangeRequest(UpdateAttributeAction.CLASS));
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected 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, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testImplementDecisions(request, createTestChangeRequest(UpdateAttributeAction.CLASS));
Assert.fail("Expected a permission exception to be thrown on user [" + user.getUsername() + "].");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(e.getType(), CGRPermissionException.CLASS);
}
}
}
use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testCreateGeoObjectCR.
@Test
public void testCreateGeoObjectCR() throws Exception {
String[] json = testCreateGeoObjectCR_Json();
TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_CGOV_RC };
for (TestUserInfo user : allowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testCreateGeoObjectCR(json, request);
});
} 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_AC };
for (TestUserInfo user : disAllowedUsers) {
try {
FastTestDataset.runAsUser(user, (request, adapter) -> {
testCreateGeoObjectCR(json, request);
Assert.fail("Expected a permission exception to be thrown on user [" + user.getUsername() + "].");
});
} catch (SmartExceptionDTO e) {
Assert.assertEquals(e.getType(), CGRPermissionException.CLASS);
}
}
}
use of net.geoprism.registry.test.TestUserInfo in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testGetAllCR.
@Test
public void testGetAllCR() {
createTestChangeRequest(CreateGeoObjectAction.CLASS);
createTestChangeRequest(UpdateAttributeAction.CLASS);
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) -> {
testGetAllCR(request, true);
});
} 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) -> {
testGetAllCR(request, false);
});
} catch (SmartExceptionDTO e) {
e.printStackTrace();
Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
}
}
}
Aggregations