blob: db9dc325dacf47afb4c66e5d30cdb433d7c7fbac [file] [log] [blame]
package org.apache.shardingsphere.example;
import org.apache.shardingsphere.example.core.api.ExampleExecuteTemplate;
import org.apache.shardingsphere.example.core.api.service.ExampleService;
import org.apache.shardingsphere.example.core.mybatis.common.SpringResultAssertUtils;
import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.sql.SQLException;
public class SpringNamespaceMasterSlaveTest {
private static final String CONFIG_FILE = "META-INF/application-master-slave.xml";
@Test
public void assertCommonService() throws SQLException {
try (ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIG_FILE)) {
ExampleService exampleService = applicationContext.getBean(ExampleService.class);
ExampleExecuteTemplate.run(exampleService);
SpringResultAssertUtils.assertExampleServiceMasterSlaveResult(exampleService);
}
}
}