public MuleContext build() throws Exception
{
// Should we set up the manager for every method?
MuleContext context;
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
//If the annotations module is on the classpath, add the annotations config builder to the list
//This will enable annotations config for this instance
if (ClassUtils.isClassOnPath(AbstractMuleContextTestCase.CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass()))
{
builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(AbstractMuleContextTestCase.CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
ClassUtils.NO_ARGS, getClass()));
}
builders.add(getAppBuilder(this.applicationResources));
DefaultMuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
configureMuleContext(contextBuilder);
context = muleContextFactory.createMuleContext(builders, contextBuilder);
context.start();
return context;
}