// should be 0
assertEquals("Size should be 0", 0, template.getCurrentCacheSize());
}
public void testCacheProducersFromContext() throws Exception {
ProducerTemplate template = context.createProducerTemplate(500);
assertEquals("Size should be 0", 0, template.getCurrentCacheSize());
// test that we cache at most 500 producers to avoid it eating to much memory
for (int i = 0; i < 503; i++) {
Endpoint e = context.getEndpoint("direct:queue:" + i);
template.sendBody(e, "Hello");
}
assertEquals("Size should be 500", 500, template.getCurrentCacheSize());
template.stop();
// should be 0
assertEquals("Size should be 0", 0, template.getCurrentCacheSize());
}