use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class JsonSerializationTest method getOauthServer.
@Request
private OauthServer getOauthServer() {
OauthServer oauth = new OauthServer();
oauth.setSecretKey("1e6db50c-0fee-11e5-98d0-3c15c2c6caf6");
oauth.setClientId("geoprism");
oauth.setProfileLocation("http://test-profile.example.net/profile");
oauth.setAuthorizationLocation("http://test-profile.example.net/authorization");
oauth.setTokenLocation("http://test-profile.example.net/token");
oauth.setServerType("DHIS2");
oauth.apply();
return oauth;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ListTypeBuilder method buildJSON.
@Request
public JsonObject buildJSON() {
JsonArray array = new JsonArray();
JsonArray hArray = new JsonArray();
for (Hierarchy ht : hts) {
JsonArray pArray = new JsonArray();
for (TestGeoObjectTypeInfo parent : ht.parents) {
JsonObject object = new JsonObject();
object.addProperty("code", parent.getCode());
object.addProperty("selected", true);
pArray.add(object);
}
JsonObject hierarchy = new JsonObject();
hierarchy.addProperty("code", ht.type.getCode());
hierarchy.add("parents", pArray);
array.add(hierarchy);
if (ht.subtypeHierarchies != null) {
for (TestHierarchyTypeInfo subtype : ht.subtypeHierarchies) {
JsonObject object = new JsonObject();
object.addProperty("code", subtype.getCode());
object.addProperty("selected", true);
hArray.add(object);
}
}
}
SingleListType list = new SingleListType();
list.setValidOn(new Date());
list.setUniversal(this.info.getUniversal());
list.getDisplayLabel().setValue("Test List");
list.setCode(this.code);
list.setOrganization(this.org);
list.getDescription().setValue("My Abstract");
list.setHierarchies(array.toString());
if (hArray.size() > 0) {
list.setSubtypeHierarchies(hArray.toString());
}
list.getListProcess().setValue("Process");
list.getListProgress().setValue("Progress");
list.getListAccessConstraints().setValue("Access Contraints");
list.getListUseConstraints().setValue("User Constraints");
list.getListAcknowledgements().setValue("Acknowledgements");
list.getListDisclaimer().setValue("Disclaimer");
list.setListContactName("Contact Name");
list.setListTelephoneNumber("Telephone Number");
list.setListEmail("Email");
return list.toJSON();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class OrganizationAndRoleTest method testRA_RoleToRegistryRole.
@Test
@Request
public void testRA_RoleToRegistryRole() {
String organizationCode = FastTestDataset.ORG_CGOV.getCode();
String raRoleName = RegistryRole.Type.getRA_RoleName(organizationCode);
Roles raRole = Roles.findRoleByName(raRoleName);
RegistryRole registryRole = new RegistryRoleConverter().build(raRole);
Assert.assertEquals(raRoleName, registryRole.getName());
Assert.assertEquals(organizationCode, registryRole.getOrganizationCode());
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class BusinessObjectImporterTest method testUpdateValue.
@Test
@Request
public void testUpdateValue() throws InterruptedException {
BusinessObject object = BusinessObject.newInstance(type);
object.setCode(TEST_CODE);
object.apply();
try {
String value = "Test Text";
String rowAttribute = "Bad";
HashMap<String, Object> row = new HashMap<String, Object>();
row.put(rowAttribute, value);
row.put(BusinessObject.CODE, TEST_CODE);
BusinessObjectImportConfiguration configuration = new BusinessObjectImportConfiguration();
configuration.setImportStrategy(ImportStrategy.UPDATE_ONLY);
configuration.setType(type);
configuration.setDate(FastTestDataset.DEFAULT_END_TIME_DATE);
configuration.setCopyBlank(false);
configuration.setFunction(attributeType.getName(), new BasicColumnFunction(rowAttribute));
configuration.setFunction(BusinessObject.CODE, new BasicColumnFunction(BusinessObject.CODE));
BusinessObjectImporter importer = new BusinessObjectImporter(configuration, new NullImportProgressListener());
importer.importRow(new MapFeatureRow(row));
Assert.assertFalse(configuration.hasExceptions());
BusinessObject result = BusinessObject.getByCode(type, TEST_CODE);
Assert.assertEquals(result.getObjectValue(attributeType.getName()), value);
} finally {
if (object != null) {
object.delete();
}
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class BusinessObjectTest method testSetGetValue.
@Test
@Request
public void testSetGetValue() {
BusinessObject object = BusinessObject.newInstance(type);
object.setValue(attribute.getName(), "Test Text");
object.setCode(TEST_CODE);
object.apply();
try {
Assert.assertEquals("Test Text", object.getObjectValue(attribute.getName()));
} finally {
object.delete();
}
}
Aggregations