diff options
6 files changed, 0 insertions, 511 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java index 744779ef4..d8bf8422a 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java @@ -40,10 +40,6 @@ public class RpcConverterTest { case ENCODED_SYNC_P_DATA: case ON_ENCODED_SYNC_P_DATA: case GENERIC_RESPONSE: - case STREAM_RPC: - case ON_LOCK_SCREEN_STATUS: - case ON_SDL_CHOICE_CHOSEN: - case ON_STREAM_RPC: continue; default: @@ -70,10 +66,6 @@ public class RpcConverterTest { case ENCODED_SYNC_P_DATA: case ON_ENCODED_SYNC_P_DATA: case GENERIC_RESPONSE: - case STREAM_RPC: - case ON_LOCK_SCREEN_STATUS: - case ON_SDL_CHOICE_CHOSEN: - case ON_STREAM_RPC: return null; case SHOW_CONSTANT_TBT: rpcClassName.append("ShowConstantTbt"); @@ -109,10 +101,6 @@ public class RpcConverterTest { case ENCODED_SYNC_P_DATA: case ON_ENCODED_SYNC_P_DATA: case GENERIC_RESPONSE: - case STREAM_RPC: - case ON_LOCK_SCREEN_STATUS: - case ON_SDL_CHOICE_CHOSEN: - case ON_STREAM_RPC: continue; default: diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/LockScreenManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/LockScreenManagerTest.java deleted file mode 100644 index 082c87fda..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/LockScreenManagerTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.smartdevicelink.test.proxy; - -import com.smartdevicelink.proxy.LockScreenManager; -import com.smartdevicelink.proxy.rpc.OnLockScreenStatus; -import com.smartdevicelink.proxy.rpc.enums.HMILevel; -import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus; -import com.smartdevicelink.test.TestValues; - -import junit.framework.TestCase; - -/** - * This is a unit test class for the SmartDeviceLink library project class : - * {@link com.smartdevicelink.proxy.LockScreenManager} - */ -public class LockScreenManagerTest extends TestCase { - - /** - * This is a unit test for the following methods : - * {@link com.smartdevicelink.proxy.LockScreenManager#setDriverDistStatus(boolean)} - */ - public void testDriverDistStatus(){ - LockScreenManager lockMan = new LockScreenManager(); - lockMan.setDriverDistStatus(true); - assertEquals(TestValues.MATCH, true, (boolean) lockMan.getLockObj().getDriverDistractionStatus()); - - lockMan.setDriverDistStatus(false); - assertEquals(TestValues.MATCH, false, (boolean) lockMan.getLockObj().getDriverDistractionStatus()); - } - - /** - * This is a unit test for the following methods : - * {@link com.smartdevicelink.proxy.LockScreenManager#setHMILevel(HMILevel)} - */ - public void testHmiLevelStatus(){ - LockScreenManager lockMan = new LockScreenManager(); - lockMan.setHMILevel(HMILevel.HMI_BACKGROUND); - assertEquals(TestValues.MATCH, HMILevel.HMI_BACKGROUND, lockMan.getLockObj().getHMILevel()); - - lockMan.setHMILevel(HMILevel.HMI_FULL); - assertEquals(TestValues.MATCH, HMILevel.HMI_FULL, lockMan.getLockObj().getHMILevel()); - - lockMan.setHMILevel(HMILevel.HMI_LIMITED); - assertEquals(TestValues.MATCH, HMILevel.HMI_LIMITED, lockMan.getLockObj().getHMILevel()); - - lockMan.setHMILevel(HMILevel.HMI_NONE); - assertEquals(TestValues.MATCH, HMILevel.HMI_NONE, lockMan.getLockObj().getHMILevel()); - - lockMan.setHMILevel(null); - assertNull(TestValues.NULL, lockMan.getLockObj().getHMILevel()); - } - - /** - * Test the lock screen status when no setter methods are called. - */ - public void testLockScreenStatusNull(){ - LockScreenManager lockMan = new LockScreenManager(); - OnLockScreenStatus result = lockMan.getLockObj(); - assertNotNull(TestValues.NOT_NULL, result); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - } - - /** - * Test the invalid settings of lock screen status. - */ - public void testLockScreenStatusDriverDistNull(){ - LockScreenManager lockMan = new LockScreenManager(); - - OnLockScreenStatus result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_NONE); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_BACKGROUND); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_FULL); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_LIMITED); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen()); - } - - /** - * Test the enabled settings of lock screen status. - */ - public void testLockScreenStatusDriverDistEnabled(){ - LockScreenManager lockMan = new LockScreenManager(); - lockMan.setDriverDistStatus(true); - - // HMI level is null - OnLockScreenStatus result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_NONE); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_BACKGROUND); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_FULL); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_LIMITED); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen()); - } - - /** - * Test the disabled settings of lock screen status. - */ - public void testLockScreenStatusDriverDistDisabled(){ - LockScreenManager lockMan = new LockScreenManager(); - lockMan.setDriverDistStatus(false); - - OnLockScreenStatus result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_NONE); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_BACKGROUND); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_FULL); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OPTIONAL, result.getShowLockScreen()); - - lockMan.setHMILevel(HMILevel.HMI_LIMITED); - result = lockMan.getLockObj(); - assertEquals(TestValues.MATCH, LockScreenStatus.OPTIONAL, result.getShowLockScreen()); - } -}
\ No newline at end of file diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLockScreenStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLockScreenStatusTests.java deleted file mode 100644 index d73b39beb..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLockScreenStatusTests.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.smartdevicelink.test.rpc.notifications; - -import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.RPCMessage; -import com.smartdevicelink.proxy.rpc.OnHMIStatus; -import com.smartdevicelink.proxy.rpc.OnLockScreenStatus; -import com.smartdevicelink.proxy.rpc.enums.HMILevel; -import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus; -import com.smartdevicelink.test.BaseRpcTests; -import com.smartdevicelink.test.TestValues; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.fail; - -/** - * This is a unit test class for the SmartDeviceLink library project class : - * {@link com.smartdevicelink.rpc.OnLockScreenStatus} - */ -public class OnLockScreenStatusTests extends BaseRpcTests{ - - @Override - protected RPCMessage createMessage(){ - OnLockScreenStatus msg = new OnLockScreenStatus(); - - msg.setDriverDistractionStatus(TestValues.GENERAL_BOOLEAN); - msg.setHMILevel(TestValues.GENERAL_HMILEVEL); - msg.setShowLockScreen(TestValues.GENERAL_LOCKSCREENSTATUS); - msg.setUserSelected(TestValues.GENERAL_BOOLEAN); - - return msg; - } - - @Override - protected String getMessageType(){ - return RPCMessage.KEY_NOTIFICATION; - } - - @Override - protected String getCommandType(){ - return FunctionID.ON_LOCK_SCREEN_STATUS.toString(); - } - - @Override - protected JSONObject getExpectedParameters(int sdlVersion){ - JSONObject result = new JSONObject(); - - try{ - result.put(OnLockScreenStatus.KEY_DRIVER_DISTRACTION, TestValues.GENERAL_BOOLEAN); - result.put(OnHMIStatus.KEY_HMI_LEVEL, TestValues.GENERAL_HMILEVEL); - result.put(OnLockScreenStatus.KEY_SHOW_LOCK_SCREEN, TestValues.GENERAL_LOCKSCREENSTATUS); - result.put(OnLockScreenStatus.KEY_USER_SELECTED, TestValues.GENERAL_BOOLEAN); - }catch(JSONException e){ - fail(TestValues.JSON_FAIL); - } - - return result; - } - - /** - * Tests the expected values of the RPC message. - */ - @Test - public void testRpcValues () { - // Test Values - Boolean status = ( (OnLockScreenStatus) msg ).getDriverDistractionStatus(); - HMILevel hmiLevel = ( (OnLockScreenStatus) msg ).getHMILevel(); - LockScreenStatus lockScreen = ( (OnLockScreenStatus) msg ).getShowLockScreen(); - boolean userSelected = ( (OnLockScreenStatus) msg ).getUserSelected(); - - // Valid Tests - assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, status); - assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL, hmiLevel); - assertEquals(TestValues.MATCH, TestValues.GENERAL_LOCKSCREENSTATUS, lockScreen); - assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, userSelected); - - // Invalid/Null Tests - OnLockScreenStatus msg = new OnLockScreenStatus(); - assertNotNull(TestValues.NOT_NULL, msg); - testNullBase(msg); - - assertNull(TestValues.NULL, msg.getDriverDistractionStatus()); - assertNull(TestValues.NULL, msg.getHMILevel()); - assertNull(TestValues.NULL, msg.getShowLockScreen()); - assertNull(TestValues.NULL, msg.getUserSelected()); - } -}
\ No newline at end of file diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSdlChoiceChosenTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSdlChoiceChosenTests.java deleted file mode 100644 index f3efebe84..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSdlChoiceChosenTests.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.smartdevicelink.test.rpc.notifications; - -import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.RPCMessage; -import com.smartdevicelink.proxy.rpc.OnSdlChoiceChosen; -import com.smartdevicelink.proxy.rpc.OnSdlChoiceChosen.SdlChoice; -import com.smartdevicelink.proxy.rpc.enums.TriggerSource; -import com.smartdevicelink.test.BaseRpcTests; -import com.smartdevicelink.test.TestValues; -import com.smartdevicelink.test.Validator; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.assertTrue; -import static junit.framework.TestCase.fail; - -/** - * This is a unit test class for the SmartDeviceLink library project class : - * {@link com.smartdevicelink.proxy.rpc.OnSdlChoiceChosen} - */ -public class OnSdlChoiceChosenTests extends BaseRpcTests{ - - SdlChoice sdlChoice; - - @Override - protected RPCMessage createMessage(){ - OnSdlChoiceChosen msg = new OnSdlChoiceChosen(); - sdlChoice = msg.new SdlChoice(TestValues.GENERAL_CHOICE); - - msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE); - msg.setSdlChoice(sdlChoice); - - return msg; - } - - @Override - protected String getMessageType(){ - return RPCMessage.KEY_NOTIFICATION; - } - - @Override - protected String getCommandType(){ - return FunctionID.ON_SDL_CHOICE_CHOSEN.toString(); - } - - @Override - protected JSONObject getExpectedParameters(int sdlVersion){ - JSONObject result = new JSONObject(); - - try{ - result.put(OnSdlChoiceChosen.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE); - result.put(OnSdlChoiceChosen.KEY_SDL_CHOICE, sdlChoice); - }catch(JSONException e){ - fail(TestValues.JSON_FAIL); - } - - return result; - } - - /** - * Tests the expected values of the RPC message. - */ - @Test - public void testRpcValues () { - // Test Values - SdlChoice data = ( (OnSdlChoiceChosen) msg ).getSdlChoice(); - TriggerSource source = ( (OnSdlChoiceChosen) msg ).getTriggerSource(); - - // Valid Tests - assertTrue(TestValues.MATCH, Validator.validateChoice(TestValues.GENERAL_CHOICE, data.getChoice())); - assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, source); - - // Invalid/Null Tests - OnSdlChoiceChosen msg = new OnSdlChoiceChosen(); - assertNotNull(TestValues.NOT_NULL, msg); - testNullBase(msg); - - assertNull(TestValues.NULL, msg.getTriggerSource()); - assertNull(TestValues.NULL, msg.getSdlChoice()); - } -}
\ No newline at end of file diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java deleted file mode 100644 index 863abf4e0..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.smartdevicelink.test.rpc.notifications; - -import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.RPCMessage; -import com.smartdevicelink.proxy.rpc.OnStreamRPC; -import com.smartdevicelink.test.BaseRpcTests; -import com.smartdevicelink.test.TestValues; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.fail; - -/** - * Created by austinkirk on 6/7/17. - */ - -public class OnStreamRPCTests extends BaseRpcTests { - @Override - protected RPCMessage createMessage(){ - OnStreamRPC msg = new OnStreamRPC(); - - msg.setBytesComplete(TestValues.GENERAL_LONG); - msg.setFileName(TestValues.GENERAL_STRING); - msg.setFileSize(TestValues.GENERAL_LONG); - - return msg; - } - - @Override - protected String getMessageType(){ - return RPCMessage.KEY_NOTIFICATION; - } - - @Override - protected String getCommandType(){ - return FunctionID.ON_STREAM_RPC.toString(); - } - - @Override - protected JSONObject getExpectedParameters(int sdlVersion){ - JSONObject result = new JSONObject(); - - try{ - result.put(OnStreamRPC.KEY_BYTESCOMPLETE, TestValues.GENERAL_LONG); - result.put(OnStreamRPC.KEY_FILENAME, TestValues.GENERAL_STRING); - result.put(OnStreamRPC.KEY_FILESIZE, TestValues.GENERAL_LONG); - }catch(JSONException e){ - fail(TestValues.JSON_FAIL); - } - - return result; - } - - /** - * Tests the expected values of the RPC message. - */ - @Test - public void testRpcValues () { - // Test Values - Long bytes = ((OnStreamRPC) msg).getBytesComplete(); - String fileName = ((OnStreamRPC) msg).getFileName(); - Long fileSize = ((OnStreamRPC) msg).getFileSize(); - - // Valid Tests - assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, bytes); - assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, fileName); - assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, fileSize); - - // Invalid/Null Tests - OnStreamRPC msg = new OnStreamRPC(); - assertNotNull(TestValues.NOT_NULL, msg); - testNullBase(msg); - - assertNull(TestValues.NULL, msg.getBytesComplete()); - assertNull(TestValues.NULL, msg.getFileName()); - assertNull(TestValues.NULL, msg.getFileSize()); - } -} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java deleted file mode 100644 index 2dcfb0509..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.smartdevicelink.test.rpc.responses; - -import com.smartdevicelink.marshal.JsonRPCMarshaller; -import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.RPCMessage; -import com.smartdevicelink.proxy.rpc.StreamRPCResponse; -import com.smartdevicelink.test.BaseRpcTests; -import com.smartdevicelink.test.JsonUtils; -import com.smartdevicelink.test.TestValues; -import com.smartdevicelink.test.json.rpc.JsonFileReader; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -import java.util.Hashtable; -import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNotNull; - - -/** - * Created by austinkirk on 6/7/17. - */ - -public class StreamRPCResponseTests extends BaseRpcTests { - @Override - protected RPCMessage createMessage(){ - StreamRPCResponse response = new StreamRPCResponse(); - response.setFileSize((Long) TestValues.GENERAL_LONG); - response.setFileName(TestValues.GENERAL_STRING); - return response; - } - - @Override - protected String getMessageType(){ - return RPCMessage.KEY_RESPONSE; - } - - @Override - protected String getCommandType(){ - return FunctionID.STREAM_RPC.toString(); - } - - @Override - protected JSONObject getExpectedParameters(int sdlVersion){ - JSONObject result = new JSONObject(); - - try { - result.put(StreamRPCResponse.KEY_FILESIZE, (Long) TestValues.GENERAL_LONG); - result.put(StreamRPCResponse.KEY_FILENAME, TestValues.GENERAL_STRING); - } catch (JSONException e) { - e.printStackTrace(); - } - - return result; - } - - /** - * Tests the expected values of the RPC message. - */ - @Test - public void testRpcValues () { - // Invalid/Null Tests - StreamRPCResponse msg = new StreamRPCResponse(); - assertNotNull(TestValues.NOT_NULL, msg); - testNullBase(msg); - } - - /** - * Tests a valid JSON construction of this RPC message. - */ - @Test - public void testJsonConstructor () { - JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType()); - assertNotNull(TestValues.NOT_NULL, commandJson); - - try { - Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); - StreamRPCResponse cmd = new StreamRPCResponse(hash); - - JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType()); - assertNotNull(TestValues.NOT_NULL, body); - - // Test everything in the json body. - assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName()); - assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID()); - - JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); - assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, StreamRPCResponse.KEY_FILENAME), cmd.getFileName()); - assertEquals(TestValues.MATCH, JsonUtils.readLongFromJsonObject(parameters, StreamRPCResponse.KEY_FILESIZE), cmd.getFileSize()); - } catch (JSONException e) { - e.printStackTrace(); - } - } -} |