Search in sources :

Example 11 with ServerParentGraphNode

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

the class UndirectedGraphTest method testAddParent.

@Test
@Request
public void testAddParent() {
    ServerGeoObjectIF parent = FastTestDataset.PROV_CENTRAL.getServerObject();
    ServerGeoObjectIF child = FastTestDataset.PROV_WESTERN.getServerObject();
    ServerParentGraphNode node = child.addGraphParent(parent, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    Assert.assertNotNull(node);
    Assert.assertEquals(child.getCode(), node.getGeoObject().getCode());
    Assert.assertEquals(FastTestDataset.DEFAULT_OVER_TIME_DATE, node.getStartDate());
    Assert.assertEquals(FastTestDataset.DEFAULT_OVER_TIME_DATE, node.getEndDate());
    List<ServerParentGraphNode> parents = node.getParents();
    Assert.assertEquals(1, parents.size());
    Assert.assertEquals(parent.getCode(), parents.get(0).getGeoObject().getCode());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 12 with ServerParentGraphNode

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

the class UndirectedGraphTest method testGetParents.

@Test
@Request
public void testGetParents() {
    ServerGeoObjectIF parent = FastTestDataset.PROV_CENTRAL.getServerObject();
    ServerGeoObjectIF child = FastTestDataset.PROV_WESTERN.getServerObject();
    child.addGraphParent(parent, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    ServerParentGraphNode node = child.getGraphParents(type, false, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    List<ServerParentGraphNode> parents = node.getParents();
    Assert.assertEquals(1, parents.size());
    Assert.assertEquals(parent.getCode(), parents.get(0).getGeoObject().getCode());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 13 with ServerParentGraphNode

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

the class UndirectedGraphTest method testAddChild.

@Test
public void testAddChild() {
    // Allowed Users
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN };
    for (TestUserInfo user : allowedUsers) {
        FastTestDataset.runAsUser(user, (request, adapter) -> {
            UndirectedGraphControllerWrapper controller = new UndirectedGraphControllerWrapper(adapter, request);
            ServerParentGraphNode node = controller.addChild(FastTestDataset.PROV_CENTRAL.getCode(), FastTestDataset.PROV_CENTRAL.getGeoObjectType().getCode(), FastTestDataset.PROV_WESTERN.getCode(), FastTestDataset.PROV_WESTERN.getGeoObjectType().getCode(), graphTypeCode, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
            validateAddChild(node, FastTestDataset.PROV_CENTRAL, FastTestDataset.PROV_WESTERN);
        });
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) UndirectedGraphControllerWrapper(net.geoprism.registry.test.graph.UndirectedGraphControllerWrapper) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test)

Example 14 with ServerParentGraphNode

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

the class UndirectedGraphTest method testGetParentCyclic.

@Test
@Request
public void testGetParentCyclic() {
    ServerGeoObjectIF provCentral = FastTestDataset.PROV_CENTRAL.getServerObject();
    ServerGeoObjectIF provWestern = FastTestDataset.PROV_WESTERN.getServerObject();
    ServerGeoObjectIF distCentral = FastTestDataset.DIST_CENTRAL.getServerObject();
    ServerGeoObjectIF cambodia = FastTestDataset.CAMBODIA.getServerObject();
    ServerGeoObjectIF privateCentral = FastTestDataset.PROV_CENTRAL_PRIVATE.getServerObject();
    ServerGeoObjectIF centralHospital = FastTestDataset.CENTRAL_HOSPITAL.getServerObject();
    provWestern.addGraphParent(provCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    provCentral.addGraphParent(distCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    provCentral.addGraphParent(cambodia, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    cambodia.addGraphParent(privateCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    cambodia.addGraphParent(centralHospital, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    distCentral.addGraphParent(provWestern, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    ServerParentGraphNode node = provWestern.getGraphParents(type, true, FastTestDataset.DEFAULT_OVER_TIME_DATE);
    Assert.assertNotNull(node);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ServerParentGraphNode (net.geoprism.registry.model.ServerParentGraphNode)14 Test (org.junit.Test)8 Request (com.runwaysdk.session.Request)6 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)6 EdgeObject (com.runwaysdk.business.graph.EdgeObject)5 VertexObject (com.runwaysdk.business.graph.VertexObject)3 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)3 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)3 GraphQuery (com.runwaysdk.business.graph.GraphQuery)2 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)2 TestUserInfo (net.geoprism.registry.test.TestUserInfo)2 HashedMap (org.apache.commons.collections4.map.HashedMap)2 Date (java.util.Date)1 DirectedAcyclicGraphControllerWrapper (net.geoprism.registry.test.graph.DirectedAcyclicGraphControllerWrapper)1 UndirectedGraphControllerWrapper (net.geoprism.registry.test.graph.UndirectedGraphControllerWrapper)1