-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support webconolse api of ssh and rdp
- Loading branch information
Qiu Jian
committed
Dec 14, 2023
1 parent
084eba3
commit cc67a0a
Showing
3 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/com/yunionyun/mcp/mcclient/WebconsoleManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.yunionyun.mcp.mcclient; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.yunionyun.mcp.mcclient.EndpointType; | ||
import com.yunionyun.mcp.mcclient.common.McClientJavaBizException; | ||
import com.yunionyun.mcp.mcclient.keystone.TokenCredential; | ||
import com.yunionyun.mcp.mcclient.managers.ListResult; | ||
import com.yunionyun.mcp.mcclient.managers.impl.webconsole.WebConsoleManager; | ||
import junit.framework.TestCase; | ||
|
||
import java.io.IOException; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author zxc | ||
* @date 2020/03/27 | ||
*/ | ||
public class WebconsoleManagerTest extends TestCase { | ||
public void testApp() { | ||
Client cli = new Client("https://192.18.222.171:30357/v3", 500, true, true); | ||
try { | ||
TokenCredential token = cli.Authenticate("test", "password", "Domain", "system", "Default"); | ||
Session s = cli.newSession("region0", "", EndpointType.PublicURL, token); | ||
|
||
WebConsoleManager webconsole = new WebConsoleManager(); | ||
|
||
JSONObject result = webconsole.DoSshConnect(s, "servername", "", 0, "", ""); | ||
System.out.println(result); | ||
|
||
result = webconsole.DoRdpConnect(s, "ed73df6af7b", "", 0, "Administrator", "passwd0"); | ||
System.out.println(result); | ||
|
||
} catch (JSONClientException e) { | ||
e.printStackTrace(); | ||
} catch (McClientJavaBizException e) { | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |