Search in sources :

Example 86 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class GeoObjectTypeRelationshipServiceTest method testAddChildOfAbstractType.

@Test(expected = AbstractParentException.class)
@Request
public void testAddChildOfAbstractType() {
    TestGeoObjectTypeInfo parentGot = new TestGeoObjectTypeInfo("HMST_Abstract", FastTestDataset.ORG_CGOV);
    parentGot.setAbstract(true);
    TestGeoObjectTypeInfo childGot = new TestGeoObjectTypeInfo("HMST_Child", FastTestDataset.ORG_CGOV);
    try {
        parentGot.apply();
        childGot.apply();
        ServerHierarchyType type = FastTestDataset.HIER_ADMIN.getServerObject();
        ServerGeoObjectType parentType = parentGot.getServerObject();
        ServerGeoObjectType childType = childGot.getServerObject();
        try {
            type.addToHierarchy(RootGeoObjectType.INSTANCE, parentType);
            type.addToHierarchy(parentType, childType);
        } finally {
            type.removeChild(RootGeoObjectType.INSTANCE, parentType, false);
        }
    } finally {
        parentGot.delete();
        childGot.delete();
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) TestGeoObjectTypeInfo(net.geoprism.registry.test.TestGeoObjectTypeInfo) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 87 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class GeoObjectQueryTest method testFailLookupRestriction.

@Test
@Request
public void testFailLookupRestriction() {
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    ServerLookupRestriction restriction = new ServerLookupRestriction(USATestData.CANADA.getCode(), USATestData.CANADA.getDate());
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    query.setRestriction(restriction);
    ServerGeoObjectIF result = query.getSingleResult();
    Assert.assertNull(result);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ServerLookupRestriction(net.geoprism.registry.query.ServerLookupRestriction) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 88 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class InheritedHierarchyAnnotationTest method testCreateOnNonRoot.

@Request
@Test(expected = HierarchyRootException.class)
public void testCreateOnNonRoot() {
    ServerGeoObjectType sGOT = TEST_CHILD.getServerObject();
    sGOT.setInheritedHierarchy(TEST_HT.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject());
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 89 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class InheritedHierarchyAnnotationTest method testGetByUniversalAndHierarchy.

@Test
@Request
public void testGetByUniversalAndHierarchy() {
    ServerGeoObjectType sGOT = FastTestDataset.PROVINCE.getServerObject();
    ServerHierarchyType forHierarchy = TEST_HT.getServerObject();
    ServerHierarchyType inheritedHierarchy = FastTestDataset.HIER_ADMIN.getServerObject();
    InheritedHierarchyAnnotation annotation = sGOT.setInheritedHierarchy(forHierarchy, inheritedHierarchy);
    try {
        InheritedHierarchyAnnotation test = InheritedHierarchyAnnotation.get(sGOT.getUniversal(), forHierarchy.getHierarchicalRelationshipType());
        Assert.assertNotNull(test);
        Assert.assertEquals(test.getOid(), annotation.getOid());
    } finally {
        annotation.delete();
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) InheritedHierarchyAnnotation(net.geoprism.registry.InheritedHierarchyAnnotation) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 90 with ServerGeoObjectType

use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.

the class InheritedHierarchyAnnotationTest method testRemove.

@Test
@Request
public void testRemove() {
    ServerGeoObjectType sGOT = FastTestDataset.PROVINCE.getServerObject();
    ServerHierarchyType forHierarchy = TEST_HT.getServerObject();
    ServerHierarchyType inheritedHierarchy = FastTestDataset.HIER_ADMIN.getServerObject();
    sGOT.setInheritedHierarchy(forHierarchy, inheritedHierarchy);
    sGOT.removeInheritedHierarchy(forHierarchy);
    InheritedHierarchyAnnotation test = InheritedHierarchyAnnotation.get(sGOT.getUniversal(), forHierarchy.getHierarchicalRelationshipType());
    try {
        Assert.assertNull(test);
    } finally {
        if (test != null) {
            test.delete();
        }
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) InheritedHierarchyAnnotation(net.geoprism.registry.InheritedHierarchyAnnotation) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)201 Request (com.runwaysdk.session.Request)69 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)57 JsonObject (com.google.gson.JsonObject)48 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)32 JsonArray (com.google.gson.JsonArray)30 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)30 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)27 LinkedList (java.util.LinkedList)27 Test (org.junit.Test)27 VertexObject (com.runwaysdk.business.graph.VertexObject)26 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)26 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)23 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)23 Date (java.util.Date)21 GraphQuery (com.runwaysdk.business.graph.GraphQuery)19 List (java.util.List)18 EdgeObject (com.runwaysdk.business.graph.EdgeObject)17 SimpleDateFormat (java.text.SimpleDateFormat)17 Locale (java.util.Locale)17