public MuleContext createMule(String resources) throws Exception
{
defineLogOutput(resources);
MuleContext context;
org.mule.api.context.MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
builders.add(new SimpleConfigurationBuilder(properties()));
if (ClassUtils.isClassOnPath(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
getClass()))
{
builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(
CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, ClassUtils.NO_ARGS,
getClass()));
}
builders.add(getBuilder(resources));
MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
configureMuleContext(contextBuilder);
context = muleContextFactory
.createMuleContext(builders, contextBuilder);
((DefaultMuleConfiguration) context.getConfiguration())
.setShutdownTimeout(0);
context.getNotificationManager().setNotificationDynamic(true);
context.getNotificationManager().addInterfaceToType(MessageProcessorNotificationListener.class, MessageProcessorNotification.class);
plugins = new MunitPluginFactory().loadPlugins(context);
initialisePlugins();
return context;
}