aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-18 02:28:16 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-18 02:28:16 +1200
commit3aaaa1de76612e26c6d25f930d94fdf4ee810d7d (patch)
tree30c4fca8cb7e1e4e22d944f3d58df2168ebb4a2d
parentca074b8dea7209293baf8513dfcf36e8d504f69b (diff)
downloadtrackermap-server-3aaaa1de76612e26c6d25f930d94fdf4ee810d7d.tar.gz
trackermap-server-3aaaa1de76612e26c6d25f930d94fdf4ee810d7d.tar.bz2
trackermap-server-3aaaa1de76612e26c6d25f930d94fdf4ee810d7d.zip
Fix GT06 encoder unit test
-rw-r--r--src/org/traccar/database/DataManager.java1
-rw-r--r--src/org/traccar/database/IdentityManager.java8
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolEncoder.java3
-rw-r--r--test/org/traccar/BaseTest.java24
4 files changed, 34 insertions, 2 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 8337762f7..0c5f458a2 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -547,4 +547,5 @@ public class DataManager {
.setLong("managedUserId", managedUserId)
.executeUpdate();
}
+
}
diff --git a/src/org/traccar/database/IdentityManager.java b/src/org/traccar/database/IdentityManager.java
index db8e9c1c7..c8c593a54 100644
--- a/src/org/traccar/database/IdentityManager.java
+++ b/src/org/traccar/database/IdentityManager.java
@@ -28,4 +28,12 @@ public interface IdentityManager {
boolean isLatestPosition(Position position);
+ boolean lookupAttributeBoolean(long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig);
+
+ String lookupAttributeString(long deviceId, String attributeName, String defaultValue, boolean lookupConfig);
+
+ int lookupAttributeInteger(long deviceId, String attributeName, int defaultValue, boolean lookupConfig);
+
+ long lookupAttributeLong(long deviceId, String attributeName, long defaultValue, boolean lookupConfig);
+
}
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
index c20e1108f..7298f0ff6 100644
--- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -22,7 +22,6 @@ import org.traccar.Context;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.model.Command;
-import org.traccar.model.Device;
import java.nio.charset.StandardCharsets;
@@ -56,7 +55,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
@Override
protected Object encodeCommand(Command command) {
- boolean alternative = Context.getDeviceManager().lookupAttributeBoolean(
+ boolean alternative = Context.getIdentityManager().lookupAttributeBoolean(
command.getDeviceId(), "gt06.alternative", false, true);
switch (command.getType()) {
diff --git a/test/org/traccar/BaseTest.java b/test/org/traccar/BaseTest.java
index 0d74f50e5..6af8610cd 100644
--- a/test/org/traccar/BaseTest.java
+++ b/test/org/traccar/BaseTest.java
@@ -37,6 +37,30 @@ public class BaseTest {
return true;
}
+ @Override
+ public boolean lookupAttributeBoolean(
+ long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig) {
+ return false;
+ }
+
+ @Override
+ public String lookupAttributeString(
+ long deviceId, String attributeName, String defaultValue, boolean lookupConfig) {
+ return null;
+ }
+
+ @Override
+ public int lookupAttributeInteger(
+ long deviceId, String attributeName, int defaultValue, boolean lookupConfig) {
+ return 0;
+ }
+
+ @Override
+ public long lookupAttributeLong(
+ long deviceId, String attributeName, long defaultValue, boolean lookupConfig) {
+ return 0;
+ }
+
});
}