本文整理汇总了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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}