summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Henigan <robert.henigan@livio.io>2020-09-17 15:37:45 -0400
committerGitHub <noreply@github.com>2020-09-17 15:37:45 -0400
commit33d48a40a5625db0967bed780654fce8b1abbd5c (patch)
tree4090f76a6e2c92c74e32cdc337d1fdbb680a0cce
parent0c801089e5988bd348ed591e7dac49f54c191796 (diff)
parentb2cdecac93ada94aecfbe00dca2c0f24ceadc875 (diff)
downloadsdl_android-33d48a40a5625db0967bed780654fce8b1abbd5c.tar.gz
Merge pull request #1503 from smartdevicelink/feature/fix_todos
Fix some todo comments
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java1
5 files changed, 31 insertions, 14 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
index 514067db9..bea2a3a46 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
@@ -4,6 +4,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.BSON.BsonEncoder;
import com.smartdevicelink.protocol.enums.ControlFrameTags;
+import com.smartdevicelink.test.TestValues;
+import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.TransportRecord;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -15,7 +18,6 @@ import static junit.framework.TestCase.assertNull;
@RunWith(AndroidJUnit4.class)
public class SdlPacketTests {
- //TODO: Add tests to cover other parts of SdlPacket class
// Test variables
private final int TEST_HASH_ID = 65537;
@@ -43,9 +45,19 @@ public class SdlPacketTests {
String tag = "hello";
SdlPacket sdlPacket = new SdlPacket();
+
assertNull(sdlPacket.getTag(tag));
sdlPacket.setPayload(testPayload);
assertEquals(sdlPacket.getTag("hello"),"world");
+
+ assertEquals(1, sdlPacket.getVersion());
+
+ sdlPacket.setPriorityCoefficient(TestValues.GENERAL_INT);
+ assertEquals(TestValues.GENERAL_INT, sdlPacket.getPrioirtyCoefficient());
+
+ sdlPacket.setTransportRecord(new TransportRecord(TransportType.TCP, TestValues.GENERAL_STRING));
+ assertEquals(TransportType.TCP, sdlPacket.getTransportRecord().getType());
+ assertEquals(TestValues.GENERAL_STRING, sdlPacket.getTransportRecord().getAddress());
}
@Test
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
index 9002f89fd..de9d0a5fb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
@@ -14,9 +14,7 @@ import java.util.TimerTask;
* {@link com.smartdevicelink.protocol.heartbeat.HeartbeatMonitor}
*/
public class HeartbeatMonitorTests extends TestCase {
-
- // TODO : Proper thread testing.
-
+
private HeartbeatMonitor monitor = new HeartbeatMonitor();
private Runnable testRunnable;
private Timer timer;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
index 0c650f40a..1e486f7eb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
@@ -5,6 +5,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.VehicleDataResult;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
@@ -30,13 +31,12 @@ import static junit.framework.TestCase.fail;
* {@link com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse}
*/
public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
-
- // TODO : Test different result codes.
@Override
protected RPCMessage createMessage() {
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
+ msg.setResultCode(TestValues.GENERAL_RESULT);
msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
@@ -93,7 +93,8 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
// Note: If the key values stored in SubscribeVehicleDataResponse
// were to be in a list then this could be easily looped through
// instead of individually set.
-
+
+ result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
@@ -140,6 +141,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
@Test
public void testRpcValues () {
// Test Values
+ Result testResult = ( (SubscribeVehicleDataResponse) msg ).getResultCode();
VehicleDataResult testGps = ( (SubscribeVehicleDataResponse) msg ).getGps();
VehicleDataResult testOdometer = ( (SubscribeVehicleDataResponse) msg ).getOdometer();
VehicleDataResult testTirePressure = ( (SubscribeVehicleDataResponse) msg ).getTirePressure();
@@ -175,6 +177,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
+ assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
@@ -213,7 +216,8 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
-
+
+ assertNull(TestValues.NULL, msg.getResultCode());
assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
index 1f4117f52..f4f61fde3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
@@ -7,6 +7,7 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.VehicleDataResult;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
@@ -33,12 +34,11 @@ import static junit.framework.TestCase.fail;
*/
public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
- // TODO : Test different result codes.
-
@Override
protected RPCMessage createMessage() {
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
+ msg.setResultCode(TestValues.GENERAL_RESULT);
msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
@@ -95,7 +95,8 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
// Note: If the key values stored in SubscribeVehicleDataResponse
// were to be in a list then this could be easily looped through
// instead of individually set.
-
+
+ result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
@@ -143,6 +144,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
@Test
public void testRpcValues () {
// Test Values
+ Result testResult = ( (UnsubscribeVehicleDataResponse) msg ).getResultCode();
VehicleDataResult testGps = ( (UnsubscribeVehicleDataResponse) msg ).getGps();
VehicleDataResult testOdometer = ( (UnsubscribeVehicleDataResponse) msg ).getOdometer();
VehicleDataResult testTirePressure = ( (UnsubscribeVehicleDataResponse) msg ).getTirePressure();
@@ -178,6 +180,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
+ assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
@@ -216,8 +219,9 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getAccPedalPosition());
+
+ assertNull(TestValues.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
assertNull(TestValues.NULL, msg.getDriverBraking());
diff --git a/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java b/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
index 2a7ab284e..f2d50b040 100644
--- a/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
+++ b/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
@@ -289,7 +289,6 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
@Override
public void onProtocolError(String info, Exception e) {
- //TODO is there anything to pass forward here?
DebugTool.logError(TAG,"on protocol error", e);
}