int componentMaxThreadsActive = 12;
int componentMaxThreadsIdle = 6;
int componentThreadPoolExhaustedAction = ThreadingProfile.WHEN_EXHAUSTED_DISCARD;
// test default config
ThreadingProfile tp = muleContext.getDefaultThreadingProfile();
assertEquals(defaultMaxBufferSize, tp.getMaxBufferSize());
assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive());
assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
assertEquals(defaultThreadTTL, tp.getThreadTTL());
// test service threading profile defaults
tp = muleContext.getDefaultServiceThreadingProfile();
assertEquals(defaultMaxBufferSize, tp.getMaxBufferSize());
assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive());
assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
assertEquals(defaultThreadTTL, tp.getThreadTTL());
// test that unset values retain a default value
AbstractConnector c = (AbstractConnector) muleContext.getRegistry().lookupConnector("dummyConnector");
tp = c.getDispatcherThreadingProfile();
// this value is configured
assertEquals(connectorMaxBufferSize, tp.getMaxBufferSize());
// these values are inherited
assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive());
assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
assertEquals(defaultThreadTTL, tp.getThreadTTL());
// test per-service values
Service service = muleContext.getRegistry().lookupService("appleComponent2");
assertTrue("service must be SedaService to get threading profile", service instanceof SedaService);
tp = ((SedaService) service).getThreadingProfile();
// these values are configured
assertEquals(componentMaxBufferSize, tp.getMaxBufferSize());
assertEquals(componentMaxThreadsActive, tp.getMaxThreadsActive());
assertEquals(componentMaxThreadsIdle, tp.getMaxThreadsIdle());
assertEquals(componentThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
// this value is inherited
assertEquals(defaultThreadTTL, tp.getThreadTTL());
}