@@ -0,0 +1,2913 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.core.routing.type.defaultds;%0A%0Aimport io.shardingsphere.api.config.ShardingRuleConfiguration;%0Aimport io.shardingsphere.api.config.TableRuleConfiguration;%0Aimport io.shardingsphere.core.routing.type.RoutingResult;%0Aimport io.shardingsphere.core.rule.ShardingRule;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0A%0Aimport static org.hamcrest.CoreMatchers.instanceOf;%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic final class DefaultDataSourceRoutingEngineTest %7B%0A    %0A    private DefaultDataSourceRoutingEngine defaultDataSourceRoutingEngine;%0A    %0A    @Before%0A    public void setEngineContext() %7B%0A        ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();%0A        TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration();%0A        shardingRuleConfig.setDefaultDataSourceName(%22ds_0%22);%0A        ShardingRule shardingRule = new ShardingRule(shardingRuleConfig, Arrays.asList(%22ds_0%22, %22ds_1%22));%0A        Collection%3CString%3E logicTables = Arrays.asList(%22t_order%22, %22t_order_item%22);%0A        defaultDataSourceRoutingEngine = new DefaultDataSourceRoutingEngine(shardingRule, logicTables);%0A    %7D%0A    %0A    @Test%0A    public void assertRoute() %7B%0A        RoutingResult routingResult = defaultDataSourceRoutingEngine.route();%0A        assertThat(routingResult, instanceOf(RoutingResult.class));%0A        assertThat(routingResult.getTableUnits().getTableUnits().size(), is(1));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getDataSourceName(), is(%22ds_0%22));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getRoutingTables().size(), is(2));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getRoutingTables().get(0).getActualTableName(), is(%22t_order%22));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getRoutingTables().get(0).getLogicTableName(), is(%22t_order%22));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getRoutingTables().get(1).getActualTableName(), is(%22t_order_item%22));%0A        assertThat(routingResult.getTableUnits().getTableUnits().get(0).getRoutingTables().get(1).getLogicTableName(), is(%22t_order_item%22));%0A    %7D%0A%7D%0A

add test case for DefaultDataSourceRoutingEngine