Search in sources :

Example 86 with Request

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;
}
Also used : OauthServer(net.geoprism.account.OauthServer) Request(com.runwaysdk.session.Request)

Example 87 with Request

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();
}
Also used : JsonArray(com.google.gson.JsonArray) TestHierarchyTypeInfo(net.geoprism.registry.test.TestHierarchyTypeInfo) JsonObject(com.google.gson.JsonObject) TestGeoObjectTypeInfo(net.geoprism.registry.test.TestGeoObjectTypeInfo) Date(java.util.Date) Request(com.runwaysdk.session.Request)

Example 88 with Request

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());
}
Also used : RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) RegistryRoleConverter(net.geoprism.registry.conversion.RegistryRoleConverter) Roles(com.runwaysdk.system.Roles) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 89 with Request

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();
        }
    }
}
Also used : HashMap(java.util.HashMap) BasicColumnFunction(net.geoprism.data.importer.BasicColumnFunction) BusinessObjectImportConfiguration(net.geoprism.registry.etl.upload.BusinessObjectImportConfiguration) NullImportProgressListener(net.geoprism.registry.etl.NullImportProgressListener) JsonObject(com.google.gson.JsonObject) JSONObject(org.json.JSONObject) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) BusinessObject(net.geoprism.registry.model.BusinessObject) BusinessObject(net.geoprism.registry.model.BusinessObject) BusinessObjectImporter(net.geoprism.registry.etl.upload.BusinessObjectImporter) MapFeatureRow(net.geoprism.registry.excel.MapFeatureRow) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 90 with Request

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();
    }
}
Also used : BusinessObject(net.geoprism.registry.model.BusinessObject) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)340 Test (org.junit.Test)145 JsonObject (com.google.gson.JsonObject)85 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)73 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)73 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)53 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)40 JsonArray (com.google.gson.JsonArray)36 Date (java.util.Date)33 ChangeRequest (net.geoprism.registry.action.ChangeRequest)32 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)31 QueryFactory (com.runwaysdk.query.QueryFactory)30 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)26 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)22 ListType (net.geoprism.registry.ListType)21 SimpleDateFormat (java.text.SimpleDateFormat)19 Classification (net.geoprism.registry.model.Classification)19 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)19 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)17 TransitionEvent (net.geoprism.registry.graph.transition.TransitionEvent)17