Search in sources :

Example 6 with DatabaseLockInfo

use of com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseLockInfo in project cubrid-manager by CUBRID.

the class LockDbTaskTest method testLockDbNoLock.

public void testLockDbNoLock() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    System.out.println("<database.lockdb.001.req.txt>");
    CommonQueryTask<DatabaseLockInfo> task = new CommonQueryTask<DatabaseLockInfo>(ServerManager.getInstance().getServer(host, monport, userName), CommonSendMsg.getCommonDatabaseSendMsg(), new DatabaseLockInfo());
    task.setDbName("unlockeddb");
    task.execute();
    assertTrue(task.isSuccess());
    assertNull(task.getErrorMsg());
    DatabaseLockInfo dli = task.getResultModel();
    assertNotNull(dli);
    assertEquals("lockdb", dli.getTaskName());
    LockInfo li = dli.getLockInfo();
    assertNotNull(li);
    assertEquals(1, li.getDinterval());
    assertEquals(100000, li.getEsc());
    List<DatabaseTransaction> dtList = li.getTransaction();
    assertNotNull(dtList);
    assertEquals(2, dtList.size());
    DatabaseTransaction dt = dtList.get(0);
    assertEquals(0, dt.getIndex());
    assertEquals("(unknown)", dt.getPname());
    assertEquals("(unknown)", dt.getUid());
    assertEquals("(unknown)", dt.getHost());
    assertEquals("-1", dt.getPid());
    assertEquals("REPEATABLE CLASSES AND READ UNCOMMITTED INSTANCES", dt.getIsolevel());
    assertEquals(-1, dt.getTimeout());
    dt = dtList.get(1);
    assertEquals(1, dt.getIndex());
    assertEquals("lockdb", dt.getPname());
    assertEquals("dba", dt.getUid());
    assertEquals("localhost.localdomain", dt.getHost());
    assertEquals("5334", dt.getPid());
    assertEquals("READ COMMITTED CLASSES AND READ UNCOMMITTED INSTANCES", dt.getIsolevel());
    assertEquals(-2, dt.getTimeout());
    DbLotInfo dbLotInfo = li.getDbLotInfo();
    assertNotNull(dbLotInfo);
    assertEquals(0, dbLotInfo.getNumlocked());
    assertEquals(10000, dbLotInfo.getMaxnumlock());
    assertNotNull(dbLotInfo.getDbLotEntryList());
    assertEquals(0, dbLotInfo.getDbLotEntryList().size());
}
Also used : DatabaseLockInfo(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseLockInfo) DatabaseTransaction(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseTransaction) DbLotInfo(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DbLotInfo) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) LockInfo(com.cubrid.cubridmanager.core.cubrid.database.model.lock.LockInfo) DatabaseLockInfo(com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseLockInfo)

Aggregations

DatabaseLockInfo (com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseLockInfo)6 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)5 DatabaseTransaction (com.cubrid.cubridmanager.core.cubrid.database.model.lock.DatabaseTransaction)4 DbLotInfo (com.cubrid.cubridmanager.core.cubrid.database.model.lock.DbLotInfo)4 LockInfo (com.cubrid.cubridmanager.core.cubrid.database.model.lock.LockInfo)4 DbLotEntry (com.cubrid.cubridmanager.core.cubrid.database.model.lock.DbLotEntry)3 LockHolders (com.cubrid.cubridmanager.core.cubrid.database.model.lock.LockHolders)2 HashMap (java.util.HashMap)2 LockWaiters (com.cubrid.cubridmanager.core.cubrid.database.model.lock.LockWaiters)1 DbTransactionList (com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList)1 Point (org.eclipse.swt.graphics.Point)1