locator2 = null;
}
public void testJbpmFactoryLocator() {
BeanFactoryReference reference1 = locator1.useBeanFactory(INSTANCE_1);
BeanFactoryReference reference2 = locator2.useBeanFactory(INSTANCE_2);
BeanFactoryReference aliasRef1 = locator1.useBeanFactory("alias1");
BeanFactoryReference aliasRef2 = locator1.useBeanFactory("alias2");
// verify the static map
BeanFactory factory1 = reference1.getFactory();
BeanFactory factory2 = reference2.getFactory();
BeanFactory factory3 = reference2.getFactory();
// get the alias from different factories
BeanFactory alias1 = aliasRef1.getFactory();
BeanFactory alias2 = aliasRef2.getFactory();
assertSame(factory1, factory2);
assertSame(factory1, factory3);
// verify it's the same bean factory as the application context
assertSame(factory1, applicationContext.getBeanFactory());
// verify aliases
assertSame(alias1, alias2);
assertSame(factory1, alias1);
aliasRef1.release();
aliasRef2.release();
reference1.release();
reference2.release();
}