blob: 0c424cca9de259331964203f38ced71d3b140f47 [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.jdbc.common.RawJdbcAssertUtils;
import org.apache.shardingsphere.example.core.jdbc.repository.mysql.AddressRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.repository.mysql.OrderItemRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.repository.mysql.OrderRepositoryImpl;
import org.apache.shardingsphere.example.core.jdbc.service.OrderServiceImpl;
import org.apache.shardingsphere.example.factory.DataSourceFactory;
import org.apache.shardingsphere.example.type.ShardingType;
import org.junit.Test;
import javax.sql.DataSource;
import java.sql.SQLException;
public class RawJDBCJavaShardingTest {
@Test
public void assertCommonService() throws SQLException {
DataSource dataSource = DataSourceFactory.newInstance(ShardingType.SHARDING_DATABASES_AND_TABLES);
ExampleService exampleService = new OrderServiceImpl(new OrderRepositoryImpl(dataSource), new OrderItemRepositoryImpl(dataSource), new AddressRepositoryImpl(dataSource));
ExampleExecuteTemplate.run(exampleService);
RawJdbcAssertUtils.assertShardingTableDatabases(exampleService);
}
}