Search in sources :

Example 6 with QueryPlanInfo

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());
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) HashMap(java.util.HashMap) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) ArrayList(java.util.ArrayList) DbSpaceInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo) DbUserInfoList(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) BackupPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.BackupPlanInfo) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 7 with QueryPlanInfo

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;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 8 with QueryPlanInfo

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();
}
Also used : QueryPlanInfoHelp(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp) ArrayList(java.util.ArrayList) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 9 with QueryPlanInfo

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);
}
Also used : QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 10 with QueryPlanInfo

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));
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) GetQueryPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Aggregations

QueryPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)13 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)7 ArrayList (java.util.ArrayList)7 QueryPlanInfoHelp (com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp)5 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)4 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)3 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)3 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 SetQueryPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.SetQueryPlanListTask)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)2 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 BackupPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.BackupPlanInfo)2 GetQueryPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask)2 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)2 EditQueryPlanDialog (com.cubrid.cubridmanager.ui.cubrid.jobauto.dialog.EditQueryPlanDialog)2 HashSet (java.util.HashSet)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 TableItem (org.eclipse.swt.widgets.TableItem)2