use of org.springframework.context.support.ClassPathXmlApplicationContext in project redisson by redisson.
the class SpringNamespaceWikiTest method testMasterSlave.
@Test
public void testMasterSlave() throws Exception {
RedisRunner.RedisProcess master = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").nosave().randomDir().run();
RedisRunner.RedisProcess slave1 = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").masterauth("do_not_use_if_it_is_not_set").port(6380).nosave().randomDir().slaveof("127.0.0.1", 6379).run();
RedisRunner.RedisProcess slave2 = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").masterauth("do_not_use_if_it_is_not_set").port(6381).nosave().randomDir().slaveof("127.0.0.1", 6379).run();
try {
((ConfigurableApplicationContext) new ClassPathXmlApplicationContext("classpath:org/redisson/spring/support/namespace_wiki_master_slave.xml")).close();
} finally {
master.stop();
slave1.stop();
slave2.stop();
}
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project redisson by redisson.
the class SpringNamespaceWikiTest method testSentinel.
@Test
public void testSentinel() throws Exception {
RedisRunner.RedisProcess master = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").nosave().randomDir().run();
RedisRunner.RedisProcess slave1 = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").masterauth("do_not_use_if_it_is_not_set").port(6380).nosave().randomDir().slaveof("127.0.0.1", 6379).run();
RedisRunner.RedisProcess slave2 = new RedisRunner().requirepass("do_not_use_if_it_is_not_set").masterauth("do_not_use_if_it_is_not_set").port(6381).nosave().randomDir().slaveof("127.0.0.1", 6379).run();
RedisRunner.RedisProcess sentinel1 = new RedisRunner().nosave().randomDir().port(26379).sentinel().sentinelMonitor("myMaster", "127.0.0.1", 6379, 2).sentinelAuthPass("myMaster", "do_not_use_if_it_is_not_set").run();
RedisRunner.RedisProcess sentinel2 = new RedisRunner().nosave().randomDir().port(26380).sentinel().sentinelMonitor("myMaster", "127.0.0.1", 6379, 2).sentinelAuthPass("myMaster", "do_not_use_if_it_is_not_set").run();
RedisRunner.RedisProcess sentinel3 = new RedisRunner().nosave().randomDir().port(26381).sentinel().sentinelMonitor("myMaster", "127.0.0.1", 6379, 2).sentinelAuthPass("myMaster", "do_not_use_if_it_is_not_set").run();
try {
((ConfigurableApplicationContext) new ClassPathXmlApplicationContext("classpath:org/redisson/spring/support/namespace_wiki_sentinel.xml")).close();
} finally {
master.stop();
slave1.stop();
slave2.stop();
sentinel1.stop();
sentinel2.stop();
sentinel3.stop();
}
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project sharding-jdbc by dangdangdotcom.
the class SpringNamespaceWithMasterSlaveMain method main.
// CHECKSTYLE:OFF
public static void main(final String[] args) throws SQLException {
// CHECKSTYLE:ON
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/applicationContextWithMasterSlave.xml");
OrderService orderService = applicationContext.getBean(OrderService.class);
orderService.insert();
orderService.select();
orderService.delete();
orderService.select();
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project cas by apereo.
the class JdbcDataSourceMonitorTests method setUp.
@Before
public void setUp() {
final ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:/jpaTestApplicationContext.xml");
this.dataSource = ctx.getBean("dataSource", DataSource.class);
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project OpenMEAP by OpenMEAP.
the class ModelTestUtils method getPersistenceBean.
public static synchronized Object getPersistenceBean(String name) {
if (persistenceBeans == null) {
System.setProperty("hibernate.show_sql", "true");
System.setProperty("hibernate.hbm2ddl.auto", "update");
System.setProperty("hibernate.dialect", "org.hibernate.dialect.SQLite3Dialect");
System.setProperty("hibernate.connection.driver_class", "org.sqlite.JDBC");
System.setProperty("hibernate.connection.url", "jdbc:sqlite:" + OPENMEAP_TEST_DB);
persistenceBeans = new ClassPathXmlApplicationContext(new String[] { "/META-INF/persistenceContext.xml", "/META-INF/test/persistenceContext.xml" });
}
return persistenceBeans.getBean(name);
}
Aggregations