use of com.ctrip.framework.dal.cluster.client.config.ClusterConfigProvider in project dal by ctripcorp.
the class DefaultClusterTest method init.
@BeforeClass
public static void init() {
ClusterConfigProvider provider = new DefaultLocalConfigProvider("demo-cluster");
// todo-lhj xiu dance
ClusterConfig config = provider.getClusterConfig(mockCustomizedOption());
cluster = config.generate();
}
use of com.ctrip.framework.dal.cluster.client.config.ClusterConfigProvider in project dal by ctripcorp.
the class DefaultLocalConfigProviderTest method test.
@Test
public void test() {
ClusterConfigProvider provider = new DefaultLocalConfigProvider("demo-cluster");
// todo-lhj xiu dan ce
ClusterConfig config = provider.getClusterConfig(DefaultClusterTest.mockCustomizedOption());
LOGGER.info(String.format("cluster config: %s", config.toString()));
}
use of com.ctrip.framework.dal.cluster.client.config.ClusterConfigProvider in project dal by ctripcorp.
the class ClusterConfigParserTest method test.
@Test
public void test() {
ClusterConfigProvider provider = new DefaultLocalConfigProvider("TestCluster");
// todo-lhj
ClusterConfig config = provider.getClusterConfig(new DefaultDalConfigCustomizedOption());
LOGGER.info(String.format("cluster config: %s", config.toString()));
}
use of com.ctrip.framework.dal.cluster.client.config.ClusterConfigProvider in project dal by ctripcorp.
the class ClusterDatabaseSetTest method testNonShardingCluster.
@Test
public void testNonShardingCluster() {
ClusterConfigProvider provider = new DefaultLocalConfigProvider("NonShardingCluster");
// todo-lhj
ClusterConfig config = provider.getClusterConfig(new DefaultDalConfigCustomizedOption());
Cluster cluster = config.generate();
ClusterDatabaseSet databaseSet = new ClusterDatabaseSet("NonShardingCluster", cluster, new DalConnectionLocator() {
@Override
public void setup(Collection<DatabaseSet> databaseSets) {
}
@Override
public Connection getConnection(String name) throws Exception {
return null;
}
@Override
public Connection getConnection(String name, ConnectionAction action) throws Exception {
return null;
}
@Override
public Connection getConnection(DataSourceIdentity id) throws Exception {
return null;
}
@Override
public Connection getConnection(DataSourceIdentity id, ConnectionAction action) throws Exception {
return null;
}
@Override
public IntegratedConfigProvider getIntegratedConfigProvider() {
return null;
}
@Override
public void setupCluster(Cluster cluster) {
}
@Override
public void uninstallCluster(Cluster cluster) {
}
@Override
public void initialize(Map<String, String> settings) throws Exception {
}
});
Assert.assertFalse(databaseSet.isShardingSupported());
Assert.assertEquals(1, databaseSet.getMasterDbs().size());
Assert.assertEquals(0, databaseSet.getSlaveDbs().size());
}
Aggregations