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());
}
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());
}
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);
});
}
}
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);
}
Aggregations