}
@Test
- public void bug1348FixTest() throws ConstructionException {
+ public void bug1348FixTest() throws ConstructionException,
+ InterruptedException {
TestSwitchManager swMgr = new TestSwitchManager();
topoManagerImpl.setSwitchManager(swMgr);
topoManagerImpl.nonClusterObjectCreate();
}
Assert.assertTrue(topoManagerImpl.flushUpdateQueue(5000));
+ // Give TopologyManger time to update its edges DB.
+ Thread.sleep(1000);
Assert.assertEquals(1, topoManagerImpl.getEdges().size());
Assert.assertNotNull(topoManagerImpl.getEdges().get(edge));
}
@Test
- public void testNotifyNodeConnector() throws ConstructionException {
+ public void testNotifyNodeConnector() throws ConstructionException,
+ InterruptedException {
TestSwitchManager swMgr = new TestSwitchManager();
topoManagerImpl.setSwitchManager(swMgr);
topoManagerImpl.nonClusterObjectCreate();
swMgr.addNodeConnectors(nc2);
topoManagerImpl.notifyNodeConnector(nc2, UpdateType.CHANGED, propMap);
Assert.assertTrue(topoManagerImpl.flushUpdateQueue(5000));
+ // Give TopologyManger time to update its edges DB.
+ Thread.sleep(1000);
Assert.assertEquals(2, topoManagerImpl.getEdges().size());
teu1 = new TopoEdgeUpdate(edge1, props, UpdateType.REMOVED);
topoedgeupdateList.add(teu2);
topoManagerImpl.edgeUpdate(topoedgeupdateList);
Assert.assertTrue(topoManagerImpl.flushUpdateQueue(5000));
+ // Give TopologyManger time to update its edges DB.
+ Thread.sleep(1000);
Assert.assertEquals(0, topoManagerImpl.getEdges().size());
topoManagerImpl.notifyNodeConnector(nc1, UpdateType.REMOVED, propMap);
topoManagerImpl.notifyNodeConnector(nc2, UpdateType.REMOVED, propMap);
swMgr.addNodeConnectors(nc2);
topoManagerImpl.notifyNodeConnector(nc2, UpdateType.CHANGED, propMap);
Assert.assertTrue(topoManagerImpl.flushUpdateQueue(5000));
+ // Give TopologyManger time to update its edges DB.
+ Thread.sleep(1000);
Assert.assertEquals(0, topoManagerImpl.getEdges().size());
topoManagerImpl.notifyNodeConnector(nc1, UpdateType.REMOVED, propMap);
topoManagerImpl.notifyNodeConnector(nc2, UpdateType.REMOVED, propMap);
Assert.assertTrue(topoManagerImpl.flushUpdateQueue(5000));
+ // Give TopologyManger time to update its edges DB.
+ Thread.sleep(1000);
Assert.assertEquals(0, topoManagerImpl.getEdges().size());
}
}
return result;
}
- public List<Record> addRecords(Object element, XSQLBluePrintNode node,
- boolean root, String tableName, XSQLBluePrint bluePrint) {
-
+ public List<Record> addRecords(Object element, XSQLBluePrintNode node,boolean root, String tableName, XSQLBluePrint bluePrint) {
List<Record> result = new LinkedList<Record>();
+ //In case this is a sibling to the requested table, the elenment type
+ //won't be in the path of the leaf node
+ if(node==null){
+ return result;
+ }
String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
if (node.getODLTableName().equals(nodeID)) {
- XSQLBluePrintNode bluePrintNode = bluePrint
- .getBluePrintNodeByODLTableName(nodeID)[0];
+ XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0];
Record rec = new Record();
rec.element = element;
- XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode
- .getBluePrintNodeName());
- if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName())
- || bpn != null) {
+ XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName());
+ if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) {
Map<String, Object> allKeyValues = collectColumnValues(element, bpn);
if (!(isObjectFitCriteria(allKeyValues,
bpn.getBluePrintNodeName()) == 1)) {
}
XSQLBluePrintNode parent = node.getParent();
- List<Record> subRecords = addRecords(element, parent, false, tableName,
- bluePrint);
+ List<Record> subRecords = addRecords(element, parent, false, tableName,bluePrint);
for (Record subRec : subRecords) {
List<Object> subO = getChildren(subRec.element, tableName,
bluePrint);