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


Java TestUtils类代码示例

本文整理汇总了Java中com.alibaba.cobar.manager.qa.util.TestUtils的典型用法代码示例。如果您正苦于以下问题:Java TestUtils类的具体用法?Java TestUtils怎么用?Java TestUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TestUtils类属于com.alibaba.cobar.manager.qa.util包,在下文中一共展示了TestUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReloadTime

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testReloadTime() {
    try {
        // show @@server
        long timeBeforeReload = cobarAdapter.getServerStatus().getReloadTime();
        long sleepTime = 1000;
        TestUtils.waitForMonment(sleepTime);

        // reload @@config
        Assert.assertTrue(sCobarNode.excuteSQL(managerConnection, reloadSql));
        long timeAfterReload = cobarAdapter.getServerStatus().getReloadTime();
        Assert.assertFalse(timeBeforeReload == timeAfterReload);
        Assert.assertTrue(timeAfterReload - timeBeforeReload >= sleepTime);
    } catch (SQLException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:TestReloadTime.java

示例2: testRollbackTime

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testRollbackTime() {
    try {
        long sleepTime = 1000;
        sCobarNode.excuteSQL(managerConnection, "reload @@config");
        sCobarNode.excuteSQL(managerConnection, rollbackSql);
        long initRollbackTime = cobarAdapter.getServerStatus().getRollbackTime();

        TestUtils.waitForMonment(sleepTime);// must sleep, otherwise second
                                            // rollback will failure

        sCobarNode.excuteSQL(managerConnection, "reload @@config");
        TestUtils.waitForMonment(sleepTime);
        sCobarNode.excuteSQL(managerConnection, rollbackSql);
        long rollbackTime = cobarAdapter.getServerStatus().getRollbackTime();

        Assert.assertFalse(rollbackTime == initRollbackTime);
        Assert.assertTrue(rollbackTime - initRollbackTime >= sleepTime);
    } catch (SQLException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:24,代码来源:TestRollbackTime.java

示例3: testRecoverTime

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testRecoverTime() {
    int recoverTime = 10;
    dataNodeStatusList = cobarAdapter.listDataNodes();
    Assert.assertTrue(dataNodeStatusList.size() >= 1);
    String testDataNode = dataNodeStatusList.get(0).getPoolName();
    try {
        sCobarNode.excuteSQL(managerConnection, "stop @@heartbeat " + testDataNode + " : " + recoverTime);
    } catch (SQLException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }

    DataNodesStatus testDataNodeStatus = this.getDataNodeStatus(testDataNode);
    Assert.assertNotNull(testDataNodeStatus);
    double remainTime = testDataNodeStatus.getRecoveryTime();
    Assert.assertTrue((remainTime > 0) && (remainTime <= recoverTime));

    TestUtils.waitForMonment(recoverTime * 1000);
    testDataNodeStatus = this.getDataNodeStatus(testDataNode);
    Assert.assertNotNull(testDataNodeStatus);
    remainTime = testDataNodeStatus.getRecoveryTime();
    Assert.assertTrue(remainTime == -1);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:TestDataNodes.java

示例4: testReloadTime

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testReloadTime() {
    try {
        //show @@server
        long timeBeforeReload = cobarAdapter.getServerStatus().getReloadTime();
        long sleepTime = 1000;
        TestUtils.waitForMonment(sleepTime);

        //reload @@config
        Assert.assertTrue(sCobarNode.excuteSQL(managerConnection, reloadSql));
        long timeAfterReload = cobarAdapter.getServerStatus().getReloadTime();
        Assert.assertFalse(timeBeforeReload == timeAfterReload);
        Assert.assertTrue(timeAfterReload - timeBeforeReload >= sleepTime);
    } catch (SQLException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
}
 
开发者ID:alibaba,项目名称:cobar,代码行数:19,代码来源:TestReloadTime.java

示例5: testRollbackTime

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testRollbackTime() {
    try {
        long sleepTime = 1000;
        sCobarNode.excuteSQL(managerConnection, "reload @@config");
        sCobarNode.excuteSQL(managerConnection, rollbackSql);
        long initRollbackTime = cobarAdapter.getServerStatus().getRollbackTime();

        TestUtils.waitForMonment(sleepTime);//must sleep, otherwise second rollback will failure

        sCobarNode.excuteSQL(managerConnection, "reload @@config");
        TestUtils.waitForMonment(sleepTime);
        sCobarNode.excuteSQL(managerConnection, rollbackSql);
        long rollbackTime = cobarAdapter.getServerStatus().getRollbackTime();

        Assert.assertFalse(rollbackTime == initRollbackTime);
        Assert.assertTrue(rollbackTime - initRollbackTime >= sleepTime);
    } catch (SQLException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
}
 
开发者ID:alibaba,项目名称:cobar,代码行数:23,代码来源:TestRollbackTime.java

示例6: testGetTimeCurrent

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testGetTimeCurrent() {
    com.alibaba.cobar.manager.dataobject.cobarnode.TimeStamp timeStamp = null;
    timeStamp = cobarAdapter.getCurrentTime();
    Assert.assertNotNull(timeStamp);
    long sleepTime = 1000L;
    long startTime = cobarAdapter.getCurrentTime().getTimestamp();
    TestUtils.waitForMonment(sleepTime);
    long endTime = cobarAdapter.getCurrentTime().getTimestamp();
    Assert.assertTrue(startTime + sleepTime <= endTime);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:12,代码来源:TestTimeStamp.java

示例7: testGetTimeStartUp

import com.alibaba.cobar.manager.qa.util.TestUtils; //导入依赖的package包/类
@Test
public void testGetTimeStartUp() {
    String startTime = cobarAdapter.getServerStatus().getUptime();
    Assert.assertNotNull(startTime);
    long sleepTime = 1000L;
    TestUtils.waitForMonment(sleepTime);
    String endTime = cobarAdapter.getServerStatus().getUptime();
    Assert.assertNotNull(endTime);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:TestTimeStamp.java


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