Search in sources :

Example 11 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class SetupEnvTestCase method setupDatabaseInfo930.

/**
	 * Setup database 9.3.0
	 *
	 */
private void setupDatabaseInfo930() throws Exception {
    serverInfo930 = new ServerInfo();
    serverInfo930.setHostAddress(host930);
    serverInfo930.setHostMonPort(monport930);
    serverInfo930.setHostJSPort(jpport930);
    serverInfo930.setUserName(userName930);
    serverInfo930.setUserPassword(passwd930);
    serverInfo930.setJdbcDriverVersion(serverVersion930);
    ServerManager.getInstance().addServer(host930, monport930, userName930, serverInfo930);
    MonitoringTask monTask = new MonitoringTask(serverInfo930);
    serverInfo930 = monTask.connectServer(serverVersion930, 1000);
    // get the latest token
    token930 = serverInfo930.getHostToken();
    //get evnInfo
    if (envInfo930 == null) {
        GetEnvInfoTask envTask = new GetEnvInfoTask(serverInfo930);
        envTask.loadEnvInfo();
        envTask.execute();
        envInfo930 = envTask.loadEnvInfo();
        serverInfo930.setEnvInfo(envInfo930);
    }
    assertNotNull(envInfo930);
    serverPath930 = envInfo930.getRootDir();
    dbRootDir930 = envInfo930.getDatabaseDir();
    //get server type
    GetCMConfParameterTask getCMConfParameterTask = new GetCMConfParameterTask(serverInfo930);
    getCMConfParameterTask.execute();
    assertEquals(null, getCMConfParameterTask.getErrorMsg());
    Map<String, String> confParameters = getCMConfParameterTask.getConfParameters();
    ServerType serverType = ServerType.BOTH;
    if (confParameters != null) {
        String target = confParameters.get(ConfConstants.CM_TARGET);
        if (target != null) {
            if (target.indexOf("broker") >= 0 && target.indexOf("server") >= 0) {
                serverType = ServerType.BOTH;
            } else if (target.indexOf("broker") >= 0) {
                serverType = ServerType.BROKER;
            } else if (target.indexOf("server") >= 0) {
                serverType = ServerType.DATABASE;
            }
        }
    }
    if (serverInfo930 != null) {
        serverInfo930.setServerType(serverType);
    }
    //Get database list task
    if (serverType == ServerType.DATABASE || serverType == ServerType.BOTH) {
        final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo930);
        getDatabaseListTask.execute();
        assertEquals(null, getDatabaseListTask.getErrorMsg());
        List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
        for (DatabaseInfo dbInfo : databaseInfoList) {
            if (dbInfo.getDbName().equals(testDbName930)) {
                databaseInfo930 = dbInfo;
                break;
            }
        }
        if (databaseInfo930 == null) {
            return;
        }
    }
    //get CubridManager user list task
    GetCMUserListTask getUserInfoTask = new GetCMUserListTask(serverInfo930);
    getUserInfoTask.execute();
    assertEquals(null, getUserInfoTask.getErrorMsg());
    List<ServerUserInfo> serverUserInfoList = getUserInfoTask.getServerUserInfoList();
    for (int i = 0; serverUserInfoList != null && i < serverUserInfoList.size(); i++) {
        ServerUserInfo userInfo = serverUserInfoList.get(i);
        if (userInfo != null && userInfo.getUserName().equals(serverInfo930.getUserName())) {
            serverInfo930.setLoginedUserInfo(userInfo);
            break;
        }
    }
    List<DatabaseInfo> databaseInfoList = serverInfo930.getLoginedUserInfo().getDatabaseInfoList();
    String dbDir = databaseInfo930.getDbDir();
    DbRunningType type = databaseInfo930.getRunningType();
    for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
        if (testDbName930.equalsIgnoreCase(databaseInfoList.get(i).getDbName())) {
            databaseInfo930 = databaseInfoList.get(i);
            databaseInfo930.setDbDir(dbDir);
            databaseInfo930.setBrokerIP(host930);
            databaseInfo930.setBrokerPort(port930);
            databaseInfo930.setCharSet(charset930);
            databaseInfo930.setRunningType(type);
            break;
        }
    }
    //get CUBRID conf parameter
    GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo930);
    getCubridConfParameterTask.execute();
    assertEquals(null, getCubridConfParameterTask.getErrorMsg());
    Map<String, Map<String, String>> confParas = getCubridConfParameterTask.getConfParameters();
    if (serverInfo930 != null) {
        serverInfo930.setCubridConfParaMap(confParas);
    }
    //get broker Info
    GetBrokerConfParameterTask getBrokerConfParameterTask = new GetBrokerConfParameterTask(serverInfo930);
    getBrokerConfParameterTask.execute();
    assertEquals(null, getBrokerConfParameterTask.getErrorMsg());
    confParas = getBrokerConfParameterTask.getConfParameters();
    if (serverInfo930 != null) {
        serverInfo930.setBrokerConfParaMap(confParas);
    }
    //Set JDBC driver
    String filePath = this.getFilePathInPlugin("/lib/JDBC-9.2.0.0155-cubrid.jar");
    if (filePath != null) {
        String version = JdbcClassLoaderFactory.validateJdbcFile(filePath);
        if (version != null) {
            JdbcClassLoaderFactory.registerClassLoader(filePath);
            serverInfo930.setJdbcDriverVersion(version);
        }
    }
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) GetCMUserListTask(com.cubrid.cubridmanager.core.common.task.GetCMUserListTask) GetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask) GetEnvInfoTask(com.cubrid.cubridmanager.core.common.task.GetEnvInfoTask) GetDatabaseListTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) MonitoringTask(com.cubrid.cubridmanager.core.common.task.MonitoringTask) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) GetBrokerConfParameterTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerConfParameterTask) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class JDBCConnectionManagerTest method testShardBroker.

public void testShardBroker() {
    assertTrue(JDBCConnectionManager.testShardBroker(databaseInfo, 1));
    assertFalse(JDBCConnectionManager.testShardBroker(new DatabaseInfo("", new ServerInfo()), 1));
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo)

Example 13 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class FunctionsSupportedInfoProviderTest method testIsSupportNLucene.

/**
	 * Test method for
	 * {@link com.cubrid.common.core.util.CompatibleUtil#isSupportNLucene(ServerInfo)}
	 * .
	 */
public void testIsSupportNLucene() {
    EnvInfo envInfo = new EnvInfo();
    envInfo.setServerVersion("CUBRID 2008 R2.0(8.3.0.1150)");
    ServerInfo serverInfo = new ServerInfo();
    serverInfo.setConnected(true);
    serverInfo.setEnvInfo(envInfo);
    boolean support = CompatibleUtil.isSupportNLucene(serverInfo);
    assertFalse(support);
    envInfo.setServerVersion("CUBRID 2008 R2.0(8.4.0.1150)");
    envInfo.setOsInfo(FileUtil.OsInfoType.NT.toString());
    support = CompatibleUtil.isSupportNLucene(serverInfo);
    assertTrue(support);
    support = CompatibleUtil.isSupportNLucene(null);
    assertFalse(support);
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) EnvInfo(com.cubrid.cubridmanager.core.common.model.EnvInfo)

Example 14 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class FunctionsSupportedInfoProviderTest method testIsSupportHA.

/**
	 * Test method for
	 * {@link com.cubrid.common.core.util.CompatibleUtil#isSupportHA(com.cubrid.cubridmanager.core.common.model.ServerInfo)}
	 * .
	 */
public void testIsSupportHA() {
    EnvInfo envInfo = new EnvInfo();
    envInfo.setServerVersion("CUBRID 2008 R2.0(8.2.0.1150)");
    ServerInfo serverInfo = new ServerInfo();
    serverInfo.setConnected(true);
    serverInfo.setEnvInfo(envInfo);
    boolean support = CompatibleUtil.isSupportHA(serverInfo);
    assertFalse(support);
    envInfo.setServerVersion("CUBRID 2008 R2.0(8.3.2.1150)");
    envInfo.setOsInfo(FileUtil.OsInfoType.LINUX.toString());
    support = CompatibleUtil.isSupportHA(serverInfo);
    assertTrue(support);
    support = CompatibleUtil.isSupportHA(null);
    assertFalse(support);
    envInfo.setOsInfo(FileUtil.OsInfoType.NT.toString());
    support = CompatibleUtil.isSupportHA(serverInfo);
    assertFalse(support);
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) EnvInfo(com.cubrid.cubridmanager.core.common.model.EnvInfo)

Example 15 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class FunctionsSupportedInfoProviderTest method testIsSupportLogPageSize.

/**
	 * Test method for
	 * {@link com.cubrid.common.core.util.CompatibleUtil#isSupportLogPageSize(com.cubrid.cubridmanager.core.common.model.ServerInfo)}
	 * .
	 */
public void testIsSupportLogPageSize() {
    EnvInfo envInfo = new EnvInfo();
    envInfo.setServerVersion("CUBRID 2008 R2.0(8.2.2.1150)");
    ServerInfo serverInfo = new ServerInfo();
    serverInfo.setConnected(true);
    serverInfo.setEnvInfo(envInfo);
    boolean support = CompatibleUtil.isSupportLogPageSize(serverInfo);
    assertTrue(support);
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) EnvInfo(com.cubrid.cubridmanager.core.common.model.EnvInfo)

Aggregations

ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)255 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)40 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)40 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)39 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)37 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)35 ArrayList (java.util.ArrayList)30 EnvInfo (com.cubrid.cubridmanager.core.common.model.EnvInfo)29 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)28 TreeViewer (org.eclipse.jface.viewers.TreeViewer)27 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)24 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)24 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)24 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)20 GridData (org.eclipse.swt.layout.GridData)17 GridLayout (org.eclipse.swt.layout.GridLayout)17 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 ITask (com.cubrid.common.core.task.ITask)15