Program: 63114
Project: 63114
Buggy source:
@Test public void testMetaCRUD() throws Exception {
  final int sleepTime=400;
  final MetadataManager metadataManager=MetadataManager.getInstance(configA);
  final MetadataManager metadataManagerB=MetadataManager.getInstance(configB);
  final Broadcaster broadcaster=Broadcaster.getInstance();
  broadcaster.getCounterAndClear();
  TableDesc tableDesc=createTestTableDesc();
  assertTrue(metadataManager.getTableDesc(tableDesc.getIdentity()) == null);
  assertTrue(metadataManagerB.getTableDesc(tableDesc.getIdentity()) == null);
  metadataManager.saveSourceTable(tableDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  Thread.sleep(sleepTime);
  assertNotNull(metadataManager.getTableDesc(tableDesc.getIdentity()));
  assertNotNull(metadataManagerB.getTableDesc(tableDesc.getIdentity()));
  final String dataModelName="String_Node_Str";
  DataModelDesc dataModelDesc=metadataManager.getDataModelDesc("String_Node_Str");
  dataModelDesc.setName(dataModelName);
  dataModelDesc.setLastModified(0);
  assertTrue(metadataManager.getDataModelDesc(dataModelName) == null);
  assertTrue(metadataManagerB.getDataModelDesc(dataModelName) == null);
  dataModelDesc.setName(dataModelName);
  metadataManager.createDataModelDesc(dataModelDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  Thread.sleep(sleepTime);
  assertEquals(dataModelDesc.getName(),metadataManagerB.getDataModelDesc(dataModelName).getName());
  final LookupDesc[] lookups=dataModelDesc.getLookups();
  assertTrue(lookups.length > 0);
  dataModelDesc.setLookups(new LookupDesc[]{lookups[0]});
  metadataManager.updateDataModelDesc(dataModelDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  Thread.sleep(sleepTime);
  assertEquals(dataModelDesc.getLookups().length,metadataManagerB.getDataModelDesc(dataModelName).getLookups().length);
}

Fixed version (ground truth):
@Test public void testMetaCRUD() throws Exception {
  final MetadataManager metadataManager=MetadataManager.getInstance(configA);
  final MetadataManager metadataManagerB=MetadataManager.getInstance(configB);
  final Broadcaster broadcaster=Broadcaster.getInstance();
  broadcaster.getCounterAndClear();
  TableDesc tableDesc=createTestTableDesc();
  assertTrue(metadataManager.getTableDesc(tableDesc.getIdentity()) == null);
  assertTrue(metadataManagerB.getTableDesc(tableDesc.getIdentity()) == null);
  metadataManager.saveSourceTable(tableDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  waitForCounterAndClear(1);
  assertNotNull(metadataManager.getTableDesc(tableDesc.getIdentity()));
  assertNotNull(metadataManagerB.getTableDesc(tableDesc.getIdentity()));
  final String dataModelName="String_Node_Str";
  DataModelDesc dataModelDesc=metadataManager.getDataModelDesc("String_Node_Str");
  dataModelDesc.setName(dataModelName);
  dataModelDesc.setLastModified(0);
  assertTrue(metadataManager.getDataModelDesc(dataModelName) == null);
  assertTrue(metadataManagerB.getDataModelDesc(dataModelName) == null);
  dataModelDesc.setName(dataModelName);
  metadataManager.createDataModelDesc(dataModelDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  waitForCounterAndClear(1);
  assertEquals(dataModelDesc.getName(),metadataManagerB.getDataModelDesc(dataModelName).getName());
  final LookupDesc[] lookups=dataModelDesc.getLookups();
  assertTrue(lookups.length > 0);
  dataModelDesc.setLookups(new LookupDesc[]{lookups[0]});
  metadataManager.updateDataModelDesc(dataModelDesc);
  assertEquals(1,broadcaster.getCounterAndClear());
  waitForCounterAndClear(1);
  assertEquals(dataModelDesc.getLookups().length,metadataManagerB.getDataModelDesc(dataModelName).getLookups().length);
}