{
context = muleContext;
}
else
{
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
builders.add(new SimpleConfigurationBuilder(getStartUpProperties()));
//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(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass()))
{
builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
ClassUtils.NO_ARGS, getClass()));
}
builders.add(getBuilder());
addBuilders(builders);
MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
DefaultMuleConfiguration muleConfiguration = new DefaultMuleConfiguration();
String workingDirectory = this.workingDirectory.getRoot().getAbsolutePath();
logger.info("Using working directory for test: " + workingDirectory);
muleConfiguration.setWorkingDirectory(workingDirectory);
contextBuilder.setMuleConfiguration(muleConfiguration);
configureMuleContext(contextBuilder);
context = muleContextFactory.createMuleContext(builders, contextBuilder);
if (!isGracefulShutdown())
{
((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0);
}
}