Search in sources :

Example 1 with ClientSocket

use of com.cubrid.cubridmanager.core.common.socket.ClientSocket in project cubrid-manager by CUBRID.

the class TestRawScript method execute.

public static void execute(String aFilename) {
    String basepath = TestRawScript.class.getResource(".").getPath() + "scripts/";
    String filename = basepath + aFilename;
    String message = MockTaskServer.getFileText(new File(filename));
    ClientSocket clientSocket = new ClientSocket(serverInfo.getHostAddress(), serverInfo.getHostJSPort(), serverInfo.getUserName());
    clientSocket.setUsingSpecialDelimiter(false);
    clientSocket.sendRequest(message);
    clientSocket.tearDownConnection();
    String errorMsg = clientSocket.getErrorMsg();
    if (errorMsg != null)
        System.out.println("ERROR MSG:" + errorMsg);
    String warningMsg = clientSocket.getWarningMsg();
    if (warningMsg != null)
        System.out.println("WARN MSG:" + warningMsg);
}
Also used : ClientSocket(com.cubrid.cubridmanager.core.common.socket.ClientSocket) File(java.io.File)

Example 2 with ClientSocket

use of com.cubrid.cubridmanager.core.common.socket.ClientSocket in project cubrid-manager by CUBRID.

the class TestTask method main.

/**
	 * TODO: how to write comments What and why the member function does what it
	 * does What a member function must be passed as parameters What a member
	 * function re turns Known bugs Any exceptions that a member function throws
	 * Visibility decisions How a member function changes the object Include a
	 * history of any code changes Examples of how to invoke th e member
	 * function if appropriate Applicable preconditions and postconditions
	 * Document all concurrency
	 * 
	 * @param args
	 */
public static void main(String[] args) {
    ClientSocket hostsocket = new ClientSocket("localhost", 8001, "admin");
    String message = "id:admin\npassword:1111\n" + "clientver:8.1.4\n\n";
    // send login message
    hostsocket.sendRequest(message);
    // get the latest token
    TreeNode node = hostsocket.getResponse();
    String token = node.getValue("token");
    System.out.println(token);
}
Also used : ClientSocket(com.cubrid.cubridmanager.core.common.socket.ClientSocket) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Aggregations

ClientSocket (com.cubrid.cubridmanager.core.common.socket.ClientSocket)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)1 File (java.io.File)1