Hi All Again,
Still doing testing on the new configuration and rewriting some code
to 3.1, and have come across the following issue:
My configuration code again:
Module extensions = new Module() {
@Override
public void configure(Binder binder) {
binder.bind(QueryCache.class).to(OSQueryCache.class);
}
};
ServerRuntime sr = new ServerRuntime("cayenne-cdao.xml", extensions);
DataDomain domain = sr.getDataDomain();
DataNode node = domain.getNode("cdaoNode");
node.setDataSource(dataSource);
Since I'm testing how my app handles caching invalidation using the
new DataChannelFilter I have 2 utility methods:
protected QueryCache getSharedCache() {
NestedQueryCache cache = (NestedQueryCache) ((DataContext)
getDataContext()).getParentDataDomain().getQueryCache();
if (osCache)
assertEquals(OSQueryCache.class, cache.getDelegate().getClass());
return cache.getDelegate();
}
protected QueryCache getLocalCache() {
NestedQueryCache cache = (NestedQueryCache) ((DataContext)
getDataContext()).getQueryCache();
if (osCache)
assertEquals(OSQueryCache.class, cache.getDelegate().getClass());
return cache.getDelegate();
}
In the test case 2 simple calls as follows:
OSQueryCache domainCache = (OSQueryCache) getSharedCache();
OSQueryCache contextCache = (OSQueryCache) getLocalCache();
now what I am finding is that both domainCache and contextCache is the
same object, when I would have though they would have been two
different instance of OSQueryCache given that one is the local cache
and the other is the shared cache.
Is there something I am missing here?
Thank you
garyj