@Test
public void testRefresh() throws IOException {

  // constants
  final String title = "test-topic-map";
  final String propfile = System.getProperty("net.ontopia.topicmaps.impl.rdbms.PropertyFile");
  RDBMSTopicMapStore store = null;
  RDBMSTopicMapStore store2 = null;
  try {
    // create a new topic map matching pattern
    store = new RDBMSTopicMapStore(propfile);
    ((TopicMap) store.getTopicMap()).setTitle(title);
    store.commit(); // make sure it's in the DB for real
    
    // verify that correct TM is being picked up
    RDBMSPatternSingleTopicMapSource source = makeSource();
    source.setMatch("title");
    source.setPattern(title);
    TopicMapReferenceIF ref = (TopicMapReferenceIF)
      source.getReferences().iterator().next();
    Assert.assertTrue("reference has wrong ID: " + ref,
               ((RDBMSTopicMapReference) ref).getTopicMapId() == store.getLongId());
    // make another topic map matching pattern
    store2 = new RDBMSTopicMapStore(propfile);
    ((TopicMap) store2.getTopicMap()).setTitle(title);
    store2.commit(); // make sure it's in the DB for real
    // verify that new topic map is being picked up
    source.refresh();
    ref = (TopicMapReferenceIF) source.getReferences().iterator().next();
    Assert.assertTrue("reference has wrong ID: " + ref,
               ((RDBMSTopicMapReference) ref).getTopicMapId() == store2.getLongId());
  } finally {
    // clean up
    if (store != null)
      store.delete(true);
    if (store2 != null)
      store2.delete(true);
  }
}