当前位置: 首页>>代码示例>>Java>>正文


Java TAtomDataSource.destroyDataSource方法代码示例

本文整理汇总了Java中com.taobao.tddl.atom.TAtomDataSource.destroyDataSource方法的典型用法代码示例。如果您正苦于以下问题:Java TAtomDataSource.destroyDataSource方法的具体用法?Java TAtomDataSource.destroyDataSource怎么用?Java TAtomDataSource.destroyDataSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taobao.tddl.atom.TAtomDataSource的用法示例。


在下文中一共展示了TAtomDataSource.destroyDataSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTAtomDataSource

import com.taobao.tddl.atom.TAtomDataSource; //导入方法依赖的package包/类
@Test
public void testInitTAtomDataSource_初始化() throws Exception {
    String appName = "tddl_sample";
    String dbKey = "tddl_sample_0";
    // Oracle测试
    // TAtomDataSource tAtomDataSource = createTAtomDataSource(appName,
    // dbKey, "oracle");
    // JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    // int actual = jtp.queryForInt(TAtomDataSourceUnitTest.TEST_SQL);
    // Assert.assertEquals(actual, 1);
    // tAtomDataSource.destroyDataSource();
    // mysql测试
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, "mysql");
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(TAtomDataSourceTest.TEST_SQL);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:TAtomDataSourceTest.java

示例2: testChange

import com.taobao.tddl.atom.TAtomDataSource; //导入方法依赖的package包/类
private void testChange(ChangeTestConfig change, ChangeTestConfig restore, String type, String dbType,
                        String methodName) throws IOException, TddlException, Exception {
    String appName = "tddl_sample";
    String dbKey = "unitTestDb-" + methodName;
    String configName = dbType;
    String testSql = TAtomDataSourceTest.TEST_SQL;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    // 设置错误的IP进行推送
    String fileName = "";
    String dataId = "";
    if (type.equals("globa")) {
        fileName = "/globa.properties";
        dataId = TAtomConstants.getGlobalDataId(dbKey);
    } else if (type.equals("app")) {
        fileName = "/app.properties";
        dataId = TAtomConstants.getAppDataId(appName, dbKey);
    }
    Properties prop = PropLoadTestUtil.loadPropFromFile("conf/" + configName + fileName);
    MockServer.setConfigInfo(dataId, PropLoadTestUtil.convertProp2Str(change.doChange(prop)));
    Thread.sleep(3000);
    // 期待出现错误
    boolean result = false;
    try {
        actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
        result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(dataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/" + configName
                                                                                            + fileName))));
    Thread.sleep(3000);
    // 期待结果正常
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:41,代码来源:TAtomDataSourceTest.java

示例3: testChange

import com.taobao.tddl.atom.TAtomDataSource; //导入方法依赖的package包/类
private void testChange(ChangeTestConfig change, ChangeTestConfig restore, String type, String dbType,
                        String methodName) throws IOException, AtomAlreadyInitException, Exception {
    String appName = "tddl_sample";
    String dbKey = "unitTestDb-" + methodName;
    String configName = dbType;
    String testSql = TAtomDataSourceTest.TEST_SQL;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    // 设置错误的IP进行推送
    String fileName = "";
    String dataId = "";
    if (type.equals("globa")) {
        fileName = "/globa.properties";
        dataId = TAtomConstants.getGlobalDataId(dbKey);
    } else if (type.equals("app")) {
        fileName = "/app.properties";
        dataId = TAtomConstants.getAppDataId(appName, dbKey);
    }
    Properties prop = PropLoadTestUtil.loadPropFromFile("conf/" + configName + fileName);
    MockServer.setConfigInfo(dataId, PropLoadTestUtil.convertProp2Str(change.doChange(prop)));
    Thread.sleep(3000);
    // 期待出现错误
    boolean result = false;
    try {
        actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
        result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(dataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/" + configName
                                                                                            + fileName))));
    Thread.sleep(3000);
    // 期待结果正常
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:41,代码来源:TAtomDataSourceTest.java

示例4: testChangePasswd

import com.taobao.tddl.atom.TAtomDataSource; //导入方法依赖的package包/类
private void testChangePasswd(ChangeTestConfig change, ChangeTestConfig restore, String dbType) throws IOException,
                                                                                               TddlException,
                                                                                               Exception {
    String appName = "tddl_sample";
    String dbKey = "unitTestDb-" + dbType;
    String configName = "";
    String testSql = TAtomDataSourceTest.TEST_SQL;
    configName = dbType;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    // 设置错误的IP进行推送
    // 全局配置
    String globaStr = PropLoadTestUtil.loadPropFile2String("conf/" + configName + "/globa.properties");
    MockServer.setConfigInfo(TAtomConstants.getGlobalDataId(dbKey), globaStr);
    // 应用配置
    String appStr = PropLoadTestUtil.loadPropFile2String("conf/" + configName + "/app.properties");
    MockServer.setConfigInfo(TAtomConstants.getAppDataId(appName, dbKey), appStr);
    // 解析配置
    TAtomDsConfDO tAtomDsConfDO = TAtomConfParser.parserTAtomDsConfDO(globaStr, appStr);
    Properties passwdProp = PropLoadTestUtil.loadPropFromFile("conf/" + configName + "/passwd.properties");
    String passwdDataId = TAtomConstants.getPasswdDataId(tAtomDsConfDO.getDbName(),
        tAtomDsConfDO.getDbType(),
        tAtomDsConfDO.getUserName());
    MockServer.setConfigInfo(passwdDataId, PropLoadTestUtil.convertProp2Str(change.doChange(passwdProp)));
    Thread.sleep(3000);
    // 期待出现错误
    boolean result = false;
    try {
        actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
        result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(passwdDataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/" + configName
                                                                                            + "/passwd.properties"))));
    Thread.sleep(3000);
    // 期待结果正常
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:46,代码来源:TAtomDataSourceTest.java

示例5: testChangePasswd

import com.taobao.tddl.atom.TAtomDataSource; //导入方法依赖的package包/类
private void testChangePasswd(ChangeTestConfig change, ChangeTestConfig restore, String dbType)
                                                                                               throws IOException,
                                                                                               AtomAlreadyInitException,
                                                                                               Exception {
    String appName = "tddl_sample";
    String dbKey = "unitTestDb-" + dbType;
    String configName = "";
    String testSql = TAtomDataSourceTest.TEST_SQL;
    configName = dbType;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    // 设置错误的IP进行推送
    // 全局配置
    String globaStr = PropLoadTestUtil.loadPropFile2String("conf/" + configName + "/globa.properties");
    MockServer.setConfigInfo(TAtomConstants.getGlobalDataId(dbKey), globaStr);
    // 应用配置
    String appStr = PropLoadTestUtil.loadPropFile2String("conf/" + configName + "/app.properties");
    MockServer.setConfigInfo(TAtomConstants.getAppDataId(appName, dbKey), appStr);
    // 解析配置
    TAtomDsConfDO tAtomDsConfDO = TAtomConfParser.parserTAtomDsConfDO(globaStr, appStr);
    Properties passwdProp = PropLoadTestUtil.loadPropFromFile("conf/" + configName + "/passwd.properties");
    String passwdDataId = TAtomConstants.getPasswdDataId(tAtomDsConfDO.getDbName(),
        tAtomDsConfDO.getDbType(),
        tAtomDsConfDO.getUserName());
    MockServer.setConfigInfo(passwdDataId, PropLoadTestUtil.convertProp2Str(change.doChange(passwdProp)));
    Thread.sleep(3000);
    // 期待出现错误
    boolean result = false;
    try {
        actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
        result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(passwdDataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/" + configName
                                                                                            + "/passwd.properties"))));
    Thread.sleep(3000);
    // 期待结果正常
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:47,代码来源:TAtomDataSourceTest.java


注:本文中的com.taobao.tddl.atom.TAtomDataSource.destroyDataSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。