diff options
author | Valerii Vyshniak <valeravi@vi-soft.com.ua> | 2017-12-03 15:20:13 +0100 |
---|---|---|
committer | Valerii Vyshniak <valeravi@vi-soft.com.ua> | 2017-12-03 15:20:13 +0100 |
commit | 8e60c4319f7931eabd98c88eeadfa1280c47974e (patch) | |
tree | 63bb9ea1d8361a7068d559c5d9c11a31137770d3 /test/org/traccar/TestIdentityManager.java | |
parent | f58fe1fcbfcc2be5a0a8113e9e561794eb9b2491 (diff) | |
download | trackermap-server-8e60c4319f7931eabd98c88eeadfa1280c47974e.tar.gz trackermap-server-8e60c4319f7931eabd98c88eeadfa1280c47974e.tar.bz2 trackermap-server-8e60c4319f7931eabd98c88eeadfa1280c47974e.zip |
T580W: tk103 encoder alternative commands in separate class to be able to test them separately
Diffstat (limited to 'test/org/traccar/TestIdentityManager.java')
-rw-r--r-- | test/org/traccar/TestIdentityManager.java | 33 |
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; } } |