Search in sources :

Example 96 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationTest method testGetAncestorTree.

@Test
@Request
public void testGetAncestorTree() {
    Classification parent = Classification.newInstance(type);
    parent.setCode(PARENT_CODE);
    parent.apply(null);
    try {
        Classification child = Classification.newInstance(type);
        child.setCode(CHILD_CODE);
        child.apply(parent);
        try {
            ClassificationNode tree = child.getAncestorTree(null, 200);
            Assert.assertEquals(parent.getOid(), tree.getClassification().getOid());
        } finally {
            child.delete();
        }
    } finally {
        parent.delete();
    }
}
Also used : ClassificationNode(net.geoprism.registry.model.ClassificationNode) Classification(net.geoprism.registry.model.Classification) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 97 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationTest method testAddGetChild.

@Test
@Request
public void testAddGetChild() {
    Classification parent = Classification.newInstance(type);
    parent.setCode(PARENT_CODE);
    parent.apply(null);
    try {
        Classification child = Classification.newInstance(type);
        child.setCode(CHILD_CODE);
        child.apply(null);
        try {
            parent.addChild(child);
            Page<Classification> children = parent.getChildren(20, 1);
            Assert.assertEquals(Long.valueOf(1), children.getCount());
            Classification result = children.getResults().get(0);
            Assert.assertEquals(child.getOid(), result.getOid());
        } finally {
            child.delete();
        }
    } finally {
        parent.delete();
    }
}
Also used : Classification(net.geoprism.registry.model.Classification) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 98 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationTypeTest method testCreate.

@Test
@Request
public void testCreate() {
    String code = "TEST_PROG";
    String label = "Test Prog";
    String description = "Test Description";
    ClassificationType type = ClassificationType.apply(createMock(code, label, description));
    try {
        Assert.assertEquals(code, type.getCode());
        Assert.assertEquals(label, type.getDisplayLabel().getValue());
        Assert.assertNotNull(type.getMdVertex());
    } finally {
        type.delete();
    }
}
Also used : ClassificationType(net.geoprism.registry.model.ClassificationType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 99 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationTypeTest method testRemove.

@Test
@Request
public void testRemove() {
    ClassificationType type = ClassificationType.apply(createMock());
    type.delete();
    try {
        ClassificationType.getByCode(type.getCode());
        Assert.fail("Able to get type which should have been deleted");
    } catch (DataNotFoundException ex) {
    // Expected
    }
}
Also used : DataNotFoundException(com.runwaysdk.dataaccess.cache.DataNotFoundException) ClassificationType(net.geoprism.registry.model.ClassificationType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 100 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class CurationTest method setUpTestCurate.

@Request
private Object[] setUpTestCurate() throws Throwable {
    TestGeoObjectInfo noGeomGo = testData.newTestGeoObjectInfo("curationJobTest-NoGeom", FastTestDataset.PROVINCE);
    noGeomGo.setWkt(null);
    noGeomGo.apply();
    version.publishNoAuth();
    return new Object[] { noGeomGo, version.getOid() };
}
Also used : JsonObject(com.google.gson.JsonObject) TestGeoObjectInfo(net.geoprism.registry.test.TestGeoObjectInfo) 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