aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/TestIdentityManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar/TestIdentityManager.java')
-rw-r--r--test/org/traccar/TestIdentityManager.java33
1 files changed, 8 insertions, 25 deletions
diff --git a/test/org/traccar/TestIdentityManager.java b/test/org/traccar/TestIdentityManager.java
index c613dcb54..f9d95927d 100644
--- a/test/org/traccar/TestIdentityManager.java
+++ b/test/org/traccar/TestIdentityManager.java
@@ -3,41 +3,25 @@ package org.traccar;
import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Position;
-import java.util.concurrent.ConcurrentHashMap;
-
-import java.util.Map;
public final class TestIdentityManager implements IdentityManager {
- private static Map<Long, Device> devicesById = new ConcurrentHashMap<>();
- private static long newDeviceId = 100;
-
- public TestIdentityManager() {
- }
-
- private static Device createDevice(long id) {
+ private static Device createDevice() {
Device device = new Device();
- device.setId(id);
+ device.setId(1);
device.setName("test");
device.setUniqueId("123456789012345");
return device;
}
- public static Device createTestDevice() {
- Device device = createDevice(newDeviceId);
- devicesById.put(newDeviceId++, device);
- return device;
- }
-
@Override
public Device getById(long id) {
- Device device = devicesById.get(id);
- return device != null ? device : createDevice(1);
+ return createDevice();
}
@Override
public Device getByUniqueId(String uniqueId) {
- return createDevice(1);
+ return createDevice();
}
@Override
@@ -53,26 +37,25 @@ public final class TestIdentityManager implements IdentityManager {
@Override
public boolean lookupAttributeBoolean(
long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig) {
- Device device = devicesById.get(deviceId);
- return device != null ? device.getBoolean(attributeName) : defaultValue;
+ return defaultValue;
}
@Override
public String lookupAttributeString(
long deviceId, String attributeName, String defaultValue, boolean lookupConfig) {
- return "alarm,result";
+ return "alarm,result";
}
@Override
public int lookupAttributeInteger(
long deviceId, String attributeName, int defaultValue, boolean lookupConfig) {
- return defaultValue;
+ return defaultValue;
}
@Override
public long lookupAttributeLong(
long deviceId, String attributeName, long defaultValue, boolean lookupConfig) {
- return defaultValue;
+ return defaultValue;
}
}