提交 8ae563ee 编写于 作者: C cherrylzhao

add JavaConfigurationExampleTest for raw-jdbc-orche

上级 8066420c
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.shardingsphere.example.jdbc.orche;
import io.shardingsphere.example.jdbc.orche.factory.CommonServiceFactory;
import io.shardingsphere.example.repository.api.senario.CommonServiceScenario;
import io.shardingsphere.example.repository.api.trace.ResultAssertUtils;
import io.shardingsphere.example.type.RegistryCenterType;
import io.shardingsphere.example.type.ShardingType;
import org.junit.Test;
import java.sql.SQLException;
public class JavaConfigurationExampleTest {
@Test
public void assertShardingDatabaseWithLocalZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_DATABASES, RegistryCenterType.ZOOKEEPER, false));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingDatabaseResult(scenario.getCommonService(), false);
}
@Test
public void assertShardingDatabaseWithCloudZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_DATABASES, RegistryCenterType.ZOOKEEPER, true));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingDatabaseResult(scenario.getCommonService(), false);
}
@Test
public void assertShardingTablesWithLocalZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_TABLES, RegistryCenterType.ZOOKEEPER, false));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingTableResult(scenario.getCommonService(), false);
}
@Test
public void assertShardingTablesWithCloudZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_TABLES, RegistryCenterType.ZOOKEEPER, true));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingTableResult(scenario.getCommonService(), false);
}
@Test
public void assertShardingDatabaseAndTablesWithLocalZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_DATABASES_AND_TABLES, RegistryCenterType.ZOOKEEPER, false));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingDatabaseAndTableResult(scenario.getCommonService(), false);
}
@Test
public void assertShardingDatabaseAndTablesWithCloudZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_DATABASES_AND_TABLES, RegistryCenterType.ZOOKEEPER, true));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertShardingDatabaseAndTableResult(scenario.getCommonService(), false);
}
@Test
public void assertMasterSlaveWithLocalZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.MASTER_SLAVE, RegistryCenterType.ZOOKEEPER, false));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertMasterSlaveResult(scenario.getCommonService());
}
@Test
public void assertMasterSlaveWithCloudZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.MASTER_SLAVE, RegistryCenterType.ZOOKEEPER, true));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertMasterSlaveResult(scenario.getCommonService());
}
@Test
public void assertShardingMasterSlaveWithLocalZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_MASTER_SLAVE, RegistryCenterType.ZOOKEEPER, false));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertMasterSlaveResult(scenario.getCommonService());
}
@Test
public void assertShardingMasterSlaveWithCloudZookeeper() throws SQLException {
CommonServiceScenario scenario = new CommonServiceScenario(CommonServiceFactory.newInstance(ShardingType.SHARDING_MASTER_SLAVE, RegistryCenterType.ZOOKEEPER, true));
scenario.executeShardingCRUDSuccess();
ResultAssertUtils.assertMasterSlaveResult(scenario.getCommonService());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册