use of org.apache.xbean.spring.context.ClassPathXmlApplicationContext in project activemq-artemis by apache.
the class Consumer method setUp.
/**
* @throws java.lang.Exception
*/
@Override
protected void setUp() throws Exception {
LOG.info("setUp() called.");
ClassPathXmlApplicationContext context1 = null;
BrokerFactoryBean brokerFactory = new BrokerFactoryBean(new ClassPathResource(config));
assertNotNull(brokerFactory);
/* start up first broker instance */
try {
// resolve broker1
Thread.currentThread().setContextClassLoader(NetworkedSyncTest.class.getClassLoader());
context1 = new ClassPathXmlApplicationContext(config);
broker1 = (BrokerService) context1.getBean("broker1");
// start the broker
if (!broker1.isStarted()) {
LOG.info("Broker broker1 not yet started. Kicking it off now.");
broker1.start();
} else {
LOG.info("Broker broker1 already started. Not kicking it off a second time.");
broker1.waitUntilStopped();
}
} catch (Exception e) {
LOG.error("Error: " + e.getMessage());
throw e;
// brokerService.stop();
}
/* start up second broker instance */
try {
Thread.currentThread().setContextClassLoader(NetworkedSyncTest.class.getClassLoader());
context1 = new ClassPathXmlApplicationContext(config);
broker2 = (BrokerService) context1.getBean("broker2");
// start the broker
if (!broker2.isStarted()) {
LOG.info("Broker broker2 not yet started. Kicking it off now.");
broker2.start();
} else {
LOG.info("Broker broker2 already started. Not kicking it off a second time.");
broker2.waitUntilStopped();
}
} catch (Exception e) {
LOG.error("Error: " + e.getMessage());
throw e;
}
// setup network connector from broker1 to broker2
connector = broker1.addNetworkConnector(networkConnectorURL);
connector.setBrokerName(broker1.getBrokerName());
connector.setDuplex(true);
connector.start();
LOG.info("Network connector created.");
}
use of org.apache.xbean.spring.context.ClassPathXmlApplicationContext in project webofneeds by researchstudio-sat.
the class BotContextTests method setup.
@Before
public void setup() throws IllegalAccessException, InstantiationException {
ApplicationContext ctx = new ClassPathXmlApplicationContext("/botContext.xml");
botContext = (BotContext) ctx.getBean(botContextClass);
}
use of org.apache.xbean.spring.context.ClassPathXmlApplicationContext in project geronimo-xbean by apache.
the class ComponentTest method test.
protected void test(String file) {
BeanFactory f = new ClassPathXmlApplicationContext(file);
ContainerBean container = (ContainerBean) f.getBean("container");
assertNotNull(container);
assertNotNull(container.getBeans());
assertEquals(1, container.getBeans().length);
}
use of org.apache.xbean.spring.context.ClassPathXmlApplicationContext in project geronimo-xbean by apache.
the class JndiTest method testConfigureJndiInsideSpringXml.
public void testConfigureJndiInsideSpringXml() throws Exception {
// lets load a spring context
BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/xbean/spring/jndi/spring.xml");
Object test = factory.getBean("restaurant");
assertNotNull("Should have found the test object", test);
Object jndi = factory.getBean("jndi");
assertNotNull("Should have found the jndi object", jndi);
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, SpringInitialContextFactory.class.getName());
InitialContext context = new InitialContext(env);
assertEntryExists(context, "test");
assertEntryExists(context, "test/restaurant");
assertSame(test, context.lookup("test/restaurant"));
}
use of org.apache.xbean.spring.context.ClassPathXmlApplicationContext in project webofneeds by researchstudio-sat.
the class BotContextWrapperTests method setup.
@Before
public void setup() throws IllegalAccessException, InstantiationException {
ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring/component/botContext/memoryBotContext.xml");
botContext = (BotContext) ctx.getBean(botContextClass);
botContextWrapper = new BotContextWrapper(botContext, BOT_NAME, LIST_NAME_1, LIST_NAME_2);
}
Aggregations