mirror of
https://github.com/revanced/jadb.git
synced 2025-02-06 07:26:48 +01:00
Refactor: Renaming to JadbDevice.
This commit is contained in:
parent
15f49dde6a
commit
e09b429b86
@ -36,7 +36,7 @@ public class JadbConnection {
|
||||
main.verifyResponse();
|
||||
}
|
||||
|
||||
public List<AndroidDevice> getDevices() throws IOException, JadbException
|
||||
public List<JadbDevice> getDevices() throws IOException, JadbException
|
||||
{
|
||||
Transport devices = createTransport();
|
||||
|
||||
@ -46,18 +46,18 @@ public class JadbConnection {
|
||||
return parseDevices(body);
|
||||
}
|
||||
|
||||
private List<AndroidDevice> parseDevices(String body) {
|
||||
private List<JadbDevice> parseDevices(String body) {
|
||||
String[] lines = body.split("\n");
|
||||
ArrayList<AndroidDevice> devices = new ArrayList<AndroidDevice>(lines.length);
|
||||
ArrayList<JadbDevice> devices = new ArrayList<JadbDevice>(lines.length);
|
||||
for (String line : lines)
|
||||
{
|
||||
String[] parts = line.split("\t");
|
||||
devices.add(new AndroidDevice(parts[0], parts[1], main));
|
||||
devices.add(new JadbDevice(parts[0], parts[1], main));
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
|
||||
public AndroidDevice getAnyDevice() {
|
||||
return AndroidDevice.createAny(main);
|
||||
public JadbDevice getAnyDevice() {
|
||||
return JadbDevice.createAny(main);
|
||||
}
|
||||
}
|
||||
|
@ -4,19 +4,19 @@ import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AndroidDevice {
|
||||
public class JadbDevice {
|
||||
private String serial;
|
||||
private Transport transport;
|
||||
private boolean selected = false;
|
||||
|
||||
AndroidDevice(String serial, String type, Transport transport) {
|
||||
JadbDevice(String serial, String type, Transport transport) {
|
||||
this.serial = serial;
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
static AndroidDevice createAny(Transport transport) { return new AndroidDevice(transport); }
|
||||
static JadbDevice createAny(Transport transport) { return new JadbDevice(transport); }
|
||||
|
||||
private AndroidDevice(Transport transport)
|
||||
private JadbDevice(Transport transport)
|
||||
{
|
||||
serial = null;
|
||||
this.transport = transport;
|
||||
@ -129,7 +129,7 @@ public class AndroidDevice {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
AndroidDevice other = (AndroidDevice) obj;
|
||||
JadbDevice other = (JadbDevice) obj;
|
||||
if (serial == null) {
|
||||
if (other.serial != null)
|
||||
return false;
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import se.vidstige.jadb.AndroidDevice;
|
||||
import se.vidstige.jadb.JadbDevice;
|
||||
import se.vidstige.jadb.JadbConnection;
|
||||
import se.vidstige.jadb.JadbException;
|
||||
|
||||
@ -13,8 +13,8 @@ public class AndroidDeviceTestCases {
|
||||
@Test
|
||||
public void testGetState() throws Exception {
|
||||
JadbConnection jadb = new JadbConnection();
|
||||
List<AndroidDevice> devices = jadb.getDevices();
|
||||
AndroidDevice device = devices.get(0);
|
||||
List<JadbDevice> devices = jadb.getDevices();
|
||||
JadbDevice device = devices.get(0);
|
||||
device.getState();
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@ public class AndroidDeviceTestCases {
|
||||
public void invalidShellCommand() throws Exception
|
||||
{
|
||||
JadbConnection jadb = new JadbConnection("localhost", 5037);
|
||||
List<AndroidDevice> devices = jadb.getDevices();
|
||||
AndroidDevice device = devices.get(0);
|
||||
List<JadbDevice> devices = jadb.getDevices();
|
||||
JadbDevice device = devices.get(0);
|
||||
device.executeShell("cmd", "foo", "bar");
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,11 @@ package se.vidstige.jadb.test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import se.vidstige.jadb.AndroidDevice;
|
||||
import se.vidstige.jadb.JadbDevice;
|
||||
import se.vidstige.jadb.JadbConnection;
|
||||
import se.vidstige.jadb.RemoteFile;
|
||||
import se.vidstige.jadb.test.fakes.AdbServer;
|
||||
|
||||
public class JadbTestCases {
|
||||
|
||||
@ -23,7 +21,7 @@ public class JadbTestCases {
|
||||
{
|
||||
//JadbConnection jadb = new JadbConnection("localhost", 15037);
|
||||
JadbConnection jadb = new JadbConnection();
|
||||
List<AndroidDevice> actual = jadb.getDevices();
|
||||
List<JadbDevice> actual = jadb.getDevices();
|
||||
//Assert.assertEquals("emulator-5554", actual.get(0).getSerial());
|
||||
}
|
||||
|
||||
@ -31,7 +29,7 @@ public class JadbTestCases {
|
||||
public void testListFiles() throws Exception
|
||||
{
|
||||
JadbConnection jadb = new JadbConnection();
|
||||
AndroidDevice any = jadb.getAnyDevice();
|
||||
JadbDevice any = jadb.getAnyDevice();
|
||||
List<RemoteFile> files = any.list("/");
|
||||
for (RemoteFile f : files)
|
||||
{
|
||||
@ -43,7 +41,7 @@ public class JadbTestCases {
|
||||
public void testPushFile() throws Exception
|
||||
{
|
||||
JadbConnection jadb = new JadbConnection();
|
||||
AndroidDevice any = jadb.getAnyDevice();
|
||||
JadbDevice any = jadb.getAnyDevice();
|
||||
any.push("README.md", "/sdcard/README.md");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user