public void testIntegrationFileForBeansChildren() throws Exception {
cEditor = openFileInEditor("src/integration-config.xml");
assertNotNull("Could not open a configuration editor.", cEditor);
AbstractConfigFormPage page = cEditor.getFormPage(OverviewFormPage.ID);
Thread.sleep(StsTestUtil.WAIT_TIME);
cEditor.setActivePage(page.getId());
assertNotNull("Could not load overview page.", page.getMasterPart());
IDOMDocument document = cEditor.getDomDocument();
CMDocumentCache cache = ModelQueryUtil.getCMDocumentCache(document);
final String siUri = ConfigCoreUtils.getSelectedSchemaLocation(document, IntegrationSchemaConstants.URI);
final String siJmsUri = ConfigCoreUtils.getSelectedSchemaLocation(document, IntJmsSchemaConstants.URI);
final String siStreamUri = ConfigCoreUtils.getSelectedSchemaLocation(document, IntStreamSchemaConstants.URI);
final CountDownLatch latch = new CountDownLatch(3);
if (cache.getStatus(siUri) == CMDocumentCache.STATUS_LOADED) {
latch.countDown();
}
if (cache.getStatus(siJmsUri) == CMDocumentCache.STATUS_LOADED) {
latch.countDown();
}
if (cache.getStatus(siStreamUri) == CMDocumentCache.STATUS_LOADED) {
latch.countDown();
}
cache.addListener(new CMDocumentCacheListener() {
public void cacheUpdated(CMDocumentCache cache, String uri, int oldStatus, int newStatus,
CMDocument cmDocument) {
if (newStatus == CMDocumentCache.STATUS_LOADED && oldStatus != CMDocumentCache.STATUS_LOADED) {
if (uri.equals(siUri) || uri.equals(siJmsUri) || uri.equals(siStreamUri)) {
latch.countDown();
}
}
}
public void cacheCleared(CMDocumentCache cache) {
// TODO Auto-generated method stub
}
});
assertTrue("Document initialization did not complete before timeout.", latch.await(30, TimeUnit.SECONDS));
TreeViewer treeViewer = (TreeViewer) page.getMasterPart().getViewer();
TreeItem root = treeViewer.getTree().getItem(0);
IDOMElement node = (IDOMElement) root.getData();
SpringConfigContentAssistProcessor xmlProcessor = page.getXmlProcessor();
List<String> children = xmlProcessor.getChildNames(node);
assertTrue(children.contains(IntegrationSchemaConstants.ELEM_AGGREGATOR));
assertTrue(children.contains(IntegrationSchemaConstants.ELEM_CHANNEL));
assertFalse(children.contains(IntegrationSchemaConstants.ELEM_WIRE_TAP));