Search in sources :

Example 1 with SingleListType

use of net.geoprism.registry.SingleListType in project geoprism-registry by terraframe.

the class CurationTest method createTestInstanceData.

@Request
private void createTestInstanceData() {
    list = new SingleListType();
    list.setUniversal(FastTestDataset.PROVINCE.getUniversal());
    list.getDisplayLabel().setValue("Test List");
    list.setCode("TEST_CODE");
    list.setOrganization(FastTestDataset.ORG_CGOV.getServerObject());
    list.getDescription().setValue("My Overal Description");
    list.setValidOn(TestDataSet.DEFAULT_OVER_TIME_DATE);
    list.getListDescription().setValue("My Abstract");
    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");
    list.apply();
    entry = ListTypeEntry.create(list, TestDataSet.DEFAULT_OVER_TIME_DATE, null);
    entry.createVersion(ListTypeTest.createVersionMetadata()).publishNoAuth();
    List<ListTypeVersion> versions = entry.getVersions();
    Assert.assertEquals(2, versions.size());
    version = versions.get(0);
    job = new ListCurationJob();
    job.setRunAsUser(TestDataSet.USER_ADMIN.getGeoprismUser());
    job.apply();
    history = (ListCurationHistory) job.createNewHistory();
    history.appLock();
    history.clearStatus();
    history.addStatus(AllJobStatus.RUNNING);
    history.setVersion(version);
    history.apply();
    historyId = history.getOid();
    jobHistoryRecord = new JobHistoryRecord(job, history);
    jobHistoryRecord.apply();
    curationProblem = new GeoObjectProblem();
    curationProblem.setHistory(history);
    curationProblem.setResolution(CurationResolution.UNRESOLVED.name());
    curationProblem.setProblemType(GeoObjectProblemType.NO_GEOMETRY.name());
    curationProblem.setTypeCode(FastTestDataset.PROVINCE.getCode());
    curationProblem.setGoCode(FastTestDataset.PROV_CENTRAL.getCode());
    curationProblem.apply();
    curationProblemId = curationProblem.getOid();
}
Also used : JobHistoryRecord(com.runwaysdk.system.scheduler.JobHistoryRecord) SingleListType(net.geoprism.registry.SingleListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Request(com.runwaysdk.session.Request)

Example 2 with SingleListType

use of net.geoprism.registry.SingleListType in project geoprism-registry by terraframe.

the class ListTypeTest method testSingleListTypeSerialization.

@Test
@Request
public void testSingleListTypeSerialization() {
    SingleListType list = new SingleListType();
    list.setUniversal(USATestData.STATE.getUniversal());
    list.getDisplayLabel().setValue("Test List");
    list.setCode("TEST_CODE");
    list.setOrganization(USATestData.ORG_NPS.getServerObject());
    list.getDescription().setValue("My Overal Description");
    list.setValidOn(USATestData.DEFAULT_OVER_TIME_DATE);
    JsonObject json = list.toJSON();
    SingleListType test = (SingleListType) ListType.fromJSON(json);
    Assert.assertEquals(list.getUniversalOid(), test.getUniversalOid());
    Assert.assertEquals(list.getDisplayLabel().getValue(), test.getDisplayLabel().getValue());
    Assert.assertEquals(list.getDescription().getValue(), test.getDescription().getValue());
    Assert.assertEquals(list.getOrganization(), test.getOrganization());
    Assert.assertEquals(list.getCode(), test.getCode());
    Assert.assertEquals(list.getHierarchiesAsJson().toString(), test.getHierarchiesAsJson().toString());
    Assert.assertEquals(list.getValidOn(), test.getValidOn());
}
Also used : JsonObject(com.google.gson.JsonObject) SingleListType(net.geoprism.registry.SingleListType) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)2 SingleListType (net.geoprism.registry.SingleListType)2 JsonObject (com.google.gson.JsonObject)1 JobHistoryRecord (com.runwaysdk.system.scheduler.JobHistoryRecord)1 ListTypeVersion (net.geoprism.registry.ListTypeVersion)1 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)1 Test (org.junit.Test)1