use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.
the class DatabaseModelTest method testModelDatabaseInfo.
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testModelDatabaseInfo() {
DatabaseInfo bean = new DatabaseInfo(testDbName, serverInfo);
bean.setDbName("dbName");
assertEquals(bean.getDbName(), "dbName");
bean.setLogined(true);
assertTrue(bean.isLogined());
bean.setDbDir("dbDir");
assertEquals(bean.getDbDir(), "dbDir");
bean.setRunningType(DbRunningType.CS);
assertEquals(bean.getRunningType(), DbRunningType.CS);
DbUserInfoList dbUserInfoList = new DbUserInfoList();
bean.setDbUserInfoList(dbUserInfoList);
assertTrue(bean.getDbUserInfoList() != null);
DbUserInfo dbUserInfo = new DbUserInfo();
bean.addDbUserInfo(dbUserInfo);
bean.removeDbUserInfo(dbUserInfo);
bean.setAuthLoginedDbUserInfo(dbUserInfo);
assertEquals(bean.getAuthLoginedDbUserInfo(), dbUserInfo);
bean.setBrokerPort("brokerPort");
assertEquals(bean.getBrokerPort(), "brokerPort");
bean.setTriggerList(new ArrayList());
assertEquals(bean.getTriggerList() != null, true);
bean.setUserTableInfoList(new ArrayList());
assertEquals(bean.getUserTableInfoList() != null, true);
bean.setUserViewInfoList(new ArrayList());
assertEquals(bean.getUserViewInfoList() != null, true);
bean.setSysTableInfoList(new ArrayList());
assertEquals(bean.getSysTableInfoList() != null, true);
bean.setSysViewInfoList(new ArrayList());
assertEquals(bean.getSysViewInfoList() != null, true);
bean.setPartitionedTableMap(new HashMap());
assertEquals(bean.getPartitionedTableMap() != null, true);
bean.setBackupPlanInfoList(new ArrayList());
assertEquals(bean.getBackupPlanInfoList() != null, true);
bean.setQueryPlanInfoList(new ArrayList());
assertEquals(bean.getQueryPlanInfoList() != null, true);
bean.setDbSpaceInfoList(new DbSpaceInfoList());
assertEquals(bean.getDbSpaceInfoList() != null, true);
bean.setDbUserInfoList(new DbUserInfoList());
assertEquals(bean.getDbUserInfoList() != null, true);
bean.setSpProcedureInfoList(new ArrayList());
assertEquals(bean.getSpProcedureInfoList() != null, true);
bean.setSpFunctionInfoList(new ArrayList());
assertEquals(bean.getSpFunctionInfoList() != null, true);
bean.setSerialInfoList(new ArrayList());
assertEquals(bean.getSerialInfoList() != null, true);
bean.setServerInfo(serverInfo);
assertEquals(bean.getServerInfo() != null, true);
bean.clear();
bean.setLogined(true);
assertEquals(bean.isLogined(), true);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
bean.getClassInfoList();
bean.addPartitionedTableList("dbname", null);
bean.addBackupPlanInfo(new BackupPlanInfo());
bean.removeBackupPlanInfo(new BackupPlanInfo());
bean.removeAllBackupPlanInfo();
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.removeQueryPlanInfo(new QueryPlanInfo());
bean.removeAllQueryPlanInfo();
bean.addSpaceInfo(new DbSpaceInfo());
bean.removeSpaceInfo(new DbSpaceInfo());
bean.getSpInfoList();
bean.getSchemaInfo("tableName");
bean.putSchemaInfo(new SchemaInfo());
bean.clearSchemas();
bean.getErrorMessage();
bean.setDbUserInfoList(null);
assertEquals(bean.getDbUserInfoList(), null);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
}
use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.
the class GetQueryPlanListTask method getQueryPlanInfoList.
/**
* Get a list that includes the instances of QueryPlanInfo
*
* @return List<QueryPlanInfo> a list that includes the instances of
* QueryPlanInfo
*/
public List<QueryPlanInfo> getQueryPlanInfoList() {
List<QueryPlanInfo> queryPlanInfoList = new ArrayList<QueryPlanInfo>();
if (null != getErrorMsg()) {
return null;
}
TreeNode result = getResponse();
String dbname = result.getValue("dbname");
if (result.childrenSize() > 0) {
TreeNode planListNode = result.getChildren().get(0);
int size = planListNode.childrenSize();
for (int i = 0; i < size; i++) {
TreeNode node = planListNode.getChildren().get(i);
QueryPlanInfo planInfo = new QueryPlanInfo();
SocketTask.setFieldValue(node, planInfo);
planInfo.setDbname(dbname);
queryPlanInfoList.add(planInfo);
}
}
return queryPlanInfoList;
}
use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.
the class SetAndGetQueryPlanListTaskTest method test.
/**
* Tests getBackupPlanListTask method
*
*/
public void test() {
QueryPlanInfo queryPlan = new QueryPlanInfo();
queryPlan.setDbname(testDbName);
queryPlan.setQuery_id("test_set");
queryPlan.setPeriod("MONTH");
queryPlan.setDetail("1 02:01");
List<String> msgList = new ArrayList<String>();
QueryPlanInfoHelp qHelp = new QueryPlanInfoHelp();
qHelp.setQueryPlanInfo(queryPlan);
msgList.add(qHelp.buildMsg(true));
//test set query plans
SetQueryPlanListTask taskSet = new SetQueryPlanListTask(serverInfo);
taskSet.setDbname(testDbName);
taskSet.buildMsg(msgList);
taskSet.execute();
String errorSet = taskSet.getErrorMsg();
assertNull(errorSet);
//get query plan list
GetQueryPlanListTask taskGet = new GetQueryPlanListTask(serverInfo);
taskGet.setDbName(testDbName);
taskGet.execute();
String errorGet = taskGet.getErrorMsg();
assertNull(errorGet);
List<QueryPlanInfo> queryPlanInfoList = taskGet.getQueryPlanInfoList();
assertNotNull(queryPlanInfoList);
if (queryPlanInfoList.size() > 0) {
QueryPlanInfo info = queryPlanInfoList.get(0);
assertNotNull(info);
}
//delete query plan
taskSet = new SetQueryPlanListTask(serverInfo);
taskSet.setDbname(testDbName);
taskSet.buildMsg(new ArrayList<String>());
taskSet.execute();
assertTrue(taskSet.isSuccess());
taskGet.setErrorMsg("err");
taskGet.getQueryPlanInfoList();
}
use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.
the class DatabaseInfoTest method testAddQueryPlanInfo.
/**
* Test method for
* {@link com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo#addQueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)}
* .
*/
public void testAddQueryPlanInfo() {
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.setQueryPlanInfoList(null);
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.removeQueryPlanInfo(new QueryPlanInfo());
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.addQueryPlanInfo(new QueryPlanInfo());
QueryPlanInfo a = new QueryPlanInfo();
a.setDbname("dbname");
bean.addQueryPlanInfo(a);
}
use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.
the class CubridQueryPlanFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetQueryPlanListTask task = new GetQueryPlanListTask(parent.getServer().getServerInfo());
task.setDbName(database.getLabel());
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
List<QueryPlanInfo> queryPlanInfoList = task.getQueryPlanInfoList();
if (queryPlanInfoList != null && !queryPlanInfoList.isEmpty()) {
for (QueryPlanInfo queryPlanInfo : queryPlanInfoList) {
String id = parent.getId() + NODE_SEPARATOR + queryPlanInfo.getQuery_id();
ICubridNode queryPlanInfoNode = new DefaultSchemaNode(id, queryPlanInfo.getQuery_id(), "icons/navigator/auto_query_item.png");
queryPlanInfoNode.setContainer(false);
queryPlanInfoNode.setModelObj(queryPlanInfo);
queryPlanInfoNode.setType(CubridNodeType.QUERY_PLAN);
parent.addChild(queryPlanInfoNode);
}
}
databaseInfo.setQueryPlanInfoList(queryPlanInfoList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
Aggregations