mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 14:56:41 +00:00
Bug 5101: Refactoring for reusability
This commit is contained in:
1 parent
7790e11673
commit
4209e5c2a3
4 files changed
+34
-30
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
package com.sap.sailing.selenium.api.core;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class DeviceStatus extends JsonWrapper {
|
||||
public DeviceStatus(JSONObject json) {
|
||||
super(json);
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return (String) ((JSONObject)get("deviceId")).get("id");
|
||||
}
|
||||
|
||||
public GPSFixResponse getLastGPSFix() {
|
||||
JSONObject jsonObject = get("lastGPSFix");
|
||||
return jsonObject == null ? null : new GPSFixResponse(jsonObject);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.sap.sailing.selenium.api.core;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class GPSFixResponse extends JsonWrapper {
|
||||
public GPSFixResponse(JSONObject json) {
|
||||
super(json);
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return ((Number)get("unixtime")).longValue();
|
||||
}
|
||||
}
|
||||
+1
-28
@@ -2,10 +2,8 @@ package com.sap.sailing.selenium.api.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.selenium.api.core.ApiContext;
|
||||
import com.sap.sailing.selenium.api.core.JsonWrapper;
|
||||
import com.sap.sailing.selenium.api.core.DeviceStatus;
|
||||
|
||||
public class TrackingDeviceApi {
|
||||
|
||||
@@ -14,29 +12,4 @@ public class TrackingDeviceApi {
|
||||
public DeviceStatus getDeviceStatus(ApiContext ctx, UUID deviceUUID) {
|
||||
return new DeviceStatus(ctx.get(BASE_PATH + "/" + deviceUUID.toString()));
|
||||
}
|
||||
|
||||
public class DeviceStatus extends JsonWrapper {
|
||||
private DeviceStatus(JSONObject json) {
|
||||
super(json);
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return (String) ((JSONObject)get("deviceId")).get("id");
|
||||
}
|
||||
|
||||
public GPSFixResponse getLastGPSFix() {
|
||||
JSONObject jsonObject = get("lastGPSFix");
|
||||
return jsonObject == null ? null : new GPSFixResponse(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
public class GPSFixResponse extends JsonWrapper {
|
||||
private GPSFixResponse(JSONObject json) {
|
||||
super(json);
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return ((Number)get("unixtime")).longValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -13,11 +13,11 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.selenium.api.core.ApiContext;
|
||||
import com.sap.sailing.selenium.api.core.DeviceStatus;
|
||||
import com.sap.sailing.selenium.api.core.GPSFixResponse;
|
||||
import com.sap.sailing.selenium.api.core.GpsFixMoving;
|
||||
import com.sap.sailing.selenium.api.event.GpsFixApi;
|
||||
import com.sap.sailing.selenium.api.event.TrackingDeviceApi;
|
||||
import com.sap.sailing.selenium.api.event.TrackingDeviceApi.DeviceStatus;
|
||||
import com.sap.sailing.selenium.api.event.TrackingDeviceApi.GPSFixResponse;
|
||||
import com.sap.sailing.selenium.test.AbstractSeleniumTest;
|
||||
|
||||
public class TrackingDeviceStatusApiTest extends AbstractSeleniumTest {
|
||||
|
||||
Reference in new issue
Block a user