connection tests
This commit is contained in:
parent
2e074e5c53
commit
072e3c4fd7
|
|
@ -0,0 +1,32 @@
|
||||||
|
package me.legrange.mikrotik;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
public class ApiConnectionTest extends TestCase {
|
||||||
|
|
||||||
|
private static final String HOSTNAME = "192.168.88.1";
|
||||||
|
private static final String ADMIN = "admin";
|
||||||
|
private static final String PASSWORD = "plasma";
|
||||||
|
|
||||||
|
public void testConnectTLSStringInt() throws MikrotikApiException, InterruptedException {
|
||||||
|
ApiConnection connect = ApiConnection.connectTLS(HOSTNAME, 8729);
|
||||||
|
connect.login(ADMIN, PASSWORD);
|
||||||
|
List<Map<String, String>> result = connect.execute("/system/resource/print");
|
||||||
|
|
||||||
|
assertEquals(1, result.size());
|
||||||
|
assertEquals("MikroTik", result.get(0).get("platform"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testConnectStringInt() throws MikrotikApiException, InterruptedException {
|
||||||
|
ApiConnection connect = ApiConnection.connect(HOSTNAME, 8728);
|
||||||
|
connect.login(ADMIN, PASSWORD);
|
||||||
|
List<Map<String, String>> result = connect.execute("/system/resource/print");
|
||||||
|
|
||||||
|
assertEquals(1, result.size());
|
||||||
|
assertEquals("MikroTik", result.get(0).get("platform"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue