summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkboskin <kboskin>2020-07-03 15:21:37 +0300
committerkboskin <kboskin>2020-07-03 15:21:37 +0300
commit424c52e8c52959c5025fa5cb33d9904608bc4f0f (patch)
tree9ebccd072bf6399870c85a6b82b05e4fbf22a86e
parentb20de876ebda0edf411afc7e084726501d17510f (diff)
parent563a3a583ef72586099b444dea9d5718892600bb (diff)
downloadsdl_android-424c52e8c52959c5025fa5cb33d9904608bc4f0f.tar.gz
Merge branch 'develop' into Feature/webengine_projection_mode
# Conflicts: # android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
-rw-r--r--.github/workflows/android.yml2
-rwxr-xr-xandroid/hello_sdl_android/build.gradle2
-rwxr-xr-xandroid/hello_sdl_android/src/main/AndroidManifest.xml7
-rwxr-xr-xandroid/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java4
-rwxr-xr-xandroid/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java69
-rw-r--r--android/sdl_android/build.gradle1
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/AndroidTestCase2.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/SdlConnection/SdlConnectionTest.java109
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java134
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java19
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlFileTests.java125
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java139
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java86
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java17
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java138
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java27
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java (renamed from android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java)46
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java27
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/InternalProxyMessageTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/LockScreenManagerTest.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java802
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java146
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/TTSChunkFactoryTests.java68
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java23
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java62
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java72
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java176
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java136
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java68
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java84
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java162
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java64
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java46
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java96
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java134
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java60
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java68
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java192
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java134
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java17
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnErrorTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java57
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java17
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLockScreenStatusTests.java45
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyClosedTests.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyOpenedTests.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSdlChoiceChosenTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnStreamRPCTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java78
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java173
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java75
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java128
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java67
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java77
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java62
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java57
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java326
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java112
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java43
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java96
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java188
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java49
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java41
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java72
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java37
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java175
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java134
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java178
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java318
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java73
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java329
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java23
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java52
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java31
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java41
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java45
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java205
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java51
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java188
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/StreamRPCResponseTests.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java318
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java318
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java49
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java63
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java17
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java31
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java27
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java165
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java13
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java41
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java36
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java76
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java10
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java9
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java6
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java1442
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java66
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java66
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java69
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java6
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java48
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java314
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java21
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java5
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java17
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java15
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java116
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java69
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java184
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java65
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java83
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java58
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java24
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransport.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java33
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java217
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java191
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java8
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java12
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java151
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java30
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java15
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java14
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java278
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java56
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java (renamed from base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java)7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/Log.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java5
-rw-r--r--android/sdl_android/src/main/res/values/sdl.xml2
-rw-r--r--base/src/main/java/android/os/AsyncTask.java1
-rw-r--r--base/src/main/java/android/os/Parcel.java1
-rw-r--r--base/src/main/java/android/os/Parcelable.java1
-rw-r--r--base/src/main/java/android/util/Log.java3
-rw-r--r--base/src/main/java/com/livio/BSON/BsonEncoder.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java754
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java13
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java1529
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/PoliciesFetcher.java27
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java548
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java193
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java338
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java82
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java104
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PausableThreadPoolExecutor.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java (renamed from base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java)108
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/SdlTrace.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/CustomTransport.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/SiphonServer.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/TransportConstants.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/TransportManager.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/WebSocketServer.java29
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java (renamed from base/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java)60
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/util/DebugTool.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/util/FileUtls.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/util/NativeLogTool.java16
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle1
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/protocol/SdlPacket.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/util/HttpRequestTask.java1
-rw-r--r--hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java14
-rw-r--r--hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java98
-rw-r--r--javaEE/build.gradle1
-rw-r--r--javaSE/build.gradle1
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java907
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java1456
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java11
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java82
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java77
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/util/HttpRequestTask.java183
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/util/Log.java22
478 files changed, 16616 insertions, 13819 deletions
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 056e51be8..c2ec6bf32 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -25,7 +25,7 @@ jobs:
script: ./android/gradlew -p ./android :sdl_android:connectedCheck
- name: Hello Sdl Android Tests
- run: ./android/gradlew -p ./android :hello_sdl_android:build
+ run: ./android/gradlew -p ./android/hello_sdl_android test
- name: Sdl JavaSE Tests
run: ./javaSE/gradlew -p ./javaSE test
diff --git a/android/hello_sdl_android/build.gradle b/android/hello_sdl_android/build.gradle
index ac8b92278..da649cbbb 100755
--- a/android/hello_sdl_android/build.gradle
+++ b/android/hello_sdl_android/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 28
+ compileSdkVersion 29
defaultConfig {
applicationId "com.sdl.hellosdlandroid"
minSdkVersion 14
diff --git a/android/hello_sdl_android/src/main/AndroidManifest.xml b/android/hello_sdl_android/src/main/AndroidManifest.xml
index 72a191542..214a04355 100755
--- a/android/hello_sdl_android/src/main/AndroidManifest.xml
+++ b/android/hello_sdl_android/src/main/AndroidManifest.xml
@@ -39,12 +39,15 @@
android:resource="@xml/accessory_filter" />
</activity>
- <service android:name="com.sdl.hellosdlandroid.SdlService" >
+ <service
+ android:name="com.sdl.hellosdlandroid.SdlService"
+ android:foregroundServiceType="connectedDevice">
</service>
<service
android:name=".SdlRouterService"
android:exported="true"
- android:process="com.smartdevicelink.router">
+ android:process="com.smartdevicelink.router"
+ android:foregroundServiceType="connectedDevice">
<intent-filter>
<action android:name="com.smartdevicelink.router.service"/>
</intent-filter>
diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
index bedeb0a39..c850f388c 100755
--- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
+++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
@@ -3,17 +3,17 @@ package com.sdl.hellosdlandroid;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
-import android.util.Log;
import com.smartdevicelink.transport.SdlBroadcastReceiver;
import com.smartdevicelink.transport.SdlRouterService;
+import com.smartdevicelink.util.DebugTool;
public class SdlReceiver extends SdlBroadcastReceiver {
private static final String TAG = "SdlBroadcastReciever";
@Override
public void onSdlEnabled(Context context, Intent intent) {
- Log.d(TAG, "SDL Enabled");
+ DebugTool.logInfo(TAG, "SDL Enabled");
intent.setClass(context, SdlService.class);
// SdlService needs to be foregrounded in Android O and above
diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
index 6b7e77c69..893525b97 100755
--- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
+++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
@@ -12,6 +12,7 @@ import android.os.IBinder;
import android.util.Log;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.screen.OnButtonListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
@@ -27,9 +28,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.Alert;
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Speak;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
@@ -183,6 +187,7 @@ public class SdlService extends Service {
performWelcomeSpeak();
performWelcomeShow();
preloadChoices();
+ subscribeToButtons();
}
}
});
@@ -198,20 +203,44 @@ public class SdlService extends Service {
}
@Override
- public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
- String appName;
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language) {
+ return null;
+ }
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
+ boolean isNeedUpdate = false;
+ String appName = APP_NAME;
+ String ttsName = APP_NAME;
switch (language) {
case ES_MX:
+ isNeedUpdate = true;
+ ttsName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ isNeedUpdate = true;
+ ttsName = APP_NAME_FR;
+ break;
+ default:
+ break;
+ }
+ switch (hmiLanguage) {
+ case ES_MX:
+ isNeedUpdate = true;
appName = APP_NAME_ES;
break;
case FR_CA:
+ isNeedUpdate = true;
appName = APP_NAME_FR;
break;
default:
- return null;
+ break;
+ }
+ if (isNeedUpdate) {
+ return new LifecycleConfigurationUpdate(appName, null, TTSChunkFactory.createSimpleTTSChunks(ttsName), null);
+ } else {
+ return null;
}
-
- return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
}
};
@@ -347,6 +376,36 @@ public class SdlService extends Service {
}
/**
+ * Attempts to Subscribe to all preset buttons
+ */
+ private void subscribeToButtons() {
+ ButtonName[] buttonNames = {ButtonName.PLAY_PAUSE, ButtonName.SEEKLEFT, ButtonName.SEEKRIGHT, ButtonName.AC_MAX, ButtonName.AC, ButtonName.RECIRCULATE,
+ ButtonName.FAN_UP, ButtonName.FAN_DOWN, ButtonName.TEMP_UP, ButtonName.TEMP_DOWN, ButtonName.FAN_DOWN, ButtonName.DEFROST_MAX, ButtonName.DEFROST_REAR, ButtonName.DEFROST,
+ ButtonName.UPPER_VENT, ButtonName.LOWER_VENT, ButtonName.VOLUME_UP, ButtonName.VOLUME_DOWN, ButtonName.EJECT, ButtonName.SOURCE, ButtonName.SHUFFLE, ButtonName.REPEAT};
+
+ OnButtonListener onButtonListener = new OnButtonListener() {
+ @Override
+ public void onPress(ButtonName buttonName, OnButtonPress buttonPress) {
+ sdlManager.getScreenManager().setTextField1(buttonName + " pressed");
+ }
+
+ @Override
+ public void onEvent(ButtonName buttonName, OnButtonEvent buttonEvent) {
+ sdlManager.getScreenManager().setTextField2(buttonName + " " + buttonEvent.getButtonEventMode());
+ }
+
+ @Override
+ public void onError(String info) {
+ Log.i(TAG, "onError: " + info);
+ }
+ };
+
+ for (ButtonName buttonName : buttonNames) {
+ sdlManager.getScreenManager().addButtonListener(buttonName, onButtonListener);
+ }
+ }
+
+ /**
* Will show a sample test message on screen as well as speak a sample test message
*/
private void showTest(){
diff --git a/android/sdl_android/build.gradle b/android/sdl_android/build.gradle
index 7d45586e7..551ff10c3 100644
--- a/android/sdl_android/build.gradle
+++ b/android/sdl_android/build.gradle
@@ -56,6 +56,7 @@ task buildWindowSymLinks(type:Exec){
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.smartdevicelink:bson_java_port:1.2.0'
+ api 'com.livio.taskmaster:taskmaster:0.3.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/AndroidTestCase2.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/AndroidTestCase2.java
deleted file mode 100644
index 1aafa19b6..000000000
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/AndroidTestCase2.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.smartdevicelink;
-
-import android.content.Context;
-import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-
-import junit.framework.TestCase;
-
-
-public class AndroidTestCase2 extends TestCase {
-
- public Context mContext;
-
- public AndroidTestCase2(){
- mContext = InstrumentationRegistry.getTargetContext();
- }
-
- public Context getContext(){
- return mContext;
- }
-
- public void setContext(Context context){}
-
-
- public void assertActivityRequiresPermission(String packageName, String className, String permission){}
- public void assertReadingContentUriRequiresPermission(Uri uri, String permission){}
- public void assertWritingContentUriRequiresPermission(Uri uri, String permission){}
-
-
- protected void scrubClass(Class<?> testCaseClass){}
- protected void setUp() throws Exception{}
- protected void tearDown() throws Exception{}
-
-}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/SdlConnection/SdlConnectionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/SdlConnection/SdlConnectionTest.java
index 776da6ccc..fa3f334e6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/SdlConnection/SdlConnectionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/SdlConnection/SdlConnectionTest.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.SdlConnection;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.test.util.DeviceUtil;
import com.smartdevicelink.transport.BTTransportConfig;
@@ -10,49 +11,54 @@ import com.smartdevicelink.transport.RouterServiceValidator;
import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
-public class SdlConnectionTest extends AndroidTestCase2 {
-
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+
+
+@RunWith(AndroidJUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)
+public class SdlConnectionTest {
+
private static final String TAG = "SdlConnection Tests";
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- }
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testForceConnectEvent(){
SdlConnection.enableLegacyMode(false, null);
assertNull(SdlConnectionTestClass.cachedMultiConfig);
-
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnectionTestClass connection = new SdlConnectionTestClass(config,rsvp);
assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
-
+
assertTrue(SdlConnectionTestClass.isLegacyModeEnabled());
-
+
assertEquals(TransportType.BLUETOOTH, connection.getCurrentTransportType());
-
+
assertNotNull(SdlConnectionTestClass.cachedMultiConfig);
-
+
connection.forceHardwareConnectEvent(TransportType.MULTIPLEX);
assertFalse(connection.connected);
SdlConnectionTestClass.cachedMultiConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
-
+
if(!DeviceUtil.isEmulator()) { // Cannot perform MBT operations in emulator
assertNotNull(SdlConnectionTestClass.cachedMultiConfig.getService());
assertEquals(TransportType.MULTIPLEX, connection.getCurrentTransportType());
}
-
+
// Test for handling of null service
- MultiplexTransportConfig null_service_config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig null_service_config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
null_service_config.setService(null);
SdlConnectionTestClass null_service_connection = new SdlConnectionTestClass(null_service_config, null);
Exception exception = null;
@@ -61,15 +67,16 @@ public class SdlConnectionTest extends AndroidTestCase2 {
}catch(NullPointerException e){
exception = e;
}
-
+
assertNull(exception); // Failed, unhandled NPE
}
-
+
+ @Test
public void testMultiplexConstructor(){
SdlConnection.enableLegacyMode(false, null);
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnection connection = new SdlConnection(config,rsvp);
if(DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
assertEquals(TransportType.BLUETOOTH, connection.getCurrentTransportType());
@@ -77,12 +84,13 @@ public class SdlConnectionTest extends AndroidTestCase2 {
assertEquals(TransportType.MULTIPLEX, connection.getCurrentTransportType());
}
}
-
+
+ @Test
public void testMultiplexConstructorInsalledFrom(){
SdlConnection.enableLegacyMode(false, null);
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnection connection = new SdlConnection(config,rsvp);
boolean didValidate = rsvp.validate();
if(didValidate){
@@ -92,12 +100,13 @@ public class SdlConnectionTest extends AndroidTestCase2 {
}
}
-
+
+ @Test
public void testMultiplexConstructorTrustedPackage(){
SdlConnection.enableLegacyMode(false, null);
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PACKAGE_CHECK);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnection connection = new SdlConnection(config,rsvp);
boolean didValidate = rsvp.validate();
if(didValidate){
@@ -107,12 +116,13 @@ public class SdlConnectionTest extends AndroidTestCase2 {
}
}
-
+
+ @Test
public void testMultiplexConstructorTrustedPackageAndVersion(){
SdlConnection.enableLegacyMode(false, null);
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnection connection = new SdlConnection(config,rsvp);
boolean didValidate = rsvp.validate();
if(didValidate){
@@ -120,13 +130,15 @@ public class SdlConnectionTest extends AndroidTestCase2 {
}else{
assertEquals(TransportType.BLUETOOTH, connection.getCurrentTransportType());
- } }
-
+ }
+ }
+
+ @Test
public void testMultiplexConstructorAllFlags(){
SdlConnection.enableLegacyMode(false, null);
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext);
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
SdlConnection connection = new SdlConnection(config,rsvp);
boolean didValidate = rsvp.validate();
if(didValidate){
@@ -134,8 +146,10 @@ public class SdlConnectionTest extends AndroidTestCase2 {
}else{
assertEquals(TransportType.BLUETOOTH, connection.getCurrentTransportType());
- } }
-
+ }
+ }
+
+ @Test
public void testBluetoothConstructor(){
SdlConnection.enableLegacyMode(false, null);
BTTransportConfig btConfig = new BTTransportConfig(true);
@@ -143,9 +157,10 @@ public class SdlConnectionTest extends AndroidTestCase2 {
assertEquals(TransportType.BLUETOOTH, connection.getCurrentTransportType());
}
+ @Test
public void testUsbConstructor(){
SdlConnection.enableLegacyMode(false, null);
- USBTransportConfig btConfig = new USBTransportConfig(mContext);
+ USBTransportConfig btConfig = new USBTransportConfig(getTargetContext());
SdlConnection connection = new SdlConnection(btConfig,null);
assertFalse(SdlConnection.isLegacyModeEnabled());
assertEquals(TransportType.USB, connection.getCurrentTransportType());
@@ -153,7 +168,7 @@ public class SdlConnectionTest extends AndroidTestCase2 {
SdlConnection connection2 = new SdlConnection(btConfig);
assertEquals(TransportType.USB, connection2.getCurrentTransportType());
}
-
+
protected class SdlConnectionTestClass extends SdlConnection{
protected boolean connected = false;
public SdlConnectionTestClass(BaseTransportConfig transportConfig) {
@@ -163,7 +178,7 @@ public class SdlConnectionTest extends AndroidTestCase2 {
protected SdlConnectionTestClass(BaseTransportConfig transportConfig,RouterServiceValidator rsvp){
super(transportConfig,rsvp);
}
-
+
@Override
public void onTransportConnected() {
super.onTransportConnected();
@@ -174,7 +189,7 @@ public class SdlConnectionTest extends AndroidTestCase2 {
public void onTransportDisconnected(String info) {
connected = false;
//Grab a currently running router service
- RouterServiceValidator rsvp2 = new RouterServiceValidator(mContext);
+ RouterServiceValidator rsvp2 = new RouterServiceValidator(getTargetContext());
rsvp2.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
assertTrue(rsvp2.validate());
assertNotNull(rsvp2.getService());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index 63917067e..c1c636c50 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -1,16 +1,16 @@
package com.smartdevicelink.managers;
import android.content.Context;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.exception.SdlException;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SdlProxyBase;
+import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
import com.smartdevicelink.proxy.rpc.OnAppServiceData;
@@ -21,10 +21,13 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.TCPTransportConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -33,15 +36,21 @@ import java.util.Arrays;
import java.util.List;
import java.util.Vector;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertSame;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.SdlManager}
*/
-public class SdlManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlManagerTests {
public static BaseTransportConfig transport = null;
private Context mTestContext;
@@ -49,7 +58,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
private TemplateColorScheme templateColorScheme;
private int listenerCalledCounter;
private SdlManager sdlManager;
- private SdlProxyBase sdlProxyBase;
+ private ISdl internalInterface;
// transport related
@SuppressWarnings("FieldCanBeLocal")
@@ -57,10 +66,8 @@ public class SdlManagerTests extends AndroidTestCase2 {
@SuppressWarnings("FieldCanBeLocal")
private String DEV_MACHINE_IP_ADDRESS = "0.0.0.0";
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
-
mTestContext = Mockito.mock(Context.class);
// set transport
@@ -72,16 +79,11 @@ public class SdlManagerTests extends AndroidTestCase2 {
// Color Scheme
templateColorScheme = new TemplateColorScheme();
- templateColorScheme.setBackgroundColor(Test.GENERAL_RGBCOLOR);
- templateColorScheme.setPrimaryColor(Test.GENERAL_RGBCOLOR);
- templateColorScheme.setSecondaryColor(Test.GENERAL_RGBCOLOR);
-
- sdlManager = createSampleManager("heyApp", "123456", Test.GENERAL_LOCKSCREENCONFIG);
- }
+ templateColorScheme.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
+ templateColorScheme.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
+ templateColorScheme.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
+ sdlManager = createSampleManager("heyApp", "123456", TestValues.GENERAL_LOCKSCREENCONFIG);
}
// SETUP / HELPERS
@@ -110,7 +112,12 @@ public class SdlManagerTests extends AndroidTestCase2 {
}
@Override
- public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language) {
+ return null;
+ }
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
return null;
}
};
@@ -123,63 +130,73 @@ public class SdlManagerTests extends AndroidTestCase2 {
builder.setLanguage(Language.EN_US);
builder.setDayColorScheme(templateColorScheme);
builder.setNightColorScheme(templateColorScheme);
- builder.setVrSynonyms(Test.GENERAL_VECTOR_STRING);
- builder.setTtsName(Test.GENERAL_VECTOR_TTS_CHUNKS);
+ builder.setVrSynonyms(TestValues.GENERAL_VECTOR_STRING);
+ builder.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
builder.setLockScreenConfig(lockScreenConfig);
- builder.setMinimumProtocolVersion(Test.GENERAL_VERSION);
- builder.setMinimumRPCVersion(Test.GENERAL_VERSION);
+ builder.setMinimumProtocolVersion(TestValues.GENERAL_VERSION);
+ builder.setMinimumRPCVersion(TestValues.GENERAL_VERSION);
builder.setContext(mTestContext);
manager = builder.build();
- // mock SdlProxyBase and set it manually
- sdlProxyBase = mock(SdlProxyBase.class);
- manager.setProxy(sdlProxyBase);
+ // mock internalInterface and set it manually
+ internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
+ manager._internalInterface = internalInterface;
return manager;
}
// TESTS
+ @Test
public void testNotNull(){
- assertNotNull(createSampleManager("app","123456", Test.GENERAL_LOCKSCREENCONFIG));
+ assertNotNull(createSampleManager("app","123456", TestValues.GENERAL_LOCKSCREENCONFIG));
}
+ @Test
public void testMissingAppName() {
try {
- createSampleManager(null,"123456", Test.GENERAL_LOCKSCREENCONFIG);
+ createSampleManager(null,"123456", TestValues.GENERAL_LOCKSCREENCONFIG);
} catch (IllegalArgumentException ex) {
assertSame(ex.getMessage(), "You must specify an app name by calling setAppName");
}
}
+ @Test
public void testMissingAppId() {
try {
- createSampleManager("app",null, Test.GENERAL_LOCKSCREENCONFIG);
+ createSampleManager("app",null, TestValues.GENERAL_LOCKSCREENCONFIG);
} catch (IllegalArgumentException ex) {
assertSame(ex.getMessage(), "You must specify an app ID by calling setAppId");
}
}
+ @Test
public void testManagerSetters() {
assertEquals("123456", sdlManager.getAppId());
assertEquals("heyApp", sdlManager.getAppName());
assertEquals("heyApp", sdlManager.getShortAppName());
assertEquals(appType, sdlManager.getAppTypes());
assertEquals(Language.EN_US, sdlManager.getHmiLanguage());
+ assertEquals(Language.EN_US, sdlManager.getLanguage());
assertEquals(transport, sdlManager.getTransport());
assertEquals(templateColorScheme, sdlManager.getDayColorScheme());
assertEquals(templateColorScheme, sdlManager.getNightColorScheme());
- assertEquals(Test.GENERAL_VECTOR_STRING, sdlManager.getVrSynonyms());
- assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, sdlManager.getTtsChunks());
- assertEquals(Test.GENERAL_LOCKSCREENCONFIG, sdlManager.getLockScreenConfig());
- assertEquals(Test.GENERAL_VERSION, sdlManager.getMinimumProtocolVersion());
- assertEquals(Test.GENERAL_VERSION, sdlManager.getMinimumRPCVersion());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, sdlManager.getVrSynonyms());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, sdlManager.getTtsChunks());
+ assertEquals(TestValues.GENERAL_LOCKSCREENCONFIG, sdlManager.getLockScreenConfig());
+ assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumProtocolVersion());
+ assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumRPCVersion());
}
+ @Test
public void testStartingManager(){
listenerCalledCounter = 0;
-
- sdlManager.start();
+
+ try {
+ sdlManager.start();
+ } catch (Exception e) {
+ }
// Create and force all sub managers to be ready manually. Because SdlManager will not start until all sub managers are ready.
// Note: SdlManager.initialize() will not be called automatically by proxy as in real life because we have mock proxy not a real one
@@ -192,9 +209,10 @@ public class SdlManagerTests extends AndroidTestCase2 {
sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
// Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", listenerCalledCounter, 1);
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
}
+ @Test
public void testManagerStates() {
SdlManager sdlManager = createSampleManager("test", "00000", new LockScreenConfig());
sdlManager.initialize();
@@ -305,10 +323,11 @@ public class SdlManagerTests extends AndroidTestCase2 {
assertEquals(BaseSubManager.SHUTDOWN, sdlManager.getState());
}
+ @Test
public void testSendRPC(){
listenerCalledCounter = 0;
- // When sdlProxyBase.sendRPCRequest() is called, create a fake success response
+ // When internalInterface.sendRPC() is called, create a fake success response
Answer<Void> answer = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
@@ -320,11 +339,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
return null;
}
};
- try {
- doAnswer(answer).when(sdlProxyBase).sendRPC(any(RPCMessage.class));
- } catch (SdlException e) {
- e.printStackTrace();
- }
+ doAnswer(answer).when(internalInterface).sendRPC(any(RPCMessage.class));
// Test send RPC request
@@ -341,21 +356,23 @@ public class SdlManagerTests extends AndroidTestCase2 {
sdlManager.sendRPC(request);
// Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", listenerCalledCounter, 1);
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
}
+ @Test
public void testSendRPCs(){
testSendMultipleRPCs(false);
}
+ @Test
public void testSendSequentialRPCs(){
testSendMultipleRPCs(true);
}
- private void testSendMultipleRPCs(boolean sequentialSend){
+ private void testSendMultipleRPCs(boolean sequentialSend) {
listenerCalledCounter = 0;
- // When sdlProxyBase.sendRPCRequests() is called, call listener.onFinished() to fake the response
+ // When internalInterface.sendRPCs() is called, call listener.onFinished() to fake the response
final Answer<Void> answer = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
@@ -365,15 +382,12 @@ public class SdlManagerTests extends AndroidTestCase2 {
return null;
}
};
- try {
- if (sequentialSend){
- doAnswer(answer).when(sdlProxyBase).sendSequentialRequests(any(List.class), any(OnMultipleRequestListener.class));
- } else {
- doAnswer(answer).when(sdlProxyBase).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
- }
- } catch (SdlException e) {
- e.printStackTrace();
+ if (sequentialSend) {
+ doAnswer(answer).when(internalInterface).sendSequentialRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ } else {
+ doAnswer(answer).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
}
@@ -381,7 +395,8 @@ public class SdlManagerTests extends AndroidTestCase2 {
List<RPCMessage> rpcsList = Arrays.asList(new GetVehicleData(), new Show(), new OnAppServiceData(), new GetAppServiceDataResponse());
OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
@Override
- public void onUpdate(int remainingRequests) { }
+ public void onUpdate(int remainingRequests) {
+ }
@Override
public void onFinished() {
@@ -389,10 +404,12 @@ public class SdlManagerTests extends AndroidTestCase2 {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {}
+ public void onError(int correlationId, Result resultCode, String info) {
+ }
@Override
- public void onResponse(int correlationId, RPCResponse response) {}
+ public void onResponse(int correlationId, RPCResponse response) {
+ }
};
if (sequentialSend) {
sdlManager.sendSequentialRPCs(rpcsList, onMultipleRequestListener);
@@ -402,7 +419,6 @@ public class SdlManagerTests extends AndroidTestCase2 {
// Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", listenerCalledCounter, 1);
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
}
-
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
index 3e6d160d5..89abc76cc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
@@ -2,8 +2,8 @@ package com.smartdevicelink.managers.file;
import android.content.Context;
import android.net.Uri;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
@@ -21,8 +21,11 @@ import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -30,6 +33,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -40,28 +48,23 @@ import static org.mockito.Mockito.verify;
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link FileManager}
*/
-public class FileManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class FileManagerTests {
public static final String TAG = "FileManagerTests";
private Context mTestContext;
private SdlFile validFile;
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
- mTestContext = this.getContext();
+ mTestContext = getTargetContext();
validFile = new SdlFile();
- validFile.setName(Test.GENERAL_STRING);
- validFile.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile.setName(TestValues.GENERAL_STRING);
+ validFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile.setPersistent(false);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
private Answer<Void> onPutFileFailureOnError = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -127,8 +130,8 @@ public class FileManagerTests extends AndroidTestCase2 {
if(message instanceof ListFiles){
int correlationId = message.getCorrelationID();
ListFilesResponse listFilesResponse = new ListFilesResponse();
- listFilesResponse.setFilenames(Test.GENERAL_STRING_LIST);
- listFilesResponse.setSpaceAvailable(Test.GENERAL_INT);
+ listFilesResponse.setFilenames(TestValues.GENERAL_STRING_LIST);
+ listFilesResponse.setSpaceAvailable(TestValues.GENERAL_INT);
listFilesResponse.setSuccess(true);
message.getOnRPCResponseListener().onResponse(correlationId, listFilesResponse);
}
@@ -145,7 +148,7 @@ public class FileManagerTests extends AndroidTestCase2 {
int correlationId = message.getCorrelationID();
PutFileResponse putFileResponse = new PutFileResponse();
putFileResponse.setSuccess(true);
- putFileResponse.setSpaceAvailable(Test.GENERAL_INT);
+ putFileResponse.setSpaceAvailable(TestValues.GENERAL_INT);
message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
}
return null;
@@ -242,6 +245,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test deleting list of files, success
*/
+ @Test
public void testDeleteRemoteFilesWithNamesSuccess(){
final ISdl internalInterface = mock(ISdl.class);
@@ -273,6 +277,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test deleting list of files, fail
*/
+ @Test
public void testDeleteRemoteFilesWithNamesFail(){
final ISdl internalInterface = mock(ISdl.class);
@@ -304,6 +309,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test reUploading failed file
*/
+ @Test
public void testFileUploadRetry(){
final ISdl internalInterface = mock(ISdl.class);
@@ -335,6 +341,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test reUploading failed Artwork
*/
+ @Test
public void testArtworkUploadRetry(){
final ISdl internalInterface = mock(ISdl.class);
@@ -342,14 +349,14 @@ public class FileManagerTests extends AndroidTestCase2 {
doAnswer(onPutFileFailureOnError).when(internalInterface).sendRPC(any(PutFile.class));
final SdlFile validFile2 = new SdlFile();
- validFile2.setName(Test.GENERAL_STRING + "2");
- validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile2.setPersistent(false);
validFile2.setType(FileType.GRAPHIC_PNG);
final SdlFile validFile3 = new SdlFile();
- validFile3.setName(Test.GENERAL_STRING + "3");
- validFile3.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile3.setName(TestValues.GENERAL_STRING + "3");
+ validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile3.setPersistent(false);
validFile3.setType(FileType.GRAPHIC_BMP);
@@ -393,6 +400,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test retry uploading failed list of files
*/
+ @Test
public void testListFilesUploadRetry(){
final ISdl internalInterface = mock(ISdl.class);
@@ -400,8 +408,8 @@ public class FileManagerTests extends AndroidTestCase2 {
doAnswer(onSendRequestsFailOnError).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
SdlFile validFile2 = new SdlFile();
- validFile2.setName(Test.GENERAL_STRING + "2");
- validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile2.setPersistent(false);
validFile2.setType(FileType.GRAPHIC_JPEG);
@@ -434,6 +442,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing the initialization of FileManager
*/
+ @Test
public void testInitializationSuccess() {
ISdl internalInterface = mock(ISdl.class);
@@ -446,8 +455,8 @@ public class FileManagerTests extends AndroidTestCase2 {
public void onComplete(boolean success) {
assertTrue(success);
assertEquals(fileManager.getState(), BaseSubManager.READY);
- assertEquals(fileManager.getRemoteFileNames(), Test.GENERAL_STRING_LIST);
- assertEquals(Test.GENERAL_INT, fileManager.getBytesAvailable());
+ assertEquals(fileManager.getRemoteFileNames(), TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
}
});
}
@@ -455,6 +464,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test file upload, success
*/
+ @Test
public void testFileUploadSuccess() {
ISdl internalInterface = mock(ISdl.class);
@@ -478,12 +488,13 @@ public class FileManagerTests extends AndroidTestCase2 {
});
assertTrue(fileManager.getRemoteFileNames().contains(validFile.getName()));
assertTrue(fileManager.hasUploadedFile(validFile));
- assertEquals(Test.GENERAL_INT, fileManager.getBytesAvailable());
+ assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
}
/**
* Testing failed file upload.
*/
+ @Test
public void testFileUploadFailure() {
ISdl internalInterface = mock(ISdl.class);
@@ -511,6 +522,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploadFile for a staticIcon, verifying that it doesn't actually upload.
*/
+ @Test
public void testFileUploadForStaticIcon() {
ISdl internalInterface = mock(ISdl.class);
@@ -537,6 +549,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploadFiles for staticIcons, verifying that it doesn't actually upload.
*/
+ @Test
public void testMultipleFileUploadsForStaticIcon() {
ISdl internalInterface = mock(ISdl.class);
@@ -568,6 +581,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploadFiles for static icons and nonStatic icons in the same list.
*/
+ @Test
public void testMultipleFileUploadsForPartialStaticIcon() {
ISdl internalInterface = mock(ISdl.class);
@@ -600,6 +614,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test to make sure you cannot upload an SdlFile with invalid data
*/
+ @Test
public void testInvalidSdlFileInput() {
ISdl internalInterface = mock(ISdl.class);
@@ -613,22 +628,22 @@ public class FileManagerTests extends AndroidTestCase2 {
assertTrue(success);
SdlFile sdlFile = new SdlFile();
// Don't set name
- sdlFile.setFileData(Test.GENERAL_BYTE_ARRAY);
+ sdlFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
checkForUploadFailure(fileManager, sdlFile);
sdlFile = new SdlFile();
- sdlFile.setName(Test.GENERAL_STRING);
+ sdlFile.setName(TestValues.GENERAL_STRING);
// Don't set data
checkForUploadFailure(fileManager, sdlFile);
sdlFile = new SdlFile();
- sdlFile.setName(Test.GENERAL_STRING);
+ sdlFile.setName(TestValues.GENERAL_STRING);
// Give an invalid resource ID
- sdlFile.setResourceId(Test.GENERAL_INT);
+ sdlFile.setResourceId(TestValues.GENERAL_INT);
checkForUploadFailure(fileManager, sdlFile);
sdlFile = new SdlFile();
- sdlFile.setName(Test.GENERAL_STRING);
+ sdlFile.setName(TestValues.GENERAL_STRING);
// Set invalid Uri
Uri testUri = Uri.parse("http://www.google.com");
sdlFile.setUri(testUri);
@@ -662,6 +677,7 @@ public class FileManagerTests extends AndroidTestCase2 {
* Test Invalid SdlArtWork FileTypes
* SdlArtwork FileTypes can only be: GRAPHIC_BMP, GRAPHIC_PNG or GRAPHIC_JPEG
*/
+ @Test
public void testInvalidSdlArtworkInput(){
SdlArtwork sdlArtwork = new SdlArtwork();
// Set invalid type
@@ -683,6 +699,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test Multiple File Uploads, success
*/
+ @Test
public void testMultipleFileUpload() {
ISdl internalInterface = mock(ISdl.class);
@@ -700,8 +717,8 @@ public class FileManagerTests extends AndroidTestCase2 {
filesToUpload.add(validFile);
SdlFile validFile2 = new SdlFile();
- validFile2.setName(Test.GENERAL_STRING + "2");
- validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile2.setPersistent(false);
validFile2.setType(FileType.GRAPHIC_JPEG);
filesToUpload.add(validFile2);
@@ -719,6 +736,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploading multiple files with some failing.
*/
+ @Test
public void testMultipleFileUploadPartialFailure() {
ISdl internalInterface = mock(ISdl.class);
@@ -726,14 +744,14 @@ public class FileManagerTests extends AndroidTestCase2 {
doAnswer(onSendRequestsFailPartialOnError).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
SdlFile validFile2 = new SdlFile();
- validFile2.setName(Test.GENERAL_STRING + "2");
- validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile2.setPersistent(false);
validFile2.setType(FileType.GRAPHIC_JPEG);
SdlFile validFile3 = new SdlFile();
- validFile3.setName(Test.GENERAL_STRING + "3");
- validFile3.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile3.setName(TestValues.GENERAL_STRING + "3");
+ validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile3.setPersistent(false);
validFile3.setType(FileType.GRAPHIC_JPEG);
@@ -767,6 +785,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploading multiple SdlArtwork files.
*/
+ @Test
public void testMultipleArtworkUploadSuccess(){
ISdl internalInterface = mock(ISdl.class);
@@ -813,13 +832,14 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Testing uploading persistent SdlFile
*/
+ @Test
public void testPersistentFileUploaded(){
ISdl internalInterface = mock(ISdl.class);
doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
final SdlFile file = new SdlFile();
- file.setName(Test.GENERAL_STRING_LIST.get(0));
+ file.setName(TestValues.GENERAL_STRING_LIST.get(0));
file.setPersistent(true);
FileManagerConfig fileManagerConfig = new FileManagerConfig();
@@ -835,6 +855,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test FileManagerConfig
*/
+ @Test
public void testFileManagerConfig() {
FileManagerConfig fileManagerConfig = new FileManagerConfig();
fileManagerConfig.setFileRetryCount(2);
@@ -847,6 +868,7 @@ public class FileManagerTests extends AndroidTestCase2 {
* Tests overwrite property for uploading a file.
* Checks to make sure file does not overwrite itself if overwrite property is set to false
*/
+ @Test
public void testOverwriteFileProperty() {
ISdl internalInterface = mock(ISdl.class);
@@ -883,6 +905,7 @@ public class FileManagerTests extends AndroidTestCase2 {
* Tests overwrite property for uploading a list of files.
* Checks to make sure files do not overwrite themselves if overwrite property is set to false.
*/
+ @Test
public void testOverWriteFilePropertyListFiles() {
final ISdl internalInterface = mock(ISdl.class);
@@ -890,8 +913,8 @@ public class FileManagerTests extends AndroidTestCase2 {
doAnswer(onListFileUploadSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
final SdlFile validFile2 = new SdlFile();
- validFile2.setName(Test.GENERAL_STRING + "2");
- validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
validFile2.setPersistent(false);
validFile2.setType(FileType.GRAPHIC_JPEG);
@@ -929,6 +952,7 @@ public class FileManagerTests extends AndroidTestCase2 {
/**
* Test custom overridden SdlFile equals method
*/
+ @Test
public void testSdlFileEquals() {
// Case 1: object is null, assertFalse
SdlFile artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
@@ -967,7 +991,7 @@ public class FileManagerTests extends AndroidTestCase2 {
artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
byte[] GENERAL_BYTE_ARRAY2 = new byte[2];
- artwork1.setFileData(Test.GENERAL_BYTE_ARRAY);
+ artwork1.setFileData(TestValues.GENERAL_BYTE_ARRAY);
artwork2.setFileData(GENERAL_BYTE_ARRAY2);
assertFalse(artwork1.equals(artwork2));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
index 395b06e27..5b179e8ef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
@@ -1,14 +1,25 @@
package com.smartdevicelink.managers.file;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNotSame;
+import static junit.framework.TestCase.assertTrue;
-public class SdlArtworkTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlArtworkTests {
+ @Test
public void testClone(){
- SdlArtwork original = Test.GENERAL_ARTWORK;
+ SdlArtwork original = TestValues.GENERAL_ARTWORK;
SdlArtwork clone = original.clone();
equalTest(original, clone);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlFileTests.java
index 7dd13ec7c..bdb47aec1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlFileTests.java
@@ -32,105 +32,116 @@
package com.smartdevicelink.managers.file.filetypes;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class SdlFileTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class SdlFileTests {
+
+ @Test
public void testConstructorWithNoParams() {
SdlFile sdlFile;
// Case 1 (Setting data)
sdlFile = new SdlFile();
- sdlFile.setFileData(Test.GENERAL_BYTE_ARRAY);
- assertEquals(sdlFile.getFileData(), Test.GENERAL_BYTE_ARRAY);
+ sdlFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ assertEquals(sdlFile.getFileData(), TestValues.GENERAL_BYTE_ARRAY);
sdlFile.setName(null);
assertEquals(sdlFile.getName(), "e9800998ecf8427e");
- sdlFile.setName(Test.GENERAL_STRING);
- assertEquals(sdlFile.getName(), Test.GENERAL_STRING);
- sdlFile.setType(Test.GENERAL_FILETYPE);
- assertEquals(sdlFile.getType(), Test.GENERAL_FILETYPE);
- sdlFile.setPersistent(Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile.isPersistent(), Test.GENERAL_BOOLEAN);
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ assertEquals(sdlFile.getName(), TestValues.GENERAL_STRING);
+ sdlFile.setType(TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile.getType(), TestValues.GENERAL_FILETYPE);
+ sdlFile.setPersistent(TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile.isPersistent(), TestValues.GENERAL_BOOLEAN);
// Case 2 (Setting resourceId)
sdlFile = new SdlFile();
- sdlFile.setResourceId(Test.GENERAL_INTEGER);
- assertEquals((Integer) sdlFile.getResourceId(), Test.GENERAL_INTEGER);
+ sdlFile.setResourceId(TestValues.GENERAL_INTEGER);
+ assertEquals((Integer) sdlFile.getResourceId(), TestValues.GENERAL_INTEGER);
sdlFile.setName(null);
assertEquals(sdlFile.getName(), "ec9ebc78777cf40d");
- sdlFile.setName(Test.GENERAL_STRING);
- assertEquals(sdlFile.getName(), Test.GENERAL_STRING);
- sdlFile.setType(Test.GENERAL_FILETYPE);
- assertEquals(sdlFile.getType(), Test.GENERAL_FILETYPE);
- sdlFile.setPersistent(Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile.isPersistent(), Test.GENERAL_BOOLEAN);
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ assertEquals(sdlFile.getName(), TestValues.GENERAL_STRING);
+ sdlFile.setType(TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile.getType(), TestValues.GENERAL_FILETYPE);
+ sdlFile.setPersistent(TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile.isPersistent(), TestValues.GENERAL_BOOLEAN);
// Case 3 (Setting URI)
sdlFile = new SdlFile();
- sdlFile.setUri(Test.GENERAL_URI);
- assertEquals(sdlFile.getUri(), Test.GENERAL_URI);
+ sdlFile.setUri(TestValues.GENERAL_URI);
+ assertEquals(sdlFile.getUri(), TestValues.GENERAL_URI);
sdlFile.setName(null);
assertEquals(sdlFile.getName(), "d3467db131372140");
- sdlFile.setName(Test.GENERAL_STRING);
- assertEquals(sdlFile.getName(), Test.GENERAL_STRING);
- sdlFile.setType(Test.GENERAL_FILETYPE);
- assertEquals(sdlFile.getType(), Test.GENERAL_FILETYPE);
- sdlFile.setPersistent(Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile.isPersistent(), Test.GENERAL_BOOLEAN);
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ assertEquals(sdlFile.getName(), TestValues.GENERAL_STRING);
+ sdlFile.setType(TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile.getType(), TestValues.GENERAL_FILETYPE);
+ sdlFile.setPersistent(TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile.isPersistent(), TestValues.GENERAL_BOOLEAN);
}
+ @Test
public void testConstructorWithResourceId() {
// Case1 (Set the name manually)
- SdlFile sdlFile1 = new SdlFile(Test.GENERAL_STRING, Test.GENERAL_FILETYPE, Test.GENERAL_INTEGER, Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile1.getName(), Test.GENERAL_STRING);
- assertEquals(sdlFile1.getType(), Test.GENERAL_FILETYPE);
- assertEquals((Integer) sdlFile1.getResourceId(), Test.GENERAL_INTEGER);
- assertEquals(sdlFile1.isPersistent(), Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile1 = new SdlFile(TestValues.GENERAL_STRING, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_INTEGER, TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile1.getName(), TestValues.GENERAL_STRING);
+ assertEquals(sdlFile1.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals((Integer) sdlFile1.getResourceId(), TestValues.GENERAL_INTEGER);
+ assertEquals(sdlFile1.isPersistent(), TestValues.GENERAL_BOOLEAN);
// Case2 (Let the library generate a name)
- SdlFile sdlFile2 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_INTEGER, Test.GENERAL_BOOLEAN);
- SdlFile sdlFile3 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_INTEGER, Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile2 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_INTEGER, TestValues.GENERAL_BOOLEAN);
+ SdlFile sdlFile3 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_INTEGER, TestValues.GENERAL_BOOLEAN);
assertEquals(sdlFile2.getName(), sdlFile3.getName());
assertEquals(sdlFile2.getName(), "ec9ebc78777cf40d");
- assertEquals(sdlFile2.getType(), Test.GENERAL_FILETYPE);
- assertEquals((Integer) sdlFile2.getResourceId(), Test.GENERAL_INTEGER);
- assertEquals(sdlFile2.isPersistent(), Test.GENERAL_BOOLEAN);
+ assertEquals(sdlFile2.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals((Integer) sdlFile2.getResourceId(), TestValues.GENERAL_INTEGER);
+ assertEquals(sdlFile2.isPersistent(), TestValues.GENERAL_BOOLEAN);
}
+ @Test
public void testConstructorWithData() {
// Case1 (Set the name manually)
- SdlFile sdlFile1 = new SdlFile(Test.GENERAL_STRING, Test.GENERAL_FILETYPE, Test.GENERAL_BYTE_ARRAY, Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile1.getName(), Test.GENERAL_STRING);
- assertEquals(sdlFile1.getType(), Test.GENERAL_FILETYPE);
- assertEquals(sdlFile1.getFileData(), Test.GENERAL_BYTE_ARRAY);
- assertEquals(sdlFile1.isPersistent(), Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile1 = new SdlFile(TestValues.GENERAL_STRING, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_BYTE_ARRAY, TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile1.getName(), TestValues.GENERAL_STRING);
+ assertEquals(sdlFile1.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile1.getFileData(), TestValues.GENERAL_BYTE_ARRAY);
+ assertEquals(sdlFile1.isPersistent(), TestValues.GENERAL_BOOLEAN);
// Case2 (Let the library generate a name)
- SdlFile sdlFile2 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_BYTE_ARRAY, Test.GENERAL_BOOLEAN);
- SdlFile sdlFile3 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_BYTE_ARRAY, Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile2 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_BYTE_ARRAY, TestValues.GENERAL_BOOLEAN);
+ SdlFile sdlFile3 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_BYTE_ARRAY, TestValues.GENERAL_BOOLEAN);
assertEquals(sdlFile2.getName(), sdlFile3.getName());
assertEquals(sdlFile2.getName(), "e9800998ecf8427e");
- assertEquals(sdlFile2.getType(), Test.GENERAL_FILETYPE);
- assertEquals(sdlFile2.getFileData(), Test.GENERAL_BYTE_ARRAY);
- assertEquals(sdlFile2.isPersistent(), Test.GENERAL_BOOLEAN);
+ assertEquals(sdlFile2.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile2.getFileData(), TestValues.GENERAL_BYTE_ARRAY);
+ assertEquals(sdlFile2.isPersistent(), TestValues.GENERAL_BOOLEAN);
}
+ @Test
public void testConstructorWithUri() {
// Case1 (Set the name manually)
- SdlFile sdlFile1 = new SdlFile(Test.GENERAL_STRING, Test.GENERAL_FILETYPE, Test.GENERAL_URI, Test.GENERAL_BOOLEAN);
- assertEquals(sdlFile1.getName(), Test.GENERAL_STRING);
- assertEquals(sdlFile1.getType(), Test.GENERAL_FILETYPE);
- assertEquals(sdlFile1.getUri(), Test.GENERAL_URI);
- assertEquals(sdlFile1.isPersistent(), Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile1 = new SdlFile(TestValues.GENERAL_STRING, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_URI, TestValues.GENERAL_BOOLEAN);
+ assertEquals(sdlFile1.getName(), TestValues.GENERAL_STRING);
+ assertEquals(sdlFile1.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile1.getUri(), TestValues.GENERAL_URI);
+ assertEquals(sdlFile1.isPersistent(), TestValues.GENERAL_BOOLEAN);
// Case2 (Let the library generate a name)
- SdlFile sdlFile2 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_URI, Test.GENERAL_BOOLEAN);
- SdlFile sdlFile3 = new SdlFile(null, Test.GENERAL_FILETYPE, Test.GENERAL_URI, Test.GENERAL_BOOLEAN);
+ SdlFile sdlFile2 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_URI, TestValues.GENERAL_BOOLEAN);
+ SdlFile sdlFile3 = new SdlFile(null, TestValues.GENERAL_FILETYPE, TestValues.GENERAL_URI, TestValues.GENERAL_BOOLEAN);
assertEquals(sdlFile2.getName(), sdlFile3.getName());
assertEquals(sdlFile2.getName(), "d3467db131372140");
- assertEquals(sdlFile2.getType(), Test.GENERAL_FILETYPE);
- assertEquals(sdlFile2.getUri(), Test.GENERAL_URI);
- assertEquals(sdlFile2.isPersistent(), Test.GENERAL_BOOLEAN);
+ assertEquals(sdlFile2.getType(), TestValues.GENERAL_FILETYPE);
+ assertEquals(sdlFile2.getUri(), TestValues.GENERAL_URI);
+ assertEquals(sdlFile2.isPersistent(), TestValues.GENERAL_BOOLEAN);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
index 6ed606648..61edcf87d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
@@ -35,44 +35,43 @@
package com.smartdevicelink.managers.lifecycle;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class LifecycleConfigurationUpdateTest extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class LifecycleConfigurationUpdateTest {
+ @Test
public void testIndividualSettersAndGetters(){
LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate();
- lifecycleConfigurationUpdate.setAppName(Test.GENERAL_STRING);
- lifecycleConfigurationUpdate.setShortAppName(Test.GENERAL_STRING);
- lifecycleConfigurationUpdate.setTtsName(Test.GENERAL_VECTOR_TTS_CHUNKS);
- lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(Test.GENERAL_VECTOR_STRING);
+ lifecycleConfigurationUpdate.setAppName(TestValues.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setShortAppName(TestValues.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
+ lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(TestValues.GENERAL_VECTOR_STRING);
- assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
- assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
- assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
- assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
}
+ @Test
public void testHelperConstructor(){
- LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VECTOR_TTS_CHUNKS, Test.GENERAL_VECTOR_STRING);
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_VECTOR_TTS_CHUNKS, TestValues.GENERAL_VECTOR_STRING);
- assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
- assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
- assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
- assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
}
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 34b3f71aa..1031fc652 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
@@ -1,6 +1,7 @@
package com.smartdevicelink.managers.lifecycle;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -9,9 +10,16 @@ import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.util.Version;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.lang.reflect.InvocationTargetException;
-public class RpcConverterTest extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+
+@RunWith(AndroidJUnit4.class)
+public class RpcConverterTest {
private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
private static final String RESPONSE_KEY = "Response";
@@ -21,6 +29,7 @@ public class RpcConverterTest extends AndroidTestCase2 {
* The RPC converter relies on the function id json name to match the class name exactly.
* Therefore we will test to ensure that they match up first.
*/
+ @Test
public void testFunctionIdsAgainstFileNames(){
FunctionID[] functionIDs = FunctionID.values();
for(FunctionID functionID : functionIDs) {
@@ -87,6 +96,7 @@ public class RpcConverterTest extends AndroidTestCase2 {
return null;
}
+ @Test
public void testRpcCreation(){
FunctionID[] functionIDs = FunctionID.values();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
index 0bf3dd5ae..1c6eb9d34 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
@@ -1,7 +1,15 @@
package com.smartdevicelink.managers.lockscreen;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
@@ -9,35 +17,30 @@ import com.smartdevicelink.test.Test;
*
* We currently do not need to test null values, as each currently is a primitive
*/
-public class LockScreenConfigTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenConfigTests {
private LockScreenConfig lockScreenConfig;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
-
// set info for all the setters
lockScreenConfig = new LockScreenConfig();
- lockScreenConfig.setCustomView(Test.GENERAL_INT);
- lockScreenConfig.setAppIcon(Test.GENERAL_INT);
- lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
+ lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
+ lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
+ lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testLockScreenConfig() {
// get the info and make sure its correct
- assertEquals(Test.GENERAL_INT, lockScreenConfig.getCustomView());
- assertEquals(Test.GENERAL_INT, lockScreenConfig.getAppIcon());
- assertEquals(Test.GENERAL_INT, lockScreenConfig.getBackgroundColor());
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getCustomView());
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getAppIcon());
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getBackgroundColor());
assertTrue(lockScreenConfig.isEnabled());
assertTrue(lockScreenConfig.isDeviceLogoEnabled());
assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenConfig.getDisplayMode());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
index 796f900d3..290515d54 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
@@ -3,21 +3,13 @@ package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.util.AndroidTools;
-
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
@@ -25,7 +17,8 @@ import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenDeviceIconManagerTests {
TemporaryFolder tempFolder = new TemporaryFolder();
private LockScreenDeviceIconManager lockScreenDeviceIconManager;
@@ -33,14 +26,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
private static final String LAST_UPDATED_TIME = "lastUpdatedTime";
private static final String STORED_PATH = "storedPath";
- public void setup() throws Exception {
- super.setUp();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testRetrieveIconShouldCallOnErrorTwiceWhenGivenURLThatCannotDownloadAndIconIsNotCached() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -54,6 +40,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(2)).onError(anyString());
}
+ @Test
public void testRetrieveIconShouldCallOnImageOnImageRetrievedWithIconWhenIconUpdateTimeIsNullFromSharedPref() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -67,7 +54,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(1)).onImageRetrieved((Bitmap) any());
}
-
+ @Test
public void testRetrieveIconShouldCallOnImageOnImageRetrievedWithIconWhenCachedIconExpired() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
@@ -81,6 +68,7 @@ public class LockScreenDeviceIconManagerTests extends AndroidTestCase2 {
verify(listener, times(1)).onImageRetrieved((Bitmap) any());
}
+ @Test
public void testRetrieveIconShouldCallOnImageRetrievedWithIconWhenCachedIconIsUpToDate() {
final SharedPreferences sharedPrefs = Mockito.mock(SharedPreferences.class);
final Context context = Mockito.mock(Context.class);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
index 1d294e100..e6e86261b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
@@ -10,11 +10,19 @@ import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -24,14 +32,14 @@ import static org.mockito.Mockito.mock;
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenManager}
*/
-public class LockScreenManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class LockScreenManagerTests {
private LockScreenManager lockScreenManager;
private OnRPCNotificationListener onDDListener;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
@@ -48,9 +56,9 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
Context context = getContext();
// create config
LockScreenConfig lockScreenConfig = new LockScreenConfig();
- lockScreenConfig.setCustomView(Test.GENERAL_INT);
- lockScreenConfig.setAppIcon(Test.GENERAL_INT);
- lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
+ lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
+ lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
+ lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
@@ -58,63 +66,67 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testVariables() {
- assertEquals(Test.GENERAL_INT, lockScreenManager.customView);
- assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenIcon);
- assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenColor);
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.customView);
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenIcon);
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenColor);
assertTrue(lockScreenManager.deviceLogoEnabled);
assertTrue(lockScreenManager.lockScreenEnabled);
assertNull(lockScreenManager.deviceLogo);
assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
}
+ @Test
public void testGetLockScreenStatusHmiNoneDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiBackgroundDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiNoneDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiFullDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiFullDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiLimitedDDOff(){
lockScreenManager.driverDistStatus = false;
lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testGetLockScreenStatusHmiLimitedDDOn(){
lockScreenManager.driverDistStatus = true;
lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
}
+ @Test
public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue(){
lockScreenManager.enableDismissGesture = true;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -125,6 +137,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertTrue(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse(){
lockScreenManager.enableDismissGesture = false;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -135,6 +148,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertFalse(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse(){
lockScreenManager.enableDismissGesture = true;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
@@ -145,6 +159,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertFalse(lockScreenManager.mIsLockscreenDismissible);
}
+ @Test
public void testLockScreenDismissibleWithEnableFalseAndDismissibilityTrue(){
lockScreenManager.enableDismissGesture = false;
OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
index deb5061dc..81354dd2c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.managers.permission;
import android.support.annotation.NonNull;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
@@ -13,6 +13,9 @@ import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -22,25 +25,26 @@ import java.util.List;
import java.util.Map;
import static com.smartdevicelink.managers.permission.BasePermissionManager.PERMISSION_GROUP_STATUS_DISALLOWED;
-import static com.smartdevicelink.managers.permission.BasePermissionManager.PERMISSION_GROUP_STATUS_UNKNOWN;
import static com.smartdevicelink.managers.permission.PermissionManager.PERMISSION_GROUP_STATUS_ALLOWED;
import static com.smartdevicelink.managers.permission.PermissionManager.PERMISSION_GROUP_STATUS_MIXED;
+import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
-public class PermissionManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PermissionManagerTests {
private OnRPCNotificationListener onHMIStatusListener, onPermissionsChangeListener;
private PermissionManager permissionManager;
private int listenerCalledCounter;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
// Mock Isdl and its behaviour to use it for PermissionManager testing
@@ -98,6 +102,7 @@ public class PermissionManagerTests extends AndroidTestCase2 {
}
// Test adding a listener to be called when ALL of the specified permissions become allowed
+ @Test
public void testListenersAllAllowed() {
listenerCalledCounter = 0;
@@ -149,6 +154,7 @@ public class PermissionManagerTests extends AndroidTestCase2 {
// Test adding a listener to be called when ANY of the specified permissions become allowed
+ @Test
public void testListenersAnyAllowed() {
listenerCalledCounter = 0;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
index 34cebfc08..a91a68b3e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
@@ -1,6 +1,8 @@
package com.smartdevicelink.managers.screen;
-import com.smartdevicelink.AndroidTestCase2;
+import com.livio.taskmaster.Taskmaster;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
@@ -9,37 +11,44 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.List;
+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 org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link ScreenManager}
*/
-public class ScreenManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ScreenManagerTests {
private ScreenManager screenManager;
private SdlArtwork testArtwork;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
+
ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
FileManager fileManager = mock(FileManager.class);
screenManager = new ScreenManager(internalInterface, fileManager);
screenManager.start(null);
testArtwork = new SdlArtwork("testFile", FileType.GRAPHIC_PNG, 1, false);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testInstantiation(){
assertNull(screenManager.getTextField1());
assertNull(screenManager.getTextField2());
@@ -63,7 +72,8 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getState(), BaseSubManager.READY);
assertNull(screenManager.getMenuConfiguration());
}
-
+
+ @Test
public void testSetTextField() {
screenManager.setTextField1("It is");
screenManager.setTextField2("Wednesday");
@@ -77,39 +87,46 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getTitle(), "title");
}
+ @Test
public void testMediaTrackTextFields() {
String songTitle = "Wild For The Night";
screenManager.setMediaTrackTextField(songTitle);
assertEquals(screenManager.getMediaTrackTextField(), songTitle);
}
+ @Test
public void testSetPrimaryGraphic() {
screenManager.setPrimaryGraphic(testArtwork);
assertEquals(screenManager.getPrimaryGraphic(), testArtwork);
}
+ @Test
public void testSetPrimaryGraphicWithBlankImage() {
screenManager.setPrimaryGraphic(null);
assertNotNull(screenManager.getPrimaryGraphic());
assertEquals(screenManager.getPrimaryGraphic().getName(), "blankArtwork");
}
+ @Test
public void testSetSecondaryGraphic() {
screenManager.setSecondaryGraphic(testArtwork);
assertEquals(screenManager.getSecondaryGraphic(), testArtwork);
}
+ @Test
public void testSetSecondaryGraphicWithBlankImage() {
screenManager.setSecondaryGraphic(null);
assertNotNull(screenManager.getSecondaryGraphic());
assertEquals(screenManager.getSecondaryGraphic().getName(), "blankArtwork");
}
+ @Test
public void testAlignment() {
screenManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
assertEquals(screenManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
}
+ @Test
public void testSetTextFieldTypes() {
screenManager.setTextField1Type(MetadataType.MEDIA_TITLE);
screenManager.setTextField2Type(MetadataType.MEDIA_ALBUM);
@@ -121,22 +138,25 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getTextField4Type(), MetadataType.MEDIA_GENRE);
}
+ @Test
public void testSetMenuManagerFields(){
screenManager.setDynamicMenuUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- screenManager.setMenu(Test.GENERAL_MENUCELL_LIST);
- screenManager.setMenuConfiguration(Test.GENERAL_MENU_CONFIGURATION);
+ screenManager.setMenu(TestValues.GENERAL_MENUCELL_LIST);
+ screenManager.setMenuConfiguration(TestValues.GENERAL_MENU_CONFIGURATION);
- assertEquals(screenManager.getMenu(), Test.GENERAL_MENUCELL_LIST);
+ assertEquals(screenManager.getMenu(), TestValues.GENERAL_MENUCELL_LIST);
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.FORCE_ON);
// Should not set because of improper RAI response and improper HMI states
assertNull(screenManager.getMenuConfiguration());
}
+ @Test
public void testSetVoiceCommands(){
- screenManager.setVoiceCommands(Test.GENERAL_VOICE_COMMAND_LIST);
- assertEquals(screenManager.getVoiceCommands(), Test.GENERAL_VOICE_COMMAND_LIST);
+ screenManager.setVoiceCommands(TestValues.GENERAL_VOICE_COMMAND_LIST);
+ assertEquals(screenManager.getVoiceCommands(), TestValues.GENERAL_VOICE_COMMAND_LIST);
}
+ @Test
public void testSetSoftButtonObjects(){
// Create softButtonObject1
SoftButtonState softButtonState1 = new SoftButtonState("object1-state1", "it is", testArtwork);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
index 93688f570..efea2bf1d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
@@ -1,29 +1,40 @@
package com.smartdevicelink.managers.screen;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.CompletionListener;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
+import com.smartdevicelink.proxy.rpc.enums.SystemAction;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.test.Validator;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -32,29 +43,34 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertNotEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link SoftButtonManager}
*/
-public class SoftButtonManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SoftButtonManagerTests {
private SoftButtonManager softButtonManager;
- private boolean fileManagerUploadArtworksGotCalled;
- private boolean internalInterfaceSendRPCGotCalled;
- private boolean softButtonMangerUpdateCompleted;
+ private int fileManagerUploadArtworksListenerCalledCounter;
+ private int internalInterfaceSendRPCListenerCalledCounter;
private int softButtonObject1Id = 1000, softButtonObject2Id = 2000;
private SoftButtonObject softButtonObject1, softButtonObject2;
private SoftButtonState softButtonState1, softButtonState2, softButtonState3, softButtonState4;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
// When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
// inside SoftButtonManager, respond with a fake HMILevel.HMI_FULL response to let the SoftButtonManager continue working.
@@ -73,13 +89,35 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+ // When internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener) is called
+ // inside SoftButtonManager, respond with a fake response to let the SoftButtonManager continue working.
+ Answer<Void> onSystemCapabilityAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnSystemCapabilityListener onSystemCapabilityListener = (OnSystemCapabilityListener) args[1];
+ SoftButtonCapabilities softButtonCapabilities = new SoftButtonCapabilities();
+ softButtonCapabilities.setImageSupported(true);
+ softButtonCapabilities.setTextSupported(true);
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setSoftButtonCapabilities(Collections.singletonList(softButtonCapabilities));
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setWindowCapabilities(Collections.singletonList(windowCapability));
+ List<DisplayCapability> capabilities = Collections.singletonList(displayCapability);
+ onSystemCapabilityListener.onCapabilityRetrieved(capabilities);
+ return null;
+ }
+ };
+ doAnswer(onSystemCapabilityAnswer).when(internalInterface).addOnSystemCapabilityListener(eq(SystemCapabilityType.DISPLAYS), any(OnSystemCapabilityListener.class));
+
+
// When fileManager.uploadArtworks() is called inside the SoftButtonManager, respond with
// a fake onComplete() callback to let the SoftButtonManager continue working.
FileManager fileManager = mock(FileManager.class);
Answer<Void> onFileManagerUploadAnswer = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
- fileManagerUploadArtworksGotCalled = true;
+ fileManagerUploadArtworksListenerCalledCounter++;
Object[] args = invocation.getArguments();
MultipleFileCompletionListener multipleFileCompletionListener = (MultipleFileCompletionListener) args[1];
multipleFileCompletionListener.onComplete(null);
@@ -90,6 +128,9 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Create softButtonManager
+ Taskmaster taskmaster = new Taskmaster.Builder().build();
+ taskmaster.start();
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
softButtonManager = new SoftButtonManager(internalInterface, fileManager);
@@ -99,14 +140,14 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
Answer<Void> onSendShowRPCAnswer = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
- internalInterfaceSendRPCGotCalled = true;
+ internalInterfaceSendRPCListenerCalledCounter++;
Object[] args = invocation.getArguments();
Show show = (Show) args[0];
- show.getOnRPCResponseListener().onResponse(0, null);
+ show.getOnRPCResponseListener().onResponse(0, new ShowResponse(true, Result.SUCCESS));
assertEquals(show.getMainField1(), softButtonManager.getCurrentMainField1());
- assertEquals(show.getSoftButtons().size(), softButtonManager.createSoftButtonsForCurrentState().size());
+ assertEquals(show.getSoftButtons().size(), softButtonManager.getSoftButtonObjects().size());
return null;
}
@@ -125,22 +166,20 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
softButtonObject2.setButtonId(softButtonObject2Id);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
+
+ private void sleep() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
+ @Test
public void testSoftButtonManagerUpdate() {
// Reset the boolean variables
- fileManagerUploadArtworksGotCalled = false;
- internalInterfaceSendRPCGotCalled = false;
- softButtonMangerUpdateCompleted = false;
-
- SoftButtonCapabilities softCap = new SoftButtonCapabilities();
- softCap.setImageSupported(true);
- WindowCapability defaultCap = new WindowCapability();
- defaultCap.setSoftButtonCapabilities(Collections.singletonList(softCap));
- softButtonManager.defaultMainWindowCapability = defaultCap;
+ fileManagerUploadArtworksListenerCalledCounter = 0;
+ internalInterfaceSendRPCListenerCalledCounter = 0;
// Test batch update
@@ -148,12 +187,6 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
List<SoftButtonObject> softButtonObjects = Arrays.asList(softButtonObject1, softButtonObject2);
softButtonManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
softButtonManager.setBatchUpdates(false);
- softButtonManager.update(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- softButtonMangerUpdateCompleted = true;
- }
- });
// Test single update, setCurrentMainField1, and transitionToNextState
@@ -161,17 +194,20 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
softButtonObject1.transitionToNextState();
- // Check that everything got called as expected
+ // Sleep to give time to Taskmaster to run the operations
+ sleep();
- assertTrue("FileManager.uploadArtworks() did get called", fileManagerUploadArtworksGotCalled);
- assertTrue("InternalInterface.sendRPC() did not get called", internalInterfaceSendRPCGotCalled);
- assertTrue("SoftButtonManger update onComplete() did not get called", softButtonMangerUpdateCompleted);
+
+ // Check that everything got called as expected
+ assertEquals("FileManager.uploadArtworks() did not get called correctly", 1, fileManagerUploadArtworksListenerCalledCounter);
+ assertEquals("InternalInterface.sendRPC() did not get called correctly",2, internalInterfaceSendRPCListenerCalledCounter);
// Test getSoftButtonObjects
assertEquals("Returned softButtonObjects value doesn't match the expected value", softButtonObjects, softButtonManager.getSoftButtonObjects());
}
+ @Test
public void testSoftButtonManagerGetSoftButtonObject() {
softButtonManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
@@ -192,6 +228,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertNull("Returned SoftButtonObject doesn't match the expected value", softButtonManager.getSoftButtonObjectById(5555));
}
+ @Test
public void testSoftButtonState(){
// Test SoftButtonState.getName()
String nameExpectedValue = "object1-state1";
@@ -209,10 +246,12 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_BOTH, SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE);
softButtonExpectedValue.setText("o1s1");
softButtonExpectedValue.setImage(new Image(artworkExpectedValue.getName(), ImageType.DYNAMIC));
+ softButtonExpectedValue.setSystemAction(SystemAction.DEFAULT_ACTION);
SoftButton actual = softButtonState1.getSoftButton();
- assertTrue("Returned SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, softButtonState1.getSoftButton()));
+ assertTrue("Returned SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, actual));
}
+ @Test
public void testSoftButtonObject(){
// Test SoftButtonObject.getName()
assertEquals("Returned object name doesn't match the expected value", "object1", softButtonObject1.getName());
@@ -233,6 +272,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Test SoftButtonObject.getCurrentStateSoftButton()
SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_TEXT, softButtonObject2Id);
softButtonExpectedValue.setText("o2s1");
+ softButtonExpectedValue.setSystemAction(SystemAction.DEFAULT_ACTION);
assertTrue("Returned current state SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, softButtonObject2.getCurrentStateSoftButton()));
@@ -257,6 +297,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertEquals(softButtonState1, softButtonObject1.getCurrentState());
}
+ @Test
public void testAssigningIdsToSoftButtonObjects() {
SoftButtonObject sbo1, sbo2, sbo3, sbo4, sbo5;
@@ -312,6 +353,7 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
/**
* Test custom overridden softButtonObject equals method
*/
+ @Test
public void testSoftButtonObjectEquals() {
SoftButtonObject softButtonObject1;
SoftButtonObject softButtonObject2;
@@ -339,14 +381,14 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Case 1: object is null, assertFalse
softButtonObject1 = new SoftButtonObject("test", softButtonState1, null);
softButtonObject2 = null;
- assertFalse(softButtonObject1.equals(softButtonObject2));
+ assertNotEquals(softButtonObject1, softButtonObject2);
// Case 2 SoftButtonObjects are the same, assertTrue
- assertTrue(softButtonObject1.equals(softButtonObject1));
+ assertEquals(softButtonObject1, softButtonObject1);
// Case 3: object is not an instance of SoftButtonObject assertFalse
SdlArtwork artwork = new SdlArtwork("image1", FileType.GRAPHIC_PNG, 1, true);
- assertFalse(softButtonObject1.equals(artwork));
+ assertNotEquals(softButtonObject1, artwork);
// Case 4: SoftButtonObjectState List are not same size, assertFalse
List<SoftButtonState> softButtonStateList = new ArrayList<>();
@@ -356,53 +398,54 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
softButtonStateList2.add(softButtonState2);
softButtonObject1 = new SoftButtonObject("hi", softButtonStateList, "Hi", null);
softButtonObject2 = new SoftButtonObject("hi", softButtonStateList2, "Hi", null);
- assertFalse(softButtonObject1.equals(softButtonObject2));
+ assertNotEquals(softButtonObject1, softButtonObject2);
// Case 5: SoftButtonStates are not the same, assertFalse
softButtonObject1 = new SoftButtonObject("test", softButtonState1, null);
softButtonObject2 = new SoftButtonObject("test", softButtonState2, null);
- assertFalse(softButtonObject1.equals(softButtonObject2));
+ assertNotEquals(softButtonObject1, softButtonObject2);
// Case 6: SoftButtonObject names are not same, assertFalse
softButtonObject1 = new SoftButtonObject("test", softButtonState1, null);
softButtonObject2 = new SoftButtonObject("test23123", softButtonState1, null);
- assertFalse(softButtonObject1.equals(softButtonObject2));
+ assertNotEquals(softButtonObject1, softButtonObject2);
// Case 7: SoftButtonObject currentStateName not same, assertFalse
softButtonObject1 = new SoftButtonObject("hi", softButtonStateList, "Hi", null);
softButtonObject2 = new SoftButtonObject("hi", softButtonStateList, "Hi2", null);
- assertFalse(softButtonObject1.equals(softButtonObject2));
+ assertNotEquals(softButtonObject1, softButtonObject2);
}
/**
* Test custom overridden softButtonState equals method
*/
+ @Test
public void testSoftButtonStateEquals() {
- assertFalse(softButtonState1.equals(softButtonState2));
+ assertNotEquals(softButtonState1, softButtonState2);
SdlArtwork artwork1 = new SdlArtwork("image1", FileType.GRAPHIC_PNG, 1, true);
SdlArtwork artwork2 = new SdlArtwork("image2", FileType.GRAPHIC_PNG, 1, true);
// Case 1: object is null, assertFalse
softButtonState1 = new SoftButtonState("object1-state1", "o1s1", artwork1);
softButtonState2 = null;
- assertFalse(softButtonState1.equals(softButtonState2));
+ assertNotEquals(softButtonState1, softButtonState2);
// Case 2 SoftButtonObjects are the same, assertTrue
- assertTrue(softButtonState1.equals(softButtonState1));
+ assertEquals(softButtonState1, softButtonState1);
// Case 3: object is not an instance of SoftButtonState, assertFalse
- assertFalse(softButtonState1.equals(artwork1));
+ assertNotEquals(softButtonState1, artwork1);
// Case 4: different artwork, assertFalse
softButtonState2 = new SoftButtonState("object1-state1", "o1s1", artwork2);
- assertFalse(softButtonState1.equals(softButtonState2));
+ assertNotEquals(softButtonState1, softButtonState2);
// Case 5: different name, assertFalse
softButtonState2 = new SoftButtonState("object1-state1 different name", "o1s1", artwork1);
- assertFalse(softButtonState1.equals(softButtonState2));
+ assertNotEquals(softButtonState1, softButtonState2);
// Case 6 they are equal, assertTrue
softButtonState2 = new SoftButtonState("object1-state1", "o1s1", artwork1);
- assertTrue(softButtonState1.equals(softButtonState2));
+ assertEquals(softButtonState1, softButtonState2);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
new file mode 100644
index 000000000..b1da6b052
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
@@ -0,0 +1,172 @@
+package com.smartdevicelink.managers.screen;
+
+import android.support.test.runner.AndroidJUnit4;
+
+import com.smartdevicelink.managers.BaseSubManager;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
+import com.smartdevicelink.proxy.rpc.SubscribeButton;
+import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
+import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
+import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+
+@RunWith(AndroidJUnit4.class)
+public class SubscribeButtonManagerTest {
+ private SubscribeButtonManager subscribeButtonManager;
+ private ISdl internalInterface;
+
+ private Answer<Void> onSubscribe_UnsubscribeSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if(message instanceof SubscribeButton){
+ SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse();
+ subscribeButtonResponse.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(message.getCorrelationID(),subscribeButtonResponse);
+ }
+ if(message instanceof UnsubscribeButton) {
+ UnsubscribeButtonResponse unsubscribeButtonResponse = new UnsubscribeButtonResponse();
+ unsubscribeButtonResponse.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(message.getCorrelationID(), unsubscribeButtonResponse);
+ }
+ return null;
+ }
+ };
+
+
+ private Answer<Void> onSubscribeFail = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if(message instanceof SubscribeButton){
+ SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse();
+ subscribeButtonResponse.setSuccess(false);
+ message.getOnRPCResponseListener().onError(message.getCorrelationID(), Result.GENERIC_ERROR, "Fail");
+ }
+ return null;
+ }
+ };
+ private OnButtonListener listener = new OnButtonListener() {
+ @Override
+ public void onPress(ButtonName buttonName, OnButtonPress buttonPress) {
+
+ }
+
+ @Override
+ public void onEvent(ButtonName buttonName, OnButtonEvent buttonEvent) {
+
+ }
+
+ @Override
+ public void onError(String info) {
+
+ }
+ };
+
+ private OnButtonListener listener2 = new OnButtonListener() {
+ @Override
+ public void onPress(ButtonName buttonName, OnButtonPress buttonPress) {
+
+ }
+
+ @Override
+ public void onEvent(ButtonName buttonName, OnButtonEvent buttonEvent) {
+
+ }
+
+ @Override
+ public void onError(String info) {
+
+ }
+ };
+
+ @Before
+ public void setUp() throws Exception {
+ internalInterface = mock(ISdl.class);
+ subscribeButtonManager = new SubscribeButtonManager(internalInterface);
+ }
+
+ @Test
+ public void testInstantiation(){
+ assertNotNull(subscribeButtonManager.onButtonListeners);
+ assertEquals(subscribeButtonManager.getState(), BaseSubManager.SETTING_UP);
+ }
+
+ @Test
+ public void testDispose() {
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
+ subscribeButtonManager.dispose();
+ assertTrue(subscribeButtonManager.onButtonListeners.size() == 0);
+ }
+
+ @Test
+ public void testAddButtonListener() {
+ doAnswer(onSubscribe_UnsubscribeSuccess).when(internalInterface).sendRPC(any(RPCMessage.class));
+
+ subscribeButtonManager.addButtonListener(null, null);
+ assertTrue(subscribeButtonManager.onButtonListeners.size() == 0);
+
+ subscribeButtonManager.addButtonListener(null, listener);
+ assertTrue(subscribeButtonManager.onButtonListeners.size() == 0);
+
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
+ assertTrue(subscribeButtonManager.onButtonListeners.containsKey(ButtonName.VOLUME_UP));
+
+ }
+
+ @Test
+ public void testAddButtonListenerError(){
+ doAnswer(onSubscribeFail).when(internalInterface).sendRPC(any(RPCMessage.class));
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
+ assertFalse(subscribeButtonManager.onButtonListeners.containsKey(ButtonName.VOLUME_UP));
+ }
+
+ @Test
+ public void testRemoveButtonListener() {
+ doAnswer(onSubscribe_UnsubscribeSuccess).when(internalInterface).sendRPC(any(RPCMessage.class));
+
+ subscribeButtonManager.removeButtonListener(ButtonName.VOLUME_DOWN, listener);
+ assertFalse(subscribeButtonManager.onButtonListeners.containsKey(ButtonName.VOLUME_DOWN));
+
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
+ assertTrue(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP).size() == 1);
+
+ subscribeButtonManager.removeButtonListener(ButtonName.VOLUME_UP, listener2);
+ assertTrue(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP).size() == 1);
+
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
+ assertTrue(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP).size() == 1);
+
+ subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener2);
+ assertTrue(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP).size() == 2);
+
+
+ subscribeButtonManager.removeButtonListener(ButtonName.VOLUME_UP, listener);
+ assertTrue(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP).size() == 1);
+
+ subscribeButtonManager.removeButtonListener(ButtonName.VOLUME_UP, listener2);
+ assertNull(subscribeButtonManager.onButtonListeners.get(ButtonName.VOLUME_UP));
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
index 8aa9ae8a8..6d9315348 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
@@ -2,8 +2,8 @@ package com.smartdevicelink.managers.screen;
import android.content.Context;
import android.net.Uri;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
@@ -20,27 +20,35 @@ import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import org.json.JSONException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
import static org.mockito.Mockito.mock;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.screen.TextAndGraphicManager}
*/
-public class TextAndGraphicManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class TextAndGraphicManagerTests {
// SETUP / HELPERS
private TextAndGraphicManager textAndGraphicManager;
private SdlArtwork testArtwork;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
- Context mTestContext = this.getContext();
+ Context mTestContext = getContext();
// mock things
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -55,10 +63,6 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager, softButtonManager);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
private WindowCapability getWindowCapability(int numberOfMainFields){
@@ -102,6 +106,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
return windowCapability;
}
+ @Test
public void testInstantiation(){
assertNull(textAndGraphicManager.getTextField1());
@@ -132,6 +137,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
/**
* Test getting number of lines available to be set based off of windowCapability
*/
+ @Test
public void testGetMainLines(){
// We want to test that the looping works. By default, it will return 4 if display cap is null
@@ -146,6 +152,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability), 3);
}
+ @Test
public void testAssemble1Line(){
Show inputShow = new Show();
@@ -196,6 +203,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(assembledShow.getMainField1(), "Wednesday - Dudes");
}
+ @Test
public void testAssemble2Lines() {
Show inputShow = new Show();
@@ -293,6 +301,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(tags.getMainField2(), tagsList2);
}
+ @Test
public void testAssemble3Lines() {
Show inputShow = new Show();
@@ -386,6 +395,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(assembledShow.getMainField3(), "My - Dudes");
}
+ @Test
public void testAssemble4Lines() {
Show inputShow = new Show();
@@ -519,6 +529,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
/**
* Testing if WindowCapability is null, TextFields should still update.
*/
+ @Test
public void testAssemble4LinesNullWindowCapability() {
Show inputShow = new Show();
@@ -629,6 +640,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(tags.getMainField4(), tagsList4);
}
+ @Test
public void testMediaTrackTextField() {
String songTitle = "Wild For The Night";
@@ -636,6 +648,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(textAndGraphicManager.getMediaTrackTextField(), songTitle);
}
+ @Test
public void testTemplateTitle() {
String title = "template title";
@@ -643,12 +656,14 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(textAndGraphicManager.getTitle(), title);
}
+ @Test
public void testAlignment() {
textAndGraphicManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
}
+ @Test
public void testExtractTextFromShow(){
Show mainShow = new Show();
@@ -666,11 +681,13 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
// TEST IMAGES
+ @Test
public void testSetPrimaryGraphic() {
textAndGraphicManager.setPrimaryGraphic(testArtwork);
assertEquals(textAndGraphicManager.getPrimaryGraphic(), testArtwork);
}
+ @Test
public void testSetSecondaryGraphic() {
textAndGraphicManager.setSecondaryGraphic(testArtwork);
assertEquals(textAndGraphicManager.getSecondaryGraphic(), testArtwork);
@@ -678,6 +695,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
// TEST DISPOSE
+ @Test
public void testDispose() {
textAndGraphicManager.dispose();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
index 7b9696151..cba4ee77d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
@@ -35,32 +35,36 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
import static org.mockito.Mockito.mock;
-public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class CheckChoiceVROptionalOperationTests {
private CheckChoiceVROptionalOperation checkChoiceVROptionalOperation;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
CheckChoiceVROptionalInterface checkChoiceVROptionalInterface = mock(CheckChoiceVROptionalInterface.class);
checkChoiceVROptionalOperation = new CheckChoiceVROptionalOperation(internalInterface, checkChoiceVROptionalInterface);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testCreateChoiceNoVR(){
CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(false);
assertNotNull(setNoVR);
@@ -69,6 +73,7 @@ public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
assertNull(choice.getVrCommands());
}
+ @Test
public void testCreateChoiceWithVR(){
CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(true);
assertNotNull(setNoVR);
@@ -77,6 +82,7 @@ public class CheckChoiceVROptionalOperationTests extends AndroidTestCase2 {
assertEquals(choice.getVrCommands().get(0), "Test VR");
}
+ @Test
public void testDeleteInteractionChoiceSet(){
DeleteInteractionChoiceSet deleteSet = checkChoiceVROptionalOperation.createDeleteInteractionChoiceSet();
assertNotNull(deleteSet);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
index 0bf6af4a5..8f1c4f5c1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
@@ -32,87 +32,89 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.enums.FileType;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
-public class ChoiceCellTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
- private static final int MAX_ID = 2000000000;
- private SdlArtwork artwork = new SdlArtwork("image", FileType.GRAPHIC_PNG, 1, true);
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+@RunWith(AndroidJUnit4.class)
+public class ChoiceCellTests {
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ private static final int MAX_ID = 2000000000;
+ private SdlArtwork artwork = new SdlArtwork("image", FileType.GRAPHIC_PNG, 1, true);
+ @Test
public void testSettersAndGetters(){
// set everything
- ChoiceCell choiceCell = new ChoiceCell(Test.GENERAL_STRING);
- choiceCell.setSecondaryText(Test.GENERAL_STRING);
- choiceCell.setTertiaryText(Test.GENERAL_STRING);
- choiceCell.setVoiceCommands(Test.GENERAL_STRING_LIST);
+ ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING);
+ choiceCell.setSecondaryText(TestValues.GENERAL_STRING);
+ choiceCell.setTertiaryText(TestValues.GENERAL_STRING);
+ choiceCell.setVoiceCommands(TestValues.GENERAL_STRING_LIST);
choiceCell.setArtwork(artwork);
choiceCell.setSecondaryArtwork(artwork);
// use getters and assert equality
- assertEquals(choiceCell.getText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getSecondaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getTertiaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ assertEquals(choiceCell.getText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getSecondaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getTertiaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(choiceCell.getArtwork(), artwork);
assertEquals(choiceCell.getSecondaryArtwork(), artwork);
assertEquals(choiceCell.getChoiceId(), MAX_ID);
}
+ @Test
public void testConstructors() {
// first constructor was tested in previous method, use the rest here
- ChoiceCell choiceCell = new ChoiceCell(Test.GENERAL_STRING, Test.GENERAL_STRING_LIST, artwork);
- choiceCell.setSecondaryText(Test.GENERAL_STRING);
- choiceCell.setTertiaryText(Test.GENERAL_STRING);
+ ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
+ choiceCell.setSecondaryText(TestValues.GENERAL_STRING);
+ choiceCell.setTertiaryText(TestValues.GENERAL_STRING);
choiceCell.setSecondaryArtwork(artwork);
- assertEquals(choiceCell.getText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getSecondaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getTertiaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ assertEquals(choiceCell.getText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getSecondaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getTertiaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(choiceCell.getArtwork(), artwork);
assertEquals(choiceCell.getSecondaryArtwork(), artwork);
assertEquals(choiceCell.getChoiceId(), MAX_ID);
- choiceCell = new ChoiceCell(Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_STRING_LIST, artwork, artwork);
- assertEquals(choiceCell.getText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getSecondaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getTertiaryText(), Test.GENERAL_STRING);
- assertEquals(choiceCell.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ choiceCell = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork, artwork);
+ assertEquals(choiceCell.getText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getSecondaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getTertiaryText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(choiceCell.getArtwork(), artwork);
assertEquals(choiceCell.getSecondaryArtwork(), artwork);
assertEquals(choiceCell.getChoiceId(), MAX_ID);
}
+ @Test
public void testCellEquality(){
- ChoiceCell choiceCell = new ChoiceCell(Test.GENERAL_STRING, Test.GENERAL_STRING_LIST, artwork);
- choiceCell.setSecondaryText(Test.GENERAL_STRING);
- choiceCell.setTertiaryText(Test.GENERAL_STRING);
+ ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
+ choiceCell.setSecondaryText(TestValues.GENERAL_STRING);
+ choiceCell.setTertiaryText(TestValues.GENERAL_STRING);
choiceCell.setSecondaryArtwork(artwork);
- ChoiceCell choiceCell2 = new ChoiceCell(Test.GENERAL_STRING, Test.GENERAL_STRING_LIST, artwork);
- choiceCell2.setSecondaryText(Test.GENERAL_STRING);
- choiceCell2.setTertiaryText(Test.GENERAL_STRING);
+ ChoiceCell choiceCell2 = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
+ choiceCell2.setSecondaryText(TestValues.GENERAL_STRING);
+ choiceCell2.setTertiaryText(TestValues.GENERAL_STRING);
choiceCell2.setSecondaryArtwork(artwork);
- ChoiceCell choiceCell3 = new ChoiceCell(Test.GENERAL_STRING, Test.GENERAL_STRING_LIST, artwork);
- choiceCell3.setSecondaryText(Test.GENERAL_STRING);
- choiceCell3.setTertiaryText(Test.GENERAL_STRING);
+ ChoiceCell choiceCell3 = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
+ choiceCell3.setSecondaryText(TestValues.GENERAL_STRING);
+ choiceCell3.setTertiaryText(TestValues.GENERAL_STRING);
// Make sure our overridden method works, even though these are different objects in memory
assertTrue(choiceCell.equals(choiceCell2));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
index 3f147f128..854fc61f7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetLayoutTests.java
@@ -32,16 +32,26 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public class ChoiceSetLayoutTests extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetLayoutTests {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
+ @Test
public void testValidEnums() {
ChoiceSetLayout choiceSetLayoutList = ChoiceSetLayout.valueForString("CHOICE_SET_LAYOUT_LIST");
ChoiceSetLayout choiceSetLayoutTiles = ChoiceSetLayout.valueForString("CHOICE_SET_LAYOUT_TILES");
@@ -52,6 +62,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies that an invalid assignment is null.
*/
+ @Test
public void testInvalidEnum() {
String example = "deFaUlt";
try {
@@ -65,6 +76,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies that a null assignment is invalid.
*/
+ @Test
public void testNullEnum() {
String example = null;
try {
@@ -78,6 +90,7 @@ public class ChoiceSetLayoutTests extends AndroidTestCase2 {
/**
* Verifies the possible enum values of DynamicMenuUpdatesMode.
*/
+ @Test
public void testListEnum() {
List<ChoiceSetLayout> enumValueList = Arrays.asList(ChoiceSetLayout.values());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
index 1a9efffbe..78dd07cce 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
@@ -35,7 +35,9 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -47,13 +49,23 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
-import java.util.concurrent.LinkedBlockingQueue;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNotSame;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -61,16 +73,19 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class ChoiceSetManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetManagerTests {
private ChoiceSetManager csm;
+ Taskmaster taskmaster;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
+ taskmaster = new Taskmaster.Builder().build();
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
csm = new ChoiceSetManager(internalInterface, fileManager);
assertEquals(csm.getState(), BaseSubManager.SETTING_UP);
@@ -82,14 +97,13 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotNull(csm.fileManager);
assertNotNull(csm.preloadedChoices);
assertNotNull(csm.pendingPreloadChoices);
- assertNotNull(csm.operationQueue);
- assertNotNull(csm.executor);
+ assertNotNull(csm.transactionQueue);
assertNotNull(csm.hmiListener);
assertNotNull(csm.onDisplayCapabilityListener);
assertNull(csm.pendingPresentOperation);
}
- @Override
+ @After
public void tearDown() throws Exception {
csm.dispose();
@@ -100,17 +114,16 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(csm.pendingPresentationSet);
assertNull(csm.pendingPresentOperation);
- assertEquals(csm.operationQueue.size(), 0);
+ assertEquals(csm.transactionQueue.getTasksAsList().size(), 0);
assertEquals(csm.nextChoiceId, 1);
- assertTrue(csm.executor.isShutdown());
assertFalse(csm.isVROptional);
assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
- super.tearDown();
}
+ @Test
public void testDefaultKeyboardConfiguration(){
KeyboardProperties properties = csm.defaultKeyboardConfiguration();
assertEquals(properties.getLanguage(), Language.EN_US);
@@ -118,6 +131,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(properties.getKeypressMode(), KeypressMode.RESEND_CURRENT_ENTRY);
}
+ @Test
public void testSetupChoiceSet(){
ChoiceSetSelectionListener choiceSetSelectionListener = new ChoiceSetSelectionListener() {
@@ -157,6 +171,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertTrue(csm.setUpChoiceSet(choiceSet5));
}
+ @Test
public void testFindIfPresent(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -170,6 +185,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(csm.findIfPresent(cell3, cellSet));
}
+ @Test
public void testUpdateIdsOnChoices(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -190,6 +206,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotSame(cell3.getChoiceId(), 2000000000);
}
+ @Test
public void testChoicesToBeRemovedFromPendingWithArray(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -215,6 +232,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testChoicesToBeUploadedWithArray(){
ChoiceCell cell1 = new ChoiceCell("test");
@@ -240,8 +258,10 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
FileManager fileManager = mock(FileManager.class);
ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
@@ -252,8 +272,10 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotNull(cancelId);
}
+ @Test
public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
FileManager fileManager = mock(FileManager.class);
ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
@@ -264,6 +286,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(cancelId);
}
+ @Test
public void testDismissingExecutingKeyboard(){
Integer testCancelID = 42;
PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
@@ -273,22 +296,19 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
verify(testKeyboardOp, times(1)).dismissKeyboard();
}
+ @Test
public void testDismissingQueuedKeyboard(){
Integer testCancelID = 42;
// Currently executing operation
PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
- doReturn(true).when(testKeyboardOp).isExecuting();
doReturn(96).when(testKeyboardOp).getCancelID();
csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
// Queued operations
PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
- doReturn(true).when(testKeyboardOp2).isExecuting();
doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
- LinkedBlockingQueue<Runnable> testOperationQueue = new LinkedBlockingQueue<>();
- testOperationQueue.add(testKeyboardOp2);
- csm.operationQueue = testOperationQueue;
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp2;
// Queued operation should be canceled
csm.dismissKeyboard(testCancelID);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
index 900336594..c7cda00fb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
@@ -32,15 +32,23 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
-public class ChoiceSetTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class ChoiceSetTests {
private ChoiceSetSelectionListener listener;
private ChoiceSetLayout layout;
@@ -48,61 +56,59 @@ public class ChoiceSetTests extends AndroidTestCase2 {
private Integer defaultTimeout;
private Boolean canceledHandlerCalled;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
listener = mock(ChoiceSetSelectionListener.class);
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
defaultTimeout = 10;
- choices = Arrays.asList(new ChoiceCell(Test.GENERAL_STRING), new ChoiceCell(Test.GENERAL_STRING));
+ choices = Arrays.asList(new ChoiceCell(TestValues.GENERAL_STRING), new ChoiceCell(TestValues.GENERAL_STRING));
canceledHandlerCalled = false;
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testSettersAndGetters(){
// test small constructor
- ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, choices, listener);
+ ChoiceSet choiceSet = new ChoiceSet(TestValues.GENERAL_STRING, choices, listener);
// use getters and assert equality
- assertEquals(choiceSet.getTitle(), Test.GENERAL_STRING);
+ assertEquals(choiceSet.getTitle(), TestValues.GENERAL_STRING);
assertEquals(choiceSet.getLayout(), layout);
assertEquals(choiceSet.getTimeout(), defaultTimeout);
assertEquals(choiceSet.getChoices(), choices);
assertEquals(choiceSet.getChoiceSetSelectionListener(), listener);
}
+ @Test
public void testConstructors() {
// first constructor was tested in previous method, use the rest here
- ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VRHELPITEM_LIST, Test.GENERAL_KEYBOARDPROPERTIES, choices, listener);
- assertEquals(choiceSet.getTitle(), Test.GENERAL_STRING);
- assertEquals(choiceSet.getInitialPrompt().get(0).getText(),Test.GENERAL_STRING);
- assertEquals(choiceSet.getHelpPrompt().get(0).getText(), Test.GENERAL_STRING);
- assertEquals(choiceSet.getTimeoutPrompt().get(0).getText(), Test.GENERAL_STRING);
+ ChoiceSet choiceSet = new ChoiceSet(TestValues.GENERAL_STRING, layout, TestValues.GENERAL_INTEGER, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_VRHELPITEM_LIST, TestValues.GENERAL_KEYBOARDPROPERTIES, choices, listener);
+ assertEquals(choiceSet.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(choiceSet.getInitialPrompt().get(0).getText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceSet.getHelpPrompt().get(0).getText(), TestValues.GENERAL_STRING);
+ assertEquals(choiceSet.getTimeoutPrompt().get(0).getText(), TestValues.GENERAL_STRING);
assertEquals(choiceSet.getLayout(), layout);
- assertEquals(choiceSet.getTimeout(), Test.GENERAL_INTEGER);
+ assertEquals(choiceSet.getTimeout(), TestValues.GENERAL_INTEGER);
assertEquals(choiceSet.getChoices(), choices);
assertEquals(choiceSet.getChoiceSetSelectionListener(), listener);
- ChoiceSet choiceSet2 = new ChoiceSet(Test.GENERAL_STRING, layout, Test.GENERAL_INTEGER, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_TTSCHUNK_LIST, Test.GENERAL_VRHELPITEM_LIST, Test.GENERAL_KEYBOARDPROPERTIES, choices, listener);
- assertEquals(choiceSet2.getTitle(), Test.GENERAL_STRING);
- assertEquals(choiceSet2.getInitialPrompt(),Test.GENERAL_TTSCHUNK_LIST);
- assertEquals(choiceSet2.getHelpPrompt(), Test.GENERAL_TTSCHUNK_LIST);
- assertEquals(choiceSet2.getTimeoutPrompt(), Test.GENERAL_TTSCHUNK_LIST);
+ ChoiceSet choiceSet2 = new ChoiceSet(TestValues.GENERAL_STRING, layout, TestValues.GENERAL_INTEGER, TestValues.GENERAL_TTSCHUNK_LIST, TestValues.GENERAL_TTSCHUNK_LIST, TestValues.GENERAL_TTSCHUNK_LIST, TestValues.GENERAL_VRHELPITEM_LIST, TestValues.GENERAL_KEYBOARDPROPERTIES, choices, listener);
+ assertEquals(choiceSet2.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(choiceSet2.getInitialPrompt(), TestValues.GENERAL_TTSCHUNK_LIST);
+ assertEquals(choiceSet2.getHelpPrompt(), TestValues.GENERAL_TTSCHUNK_LIST);
+ assertEquals(choiceSet2.getTimeoutPrompt(), TestValues.GENERAL_TTSCHUNK_LIST);
assertEquals(choiceSet2.getLayout(), layout);
- assertEquals(choiceSet2.getTimeout(), Test.GENERAL_INTEGER);
+ assertEquals(choiceSet2.getTimeout(), TestValues.GENERAL_INTEGER);
assertEquals(choiceSet2.getChoices(), choices);
assertEquals(choiceSet2.getChoiceSetSelectionListener(), listener);
}
+ @Test
public void testCancelingChoiceSet() {
- ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, choices, listener);
+ ChoiceSet choiceSet = new ChoiceSet(TestValues.GENERAL_STRING, choices, listener);
choiceSet.canceledListener = new ChoiceSetCanceledListener() {
@Override
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
index 67200d0fe..e2cdcf7ae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
@@ -35,22 +35,29 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.HashSet;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
import static org.mockito.Mockito.mock;
-public class DeleteChoicesOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class DeleteChoicesOperationTests {
private DeleteChoicesOperation deleteChoicesOperation;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
ChoiceCell cell1 = new ChoiceCell("cell 1");
ChoiceCell cell2 = new ChoiceCell("cell 2");
@@ -62,11 +69,8 @@ public class DeleteChoicesOperationTests extends AndroidTestCase2 {
deleteChoicesOperation = new DeleteChoicesOperation(internalInterface, cellsToDelete, null);
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testCreateListDeleteInteractionSets(){
List<DeleteInteractionChoiceSet> deletes = deleteChoicesOperation.createDeleteSets();
assertNotNull(deletes);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
index 3fbfcada9..b8be6edc5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
@@ -35,7 +35,8 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -47,29 +48,36 @@ import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
-public class PreloadChoicesOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PreloadChoicesOperationTests {
private PreloadChoicesOperation preloadChoicesOperation;
private PreloadChoicesOperation preloadChoicesOperationNullCapability;
private PreloadChoicesOperation preloadChoicesOperationEmptyCapability;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
-
ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, Test.GENERAL_ARTWORK);
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
cellsToPreload.add(cell1);
cellsToPreload.add(cell2);
@@ -102,7 +110,7 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
public void setUpNullWindowCapability() {
ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, Test.GENERAL_ARTWORK);
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
cellsToPreload.add(cell1);
cellsToPreload.add(cell2);
@@ -119,7 +127,7 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
public void setUpEmptyWindowCapability() {
ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, Test.GENERAL_ARTWORK);
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
cellsToPreload.add(cell1);
cellsToPreload.add(cell2);
@@ -140,16 +148,13 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testArtworkNeedsUpload(){
- boolean test = preloadChoicesOperation.artworkNeedsUpload(Test.GENERAL_ARTWORK);
+ boolean test = preloadChoicesOperation.artworkNeedsUpload(TestValues.GENERAL_ARTWORK);
assertTrue(test);
}
+ @Test
public void testArtworksToUpload(){
List<SdlArtwork> artworksToUpload = preloadChoicesOperation.artworksToUpload();
assertNotNull(artworksToUpload);
@@ -159,6 +164,7 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
/**
* Testing shouldSend method's with varying WindowCapability set.
*/
+ @Test
public void testShouldSendText() {
setUpNullWindowCapability();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
index d8cf5be9d..1f4984706 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
@@ -35,7 +35,11 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.livio.taskmaster.Queue;
+import com.livio.taskmaster.Task;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -48,16 +52,18 @@ import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.Collections;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -66,7 +72,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PresentChoiceSetOperationTests {
private PresentChoiceSetOperation presentChoiceSetOperation;
private ChoiceSet choiceSet;
@@ -74,11 +81,11 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
private KeyboardListener keyboardListener;
private ChoiceSetSelectionListener choiceSetSelectionListener;
- private ExecutorService executor;
+ private Taskmaster taskmaster;
+ private Queue queue;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
internalInterface = mock(ISdl.class);
@@ -89,13 +96,11 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
cell1.setChoiceId(0);
choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
- executor = Executors.newCachedThreadPool();
+ taskmaster = new Taskmaster.Builder().build();
+ queue = taskmaster.createQueue("test", 100, false);
+ taskmaster.start();
}
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
private KeyboardProperties getKeyBoardProperties(){
KeyboardProperties properties = new KeyboardProperties();
@@ -105,17 +110,19 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
return properties;
}
+ @Test
public void testGetLayoutMode(){
// First we will check knowing our keyboard listener is NOT NULL
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
presentChoiceSetOperation.keyboardListener = null;
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
}
+ @Test
public void testGetPerformInteraction(){
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
PerformInteraction pi = presentChoiceSetOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
@@ -123,30 +130,36 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getTimeout(), Integer.valueOf(10000));
- assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(pi.getCancelID(), TestValues.GENERAL_INTEGER);
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
}
+ @Test
public void testSetSelectedCellWithId(){
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
assertNull(presentChoiceSetOperation.selectedCellRow);
presentChoiceSetOperation.setSelectedCellWithId(0);
assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
}
+ private void sleep() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
- executor.execute(presentChoiceSetOperation);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ sleep();
- assertTrue(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
choiceSet.cancel();
Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
@@ -155,7 +168,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
Object[] args = invocation.getArguments();
CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
@@ -170,22 +183,17 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- assertTrue(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
}
+ @Test
public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
- executor.execute(presentChoiceSetOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertTrue(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
choiceSet.cancel();
Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
@@ -194,7 +202,7 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
Object[] args = invocation.getArguments();
CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
@@ -209,65 +217,52 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- assertTrue(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
}
+ @Test
public void testCancelingChoiceSetIfThreadHasFinished(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
presentChoiceSetOperation.finishOperation();
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertTrue(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
choiceSet.cancel();
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertTrue(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
}
+ @Test
public void testCancelingChoiceSetIfThreadHasNotYetRun(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
choiceSet.cancel();
// Once the operation has started
- executor.execute(presentChoiceSetOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertTrue(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
// Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
- executor.execute(presentChoiceSetOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertTrue(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
choiceSet.cancel();
@@ -275,28 +270,23 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertFalse(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
choiceSet.cancel();
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
// Once the operation has started
- executor.execute(presentChoiceSetOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertFalse(presentChoiceSetOperation.isExecuting());
- assertTrue(presentChoiceSetOperation.isFinished());
- assertFalse(presentChoiceSetOperation.isCancelled());
+ assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
// Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
index 486a1c361..16992a522 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
@@ -35,7 +35,11 @@
package com.smartdevicelink.managers.screen.choiceset;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.livio.taskmaster.Queue;
+import com.livio.taskmaster.Task;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -48,8 +52,11 @@ import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -57,6 +64,10 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -65,17 +76,18 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class PresentKeyboardOperationTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class PresentKeyboardOperationTests {
private PresentKeyboardOperation presentKeyboardOperation;
private KeyboardListener keyboardListener;
private ISdl internalInterface;
- private ExecutorService executor;
+ private Taskmaster taskmaster;
+ private Queue queue;
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
internalInterface = mock(ISdl.class);
keyboardListener = mock(KeyboardListener.class);
@@ -95,12 +107,9 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
};
doAnswer(setGlobalPropertiesAnswer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
- executor = Executors.newCachedThreadPool();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
+ taskmaster = new Taskmaster.Builder().build();
+ queue = taskmaster.createQueue("test", 100, false);
+ taskmaster.start();
}
private KeyboardProperties getKeyBoardProperties(){
@@ -111,8 +120,9 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
return properties;
}
+ @Test
public void testGetPerformInteraction(){
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, Test.GENERAL_INTEGER);
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, TestValues.GENERAL_INTEGER);
PerformInteraction pi = presentKeyboardOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
@@ -120,20 +130,25 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getInteractionLayout(), LayoutMode.KEYBOARD);
- assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(pi.getCancelID(), TestValues.GENERAL_INTEGER);
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
+ @Test
public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
- executor.execute(presentKeyboardOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertTrue(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
presentKeyboardOperation.dismissKeyboard();
Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
@@ -142,7 +157,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
Object[] args = invocation.getArguments();
CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
@@ -157,18 +172,15 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- assertTrue(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
}
+ @Test
public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
- executor.execute(presentKeyboardOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ queue.add(presentKeyboardOperation, false);
+ sleep();
presentKeyboardOperation.dismissKeyboard();
Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
@@ -177,7 +189,7 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
Object[] args = invocation.getArguments();
CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
@@ -192,65 +204,52 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- assertTrue(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
}
+ @Test
public void testCancelingKeyboardIfThreadHasFinished(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
presentKeyboardOperation.finishOperation();
- assertFalse(presentKeyboardOperation.isExecuting());
- assertTrue(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
presentKeyboardOperation.dismissKeyboard();
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- assertFalse(presentKeyboardOperation.isExecuting());
- assertTrue(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
}
+ @Test
public void testCancelingKeyboardIfThreadHasNotYetRun(){
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
- assertFalse(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
presentKeyboardOperation.dismissKeyboard();
// Once the operation has started
- executor.execute(presentKeyboardOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertFalse(presentKeyboardOperation.isExecuting());
- assertTrue(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
// Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
- executor.execute(presentKeyboardOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertTrue(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
presentKeyboardOperation.dismissKeyboard();
@@ -258,28 +257,23 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
}
+ @Test
public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
// Cancel Interaction is only supported on RPC specs v.6.0.0+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
- assertFalse(presentKeyboardOperation.isExecuting());
- assertFalse(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
presentKeyboardOperation.dismissKeyboard();
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
// Once the operation has started
- executor.execute(presentKeyboardOperation);
- try {
- executor.awaitTermination(1, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertFalse(presentKeyboardOperation.isExecuting());
- assertTrue(presentKeyboardOperation.isFinished());
- assertFalse(presentKeyboardOperation.isCancelled());
+ assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
// Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
index 0a629d808..0105553fa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
@@ -32,17 +32,27 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.file.SdlArtworkTests;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNotSame;
+import static junit.framework.TestCase.assertTrue;
-public class MenuCellTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class MenuCellTests {
private MenuSelectionListener menuSelectionListener = new MenuSelectionListener() {
@Override
@@ -51,62 +61,55 @@ public class MenuCellTests extends AndroidTestCase2 {
}
};
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testSettersAndGetters(){
// set everything
- MenuCell menuCell = new MenuCell(Test.GENERAL_STRING, null, null, menuSelectionListener);
- menuCell.setIcon(Test.GENERAL_ARTWORK);
- menuCell.setVoiceCommands(Test.GENERAL_STRING_LIST);
+ MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, null, null, menuSelectionListener);
+ menuCell.setIcon(TestValues.GENERAL_ARTWORK);
+ menuCell.setVoiceCommands(TestValues.GENERAL_STRING_LIST);
menuCell.setMenuSelectionListener(menuSelectionListener);
- menuCell.setSubMenuLayout(Test.GENERAL_MENU_LAYOUT);
+ menuCell.setSubMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
// use getters and assert equality
- assertEquals(menuCell.getTitle(), Test.GENERAL_STRING);
- assertEquals(menuCell.getIcon(), Test.GENERAL_ARTWORK);
- assertEquals(menuCell.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ assertEquals(menuCell.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(menuCell.getMenuSelectionListener(), menuSelectionListener);
- assertEquals(menuCell.getCellId(), Test.GENERAL_MENU_MAX_ID);
- assertEquals(menuCell.getParentCellId(), Test.GENERAL_MENU_MAX_ID);
- assertEquals(menuCell.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
+ assertEquals(menuCell.getCellId(), TestValues.GENERAL_MENU_MAX_ID);
+ assertEquals(menuCell.getParentCellId(), TestValues.GENERAL_MENU_MAX_ID);
+ assertEquals(menuCell.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
}
+ @Test
public void testConstructors(){
// first constructor was tested in previous method, use the last two here
- MenuCell menuCell3 =new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener);
- assertEquals(menuCell3.getTitle(), Test.GENERAL_STRING);
- assertEquals(menuCell3.getIcon(), Test.GENERAL_ARTWORK);
- assertEquals(menuCell3.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ MenuCell menuCell3 =new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ assertEquals(menuCell3.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell3.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell3.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(menuCell3.getMenuSelectionListener(), menuSelectionListener);
- MenuCell menuCell4 =new MenuCell(Test.GENERAL_STRING,null, null, menuSelectionListener);
- assertEquals(menuCell4.getTitle(), Test.GENERAL_STRING);
+ MenuCell menuCell4 =new MenuCell(TestValues.GENERAL_STRING,null, null, menuSelectionListener);
+ assertEquals(menuCell4.getTitle(), TestValues.GENERAL_STRING);
assertEquals(menuCell4.getMenuSelectionListener(), menuSelectionListener);
- MenuCell menuCell5 = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_MENU_LAYOUT, Test.GENERAL_ARTWORK, Test.GENERAL_MENUCELL_LIST);
- assertEquals(menuCell5.getTitle(), Test.GENERAL_STRING);
- assertEquals(menuCell5.getIcon(), Test.GENERAL_ARTWORK);
- assertEquals(menuCell5.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
- assertEquals(menuCell5.getSubCells(), Test.GENERAL_MENUCELL_LIST);
+ MenuCell menuCell5 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_MENUCELL_LIST);
+ assertEquals(menuCell5.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell5.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell5.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ assertEquals(menuCell5.getSubCells(), TestValues.GENERAL_MENUCELL_LIST);
}
+ @Test
public void testEquality(){
//We should use assertTrue (or assertFalse) because we want to use the overridden equals() method
- MenuCell menuCell = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener);
- MenuCell menuCell2 = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell2 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
// these are the same object, should be equal.
assertTrue(menuCell.equals(menuCell));
@@ -114,14 +117,15 @@ public class MenuCellTests extends AndroidTestCase2 {
// Make sure these are marked as equals, even though they are different objects
assertTrue(menuCell.equals(menuCell2));
- MenuCell menuCell3 = new MenuCell(Test.GENERAL_STRING, null, Test.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell3 = new MenuCell(TestValues.GENERAL_STRING, null, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
// these should be different
assertFalse(menuCell.equals(menuCell3));
}
+ @Test
public void testClone(){
- MenuCell original = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell original = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
MenuCell clone = original.clone();
assertNotNull(clone);
@@ -138,7 +142,7 @@ public class MenuCellTests extends AndroidTestCase2 {
subcells.add(original.clone());
subcells.add(clone.clone());
- original = new MenuCell(Test.GENERAL_STRING, MenuLayout.LIST, Test.GENERAL_ARTWORK,subcells);
+ original = new MenuCell(TestValues.GENERAL_STRING, MenuLayout.LIST, TestValues.GENERAL_ARTWORK,subcells);
clone = original.clone();
assertNotNull(original.getSubCells());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
index 62f6ccb92..e623d2ee2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
@@ -35,29 +35,27 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class MenuConfigurationTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class MenuConfigurationTests {
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testSettersAndGetters(){
// set everything - we only use the constructor to set variables in the Menu Manager
- MenuConfiguration menuConfiguration = new MenuConfiguration(Test.GENERAL_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
+ MenuConfiguration menuConfiguration = new MenuConfiguration(TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
// use getters and assert equality
- assertEquals(menuConfiguration.getMenuLayout(), Test.GENERAL_MENU_LAYOUT);
- assertEquals(menuConfiguration.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
+ assertEquals(menuConfiguration.getMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ assertEquals(menuConfiguration.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index feca36cdf..4a68a6b1c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -32,7 +32,8 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.R;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -54,15 +55,23 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -73,7 +82,8 @@ import static org.mockito.Mockito.verify;
/**
* the Algorithm specific tests are defined based on: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0210-mobile-dynamic-menu-cell-updating.md
*/
-public class MenuManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class MenuManagerTests {
private OnRPCNotificationListener onHMIStatusListener, commandListener;
private MenuManager menuManager;
@@ -82,9 +92,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
cells = createTestCells();
@@ -148,7 +157,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
}
- @Override
+ @After
public void tearDown() throws Exception {
menuManager.dispose();
@@ -169,9 +178,9 @@ public class MenuManagerTests extends AndroidTestCase2 {
// after everything, make sure we are in the correct state
assertEquals(menuManager.getState(), BaseSubManager.SHUTDOWN);
- super.tearDown();
}
+ @Test
public void testStartMenuManager(){
menuManager.start(new CompletionListener() {
@@ -184,6 +193,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMINotReady(){
menuManager.currentHMILevel = HMILevel.HMI_NONE;
@@ -202,6 +212,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertFalse(menuManager.waitingOnHMIUpdate);
}
+ @Test
public void testUpdatingOldWay(){
// Force Menu Manager to use the old way of deleting / sending all
@@ -247,6 +258,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
}
}
+ @Test
public void testAlgorithmTest1(){
// Force Menu Manager to use the new way
@@ -283,6 +295,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 4);
}
+ @Test
public void testAlgorithmTest2(){
// Force Menu Manager to use the new way
@@ -319,6 +332,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 3);
}
+ @Test
public void testAlgorithmTest3(){
// Force Menu Manager to use the new way
@@ -355,6 +369,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 0);
}
+ @Test
public void testAlgorithmTest4(){
// Force Menu Manager to use the new way
@@ -391,6 +406,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 2);
}
+ @Test
public void testAlgorithmTest5(){
// Force Menu Manager to use the new way
@@ -427,6 +443,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.keepsOld.size(), 3);
}
+ @Test
public void testSettingNullMenu(){
// Make sure we can send an empty menu with no issues
@@ -448,6 +465,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ @Test
public void testClearingMenu(){
// Make sure we can send an empty menu with no issues
@@ -469,6 +487,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ @Test
public void testOpeningMainMenu(){
// call open Menu
MenuManager mockMenuManager = mock(MenuManager.class);
@@ -476,6 +495,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
verify(mockMenuManager, Mockito.times(1)).openMenu();
}
+ @Test
public void testOpeningSubMenuNullCells(){
// call open Menu
MenuManager mockMenuManager = mock(MenuManager.class);
@@ -484,6 +504,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertFalse(mockMenuManager.openSubMenu(cell));
}
+ @Test
public void testOpeningSubMenu(){
// call open Menu
List<MenuCell> testCells = createTestCells();
@@ -492,7 +513,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
// has to get success response to be true
assertTrue(menuManager.openSubMenu(testCells.get(3)));
}
-
+
+ @Test
public void testSetMenuConfiguration(){
menuManager.currentHMILevel = HMILevel.HMI_FULL;
menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
index 15128293c..724a53699 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
@@ -32,31 +32,28 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class RunScoreTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+import static junit.framework.TestCase.assertEquals;
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+@RunWith(AndroidJUnit4.class)
+public class RunScoreTests {
+ @Test
public void testSettersAndGetters(){
// set everything - we only use the constructor to set variables in the Menu Manager
- RunScore runScore = new RunScore(Test.GENERAL_INT, Test.GENERAL_INTEGER_LIST, Test.GENERAL_INTEGER_LIST);
+ RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
// use getters and assert equality
- assertEquals(runScore.getScore(), Test.GENERAL_INT);
- assertEquals(runScore.getCurrentMenu(), Test.GENERAL_INTEGER_LIST);
- assertEquals(runScore.getOldMenu(), Test.GENERAL_INTEGER_LIST);
+ assertEquals(runScore.getScore(), TestValues.GENERAL_INT);
+ assertEquals(runScore.getCurrentMenu(), TestValues.GENERAL_INTEGER_LIST);
+ assertEquals(runScore.getOldMenu(), TestValues.GENERAL_INTEGER_LIST);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
index c25fb7f41..a6eccbad0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
@@ -32,34 +32,32 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class SubCellCommandListTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
+import org.junit.Test;
+import org.junit.runner.RunWith;
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class SubCellCommandListTests {
+ @Test
public void testSettersAndGetters() {
- RunScore runScore = new RunScore(Test.GENERAL_INT, Test.GENERAL_INTEGER_LIST, Test.GENERAL_INTEGER_LIST);
+ RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
// set everything
- SubCellCommandList subCellCommandList = new SubCellCommandList(Test.GENERAL_STRING, Test.GENERAL_INTEGER, runScore, Test.GENERAL_MENUCELL_LIST, Test.GENERAL_MENUCELL_LIST);
+ SubCellCommandList subCellCommandList = new SubCellCommandList(TestValues.GENERAL_STRING, TestValues.GENERAL_INTEGER, runScore, TestValues.GENERAL_MENUCELL_LIST, TestValues.GENERAL_MENUCELL_LIST);
// use getters and assert equality
- assertEquals(subCellCommandList.getMenuTitle(), Test.GENERAL_STRING);
- assertEquals(subCellCommandList.getParentId(), Test.GENERAL_INTEGER);
+ assertEquals(subCellCommandList.getMenuTitle(), TestValues.GENERAL_STRING);
+ assertEquals(subCellCommandList.getParentId(), TestValues.GENERAL_INTEGER);
assertEquals(runScore, runScore);
- assertEquals(subCellCommandList.getNewList(), Test.GENERAL_MENUCELL_LIST);
- assertEquals(subCellCommandList.getOldList(), Test.GENERAL_MENUCELL_LIST);
+ assertEquals(subCellCommandList.getNewList(), TestValues.GENERAL_MENUCELL_LIST);
+ assertEquals(subCellCommandList.getOldList(), TestValues.GENERAL_MENUCELL_LIST);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
index 2b07fcfbf..72f52b3d5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
@@ -32,7 +32,8 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -43,6 +44,10 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -50,6 +55,11 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -57,7 +67,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-public class VoiceCommandManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class VoiceCommandManagerTests {
private VoiceCommand command, command3;
private List<VoiceCommand> commands;
@@ -67,9 +78,8 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
VoiceCommandSelectionListener mockListener = mock(VoiceCommandSelectionListener.class);
command = new VoiceCommand(Arrays.asList("Command one", "Command two"), null);
@@ -117,7 +127,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertNull(voiceCommandManager.inProgressUpdate);
}
- @Override
+ @After
public void tearDown() throws Exception {
voiceCommandManager.dispose();
@@ -131,10 +141,9 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertFalse(voiceCommandManager.waitingOnHMIUpdate);
// after everything, make sure we are in the correct state
assertEquals(voiceCommandManager.getState(), BaseSubManager.SHUTDOWN);
-
- super.tearDown();
}
+ @Test
public void testStartVoiceCommandManager(){
voiceCommandManager.start(new CompletionListener() {
@@ -147,6 +156,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMINotReady(){
voiceCommandManager.currentHMILevel = HMILevel.HMI_NONE;
@@ -167,6 +177,7 @@ public class VoiceCommandManagerTests extends AndroidTestCase2 {
assertFalse(voiceCommandManager.waitingOnHMIUpdate);
}
+ @Test
public void testUpdatingCommands(){
// we have previously sent 2 VoiceCommand objects. we will now update it and have just one
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
index f8a8a538d..6be14c367 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
@@ -32,10 +32,17 @@
package com.smartdevicelink.managers.screen.menu;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
-public class VoiceCommandTests extends AndroidTestCase2 {
+import com.smartdevicelink.test.TestValues;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class VoiceCommandTests {
private VoiceCommandSelectionListener voiceCommandSelectionListener = new VoiceCommandSelectionListener() {
@Override
@@ -44,20 +51,11 @@ public class VoiceCommandTests extends AndroidTestCase2 {
}
};
- @Override
- public void setUp() throws Exception{
- super.setUp();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testSettersAndGetters(){
- VoiceCommand voiceCommand = new VoiceCommand(Test.GENERAL_STRING_LIST, voiceCommandSelectionListener);
+ VoiceCommand voiceCommand = new VoiceCommand(TestValues.GENERAL_STRING_LIST, voiceCommandSelectionListener);
- assertEquals(voiceCommand.getVoiceCommands(), Test.GENERAL_STRING_LIST);
+ assertEquals(voiceCommand.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
assertEquals(voiceCommand.getVoiceCommandSelectionListener(), voiceCommandSelectionListener);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
index 1b7417363..e6cb892bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
@@ -3,12 +3,12 @@ package com.smartdevicelink.managers.video;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -19,7 +19,6 @@ import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
@@ -31,9 +30,12 @@ import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.Version;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -44,6 +46,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.eq;
@@ -52,27 +58,23 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static android.support.test.InstrumentationRegistry.getContext;
/**
* This is a unit test class for the SmartDeviceLink video streaming manager class :
* {@link VideoStreamManager}
*/
-public class VideoStreamManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class VideoStreamManagerTests {
public static final String TAG = "VideoStreamManagerTests";
private Context mTestContext;
private static boolean touchEventOccured = false;
// SETUP / HELPERS
- @Override
+ @Before
public void setUp() throws Exception{
- super.setUp();
- mTestContext = this.getContext();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
+ mTestContext = getContext();
}
// TEST CLASSES
@@ -99,6 +101,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
// TESTS
+ @Test
public void testInitialization(){
ISdl internalInterface = mock(ISdl.class);
when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,1,0));
@@ -132,6 +135,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testHMILevelNotFull(){
final ISdl internalInterface = mock(ISdl.class);
@@ -157,6 +161,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
});
}
+ @Test
public void testRemoteDisplayStream(){
ISdl internalInterface = mock(ISdl.class);
@@ -176,7 +181,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
OnSystemCapabilityListener systemCapabilityListener = (OnSystemCapabilityListener) args[1];
- systemCapabilityListener.onCapabilityRetrieved(Test.GENERAL_VIDEOSTREAMINGCAPABILITY);
+ systemCapabilityListener.onCapabilityRetrieved(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
return null;
}
};
@@ -249,7 +254,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
public void sendFrame(ByteBuffer data, long presentationTimeUs) {}
});
- when(internalInterface.getCapability(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(Test.GENERAL_VIDEOSTREAMINGCAPABILITY);
+ when(internalInterface.getCapability(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
videoStreamManager.start(new CompletionListener() {
@@ -273,6 +278,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
}
+ @Test
public void testConvertTouchEvent() {
ISdl internalInterface = mock(ISdl.class);
@@ -482,14 +488,17 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
+ @Test
public void testConvertTouchEvent_Scale_1() {
assertMotionEventWithScale(800, 480, 1.0f);
}
+ @Test
public void testConvertTouchEvent_Scale_1_25() {
assertMotionEventWithScale(1280, 768, 1.25f);
}
+ @Test
public void testConvertTouchEvent_Scale_1_5() {
assertMotionEventWithScale(1280, 768, 1.5f);
}
@@ -533,6 +542,7 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
}
+ @Test
public void testIsHMIStateVideoStreamCapable() {
VideoStreamManager videoStreamManager = new VideoStreamManager(mock(ISdl.class));
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 e9e179659..e4a2555d2 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
@@ -1,12 +1,20 @@
package com.smartdevicelink.protocol;
+import android.support.test.runner.AndroidJUnit4;
+
import com.livio.BSON.BsonEncoder;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.enums.ControlFrameTags;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.HashMap;
-public class SdlPacketTests extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNull;
+
+@RunWith(AndroidJUnit4.class)
+public class SdlPacketTests {
//TODO: Add tests to cover other parts of SdlPacket class
// Test variables
@@ -24,6 +32,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
"70726f746f636f6c56657273" +
"696f6e0006000000352e302e300000");
+ @Test
public void testNull(){
byte[] testPayload = hexStringToByteArray(
"16000000" +
@@ -39,6 +48,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
assertEquals(sdlPacket.getTag("hello"),"world");
}
+ @Test
public void testBsonDecoding(){
SdlPacket sdlPacket = new SdlPacket();
sdlPacket.setPayload(corePayload);
@@ -47,6 +57,7 @@ public class SdlPacketTests extends AndroidTestCase2 {
assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.MTU), TEST_MTU);
}
+ @Test
public void testBsonEncoding(){
HashMap<String, Object> testMap = new HashMap<>();
testMap.put(ControlFrameTags.RPC.StartServiceACK.HASH_ID, TEST_HASH_ID);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
index 4c53e9b58..be04ce1f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.protocol;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
@@ -15,13 +15,24 @@ import com.smartdevicelink.transport.RouterServiceValidator;
import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Method;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
+import static android.support.test.InstrumentationRegistry.getContext;
-public class SdlProtocolTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlProtocolTests {
int max_int = 2147483647;
byte[] payload;
@@ -89,17 +100,20 @@ public class SdlProtocolTests extends AndroidTestCase2 {
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
+ @Before
public void setUp(){
- config = new MultiplexTransportConfig(this.mContext, SdlUnitTestContants.TEST_APP_ID);
+ config = new MultiplexTransportConfig(getContext(), SdlUnitTestContants.TEST_APP_ID);
protocol = new SdlProtocol(defaultListener,config);
}
+ @Test
public void testBase(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
}
+ @Test
public void testVersion(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -133,6 +147,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
assertEquals((byte)0x01,sdlProtocol.getProtocolVersion().getMajor());
}
+ @Test
public void testMtu(){
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -167,6 +182,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
+ @Test
public void testHandleFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -177,6 +193,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
+ @Test
public void testHandleFrameCorrupt(){
SampleRpc sampleRpc = new SampleRpc(4);
BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
@@ -191,6 +208,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
}
+ @Test
public void testHandleSingleFrameMessageFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
@@ -206,6 +224,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
}
}
+ @Test
public void testHandleSingleFrameMessageFrameCorruptBfh(){
SampleRpc sampleRpc = new SampleRpc(4);
@@ -245,7 +264,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
-
+ @Test
public void testNormalCase(){
setUp();
payload = new byte[]{0x00,0x02,0x05,0x01,0x01,0x01,0x05,0x00};
@@ -290,6 +309,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
assertNull(oom_error);
}
+ @Test
public void testOverallocatingAccumulator(){
setUp();
ByteArrayOutputStream builder = new ByteArrayOutputStream();
@@ -357,7 +377,7 @@ public class SdlProtocolTests extends AndroidTestCase2 {
public void onTransportDisconnected(String info) {
connected = false;
//Grab a currently running router service
- RouterServiceValidator rsvp2 = new RouterServiceValidator(mContext);
+ RouterServiceValidator rsvp2 = new RouterServiceValidator(getContext());
rsvp2.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
assertTrue(rsvp2.validate());
assertNotNull(rsvp2.getService());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
index a5556479f..21892632a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.protocol;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.protocol.WiProProtocol.MessageFrameAssembler;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -14,15 +14,27 @@ import com.smartdevicelink.transport.RouterServiceValidator;
import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Method;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertTrue;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.protocol.BinaryFrameHeader}
*/
-public class WiProProtocolTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class WiProProtocolTests {
int max_int = 2147483647;
byte[] payload;
@@ -97,12 +109,14 @@ public class WiProProtocolTests extends AndroidTestCase2 {
public void onProtocolError(String info, Exception e) {}
};
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
-
+
+ @Test
public void testBase(){
WiProProtocol wiProProtocol = new WiProProtocol(defaultListener);
}
-
+
+ @Test
public void testVersion(){
WiProProtocol wiProProtocol = new WiProProtocol(defaultListener);
@@ -135,7 +149,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
wiProProtocol.setVersion((byte)0x00);
assertEquals((byte)0x01,wiProProtocol.getVersion());
}
-
+
+ @Test
public void testMtu(){
WiProProtocol wiProProtocol = new WiProProtocol(defaultListener);
@@ -169,7 +184,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
}
}
-
+
+ @Test
public void testHandleFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
WiProProtocol wiProProtocol = new WiProProtocol(defaultListener);
@@ -180,6 +196,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
+
+ @Test
public void testHandleFrameCorrupt(){
SampleRpc sampleRpc = new SampleRpc(4);
BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
@@ -193,7 +211,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
-
+
+ @Test
public void testHandleSingleFrameMessageFrame(){
SampleRpc sampleRpc = new SampleRpc(4);
WiProProtocol wiProProtocol = new WiProProtocol(defaultListener);
@@ -208,7 +227,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
Assert.fail("Exceptin during handleSingleFrameMessageFrame - " + e.toString());
}
}
-
+
+ @Test
public void testHandleSingleFrameMessageFrameCorruptBfh(){
SampleRpc sampleRpc = new SampleRpc(4);
@@ -246,13 +266,14 @@ public class WiProProtocolTests extends AndroidTestCase2 {
}
-
+ @Before
public void setUp(){
- config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ config = new MultiplexTransportConfig(getContext(),SdlUnitTestContants.TEST_APP_ID);
connection = new SdlConnectionTestClass(config, null);
protocol = new WiProProtocol(connection);
}
-
+
+ @Test
public void testNormalCase(){
setUp();
payload = new byte[]{0x00,0x02,0x05,0x01,0x01,0x01,0x05,0x00};
@@ -296,7 +317,8 @@ public class WiProProtocolTests extends AndroidTestCase2 {
assertNull(np_exception);
assertNull(oom_error);
}
-
+
+ @Test
public void testOverallocatingAccumulator(){
setUp();
ByteArrayOutputStream builder = new ByteArrayOutputStream();
@@ -364,7 +386,7 @@ public class WiProProtocolTests extends AndroidTestCase2 {
public void onTransportDisconnected(String info) {
connected = false;
//Grab a currently running router service
- RouterServiceValidator rsvp2 = new RouterServiceValidator(mContext);
+ RouterServiceValidator rsvp2 = new RouterServiceValidator(getContext());
rsvp2.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
assertTrue(rsvp2.validate());
assertNotNull(rsvp2.getService());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
index 023a6f8e9..db9d7f5b2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.test;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
@@ -8,10 +9,19 @@ import com.smartdevicelink.proxy.RPCResponse;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.Iterator;
-public abstract class BaseRpcTests extends AndroidTestCase2 {
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public abstract class BaseRpcTests {
public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
@@ -39,7 +49,7 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
*/
protected abstract JSONObject getExpectedParameters(int sdlVersion);
- @Override
+ @Before
public void setUp(){
this.msg = createMessage();
if (msg instanceof RPCRequest) {
@@ -51,10 +61,12 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
}
+ @Test
public void testCreation(){
assertNotNull("Object creation failed.", msg);
}
+ @Test
public void testCorrelationId(){
int correlationId;
if (msg instanceof RPCRequest) {
@@ -68,6 +80,7 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
}
+ @Test
public void testMessageType(){
String messageType = msg.getMessageType();
@@ -75,6 +88,7 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
assertEquals("Message type was not REQUEST.", getMessageType(), messageType);
}
+ @Test
public void testCommandType(){
String command = msg.getFunctionName();
@@ -83,6 +97,7 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
}
+ @Test
public void testFunctionName(){
String funcName = msg.getFunctionName();
@@ -90,6 +105,7 @@ public abstract class BaseRpcTests extends AndroidTestCase2 {
assertEquals("Function name did not match expected name.", getCommandType(), funcName);
}
+ @Test
public void testJson(){
try{
JSONObject reference = buildJsonStore();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
index 602e638ae..f5cc9827d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
@@ -214,7 +214,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Vector;
-public class Test {
+public class TestValues {
//Versions
public static final Version MAX_RPC_VERSION_SUPPORTED = SdlProxyBase.MAX_SUPPORTED_RPC_VERSION;
@@ -353,7 +353,7 @@ public class Test {
public static final WayPointType GENERAL_WAYPOINTTYPE = WayPointType.DESTINATION;
public static final SingleTireStatus GENERAL_SINGLETIRESTATUS = new SingleTireStatus();
public static final DriverDistractionState GENERAL_DRIVERDISTRACTIONSTATE = DriverDistractionState.DD_ON;
- public static final List<LocationDetails> GENERAL_LOCATIONDETAILS_LIST = Arrays.asList(new LocationDetails[] { Test.GENERAL_LOCATIONDETAILS, Test.GENERAL_LOCATIONDETAILS});
+ public static final List<LocationDetails> GENERAL_LOCATIONDETAILS_LIST = Arrays.asList(new LocationDetails[] { TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_LOCATIONDETAILS});
public static final AudioStreamingIndicator GENERAL_AUDIO_STREAMING_INDICATOR = AudioStreamingIndicator.PLAY;
public static final String GENERAL_APP_ID = "123e4567e8";
public static final String GENERAL_FULL_APP_ID = "123e4567-e89b-12d3-a456-426655440000";
@@ -742,8 +742,8 @@ public class Test {
GENERAL_IMAGE.setIsTemplate(GENERAL_BOOLEAN);
GENERAL_TEMPLATE_CONFIGURATION.setTemplate(GENERAL_STRING);
- GENERAL_TEMPLATE_CONFIGURATION.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
- GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+ GENERAL_TEMPLATE_CONFIGURATION.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
GENERAL_SOFTBUTTON.setIsHighlighted(GENERAL_BOOLEAN);
GENERAL_SOFTBUTTON.setSoftButtonID(GENERAL_INT);
@@ -773,7 +773,7 @@ public class Test {
GENERAL_KEYBOARDPROPERTIES.setKeypressMode(KeypressMode.SINGLE_KEYPRESS);
GENERAL_KEYBOARDPROPERTIES.setKeyboardLayout(KeyboardLayout.QWERTY);
GENERAL_KEYBOARDPROPERTIES.setLanguage(Language.EN_US);
- GENERAL_KEYBOARDPROPERTIES.setLimitedCharacterList(Test.GENERAL_STRING_LIST);
+ GENERAL_KEYBOARDPROPERTIES.setLimitedCharacterList(TestValues.GENERAL_STRING_LIST);
GENERAL_STARTTIME.setHours(GENERAL_INT);
GENERAL_STARTTIME.setMinutes(GENERAL_INT);
@@ -1039,15 +1039,15 @@ public class Test {
GENERAL_APP_SERVICE_CAPABILITIES.setAppServices(GENERAL_APPSERVICECAPABILITY_LIST);
- GENERAL_DATETIME.setDay(Test.GENERAL_INT);
- GENERAL_DATETIME.setHour(Test.GENERAL_INT);
- GENERAL_DATETIME.setMilliSecond(Test.GENERAL_INT);
- GENERAL_DATETIME.setMinute(Test.GENERAL_INT);
- GENERAL_DATETIME.setMonth(Test.GENERAL_INT);
- GENERAL_DATETIME.setSecond(Test.GENERAL_INT);
- GENERAL_DATETIME.setTzHour(Test.GENERAL_INT);
- GENERAL_DATETIME.setTzMinute(Test.GENERAL_INT);
- GENERAL_DATETIME.setYear(Test.GENERAL_INT);
+ GENERAL_DATETIME.setDay(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setHour(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMilliSecond(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMinute(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMonth(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setSecond(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setTzHour(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setTzMinute(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setYear(TestValues.GENERAL_INT);
GENERAL_WEATHERDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
GENERAL_WEATHERDATA.setTemperatureHigh(GENERAL_TEMPERATURE);
@@ -1110,10 +1110,10 @@ public class Test {
GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
- GENERAL_MODULE_INFO.setModuleId(Test.GENERAL_STRING);
- GENERAL_MODULE_INFO.setModuleLocation(Test.GENERAL_GRID);
- GENERAL_MODULE_INFO.setModuleServiceArea(Test.GENERAL_GRID);
- GENERAL_MODULE_INFO.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
+ GENERAL_MODULE_INFO.setModuleId(TestValues.GENERAL_STRING);
+ GENERAL_MODULE_INFO.setModuleLocation(TestValues.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setModuleServiceArea(TestValues.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
try {
@@ -1287,7 +1287,7 @@ public class Test {
JSON_TEXTFIELDS.put(JSON_TEXTFIELD);
JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_RESOLUTION, JSON_IMAGERESOLUTION);
- JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(Test.GENERAL_FILETYPE_LIST));
+ JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(TestValues.GENERAL_FILETYPE_LIST));
JSON_IMAGEFIELD.put(ImageField.KEY_NAME, ImageFieldName.graphic);
JSON_IMAGEFIELDS.put(JSON_IMAGEFIELD);
@@ -1345,10 +1345,10 @@ public class Test {
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST);
JSON_SEAT_LOCATIONS.put(JSON_GRID);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, Test.JSON_GRID);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, Test.JSON_GRID);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, TestValues.GENERAL_STRING);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, TestValues.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, TestValues.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
index b0f753e13..729f1e498 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
@@ -188,7 +188,7 @@ public class VehicleDataHelper{
// fuel range
public static final FuelType FUEL_RANGE_TYPE = FuelType.GASOLINE;
- public static final Float FUEL_RANGE_RANGE = Test.GENERAL_FLOAT;
+ public static final Float FUEL_RANGE_RANGE = TestValues.GENERAL_FLOAT;
public static final JSONArray JSON_FUEL_RANGE = new JSONArray();
@@ -357,7 +357,7 @@ public class VehicleDataHelper{
VEHICLE_DATA.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
- VEHICLE_DATA.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
+ VEHICLE_DATA.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
//set up the GetVehicleDataResponse object
VEHICLE_DATA_RESPONSE.setSpeed(SPEED);
@@ -389,7 +389,7 @@ public class VehicleDataHelper{
VEHICLE_DATA_RESPONSE.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA_RESPONSE.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
- VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
+ VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
}
private VehicleDataHelper(){}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
index 04c44e810..733192fdd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
@@ -1,13 +1,24 @@
package com.smartdevicelink.test.protocol;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.protocol.BinaryFrameHeader;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.test.SampleRpc;
import junit.framework.Assert;
-public class BinaryFrameHeaderTests extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public class BinaryFrameHeaderTests {
public static final byte RPC_TYPE_REQUEST = 0x00;
public static final byte RPC_TYPE_RESPONSE = 0x01;
@@ -32,7 +43,8 @@ public class BinaryFrameHeaderTests extends AndroidTestCase2 {
return null;
}
}
-
+
+ @Test
public void testAssemblyAndParse(){
BinaryFrameHeader bfh = createDummyBfh();
@@ -55,7 +67,8 @@ public class BinaryFrameHeaderTests extends AndroidTestCase2 {
assertTrue(bfh.getJsonSize() == parsedBfh.getJsonSize());
}
-
+
+ @Test
public void testCorruptHeader(){
BinaryFrameHeader bfh = createDummyBfh();
bfh.setJsonSize(5);
@@ -78,7 +91,8 @@ public class BinaryFrameHeaderTests extends AndroidTestCase2 {
BinaryFrameHeader head = BinaryFrameHeader.parseBinaryHeader(bfhBytes);
assertNull(head);
}
-
+
+ @Test
public void testJsonSetException(){
try{
BinaryFrameHeader bfh = createDummyBfh();
@@ -88,7 +102,8 @@ public class BinaryFrameHeaderTests extends AndroidTestCase2 {
//Pass
}
}
-
+
+ @Test
public void testAlteredDataInSampleRpc(){
SampleRpc sampleRpc = new SampleRpc(4);
//Create a corrupted header
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 7957ee227..9002f89fd 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
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.protocol.heartbeat;
import com.smartdevicelink.protocol.heartbeat.HeartbeatMonitor;
import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitorListener;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -22,10 +22,10 @@ public class HeartbeatMonitorTests extends TestCase {
private Timer timer;
public void testValues () {
- assertNotNull(Test.NOT_NULL, monitor);
+ assertNotNull(TestValues.NOT_NULL, monitor);
testRunnable = monitor.getHeartbeatRunnable();
- assertNotNull(Test.NOT_NULL, testRunnable);
+ assertNotNull(TestValues.NOT_NULL, testRunnable);
int testInterval = 100;
monitor.setInterval(testInterval);
@@ -35,7 +35,7 @@ public class HeartbeatMonitorTests extends TestCase {
public void testThread () {
try {
Thread testThread = new Thread(testRunnable);
- assertNotNull(Test.NOT_NULL, testThread);
+ assertNotNull(TestValues.NOT_NULL, testThread);
setTimeout(5000, testThread); // Cannot leave thread hanging
testThread.start();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/InternalProxyMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/InternalProxyMessageTests.java
index f5baf5e06..ec64ed99d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/InternalProxyMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/InternalProxyMessageTests.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.proxy;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -19,17 +19,17 @@ public class InternalProxyMessageTests extends TestCase {
// Valid Tests
String test = "functionName";
InternalProxyMessage testIPM = new InternalProxyMessage(test);
- assertEquals(Test.MATCH, test, testIPM.getFunctionName());
+ assertEquals(TestValues.MATCH, test, testIPM.getFunctionName());
test = "OnProxyError";
- assertEquals(Test.MATCH, test, InternalProxyMessage.OnProxyError);
+ assertEquals(TestValues.MATCH, test, InternalProxyMessage.OnProxyError);
test = "OnProxyOpened";
- assertEquals(Test.MATCH, test, InternalProxyMessage.OnProxyOpened);
+ assertEquals(TestValues.MATCH, test, InternalProxyMessage.OnProxyOpened);
test = "OnProxyClosed";
- assertEquals(Test.MATCH, test, InternalProxyMessage.OnProxyClosed);
+ assertEquals(TestValues.MATCH, test, InternalProxyMessage.OnProxyClosed);
// Invalid/Null Tests
testIPM = new InternalProxyMessage(null);
- assertNull(Test.NULL, testIPM.getFunctionName());
+ assertNull(TestValues.NULL, testIPM.getFunctionName());
}
} \ No newline at end of file
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
index 55d22dcfd..082c87fda 100644
--- 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
@@ -4,7 +4,7 @@ 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.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -21,10 +21,10 @@ public class LockScreenManagerTest extends TestCase {
public void testDriverDistStatus(){
LockScreenManager lockMan = new LockScreenManager();
lockMan.setDriverDistStatus(true);
- assertEquals(Test.MATCH, true, (boolean) lockMan.getLockObj().getDriverDistractionStatus());
+ assertEquals(TestValues.MATCH, true, (boolean) lockMan.getLockObj().getDriverDistractionStatus());
lockMan.setDriverDistStatus(false);
- assertEquals(Test.MATCH, false, (boolean) lockMan.getLockObj().getDriverDistractionStatus());
+ assertEquals(TestValues.MATCH, false, (boolean) lockMan.getLockObj().getDriverDistractionStatus());
}
/**
@@ -34,19 +34,19 @@ public class LockScreenManagerTest extends TestCase {
public void testHmiLevelStatus(){
LockScreenManager lockMan = new LockScreenManager();
lockMan.setHMILevel(HMILevel.HMI_BACKGROUND);
- assertEquals(Test.MATCH, HMILevel.HMI_BACKGROUND, lockMan.getLockObj().getHMILevel());
+ assertEquals(TestValues.MATCH, HMILevel.HMI_BACKGROUND, lockMan.getLockObj().getHMILevel());
lockMan.setHMILevel(HMILevel.HMI_FULL);
- assertEquals(Test.MATCH, HMILevel.HMI_FULL, lockMan.getLockObj().getHMILevel());
+ assertEquals(TestValues.MATCH, HMILevel.HMI_FULL, lockMan.getLockObj().getHMILevel());
lockMan.setHMILevel(HMILevel.HMI_LIMITED);
- assertEquals(Test.MATCH, HMILevel.HMI_LIMITED, lockMan.getLockObj().getHMILevel());
+ assertEquals(TestValues.MATCH, HMILevel.HMI_LIMITED, lockMan.getLockObj().getHMILevel());
lockMan.setHMILevel(HMILevel.HMI_NONE);
- assertEquals(Test.MATCH, HMILevel.HMI_NONE, lockMan.getLockObj().getHMILevel());
+ assertEquals(TestValues.MATCH, HMILevel.HMI_NONE, lockMan.getLockObj().getHMILevel());
lockMan.setHMILevel(null);
- assertNull(Test.NULL, lockMan.getLockObj().getHMILevel());
+ assertNull(TestValues.NULL, lockMan.getLockObj().getHMILevel());
}
/**
@@ -55,8 +55,8 @@ public class LockScreenManagerTest extends TestCase {
public void testLockScreenStatusNull(){
LockScreenManager lockMan = new LockScreenManager();
OnLockScreenStatus result = lockMan.getLockObj();
- assertNotNull(Test.NOT_NULL, result);
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertNotNull(TestValues.NOT_NULL, result);
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
}
/**
@@ -66,23 +66,23 @@ public class LockScreenManagerTest extends TestCase {
LockScreenManager lockMan = new LockScreenManager();
OnLockScreenStatus result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_NONE);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_BACKGROUND);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_FULL);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_LIMITED);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
}
/**
@@ -94,23 +94,23 @@ public class LockScreenManagerTest extends TestCase {
// HMI level is null
OnLockScreenStatus result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_NONE);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_BACKGROUND);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_FULL);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_LIMITED);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.REQUIRED, result.getShowLockScreen());
}
/**
@@ -121,22 +121,22 @@ public class LockScreenManagerTest extends TestCase {
lockMan.setDriverDistStatus(false);
OnLockScreenStatus result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_NONE);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_BACKGROUND);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OFF, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_FULL);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OPTIONAL, result.getShowLockScreen());
+ assertEquals(TestValues.MATCH, LockScreenStatus.OPTIONAL, result.getShowLockScreen());
lockMan.setHMILevel(HMILevel.HMI_LIMITED);
result = lockMan.getLockObj();
- assertEquals(Test.MATCH, LockScreenStatus.OPTIONAL, result.getShowLockScreen());
+ 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/proxy/RPCMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
index 51727bb66..6bc3011b8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -39,11 +39,11 @@ public class RPCMessageTests extends TestCase {
}
public void testGeneralGettersAndSetters(){
- String testKey = Test.GENERAL_STRING;
- Integer testInt = Test.GENERAL_INT;
+ String testKey = TestValues.GENERAL_STRING;
+ Integer testInt = TestValues.GENERAL_INT;
testMessage.setParameters(testKey, testInt);
- assertEquals(Test.MATCH, testInt, testMessage.getParameters(testKey));
+ assertEquals(TestValues.MATCH, testInt, testMessage.getParameters(testKey));
testMessage.setParameters(testKey, null);
assertNull(testMessage.getParameters(testKey));
@@ -51,38 +51,38 @@ public class RPCMessageTests extends TestCase {
public void testCommonObjectGetters(){
String stringKey = "String";
- String testString = Test.GENERAL_STRING;
+ String testString = TestValues.GENERAL_STRING;
testMessage.setParameters(stringKey, testString);
- assertEquals(Test.MATCH, testMessage.getString(stringKey), testString);
+ assertEquals(TestValues.MATCH, testMessage.getString(stringKey), testString);
String intKey = "Integer";
- Integer testInt = Test.GENERAL_INT;
+ Integer testInt = TestValues.GENERAL_INT;
testMessage.setParameters(intKey, testInt);
- assertEquals(Test.MATCH, testMessage.getInteger(intKey), testInt);
+ assertEquals(TestValues.MATCH, testMessage.getInteger(intKey), testInt);
String doubleKey = "Double";
- Double testDouble = Test.GENERAL_DOUBLE;
+ Double testDouble = TestValues.GENERAL_DOUBLE;
testMessage.setParameters(doubleKey, testDouble);
- assertEquals(Test.MATCH, testMessage.getDouble(doubleKey), testDouble);
+ assertEquals(TestValues.MATCH, testMessage.getDouble(doubleKey), testDouble);
String booleanKey = "Boolean";
- Boolean testBoolean = Test.GENERAL_BOOLEAN;
+ Boolean testBoolean = TestValues.GENERAL_BOOLEAN;
testMessage.setParameters(booleanKey, testBoolean);
- assertEquals(Test.MATCH, testMessage.getBoolean(booleanKey), testBoolean);
+ assertEquals(TestValues.MATCH, testMessage.getBoolean(booleanKey), testBoolean);
String longKey = "Long";
- Long testLong = Test.GENERAL_LONG;
+ Long testLong = TestValues.GENERAL_LONG;
testMessage.setParameters(longKey, testLong);
- assertEquals(Test.MATCH, testMessage.getLong(longKey), testLong);
+ assertEquals(TestValues.MATCH, testMessage.getLong(longKey), testLong);
testMessage.setParameters(longKey, testInt);
- assertEquals(Test.MATCH, testMessage.getLong(longKey), new Long(testInt.longValue()));
+ assertEquals(TestValues.MATCH, testMessage.getLong(longKey), new Long(testInt.longValue()));
testMessage.setParameters(longKey, testDouble);
assertNull(testMessage.getLong(longKey));
@@ -93,28 +93,28 @@ public class RPCMessageTests extends TestCase {
assertNull(testMessage.getObject(Integer.class, keyIsEmpty));
String keyLanguage = ChangeRegistration.KEY_LANGUAGE;
- Language language = Test.GENERAL_LANGUAGE;
+ Language language = TestValues.GENERAL_LANGUAGE;
testMessage.setParameters(keyLanguage, language);
- assertEquals(Test.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
+ assertEquals(TestValues.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
String languageString = language.toString();
testMessage.setParameters(keyLanguage, languageString);
- assertEquals(Test.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
+ assertEquals(TestValues.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
String keyImage = Choice.KEY_IMAGE;
- Image testImage = Test.GENERAL_IMAGE;
+ Image testImage = TestValues.GENERAL_IMAGE;
testMessage.setParameters(keyImage, testImage.getStore());
assertTrue(Validator.validateImage(testImage, (Image) testMessage.getObject(Image.class, keyImage)));
String keyDTCs = GetDTCsResponse.KEY_DTC;
- List<String> testDTCs = Test.GENERAL_STRING_LIST;
+ List<String> testDTCs = TestValues.GENERAL_STRING_LIST;
testMessage.setParameters(keyDTCs, testDTCs);
- assertEquals(Test.MATCH, testDTCs, testMessage.getObject(String.class, keyDTCs));
+ assertEquals(TestValues.MATCH, testDTCs, testMessage.getObject(String.class, keyDTCs));
String keyTTSchunks = Alert.KEY_TTS_CHUNKS;
- List<TTSChunk> testTTSchunks = Test.GENERAL_TTSCHUNK_LIST;
+ List<TTSChunk> testTTSchunks = TestValues.GENERAL_TTSCHUNK_LIST;
testMessage.setParameters(keyTTSchunks, testTTSchunks);
- assertEquals(Test.MATCH, testTTSchunks, testMessage.getObject(TTSChunk.class, keyTTSchunks));
+ assertEquals(TestValues.MATCH, testTTSchunks, testMessage.getObject(TTSChunk.class, keyTTSchunks));
List<Hashtable<String, Object>> testListTTSchunks = new ArrayList<>();
for(TTSChunk ttsChunk : testTTSchunks){
@@ -125,16 +125,16 @@ public class RPCMessageTests extends TestCase {
assertTrue(Validator.validateTtsChunks(testTTSchunks, underTest));
String keyMediaClockFormats = DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS;
- List<MediaClockFormat> testMediaClockFormats = Test.GENERAL_MEDIACLOCKFORMAT_LIST;
+ List<MediaClockFormat> testMediaClockFormats = TestValues.GENERAL_MEDIACLOCKFORMAT_LIST;
testMessage.setParameters(keyMediaClockFormats, testMediaClockFormats);
- assertEquals(Test.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
+ assertEquals(TestValues.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
List<String> testListMediaClockFormats = new ArrayList<>();
for(MediaClockFormat mcFormat : testMediaClockFormats){
testListMediaClockFormats.add(mcFormat.toString());
}
testMessage.setParameters(keyMediaClockFormats, testListMediaClockFormats);
- assertEquals(Test.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
+ assertEquals(TestValues.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
assertNull(testMessage.getObject(Image.class, keyLanguage)); // Test incorrect class
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
index 4762bc2b9..8c66446af 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
@@ -51,7 +51,7 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
import com.smartdevicelink.test.NullValues;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -75,14 +75,14 @@ public class RPCRequestFactoryTests extends TestCase {
testData = "test";
testInt = 0;
testBSR = RPCRequestFactory.buildSystemRequest(testData, testInt);
- assertNotNull(Test.NOT_NULL, testBSR.getBulkData());
- assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
+ assertNotNull(TestValues.NOT_NULL, testBSR.getBulkData());
+ assertEquals(TestValues.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(testData, null);
- assertNotNull(Test.NULL, testBSR.getCorrelationID());
+ assertNotNull(TestValues.NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(null, testInt);
- assertNull(Test.NULL, testBSR);
+ assertNull(TestValues.NULL, testBSR);
// Test -- buildSystemRequestLegacy(Vector<String> data, Integer correlationID)
testVData = new Vector<String>();
@@ -90,14 +90,14 @@ public class RPCRequestFactoryTests extends TestCase {
testVData.add("Test B");
testVData.add("Test C");
testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, testInt);
- assertEquals(Test.MATCH, testVData, new Vector<String>(testBSR.getLegacyData()));
- assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
+ assertEquals(TestValues.MATCH, testVData, new Vector<String>(testBSR.getLegacyData()));
+ assertEquals(TestValues.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, null);
- assertNotNull(Test.NOT_NULL, testBSR.getCorrelationID());
+ assertNotNull(TestValues.NOT_NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(null, testInt);
- assertNull(Test.NULL, testBSR);
+ assertNull(TestValues.NULL, testBSR);
// Issue #166 -- Null values within the Vector<String> parameter.
// TODO: Once resolved, add the following test.
@@ -131,20 +131,20 @@ public class RPCRequestFactoryTests extends TestCase {
testVrCommands.add("Test A");
testVrCommands.add("Test B");
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testImage, testCorrelationID);
- assertEquals(Test.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(Test.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(Test.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(Test.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(Test.MATCH, testVrCommands, testBAC.getVrCommands());
- assertTrue(Test.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
- assertEquals(Test.MATCH, testCorrelationID, testBAC.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
+ assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
+ assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
+ assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
+ assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
+ assertTrue(TestValues.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null, null);
- assertNull(Test.NULL, testBAC.getCmdID());
- assertNull(Test.NULL, testBAC.getMenuParams());
- assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
+ assertNull(TestValues.NULL, testBAC.getCmdID());
+ assertNull(TestValues.NULL, testBAC.getMenuParams());
+ assertNull(TestValues.NULL, testBAC.getVrCommands());
+ assertNull(TestValues.NULL, testBAC.getCmdIcon());
+ assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
testIconValue = "icon";
@@ -153,59 +153,59 @@ public class RPCRequestFactoryTests extends TestCase {
testImage.setValue(testIconValue);
testImage.setImageType(testIconType);
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testIconValue, testIconType, testCorrelationID);
- assertEquals(Test.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(Test.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(Test.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(Test.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(Test.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(Test.MATCH, testCorrelationID, testBAC.getCorrelationID());
- assertTrue(Test.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
+ assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
+ assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
+ assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
+ assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
+ assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testBAC.getCmdID());
- assertNull(Test.NULL, testBAC.getMenuParams());
- assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
+ assertNull(TestValues.NULL, testBAC.getCmdID());
+ assertNull(TestValues.NULL, testBAC.getMenuParams());
+ assertNull(TestValues.NULL, testBAC.getVrCommands());
+ assertNull(TestValues.NULL, testBAC.getCmdIcon());
+ assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testCorrelationID);
- assertEquals(Test.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(Test.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(Test.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(Test.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(Test.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(Test.MATCH, testCorrelationID, testBAC.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
+ assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
+ assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
+ assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
+ assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null);
- assertNull(Test.NULL, testBAC.getCmdID());
- assertNull(Test.NULL, testBAC.getMenuParams());
- assertNull(Test.NULL, testBAC.getVrCommands());
- assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
+ assertNull(TestValues.NULL, testBAC.getCmdID());
+ assertNull(TestValues.NULL, testBAC.getMenuParams());
+ assertNull(TestValues.NULL, testBAC.getVrCommands());
+ assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testVrCommands, testCorrelationID);
- assertEquals(Test.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(Test.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(Test.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(Test.MATCH, testCorrelationID, testBAC.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
+ assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
+ assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null);
- assertNull(Test.NULL, testBAC.getCmdID());
- assertNull(Test.NULL, testBAC.getMenuParams());
- assertNull(Test.NULL, testBAC.getVrCommands());
- assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
+ assertNull(TestValues.NULL, testBAC.getCmdID());
+ assertNull(TestValues.NULL, testBAC.getMenuParams());
+ assertNull(TestValues.NULL, testBAC.getVrCommands());
+ assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testVrCommands, testCorrelationID);
- assertEquals(Test.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(Test.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(Test.MATCH, testCorrelationID, testBAC.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
+ assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
testBAC = RPCRequestFactory.buildAddCommand(null, null, null);
- assertNull(Test.NULL, testBAC.getCmdID());
- assertNull(Test.NULL, testBAC.getVrCommands());
- assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
+ assertNull(TestValues.NULL, testBAC.getCmdID());
+ assertNull(TestValues.NULL, testBAC.getVrCommands());
+ assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
}
public void testBuildAddSubMenu () {
@@ -222,16 +222,16 @@ public class RPCRequestFactoryTests extends TestCase {
testPosition = 1;
testCorrelationID = 2;
testBASM = RPCRequestFactory.buildAddSubMenu(testMenuID, testMenuName, testPosition, testCorrelationID);
- assertEquals(Test.MATCH, testMenuID, testBASM.getMenuID());
- assertEquals(Test.MATCH, testMenuName, testBASM.getMenuName());
- assertEquals(Test.MATCH, testPosition, testBASM.getPosition());
- assertEquals(Test.MATCH, testCorrelationID, testBASM.getCorrelationID());
+ assertEquals(TestValues.MATCH, testMenuID, testBASM.getMenuID());
+ assertEquals(TestValues.MATCH, testMenuName, testBASM.getMenuName());
+ assertEquals(TestValues.MATCH, testPosition, testBASM.getPosition());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBASM.getCorrelationID());
testBASM = RPCRequestFactory.buildAddSubMenu(null, null, null, null);
- assertNull(Test.NULL, testBASM.getMenuID());
- assertNull(Test.NULL, testBASM.getMenuName());
- assertNull(Test.NULL, testBASM.getPosition());
- assertNotNull(Test.NOT_NULL, testBASM.getCorrelationID());
+ assertNull(TestValues.NULL, testBASM.getMenuID());
+ assertNull(TestValues.NULL, testBASM.getMenuName());
+ assertNull(TestValues.NULL, testBASM.getPosition());
+ assertNotNull(TestValues.NOT_NULL, testBASM.getCorrelationID());
}
public void testBuildAlert () {
@@ -255,7 +255,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSoftButtons.add(test1);
testSoftButtons.add(test2);
testAlert = RPCRequestFactory.buildAlert(testTTSText, testPlayTone, testSoftButtons, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
// ^ Calls another build method.
// Test -- buildAlert(String alertText1, String alertText2, String alertText3, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
@@ -267,7 +267,7 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildAlert(String ttsText, String alertText1, String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
testAlert = RPCRequestFactory.buildAlert(testTTSText, testAlertText1, testAlertText2, testAlertText3, testPlayTone, testDuration, testSoftButtons, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
// ^ Calls another build method.
// Test -- buildAlert(Vector<TTSChunk> chunks, Boolean playTone, Vector<SoftButton> softButtons, Integer correlationID)
@@ -276,24 +276,24 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildAlert(Vector<TTSChunk> ttsChunks, String alertText1, String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
testTtsChunks = TTSChunkFactory.createSimpleTTSChunks(testTTSText);
testAlert = RPCRequestFactory.buildAlert(testTtsChunks, testAlertText1, testAlertText2, testAlertText3, testPlayTone, testDuration, testSoftButtons, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
- assertEquals(Test.MATCH, testAlertText1, testAlert.getAlertText1());
- assertEquals(Test.MATCH, testAlertText2, testAlert.getAlertText2());
- assertEquals(Test.MATCH, testAlertText3, testAlert.getAlertText3());
- assertEquals(Test.MATCH, testPlayTone, testAlert.getPlayTone());
- assertEquals(Test.MATCH, testDuration, testAlert.getDuration());
- assertTrue(Test.TRUE, Validator.validateSoftButtons(testSoftButtons, testAlert.getSoftButtons()));
- assertEquals(Test.MATCH, testCorrelationID, testAlert.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
+ assertEquals(TestValues.MATCH, testAlertText1, testAlert.getAlertText1());
+ assertEquals(TestValues.MATCH, testAlertText2, testAlert.getAlertText2());
+ assertEquals(TestValues.MATCH, testAlertText3, testAlert.getAlertText3());
+ assertEquals(TestValues.MATCH, testPlayTone, testAlert.getPlayTone());
+ assertEquals(TestValues.MATCH, testDuration, testAlert.getDuration());
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testAlert.getSoftButtons()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testAlert.getCorrelationID());
testAlert = RPCRequestFactory.buildAlert((Vector<TTSChunk>) null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testAlert.getTtsChunks());
- assertNull(Test.NULL, testAlert.getAlertText1());
- assertNull(Test.NULL, testAlert.getAlertText2());
- assertNull(Test.NULL, testAlert.getAlertText3());
- assertNull(Test.NULL, testAlert.getPlayTone());
- assertNull(Test.NULL, testAlert.getDuration());
- assertNull(Test.NULL, testAlert.getSoftButtons());
- assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
+ assertNull(TestValues.NULL, testAlert.getTtsChunks());
+ assertNull(TestValues.NULL, testAlert.getAlertText1());
+ assertNull(TestValues.NULL, testAlert.getAlertText2());
+ assertNull(TestValues.NULL, testAlert.getAlertText3());
+ assertNull(TestValues.NULL, testAlert.getPlayTone());
+ assertNull(TestValues.NULL, testAlert.getDuration());
+ assertNull(TestValues.NULL, testAlert.getSoftButtons());
+ assertNotNull(TestValues.NOT_NULL, testAlert.getCorrelationID());
// Test -- buildAlert(String ttsText, Boolean playTone, Integer correlationID)
// ^ Calls another build method.
@@ -309,20 +309,20 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildAlert(Vector<TTSChunk> ttsChunks, String alertText1, String alertText2, Boolean playTone, Integer duration, Integer correlationID)
testAlert = RPCRequestFactory.buildAlert(testTtsChunks, testAlertText1, testAlertText2, testPlayTone, testDuration, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
- assertEquals(Test.MATCH, testAlertText1, testAlert.getAlertText1());
- assertEquals(Test.MATCH, testAlertText2, testAlert.getAlertText2());
- assertEquals(Test.MATCH, testPlayTone, testAlert.getPlayTone());
- assertEquals(Test.MATCH, testDuration, testAlert.getDuration());
- assertEquals(Test.MATCH, testCorrelationID, testAlert.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
+ assertEquals(TestValues.MATCH, testAlertText1, testAlert.getAlertText1());
+ assertEquals(TestValues.MATCH, testAlertText2, testAlert.getAlertText2());
+ assertEquals(TestValues.MATCH, testPlayTone, testAlert.getPlayTone());
+ assertEquals(TestValues.MATCH, testDuration, testAlert.getDuration());
+ assertEquals(TestValues.MATCH, testCorrelationID, testAlert.getCorrelationID());
testAlert = RPCRequestFactory.buildAlert((Vector<TTSChunk>) null, null, null, null, null, null);
- assertNull(Test.NULL, testAlert.getTtsChunks());
- assertNull(Test.NULL, testAlert.getAlertText1());
- assertNull(Test.NULL, testAlert.getAlertText2());
- assertNull(Test.NULL, testAlert.getPlayTone());
- assertNull(Test.NULL, testAlert.getDuration());
- assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
+ assertNull(TestValues.NULL, testAlert.getTtsChunks());
+ assertNull(TestValues.NULL, testAlert.getAlertText1());
+ assertNull(TestValues.NULL, testAlert.getAlertText2());
+ assertNull(TestValues.NULL, testAlert.getPlayTone());
+ assertNull(TestValues.NULL, testAlert.getDuration());
+ assertNotNull(TestValues.NOT_NULL, testAlert.getCorrelationID());
}
public void testBuildCreateInteractionChoiceSet () {
@@ -338,14 +338,14 @@ public class RPCRequestFactoryTests extends TestCase {
Choice testChoice = new Choice();
testChoiceSet.add(testChoice);
testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(testChoiceSet, testICSID, testCorrelationID);
- assertEquals(Test.MATCH, testChoiceSet, testBCICS.getChoiceSet());
- assertEquals(Test.MATCH, testICSID, testBCICS.getInteractionChoiceSetID());
- assertEquals(Test.MATCH, testCorrelationID, testBCICS.getCorrelationID());
+ assertEquals(TestValues.MATCH, testChoiceSet, testBCICS.getChoiceSet());
+ assertEquals(TestValues.MATCH, testICSID, testBCICS.getInteractionChoiceSetID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testBCICS.getCorrelationID());
testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(null, null, null);
- assertNull(Test.NULL, testBCICS.getChoiceSet());
- assertNull(Test.NULL, testBCICS.getInteractionChoiceSetID());
- assertNotNull(Test.NOT_NULL, testBCICS.getCorrelationID());
+ assertNull(TestValues.NULL, testBCICS.getChoiceSet());
+ assertNull(TestValues.NULL, testBCICS.getInteractionChoiceSetID());
+ assertNotNull(TestValues.NOT_NULL, testBCICS.getCorrelationID());
}
public void testBuildDeleteCommand () {
@@ -357,12 +357,12 @@ public class RPCRequestFactoryTests extends TestCase {
testCID = 0;
testCorrelationID = 1;
testDC = RPCRequestFactory.buildDeleteCommand(testCID, testCorrelationID);
- assertEquals(Test.MATCH, testCID, testDC.getCmdID());
- assertEquals(Test.MATCH, testCorrelationID, testDC.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCID, testDC.getCmdID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testDC.getCorrelationID());
testDC = RPCRequestFactory.buildDeleteCommand(null, null);
- assertNull(Test.NULL, testDC.getCmdID());
- assertNotNull(Test.NOT_NULL, testDC.getCorrelationID());
+ assertNull(TestValues.NULL, testDC.getCmdID());
+ assertNotNull(TestValues.NOT_NULL, testDC.getCorrelationID());
}
@@ -376,12 +376,12 @@ public class RPCRequestFactoryTests extends TestCase {
testCorrelationID = 0;
testFileName = "test";
testDF = RPCRequestFactory.buildDeleteFile(testFileName, testCorrelationID);
- assertEquals(Test.MATCH, testCorrelationID, testDF.getCorrelationID());
- assertEquals(Test.MATCH, testFileName, testDF.getSdlFileName());
+ assertEquals(TestValues.MATCH, testCorrelationID, testDF.getCorrelationID());
+ assertEquals(TestValues.MATCH, testFileName, testDF.getSdlFileName());
testDF = RPCRequestFactory.buildDeleteFile(null, null);
- assertNotNull(Test.NOT_NULL, testDF.getCorrelationID());
- assertNull(Test.NULL, testDF.getSdlFileName());
+ assertNotNull(TestValues.NOT_NULL, testDF.getCorrelationID());
+ assertNull(TestValues.NULL, testDF.getSdlFileName());
}
@@ -394,12 +394,12 @@ public class RPCRequestFactoryTests extends TestCase {
testICSID = 0;
testCorrelationID = 1;
testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(testICSID, testCorrelationID);
- assertEquals(Test.MATCH, testICSID, testDICS.getInteractionChoiceSetID());
- assertEquals(Test.MATCH, testCorrelationID, testDICS.getCorrelationID());
+ assertEquals(TestValues.MATCH, testICSID, testDICS.getInteractionChoiceSetID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testDICS.getCorrelationID());
testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(null, null);
- assertNull(Test.NULL, testDICS.getInteractionChoiceSetID());
- assertNotNull(Test.NOT_NULL, testDICS.getCorrelationID());
+ assertNull(TestValues.NULL, testDICS.getInteractionChoiceSetID());
+ assertNotNull(TestValues.NOT_NULL, testDICS.getCorrelationID());
}
public void testBuildDeleteSubMenu () {
@@ -411,12 +411,12 @@ public class RPCRequestFactoryTests extends TestCase {
testMenuID = 0;
testCorrelationID = 1;
testDSM = RPCRequestFactory.buildDeleteSubMenu(testMenuID, testCorrelationID);
- assertEquals(Test.MATCH, testMenuID, testDSM.getMenuID());
- assertEquals(Test.MATCH, testCorrelationID, testDSM.getCorrelationID());
+ assertEquals(TestValues.MATCH, testMenuID, testDSM.getMenuID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testDSM.getCorrelationID());
testDSM = RPCRequestFactory.buildDeleteSubMenu(null, null);
- assertNull(Test.NULL, testDSM.getMenuID());
- assertNotNull(Test.NOT_NULL, testDSM.getCorrelationID());
+ assertNull(TestValues.NULL, testDSM.getMenuID());
+ assertNotNull(TestValues.NOT_NULL, testDSM.getCorrelationID());
}
public void testBuildListFiles () {
@@ -426,10 +426,10 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildListFiles(Integer correlationID)
testLF = RPCRequestFactory.buildListFiles(testCorrelationID);
- assertEquals(Test.MATCH, testCorrelationID, testLF.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testLF.getCorrelationID());
testLF = RPCRequestFactory.buildListFiles(null);
- assertNotNull(Test.NOT_NULL, testLF.getCorrelationID());
+ assertNotNull(TestValues.NOT_NULL, testLF.getCorrelationID());
}
@SuppressWarnings("deprecation")
@@ -460,26 +460,26 @@ public class RPCRequestFactoryTests extends TestCase {
testCSIDs.add(0);
testCSIDs.add(1);
testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testTimeoutChunks, testIM, testTimeout, testVrHelpItems, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(Test.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(Test.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
- assertEquals(Test.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(Test.MATCH, testTimeout, testPI.getTimeout());
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(testVrHelpItems, testPI.getVrHelp()));
- assertEquals(Test.MATCH, testCorrelationID, testPI.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
+ assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
+ assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(testVrHelpItems, testPI.getVrHelp()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testPI.getInitialPrompt());
- assertNull(Test.NULL, testPI.getInitialText());
- assertNull(Test.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(Test.NULL, testPI.getHelpPrompt());
- assertNull(Test.NULL, testPI.getTimeoutPrompt());
- assertNull(Test.NULL, testPI.getInteractionMode());
- assertNull(Test.NULL, testPI.getTimeout());
- assertNull(Test.NULL, testPI.getVrHelp());
- assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
+ assertNull(TestValues.NULL, testPI.getInitialPrompt());
+ assertNull(TestValues.NULL, testPI.getInitialText());
+ assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
+ assertNull(TestValues.NULL, testPI.getHelpPrompt());
+ assertNull(TestValues.NULL, testPI.getTimeoutPrompt());
+ assertNull(TestValues.NULL, testPI.getInteractionMode());
+ assertNull(TestValues.NULL, testPI.getTimeout());
+ assertNull(TestValues.NULL, testPI.getVrHelp());
+ assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
@@ -492,24 +492,24 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildPerformInteraction(Vector<TTSChunk> initChunks, String displayText, Vector<Integer> interactionChoiceSetIDList, Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, InteractionMode interactionMode, Integer timeout, Integer correlationID)
testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testTimeoutChunks, testIM, testTimeout, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(Test.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(Test.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
- assertEquals(Test.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(Test.MATCH, testTimeout, testPI.getTimeout());
- assertEquals(Test.MATCH, testCorrelationID, testPI.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
+ assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
+ assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
+ assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testPI.getInitialPrompt());
- assertNull(Test.NULL, testPI.getInitialText());
- assertNull(Test.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(Test.NULL, testPI.getHelpPrompt());
- assertNull(Test.NULL, testPI.getTimeoutPrompt());
- assertNull(Test.NULL, testPI.getInteractionMode());
- assertNull(Test.NULL, testPI.getTimeout());
- assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
+ assertNull(TestValues.NULL, testPI.getInitialPrompt());
+ assertNull(TestValues.NULL, testPI.getInitialText());
+ assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
+ assertNull(TestValues.NULL, testPI.getHelpPrompt());
+ assertNull(TestValues.NULL, testPI.getTimeoutPrompt());
+ assertNull(TestValues.NULL, testPI.getInteractionMode());
+ assertNull(TestValues.NULL, testPI.getTimeout());
+ assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -522,22 +522,22 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildPerformInteraction(Vector<TTSChunk> initChunks, String displayText, Vector<Integer> interactionChoiceSetIDList, Vector<TTSChunk> helpChunks, InteractionMode interactionMode, Integer timeout, Integer correlationID)
testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testIM, testTimeout, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(Test.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(Test.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertEquals(Test.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(Test.MATCH, testTimeout, testPI.getTimeout());
- assertEquals(Test.MATCH, testCorrelationID, testPI.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
+ assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
+ assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
+ assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
+ assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null);
- assertNull(Test.NULL, testPI.getInitialPrompt());
- assertNull(Test.NULL, testPI.getInitialText());
- assertNull(Test.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(Test.NULL, testPI.getHelpPrompt());
- assertNull(Test.NULL, testPI.getInteractionMode());
- assertNull(Test.NULL, testPI.getTimeout());
- assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
+ assertNull(TestValues.NULL, testPI.getInitialPrompt());
+ assertNull(TestValues.NULL, testPI.getInitialText());
+ assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
+ assertNull(TestValues.NULL, testPI.getHelpPrompt());
+ assertNull(TestValues.NULL, testPI.getInteractionMode());
+ assertNull(TestValues.NULL, testPI.getTimeout());
+ assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -555,45 +555,45 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildPutFile(String sdlFileName, FileType fileType, Boolean persistentFile, byte[] fileData, Integer correlationID)
testPF = RPCRequestFactory.buildPutFile(testFileName, testFileType, testPFile, testFileData, testCorrelationID);
- assertEquals(Test.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(Test.MATCH, testFileType, testPF.getFileType());
- assertEquals(Test.MATCH, testPFile, testPF.getPersistentFile());
- assertTrue(Test.TRUE, Validator.validateBulkData(testFileData, testPF.getFileData()));
- assertEquals(Test.MATCH, testCorrelationID, testPF.getCorrelationID());
+ assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
+ assertEquals(TestValues.MATCH, testFileType, testPF.getFileType());
+ assertEquals(TestValues.MATCH, testPFile, testPF.getPersistentFile());
+ assertTrue(TestValues.TRUE, Validator.validateBulkData(testFileData, testPF.getFileData()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testPF.getCorrelationID());
testPF = RPCRequestFactory.buildPutFile(null, null, null, null, null);
- assertNull(Test.NULL, testPF.getSdlFileName());
- assertNull(Test.NULL, testPF.getFileType());
- assertNull(Test.NULL, testPF.getPersistentFile());
- assertNull(Test.NULL, testPF.getFileData());
- assertNotNull(Test.NOT_NULL, testPF.getCorrelationID());
+ assertNull(TestValues.NULL, testPF.getSdlFileName());
+ assertNull(TestValues.NULL, testPF.getFileType());
+ assertNull(TestValues.NULL, testPF.getPersistentFile());
+ assertNull(TestValues.NULL, testPF.getFileData());
+ assertNotNull(TestValues.NOT_NULL, testPF.getCorrelationID());
// Test -- buildPutFile(String sdlFileName, Integer iOffset, Integer iLength)
testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength);
- assertEquals(Test.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(Test.MATCH, testOffset, testPF.getOffset());
- assertEquals(Test.MATCH, testLength, testPF.getLength());
+ assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
+ assertEquals(TestValues.MATCH, testOffset, testPF.getOffset());
+ assertEquals(TestValues.MATCH, testLength, testPF.getLength());
testPF = RPCRequestFactory.buildPutFile(NullValues.STRING, NullValues.INTEGER, NullValues.INTEGER);
- assertNull(Test.NULL, testPF.getSdlFileName());
- assertNull(Test.NULL, testPF.getOffset());
- assertNull(Test.NULL, testPF.getLength());
+ assertNull(TestValues.NULL, testPF.getSdlFileName());
+ assertNull(TestValues.NULL, testPF.getOffset());
+ assertNull(TestValues.NULL, testPF.getLength());
// Test -- buildPutFile(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile)
testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength, testFileType, testPFile, testSystemFile);
- assertEquals(Test.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(Test.MATCH, testOffset, testPF.getOffset());
- assertEquals(Test.MATCH, testLength, testPF.getLength());
- assertTrue(Test.TRUE, testPF.getPersistentFile());
- assertEquals(Test.MATCH, testSystemFile, testPF.getSystemFile());
+ assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
+ assertEquals(TestValues.MATCH, testOffset, testPF.getOffset());
+ assertEquals(TestValues.MATCH, testLength, testPF.getLength());
+ assertTrue(TestValues.TRUE, testPF.getPersistentFile());
+ assertEquals(TestValues.MATCH, testSystemFile, testPF.getSystemFile());
testPF = RPCRequestFactory.buildPutFile(NullValues.STRING, NullValues.INTEGER, NullValues.INTEGER, null, NullValues.BOOLEAN, NullValues.BOOLEAN);
- assertNull(Test.NULL, testPF.getSdlFileName());
- assertNull(Test.NULL, testPF.getOffset());
- assertNull(Test.NULL, testPF.getLength());
- assertNull(Test.NULL, testPF.getFileType());
- assertNull(Test.NULL, testPF.getPersistentFile());
- assertNull(Test.NULL, testPF.getSystemFile());
+ assertNull(TestValues.NULL, testPF.getSdlFileName());
+ assertNull(TestValues.NULL, testPF.getOffset());
+ assertNull(TestValues.NULL, testPF.getLength());
+ assertNull(TestValues.NULL, testPF.getFileType());
+ assertNull(TestValues.NULL, testPF.getPersistentFile());
+ assertNull(TestValues.NULL, testPF.getSystemFile());
}
public void testBuildRegisterAppInterface () {
@@ -621,34 +621,34 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildRegisterAppInterface(SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID, Integer correlationID)
testRAI = RPCRequestFactory.buildRegisterAppInterface(testSMV, testAppName, testTTSName, testNGN, testSynonyms, testIMA, testLang, testHMILang, testHMIType, testAppID, testCorrelationID,testDI);
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(testSMV, testRAI.getSdlMsgVersion()));
- assertEquals(Test.MATCH, testAppName, testRAI.getAppName());
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSName, testRAI.getTtsName()));
- assertEquals(Test.MATCH, testNGN, testRAI.getNgnMediaScreenAppName());
- assertTrue(Test.TRUE, Validator.validateStringList(testSynonyms, testRAI.getVrSynonyms()));
- assertEquals(Test.MATCH, testIMA, testRAI.getIsMediaApplication());
- assertEquals(Test.MATCH, testLang, testRAI.getLanguageDesired());
- assertEquals(Test.MATCH, testHMILang, testRAI.getHmiDisplayLanguageDesired());
- assertEquals(Test.MATCH, AppHMIType.DEFAULT, testRAI.getAppHMIType().get(0));
- assertEquals(Test.MATCH, testAppID, testRAI.getAppID());
- assertEquals(Test.MATCH, testCorrelationID, testRAI.getCorrelationID());
- assertEquals(Test.MATCH, testDI, testRAI.getDeviceInfo());
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(testSMV, testRAI.getSdlMsgVersion()));
+ assertEquals(TestValues.MATCH, testAppName, testRAI.getAppName());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSName, testRAI.getTtsName()));
+ assertEquals(TestValues.MATCH, testNGN, testRAI.getNgnMediaScreenAppName());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(testSynonyms, testRAI.getVrSynonyms()));
+ assertEquals(TestValues.MATCH, testIMA, testRAI.getIsMediaApplication());
+ assertEquals(TestValues.MATCH, testLang, testRAI.getLanguageDesired());
+ assertEquals(TestValues.MATCH, testHMILang, testRAI.getHmiDisplayLanguageDesired());
+ assertEquals(TestValues.MATCH, AppHMIType.DEFAULT, testRAI.getAppHMIType().get(0));
+ assertEquals(TestValues.MATCH, testAppID, testRAI.getAppID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testRAI.getCorrelationID());
+ assertEquals(TestValues.MATCH, testDI, testRAI.getDeviceInfo());
testRAI = RPCRequestFactory.buildRegisterAppInterface(null, null, null, null, null, null, null, null, null, null, null,null);
- assertEquals(Test.MATCH, (Integer) 1, testRAI.getCorrelationID());
- assertEquals(Test.MATCH, testSMV.getMajorVersion(), testRAI.getSdlMsgVersion().getMajorVersion());
- assertEquals(Test.MATCH, testSMV.getMinorVersion(), testRAI.getSdlMsgVersion().getMinorVersion());
- assertNull(Test.NULL, testRAI.getAppName());
- assertNull(Test.NULL, testRAI.getTtsName());
- assertNull(Test.NULL, testRAI.getNgnMediaScreenAppName());
- assertNull(Test.NULL, testRAI.getVrSynonyms());
- assertNull(Test.NULL, testRAI.getIsMediaApplication());
- assertNotNull(Test.NOT_NULL, testRAI.getLanguageDesired());
- assertNotNull(Test.NOT_NULL, testRAI.getHmiDisplayLanguageDesired());
- assertNull(Test.NULL, testRAI.getAppHMIType());
- assertNull(Test.NULL, testRAI.getAppID());
- assertNull(Test.NULL, testRAI.getDeviceInfo());
+ assertEquals(TestValues.MATCH, (Integer) 1, testRAI.getCorrelationID());
+ assertEquals(TestValues.MATCH, testSMV.getMajorVersion(), testRAI.getSdlMsgVersion().getMajorVersion());
+ assertEquals(TestValues.MATCH, testSMV.getMinorVersion(), testRAI.getSdlMsgVersion().getMinorVersion());
+ assertNull(TestValues.NULL, testRAI.getAppName());
+ assertNull(TestValues.NULL, testRAI.getTtsName());
+ assertNull(TestValues.NULL, testRAI.getNgnMediaScreenAppName());
+ assertNull(TestValues.NULL, testRAI.getVrSynonyms());
+ assertNull(TestValues.NULL, testRAI.getIsMediaApplication());
+ assertNotNull(TestValues.NOT_NULL, testRAI.getLanguageDesired());
+ assertNotNull(TestValues.NOT_NULL, testRAI.getHmiDisplayLanguageDesired());
+ assertNull(TestValues.NULL, testRAI.getAppHMIType());
+ assertNull(TestValues.NULL, testRAI.getAppID());
+ assertNull(TestValues.NULL, testRAI.getDeviceInfo());
}
public void testBuildSetAppIcon () {
@@ -659,12 +659,12 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildSetAppIcon(String sdlFileName, Integer correlationID)
testSAI = RPCRequestFactory.buildSetAppIcon(testFileName, testCorrelationID);
- assertEquals(Test.MATCH, testFileName, testSAI.getSdlFileName());
- assertEquals(Test.MATCH, testCorrelationID, testSAI.getCorrelationID());
+ assertEquals(TestValues.MATCH, testFileName, testSAI.getSdlFileName());
+ assertEquals(TestValues.MATCH, testCorrelationID, testSAI.getCorrelationID());
testSAI = RPCRequestFactory.buildSetAppIcon(null, null);
- assertNull(Test.NULL, testSAI.getSdlFileName());
- assertNotNull(Test.NOT_NULL, testSAI.getCorrelationID());
+ assertNull(TestValues.NULL, testSAI.getSdlFileName());
+ assertNotNull(TestValues.NOT_NULL, testSAI.getCorrelationID());
}
@@ -690,32 +690,32 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, Integer correlationID)
testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
- assertEquals(Test.MATCH, testCorrelationID, testSBP.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSBP.getCorrelationID());
testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null);
- assertNull(Test.NULL, testSBP.getHelpPrompt());
- assertNull(Test.NULL, testSBP.getTimeoutPrompt());
- assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
+ assertNull(TestValues.NULL, testSBP.getHelpPrompt());
+ assertNull(TestValues.NULL, testSBP.getTimeoutPrompt());
+ assertNotNull(TestValues.NOT_NULL, testSBP.getCorrelationID());
// Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
// Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testHelpTitle, testVrHelp, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
- assertEquals(Test.MATCH, testHelpTitle, testSBP.getVrHelpTitle());
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(testVrHelp, testSBP.getVrHelp()));
- assertEquals(Test.MATCH, testCorrelationID, testSBP.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, testHelpTitle, testSBP.getVrHelpTitle());
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(testVrHelp, testSBP.getVrHelp()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSBP.getCorrelationID());
testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null, null, null);
- assertNull(Test.NULL, testSBP.getHelpPrompt());
- assertNull(Test.NULL, testSBP.getTimeoutPrompt());
- assertNull(Test.NULL, testSBP.getVrHelpTitle());
- assertNull(Test.NULL, testSBP.getVrHelp());
- assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
+ assertNull(TestValues.NULL, testSBP.getHelpPrompt());
+ assertNull(TestValues.NULL, testSBP.getTimeoutPrompt());
+ assertNull(TestValues.NULL, testSBP.getVrHelpTitle());
+ assertNull(TestValues.NULL, testSBP.getVrHelp());
+ assertNotNull(TestValues.NOT_NULL, testSBP.getCorrelationID());
}
public void testBuildSetMediaClockTimer () {
@@ -726,16 +726,16 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildSetMediaClockTimer(Integer hours, Integer minutes, Integer seconds, UpdateMode updateMode, Integer correlationID)
testSMCT = RPCRequestFactory.buildSetMediaClockTimer(hours, minutes, seconds, testMode, testCorrelationID);
- assertEquals(Test.MATCH, hours, testSMCT.getStartTime().getHours());
- assertEquals(Test.MATCH, minutes, testSMCT.getStartTime().getMinutes());
- assertEquals(Test.MATCH, seconds, testSMCT.getStartTime().getSeconds());
- assertEquals(Test.MATCH, testMode, testSMCT.getUpdateMode());
- assertEquals(Test.MATCH, testCorrelationID, testSMCT.getCorrelationID());
+ assertEquals(TestValues.MATCH, hours, testSMCT.getStartTime().getHours());
+ assertEquals(TestValues.MATCH, minutes, testSMCT.getStartTime().getMinutes());
+ assertEquals(TestValues.MATCH, seconds, testSMCT.getStartTime().getSeconds());
+ assertEquals(TestValues.MATCH, testMode, testSMCT.getUpdateMode());
+ assertEquals(TestValues.MATCH, testCorrelationID, testSMCT.getCorrelationID());
testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null);
- assertNull(Test.NULL, testSMCT.getStartTime());
- assertNull(Test.NULL, testSMCT.getUpdateMode());
- assertNotNull(Test.NOT_NULL, testSMCT.getCorrelationID());
+ assertNull(TestValues.NULL, testSMCT.getStartTime());
+ assertNull(TestValues.NULL, testSMCT.getUpdateMode());
+ assertNotNull(TestValues.NOT_NULL, testSMCT.getCorrelationID());
// Test -- buildSetMediaClockTimer(UpdateMode updateMode, Integer correlationID)
// ^ Calls another build method.
@@ -758,53 +758,53 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, String statusBar, String mediaClock, String mediaTrack, Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets, TextAlignment alignment, Integer correlationID)
testShow = RPCRequestFactory.buildShow(testText1, testText2, testText3, testText4, testStatusBar, testMediaClock, testMediaTrack, testGraphic, testSoftButtons, testCustomPresets, testAlignment, testCorrelationID);
- assertEquals(Test.MATCH, testText1, testShow.getMainField1());
- assertEquals(Test.MATCH, testText2, testShow.getMainField2());
- assertEquals(Test.MATCH, testText3, testShow.getMainField3());
- assertEquals(Test.MATCH, testText4, testShow.getMainField4());
- assertEquals(Test.MATCH, testStatusBar, testShow.getStatusBar());
- assertEquals(Test.MATCH, testMediaClock, testShow.getMediaClock());
- assertEquals(Test.MATCH, testMediaTrack, testShow.getMediaTrack());
- assertTrue(Test.TRUE, Validator.validateImage(testGraphic, testShow.getGraphic()));
- assertTrue(Test.TRUE, Validator.validateSoftButtons(testSoftButtons, testShow.getSoftButtons()));
- assertTrue(Test.TRUE, Validator.validateStringList(testCustomPresets, testShow.getCustomPresets()));
- assertEquals(Test.MATCH, testAlignment, testShow.getAlignment());
- assertEquals(Test.MATCH, testCorrelationID, testShow.getCorrelationID());
+ assertEquals(TestValues.MATCH, testText1, testShow.getMainField1());
+ assertEquals(TestValues.MATCH, testText2, testShow.getMainField2());
+ assertEquals(TestValues.MATCH, testText3, testShow.getMainField3());
+ assertEquals(TestValues.MATCH, testText4, testShow.getMainField4());
+ assertEquals(TestValues.MATCH, testStatusBar, testShow.getStatusBar());
+ assertEquals(TestValues.MATCH, testMediaClock, testShow.getMediaClock());
+ assertEquals(TestValues.MATCH, testMediaTrack, testShow.getMediaTrack());
+ assertTrue(TestValues.TRUE, Validator.validateImage(testGraphic, testShow.getGraphic()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testShow.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(testCustomPresets, testShow.getCustomPresets()));
+ assertEquals(TestValues.MATCH, testAlignment, testShow.getAlignment());
+ assertEquals(TestValues.MATCH, testCorrelationID, testShow.getCorrelationID());
testShow = RPCRequestFactory.buildShow(null, null, null, null, null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testShow.getMainField1());
- assertNull(Test.NULL, testShow.getMainField2());
- assertNull(Test.NULL, testShow.getMainField3());
- assertNull(Test.NULL, testShow.getMainField4());
- assertNull(Test.NULL, testShow.getStatusBar());
- assertNull(Test.NULL, testShow.getMediaClock());
- assertNull(Test.NULL, testShow.getMediaTrack());
- assertNull(Test.NULL, testShow.getGraphic());
- assertNull(Test.NULL, testShow.getSoftButtons());
- assertNull(Test.NULL, testShow.getCustomPresets());
- assertNull(Test.NULL, testShow.getAlignment());
- assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
+ assertNull(TestValues.NULL, testShow.getMainField1());
+ assertNull(TestValues.NULL, testShow.getMainField2());
+ assertNull(TestValues.NULL, testShow.getMainField3());
+ assertNull(TestValues.NULL, testShow.getMainField4());
+ assertNull(TestValues.NULL, testShow.getStatusBar());
+ assertNull(TestValues.NULL, testShow.getMediaClock());
+ assertNull(TestValues.NULL, testShow.getMediaTrack());
+ assertNull(TestValues.NULL, testShow.getGraphic());
+ assertNull(TestValues.NULL, testShow.getSoftButtons());
+ assertNull(TestValues.NULL, testShow.getCustomPresets());
+ assertNull(TestValues.NULL, testShow.getAlignment());
+ assertNotNull(TestValues.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
// Test -- buildShow(String mainText1, String mainText2, String statusBar, String mediaClock, String mediaTrack, TextAlignment alignment, Integer correlationID)
testShow = RPCRequestFactory.buildShow(testText1, testText2, testStatusBar, testMediaClock, testMediaTrack, testAlignment, testCorrelationID);
- assertEquals(Test.MATCH, testText1, testShow.getMainField1());
- assertEquals(Test.MATCH, testText2, testShow.getMainField2());
- assertEquals(Test.MATCH, testStatusBar, testShow.getStatusBar());
- assertEquals(Test.MATCH, testMediaClock, testShow.getMediaClock());
- assertEquals(Test.MATCH, testMediaTrack, testShow.getMediaTrack());
- assertEquals(Test.MATCH, testAlignment, testShow.getAlignment());
- assertEquals(Test.MATCH, testCorrelationID, testShow.getCorrelationID());
+ assertEquals(TestValues.MATCH, testText1, testShow.getMainField1());
+ assertEquals(TestValues.MATCH, testText2, testShow.getMainField2());
+ assertEquals(TestValues.MATCH, testStatusBar, testShow.getStatusBar());
+ assertEquals(TestValues.MATCH, testMediaClock, testShow.getMediaClock());
+ assertEquals(TestValues.MATCH, testMediaTrack, testShow.getMediaTrack());
+ assertEquals(TestValues.MATCH, testAlignment, testShow.getAlignment());
+ assertEquals(TestValues.MATCH, testCorrelationID, testShow.getCorrelationID());
testShow = RPCRequestFactory.buildShow(null, null, null, null, null, null, null);
- assertNull(Test.NULL, testShow.getMainField1());
- assertNull(Test.NULL, testShow.getMainField2());
- assertNull(Test.NULL, testShow.getStatusBar());
- assertNull(Test.NULL, testShow.getMediaClock());
- assertNull(Test.NULL, testShow.getMediaTrack());
- assertNull(Test.NULL, testShow.getAlignment());
- assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
+ assertNull(TestValues.NULL, testShow.getMainField1());
+ assertNull(TestValues.NULL, testShow.getMainField2());
+ assertNull(TestValues.NULL, testShow.getStatusBar());
+ assertNull(TestValues.NULL, testShow.getMediaClock());
+ assertNull(TestValues.NULL, testShow.getMediaTrack());
+ assertNull(TestValues.NULL, testShow.getAlignment());
+ assertNotNull(TestValues.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
@@ -819,21 +819,21 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildSpeak(String ttsText, Integer correlationID)
testSpeak = RPCRequestFactory.buildSpeak(testTTSText, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
- assertEquals(Test.MATCH, testCorrelationID, testSpeak.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSpeak.getCorrelationID());
testSpeak = RPCRequestFactory.buildSpeak((String) null, null);
- assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
+ assertNull(TestValues.NULL, testSpeak.getTtsChunks());
+ assertNotNull(TestValues.NOT_NULL, testSpeak.getCorrelationID());
// Test -- buildSpeak(Vector<TTSChunk> ttsChunks, Integer correlationID)
testSpeak = RPCRequestFactory.buildSpeak(testTTSChunks, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
- assertEquals(Test.MATCH, testCorrelationID, testSpeak.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSpeak.getCorrelationID());
testSpeak = RPCRequestFactory.buildSpeak((Vector<TTSChunk>) null, null);
- assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
+ assertNull(TestValues.NULL, testSpeak.getTtsChunks());
+ assertNotNull(TestValues.NOT_NULL, testSpeak.getCorrelationID());
}
public void testBuildSubscribeButton () {
@@ -844,12 +844,12 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildSubscribeButton(ButtonName buttonName, Integer correlationID)
testSB = RPCRequestFactory.buildSubscribeButton(testButtonName, testCorrelationID);
- assertEquals(Test.MATCH, testButtonName, testSB.getButtonName());
- assertEquals(Test.MATCH, testCorrelationID, testSB.getCorrelationID());
+ assertEquals(TestValues.MATCH, testButtonName, testSB.getButtonName());
+ assertEquals(TestValues.MATCH, testCorrelationID, testSB.getCorrelationID());
testSB = RPCRequestFactory.buildSubscribeButton(null, null);
- assertNull(Test.NULL, testSB.getButtonName());
- assertNotNull(Test.NOT_NULL, testSB.getCorrelationID());
+ assertNull(TestValues.NULL, testSB.getButtonName());
+ assertNotNull(TestValues.NOT_NULL, testSB.getCorrelationID());
}
@@ -860,10 +860,10 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildUnregisterAppInterface(Integer correlationID)
testUAI = RPCRequestFactory.buildUnregisterAppInterface(testCorrelationID);
- assertEquals(Test.MATCH, testCorrelationID, testUAI.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testUAI.getCorrelationID());
testUAI = RPCRequestFactory.buildUnregisterAppInterface(null);
- assertNotNull(Test.NOT_NULL, testUAI.getCorrelationID());
+ assertNotNull(TestValues.NOT_NULL, testUAI.getCorrelationID());
}
public void testBuildUnsubscribeButton () {
@@ -874,12 +874,12 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- buildUnsubscribeButton(ButtonName buttonName, Integer correlationID)
testUB = RPCRequestFactory.buildUnsubscribeButton(testButtonName, testCorrelationID);
- assertEquals(Test.MATCH, testButtonName, testUB.getButtonName());
- assertEquals(Test.MATCH, testCorrelationID, testUB.getCorrelationID());
+ assertEquals(TestValues.MATCH, testButtonName, testUB.getButtonName());
+ assertEquals(TestValues.MATCH, testCorrelationID, testUB.getCorrelationID());
testUB = RPCRequestFactory.buildUnsubscribeButton(null, null);
- assertNull(Test.NULL, testUB.getButtonName());
- assertNotNull(Test.NOT_NULL, testUB.getCorrelationID());
+ assertNull(TestValues.NULL, testUB.getButtonName());
+ assertNotNull(TestValues.NOT_NULL, testUB.getCorrelationID());
}
@@ -891,24 +891,24 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildSubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(Test.TRUE, testSVD.getGps());
- assertTrue(Test.TRUE, testSVD.getSpeed());
- assertTrue(Test.TRUE, testSVD.getRpm());
- assertTrue(Test.TRUE, testSVD.getFuelLevel());
- assertTrue(Test.TRUE, testSVD.getFuelLevelState());
- assertTrue(Test.TRUE, testSVD.getInstantFuelConsumption());
- assertTrue(Test.TRUE, testSVD.getExternalTemperature());
- assertTrue(Test.TRUE, testSVD.getPrndl());
- assertTrue(Test.TRUE, testSVD.getTirePressure());
- assertTrue(Test.TRUE, testSVD.getOdometer());
- assertTrue(Test.TRUE, testSVD.getBeltStatus());
- assertTrue(Test.TRUE, testSVD.getBodyInformation());
- assertTrue(Test.TRUE, testSVD.getDeviceStatus());
- assertTrue(Test.TRUE, testSVD.getDriverBraking());
- assertEquals(Test.MATCH, testCorrelationID, testSVD.getCorrelationID());
+ assertTrue(TestValues.TRUE, testSVD.getGps());
+ assertTrue(TestValues.TRUE, testSVD.getSpeed());
+ assertTrue(TestValues.TRUE, testSVD.getRpm());
+ assertTrue(TestValues.TRUE, testSVD.getFuelLevel());
+ assertTrue(TestValues.TRUE, testSVD.getFuelLevelState());
+ assertTrue(TestValues.TRUE, testSVD.getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, testSVD.getExternalTemperature());
+ assertTrue(TestValues.TRUE, testSVD.getPrndl());
+ assertTrue(TestValues.TRUE, testSVD.getTirePressure());
+ assertTrue(TestValues.TRUE, testSVD.getOdometer());
+ assertTrue(TestValues.TRUE, testSVD.getBeltStatus());
+ assertTrue(TestValues.TRUE, testSVD.getBodyInformation());
+ assertTrue(TestValues.TRUE, testSVD.getDeviceStatus());
+ assertTrue(TestValues.TRUE, testSVD.getDriverBraking());
+ assertEquals(TestValues.MATCH, testCorrelationID, testSVD.getCorrelationID());
testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(Test.NULL, testSVD.getCorrelationID());
+ assertNotNull(TestValues.NULL, testSVD.getCorrelationID());
}
public void testBuildUnsubscribeVehicleData () {
@@ -919,24 +919,24 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildUnsubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(Test.TRUE, testUVD.getGps());
- assertTrue(Test.TRUE, testUVD.getSpeed());
- assertTrue(Test.TRUE, testUVD.getRpm());
- assertTrue(Test.TRUE, testUVD.getFuelLevel());
- assertTrue(Test.TRUE, testUVD.getFuelLevelState());
- assertTrue(Test.TRUE, testUVD.getInstantFuelConsumption());
- assertTrue(Test.TRUE, testUVD.getExternalTemperature());
- assertTrue(Test.TRUE, testUVD.getPrndl());
- assertTrue(Test.TRUE, testUVD.getTirePressure());
- assertTrue(Test.TRUE, testUVD.getOdometer());
- assertTrue(Test.TRUE, testUVD.getBeltStatus());
- assertTrue(Test.TRUE, testUVD.getBodyInformation());
- assertTrue(Test.TRUE, testUVD.getDeviceStatus());
- assertTrue(Test.TRUE, testUVD.getDriverBraking());
- assertEquals(Test.MATCH, testCorrelationID, testUVD.getCorrelationID());
+ assertTrue(TestValues.TRUE, testUVD.getGps());
+ assertTrue(TestValues.TRUE, testUVD.getSpeed());
+ assertTrue(TestValues.TRUE, testUVD.getRpm());
+ assertTrue(TestValues.TRUE, testUVD.getFuelLevel());
+ assertTrue(TestValues.TRUE, testUVD.getFuelLevelState());
+ assertTrue(TestValues.TRUE, testUVD.getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, testUVD.getExternalTemperature());
+ assertTrue(TestValues.TRUE, testUVD.getPrndl());
+ assertTrue(TestValues.TRUE, testUVD.getTirePressure());
+ assertTrue(TestValues.TRUE, testUVD.getOdometer());
+ assertTrue(TestValues.TRUE, testUVD.getBeltStatus());
+ assertTrue(TestValues.TRUE, testUVD.getBodyInformation());
+ assertTrue(TestValues.TRUE, testUVD.getDeviceStatus());
+ assertTrue(TestValues.TRUE, testUVD.getDriverBraking());
+ assertEquals(TestValues.MATCH, testCorrelationID, testUVD.getCorrelationID());
testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(Test.NULL, testUVD.getCorrelationID());
+ assertNotNull(TestValues.NULL, testUVD.getCorrelationID());
}
public void testBuildGetVehicleData () {
@@ -947,25 +947,25 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildGetVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(Test.TRUE, testGVD.getGps());
- assertTrue(Test.TRUE, testGVD.getSpeed());
- assertTrue(Test.TRUE, testGVD.getRpm());
- assertTrue(Test.TRUE, testGVD.getFuelLevel());
- assertTrue(Test.TRUE, testGVD.getFuelLevelState());
- assertTrue(Test.TRUE, testGVD.getInstantFuelConsumption());
- assertTrue(Test.TRUE, testGVD.getExternalTemperature());
- assertTrue(Test.TRUE, testGVD.getPrndl());
- assertTrue(Test.TRUE, testGVD.getTirePressure());
- assertTrue(Test.TRUE, testGVD.getOdometer());
- assertTrue(Test.TRUE, testGVD.getBeltStatus());
- assertTrue(Test.TRUE, testGVD.getBodyInformation());
- assertTrue(Test.TRUE, testGVD.getDeviceStatus());
- assertTrue(Test.TRUE, testGVD.getDriverBraking());
- assertTrue(Test.TRUE, testGVD.getVin());
- assertEquals(Test.MATCH, testCorrelationID, testGVD.getCorrelationID());
+ assertTrue(TestValues.TRUE, testGVD.getGps());
+ assertTrue(TestValues.TRUE, testGVD.getSpeed());
+ assertTrue(TestValues.TRUE, testGVD.getRpm());
+ assertTrue(TestValues.TRUE, testGVD.getFuelLevel());
+ assertTrue(TestValues.TRUE, testGVD.getFuelLevelState());
+ assertTrue(TestValues.TRUE, testGVD.getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, testGVD.getExternalTemperature());
+ assertTrue(TestValues.TRUE, testGVD.getPrndl());
+ assertTrue(TestValues.TRUE, testGVD.getTirePressure());
+ assertTrue(TestValues.TRUE, testGVD.getOdometer());
+ assertTrue(TestValues.TRUE, testGVD.getBeltStatus());
+ assertTrue(TestValues.TRUE, testGVD.getBodyInformation());
+ assertTrue(TestValues.TRUE, testGVD.getDeviceStatus());
+ assertTrue(TestValues.TRUE, testGVD.getDriverBraking());
+ assertTrue(TestValues.TRUE, testGVD.getVin());
+ assertEquals(TestValues.MATCH, testCorrelationID, testGVD.getCorrelationID());
testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(Test.NULL, testGVD.getCorrelationID());
+ assertNotNull(TestValues.NULL, testGVD.getCorrelationID());
}
public void testBuildScrollableMessage () {
@@ -978,16 +978,16 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildScrollableMessage(String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID)
testSM = RPCRequestFactory.BuildScrollableMessage(testSMB, testTimeout, testSoftButtons, testCorrelationID);
- assertEquals(Test.MATCH, testSMB, testSM.getScrollableMessageBody());
- assertEquals(Test.MATCH, testTimeout, testSM.getTimeout());
- assertTrue(Test.TRUE, Validator.validateSoftButtons(testSoftButtons, testSM.getSoftButtons()));
- assertEquals(Test.MATCH, testCorrelationID, testSM.getCorrelationID());
+ assertEquals(TestValues.MATCH, testSMB, testSM.getScrollableMessageBody());
+ assertEquals(TestValues.MATCH, testTimeout, testSM.getTimeout());
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testSM.getSoftButtons()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSM.getCorrelationID());
testSM = RPCRequestFactory.BuildScrollableMessage(null, null, null, null);
- assertNull(Test.NULL, testSM.getScrollableMessageBody());
- assertNull(Test.NULL, testSM.getTimeout());
- assertNull(Test.NULL, testSM.getSoftButtons());
- assertNotNull(Test.NOT_NULL, testSM.getCorrelationID());
+ assertNull(TestValues.NULL, testSM.getScrollableMessageBody());
+ assertNull(TestValues.NULL, testSM.getTimeout());
+ assertNull(TestValues.NULL, testSM.getSoftButtons());
+ assertNotNull(TestValues.NOT_NULL, testSM.getCorrelationID());
}
public void testBuildSlider () {
@@ -1000,19 +1000,19 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildSlider(Integer numTicks, Integer position, String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID)
testSlider = RPCRequestFactory.BuildSlider(testTicks, testPosition, testHeader, testFooter, testTimeout, testCorrelationID);
- assertEquals(Test.MATCH, testTicks, testSlider.getNumTicks());
- assertEquals(Test.MATCH, testPosition, testSlider.getPosition());
- assertEquals(Test.MATCH, testHeader, testSlider.getSliderHeader());
- assertTrue(Test.TRUE, Validator.validateStringList(testFooter, testSlider.getSliderFooter()));
- assertEquals(Test.MATCH, testCorrelationID, testSlider.getCorrelationID());
+ assertEquals(TestValues.MATCH, testTicks, testSlider.getNumTicks());
+ assertEquals(TestValues.MATCH, testPosition, testSlider.getPosition());
+ assertEquals(TestValues.MATCH, testHeader, testSlider.getSliderHeader());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(testFooter, testSlider.getSliderFooter()));
+ assertEquals(TestValues.MATCH, testCorrelationID, testSlider.getCorrelationID());
testSlider = RPCRequestFactory.BuildSlider(null, null, null, null, null, null);
- assertNull(Test.NULL, testSlider.getNumTicks());
- assertNull(Test.NULL, testSlider.getPosition());
- assertNull(Test.NULL, testSlider.getSliderHeader());
- assertNull(Test.NULL, testSlider.getSliderFooter());
- assertNull(Test.NULL, testSlider.getTimeout());
- assertNotNull(Test.NOT_NULL, testSlider.getCorrelationID());
+ assertNull(TestValues.NULL, testSlider.getNumTicks());
+ assertNull(TestValues.NULL, testSlider.getPosition());
+ assertNull(TestValues.NULL, testSlider.getSliderHeader());
+ assertNull(TestValues.NULL, testSlider.getSliderFooter());
+ assertNull(TestValues.NULL, testSlider.getTimeout());
+ assertNotNull(TestValues.NOT_NULL, testSlider.getCorrelationID());
}
public void testBuildChangeRegistration () {
@@ -1023,14 +1023,14 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildChangeRegistration(Language language, Language hmiDisplayLanguage, Integer correlationID)
testCR = RPCRequestFactory.BuildChangeRegistration(testLang, testHMILang, testCorrelationID);
- assertEquals(Test.MATCH, testLang, testCR.getLanguage());
- assertEquals(Test.MATCH, testHMILang, testCR.getHmiDisplayLanguage());
- assertEquals(Test.MATCH, testCorrelationID, testCR.getCorrelationID());
+ assertEquals(TestValues.MATCH, testLang, testCR.getLanguage());
+ assertEquals(TestValues.MATCH, testHMILang, testCR.getHmiDisplayLanguage());
+ assertEquals(TestValues.MATCH, testCorrelationID, testCR.getCorrelationID());
testCR = RPCRequestFactory.BuildChangeRegistration(null, null, null);
- assertNull(Test.NULL, testCR.getLanguage());
- assertNull(Test.NULL, testCR.getHmiDisplayLanguage());
- assertNotNull(Test.NOT_NULL, testCR.getCorrelationID());
+ assertNull(TestValues.NULL, testCR.getLanguage());
+ assertNull(TestValues.NULL, testCR.getHmiDisplayLanguage());
+ assertNotNull(TestValues.NOT_NULL, testCR.getCorrelationID());
}
public void testBuildSetDisplayLayout () {
@@ -1041,12 +1041,12 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildSetDisplayLayout(String displayLayout, Integer correlationID)
testSDL = RPCRequestFactory.BuildSetDisplayLayout(testDL, testCorrelationID);
- assertEquals(Test.MATCH, testDL, testSDL.getDisplayLayout());
- assertEquals(Test.MATCH, testCorrelationID, testSDL.getCorrelationID());
+ assertEquals(TestValues.MATCH, testDL, testSDL.getDisplayLayout());
+ assertEquals(TestValues.MATCH, testCorrelationID, testSDL.getCorrelationID());
testSDL = RPCRequestFactory.BuildSetDisplayLayout(null, null);
- assertNull(Test.NULL, testSDL.getDisplayLayout());
- assertNotNull(Test.NOT_NULL, testSDL.getCorrelationID());
+ assertNull(TestValues.NULL, testSDL.getDisplayLayout());
+ assertNotNull(TestValues.NOT_NULL, testSDL.getCorrelationID());
}
public void testBuildPerformAudioPassThru () {
@@ -1065,26 +1065,26 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildPerformAudioPassThru(Vector<TTSChunk> initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2, SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample, AudioType audioType, Boolean muteAudio, Integer correlationID)
testPAPT = RPCRequestFactory.BuildPerformAudioPassThru(testInitialPrompt, testAPTDT1, testAPTDT2, testSR, testMaxDuration, testBits, testAT, testMute, testCorrelationID);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(testInitialPrompt, testPAPT.getInitialPrompt()));
- assertEquals(Test.MATCH, testAPTDT1, testPAPT.getAudioPassThruDisplayText1());
- assertEquals(Test.MATCH, testAPTDT2, testPAPT.getAudioPassThruDisplayText2());
- assertEquals(Test.MATCH, testSR, testPAPT.getSamplingRate());
- assertEquals(Test.MATCH, testMaxDuration, testPAPT.getMaxDuration());
- assertEquals(Test.MATCH, testBits, testPAPT.getBitsPerSample());
- assertEquals(Test.MATCH, testAT, testPAPT.getAudioType());
- assertEquals(Test.MATCH, testMute, testPAPT.getMuteAudio());
- assertEquals(Test.MATCH, testCorrelationID, testPAPT.getCorrelationID());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitialPrompt, testPAPT.getInitialPrompt()));
+ assertEquals(TestValues.MATCH, testAPTDT1, testPAPT.getAudioPassThruDisplayText1());
+ assertEquals(TestValues.MATCH, testAPTDT2, testPAPT.getAudioPassThruDisplayText2());
+ assertEquals(TestValues.MATCH, testSR, testPAPT.getSamplingRate());
+ assertEquals(TestValues.MATCH, testMaxDuration, testPAPT.getMaxDuration());
+ assertEquals(TestValues.MATCH, testBits, testPAPT.getBitsPerSample());
+ assertEquals(TestValues.MATCH, testAT, testPAPT.getAudioType());
+ assertEquals(TestValues.MATCH, testMute, testPAPT.getMuteAudio());
+ assertEquals(TestValues.MATCH, testCorrelationID, testPAPT.getCorrelationID());
testPAPT = RPCRequestFactory.BuildPerformAudioPassThru((Vector<TTSChunk>) null, null, null, null, null, null, null, null, null);
- assertNull(Test.NULL, testPAPT.getInitialPrompt());
- assertNull(Test.NULL, testPAPT.getAudioPassThruDisplayText1());
- assertNull(Test.NULL, testPAPT.getAudioPassThruDisplayText2());
- assertNull(Test.NULL, testPAPT.getSamplingRate());
- assertNull(Test.NULL, testPAPT.getMaxDuration());
- assertNull(Test.NULL, testPAPT.getBitsPerSample());
- assertNull(Test.NULL, testPAPT.getAudioType());
- assertNull(Test.NULL, testPAPT.getMuteAudio());
- assertNotNull(Test.NOT_NULL, testPAPT.getCorrelationID());
+ assertNull(TestValues.NULL, testPAPT.getInitialPrompt());
+ assertNull(TestValues.NULL, testPAPT.getAudioPassThruDisplayText1());
+ assertNull(TestValues.NULL, testPAPT.getAudioPassThruDisplayText2());
+ assertNull(TestValues.NULL, testPAPT.getSamplingRate());
+ assertNull(TestValues.NULL, testPAPT.getMaxDuration());
+ assertNull(TestValues.NULL, testPAPT.getBitsPerSample());
+ assertNull(TestValues.NULL, testPAPT.getAudioType());
+ assertNull(TestValues.NULL, testPAPT.getMuteAudio());
+ assertNotNull(TestValues.NOT_NULL, testPAPT.getCorrelationID());
}
public void testBuildEndAudioPassThru () {
@@ -1094,9 +1094,9 @@ public class RPCRequestFactoryTests extends TestCase {
// Test -- BuildEndAudioPassThru(Integer correlationID)
testEAPT = RPCRequestFactory.BuildEndAudioPassThru(testCorrelationID);
- assertEquals(Test.MATCH, testCorrelationID, testEAPT.getCorrelationID());
+ assertEquals(TestValues.MATCH, testCorrelationID, testEAPT.getCorrelationID());
testEAPT = RPCRequestFactory.BuildEndAudioPassThru(null);
- assertNotNull(Test.NOT_NULL, testEAPT.getCorrelationID());
+ assertNotNull(TestValues.NOT_NULL, testEAPT.getCorrelationID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
index 8496a16d5..bcf319383 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
@@ -1,13 +1,21 @@
package com.smartdevicelink.test.proxy;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.GetSystemCapability;
import com.smartdevicelink.test.Config;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
-public class RPCRequestTest extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class RPCRequestTest {
public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
@@ -15,19 +23,23 @@ public class RPCRequestTest extends AndroidTestCase2 {
protected RPCRequest msg;
- @Override
+ @Before
public void setUp(){
this.msg = new GetSystemCapability();
-
+
}
+ @Test
public void testCreation(){
assertNotNull("Object creation failed.", msg);
}
+ @Test
public void testGetCorrelationId(){
assertNotNull(this.msg.getCorrelationID());
}
+
+ @Test
public void testSettingCorrelationId(){
assertNotNull(this.msg.getCorrelationID());
msg.setCorrelationID(CORR_ID);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
index 370d30979..a61c9558e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -38,11 +38,11 @@ public class RPCStructTests extends TestCase {
}
public void testGeneralGettersAndSetters(){
- String testKey = Test.GENERAL_STRING;
- Integer testInt = Test.GENERAL_INT;
+ String testKey = TestValues.GENERAL_STRING;
+ Integer testInt = TestValues.GENERAL_INT;
testStruct.setValue(testKey, testInt);
- assertEquals(Test.MATCH, testInt, testStruct.getValue(testKey));
+ assertEquals(TestValues.MATCH, testInt, testStruct.getValue(testKey));
testStruct.setValue(testKey, null);
assertNull(testStruct.getValue(testKey));
@@ -50,38 +50,38 @@ public class RPCStructTests extends TestCase {
public void testCommonObjectGetters(){
String stringKey = "String";
- String testString = Test.GENERAL_STRING;
+ String testString = TestValues.GENERAL_STRING;
testStruct.setValue(stringKey, testString);
- assertEquals(Test.MATCH, testStruct.getString(stringKey), testString);
+ assertEquals(TestValues.MATCH, testStruct.getString(stringKey), testString);
String intKey = "Integer";
- Integer testInt = Test.GENERAL_INT;
+ Integer testInt = TestValues.GENERAL_INT;
testStruct.setValue(intKey, testInt);
- assertEquals(Test.MATCH, testStruct.getInteger(intKey), testInt);
+ assertEquals(TestValues.MATCH, testStruct.getInteger(intKey), testInt);
String doubleKey = "Double";
- Double testDouble = Test.GENERAL_DOUBLE;
+ Double testDouble = TestValues.GENERAL_DOUBLE;
testStruct.setValue(doubleKey, testDouble);
- assertEquals(Test.MATCH, testStruct.getDouble(doubleKey), testDouble);
+ assertEquals(TestValues.MATCH, testStruct.getDouble(doubleKey), testDouble);
String booleanKey = "Boolean";
- Boolean testBoolean = Test.GENERAL_BOOLEAN;
+ Boolean testBoolean = TestValues.GENERAL_BOOLEAN;
testStruct.setValue(booleanKey, testBoolean);
- assertEquals(Test.MATCH, testStruct.getBoolean(booleanKey), testBoolean);
+ assertEquals(TestValues.MATCH, testStruct.getBoolean(booleanKey), testBoolean);
String longKey = "Long";
- Long testLong = Test.GENERAL_LONG;
+ Long testLong = TestValues.GENERAL_LONG;
testStruct.setValue(longKey, testLong);
- assertEquals(Test.MATCH, testStruct.getLong(longKey), testLong);
+ assertEquals(TestValues.MATCH, testStruct.getLong(longKey), testLong);
testStruct.setValue(longKey, testInt);
- assertEquals(Test.MATCH, testStruct.getLong(longKey), new Long(testInt.longValue()));
+ assertEquals(TestValues.MATCH, testStruct.getLong(longKey), new Long(testInt.longValue()));
testStruct.setValue(longKey, testDouble);
@@ -95,26 +95,26 @@ public class RPCStructTests extends TestCase {
String keyAirbag = AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED;
VehicleDataEventStatus eventStatus = VehicleDataEventStatus.FAULT;
testStruct.setValue(keyAirbag, eventStatus);
- assertEquals(Test.MATCH, eventStatus, testStruct.getObject(VehicleDataEventStatus.class, keyAirbag));
+ assertEquals(TestValues.MATCH, eventStatus, testStruct.getObject(VehicleDataEventStatus.class, keyAirbag));
String eventStatusString = VehicleDataEventStatus.FAULT.toString();
testStruct.setValue(keyAirbag, eventStatusString);
- assertEquals(Test.MATCH, eventStatus, testStruct.getObject(VehicleDataEventStatus.class, keyAirbag));
+ assertEquals(TestValues.MATCH, eventStatus, testStruct.getObject(VehicleDataEventStatus.class, keyAirbag));
String keyImage = Choice.KEY_IMAGE;
- Image testImage = Test.GENERAL_IMAGE;
+ Image testImage = TestValues.GENERAL_IMAGE;
testStruct.setValue(keyImage, testImage.getStore());
assertTrue(Validator.validateImage(testImage, (Image) testStruct.getObject(Image.class, keyImage)));
String keyVrCommand = Choice.KEY_VR_COMMANDS;
- List<String> testCommands = Test.GENERAL_STRING_LIST;
+ List<String> testCommands = TestValues.GENERAL_STRING_LIST;
testStruct.setValue(keyVrCommand, testCommands);
- assertEquals(Test.MATCH, testCommands, testStruct.getObject(String.class, keyVrCommand));
+ assertEquals(TestValues.MATCH, testCommands, testStruct.getObject(String.class, keyVrCommand));
String keyImageFields = DisplayCapabilities.KEY_IMAGE_FIELDS;
- List<ImageField> testImageFields = Test.GENERAL_IMAGEFIELD_LIST;
+ List<ImageField> testImageFields = TestValues.GENERAL_IMAGEFIELD_LIST;
testStruct.setValue(keyImageFields, testImageFields);
- assertEquals(Test.MATCH, testImageFields, testStruct.getObject(ImageField.class, keyImageFields));
+ assertEquals(TestValues.MATCH, testImageFields, testStruct.getObject(ImageField.class, keyImageFields));
List<Hashtable<String, Object>> testListImageFields = new ArrayList<>();
for(ImageField imgField : testImageFields){
@@ -128,16 +128,16 @@ public class RPCStructTests extends TestCase {
}
String keyMediaClockFormats = DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS;
- List<MediaClockFormat> testMediaClockFormats = Test.GENERAL_MEDIACLOCKFORMAT_LIST;
+ List<MediaClockFormat> testMediaClockFormats = TestValues.GENERAL_MEDIACLOCKFORMAT_LIST;
testStruct.setValue(keyMediaClockFormats, testMediaClockFormats);
- assertEquals(Test.MATCH, testMediaClockFormats, testStruct.getObject(MediaClockFormat.class, keyMediaClockFormats));
+ assertEquals(TestValues.MATCH, testMediaClockFormats, testStruct.getObject(MediaClockFormat.class, keyMediaClockFormats));
List<String> testListMediaClockFormats = new ArrayList<>();
for(MediaClockFormat mcFormat : testMediaClockFormats){
testListMediaClockFormats.add(mcFormat.toString());
}
testStruct.setValue(keyMediaClockFormats, testListMediaClockFormats);
- assertEquals(Test.MATCH, testMediaClockFormats, testStruct.getObject(MediaClockFormat.class, keyMediaClockFormats));
+ assertEquals(TestValues.MATCH, testMediaClockFormats, testStruct.getObject(MediaClockFormat.class, keyMediaClockFormats));
assertNull(testStruct.getObject(Image.class, keyAirbag)); // Test incorrect class
}
@@ -152,7 +152,7 @@ public class RPCStructTests extends TestCase {
testStruct.setValue(invalidKey, list);
assertNull(testStruct.getObject(Integer.class, invalidKey));
- testStruct.setValue(invalidKey, Test.GENERAL_STRING);
+ testStruct.setValue(invalidKey, TestValues.GENERAL_STRING);
assertNull(testStruct.getObject(Integer.class, invalidKey));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index 482a618ff..385362be8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -1,10 +1,10 @@
package com.smartdevicelink.test.proxy;
import android.content.Context;
+import android.support.test.runner.AndroidJUnit4;
import android.telephony.TelephonyManager;
import android.util.Log;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.proxy.RPCMessage;
@@ -28,6 +28,8 @@ import com.smartdevicelink.test.streaming.video.SdlRemoteDisplayTest;
import junit.framework.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -36,35 +38,30 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
-
-public class SdlProxyBaseTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlProxyBaseTests {
public static final String TAG = "SdlProxyBaseTests";
int onUpdateListenerCounter, onFinishedListenerCounter, onResponseListenerCounter, onErrorListenerCounter, remainingRequestsExpected;
- @Override
- protected void setUp() throws Exception{
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- //Nothing here for now
- }
-
/**
* Test SdlProxyBase for handling null SdlProxyConfigurationResources
*/
+ @Test
public void testNullSdlProxyConfigurationResources() {
SdlProxyALM proxy = null;
- SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getContext());
- SdlProxyConfigurationResources config = new SdlProxyConfigurationResources("path", (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE));
+ SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getTargetContext());
+ SdlProxyConfigurationResources config = new SdlProxyConfigurationResources("path", (TelephonyManager) getTargetContext().getSystemService(Context.TELEPHONY_SERVICE));
//Construct with a non-null SdlProxyConfigurationResources
builder.setSdlProxyConfigurationResources(config);
try {
@@ -127,16 +124,17 @@ public class SdlProxyBaseTests extends AndroidTestCase2 {
}
}
+ @Test
public void testRemoteDisplayStreaming(){
SdlProxyALM proxy = null;
- SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getContext());
+ SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getTargetContext());
try{
proxy = builder.build();
// public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
Method m = SdlProxyALM.class.getDeclaredMethod("startRemoteDisplayStream", Context.class, SdlRemoteDisplay.class, VideoStreamingParameters.class, boolean.class);
assertNotNull(m);
m.setAccessible(true);
- m.invoke(proxy,getContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
+ m.invoke(proxy,getTargetContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
assert true;
}catch (Exception e){
@@ -144,18 +142,22 @@ public class SdlProxyBaseTests extends AndroidTestCase2 {
}
}
+ @Test
public void testSendRPCsAllSucceed(){
testSendMultipleRPCs(false, 1);
}
+ @Test
public void testSendRPCsSomeFail(){
testSendMultipleRPCs(false, 2);
}
+ @Test
public void testSendSequentialRPCsAllSucceed(){
testSendMultipleRPCs(true, 1);
}
+ @Test
public void testSendSequentialRPCsSomeFail(){
testSendMultipleRPCs(true, 2);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
index e28cd9a00..75b45797f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
@@ -1,8 +1,9 @@
package com.smartdevicelink.test.proxy;
+import android.support.test.runner.AndroidJUnit4;
import android.util.SparseArray;
-import com.smartdevicelink.AndroidTestCase2;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -57,12 +58,15 @@ import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.utl.AppServiceFactory;
import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.Version;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -71,6 +75,11 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+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 org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -79,29 +88,24 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class SystemCapabilityManagerTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SystemCapabilityManagerTests {
public static final String TAG = "SystemCapabilityManagerTests";
public static SystemCapabilityManager systemCapabilityManager;
private SystemCapability systemCapability;
private VideoStreamingCapability videoStreamingCapability;
- @Override
- protected void setUp() throws Exception{
- super.setUp();
+ @Before
+ public void setUp() throws Exception{
systemCapability = new SystemCapability(SystemCapabilityType.VIDEO_STREAMING);
videoStreamingCapability = new VideoStreamingCapability();
- videoStreamingCapability.setMaxBitrate(Test.GENERAL_INT);
- videoStreamingCapability.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
- videoStreamingCapability.setSupportedFormats(Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ videoStreamingCapability.setMaxBitrate(TestValues.GENERAL_INT);
+ videoStreamingCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ videoStreamingCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
systemCapability.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
public SystemCapabilityManager createSampleManager(){
return createSampleManager(new InternalSDLInterface());
}
@@ -111,15 +115,15 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
RegisterAppInterfaceResponse raiResponse = new RegisterAppInterfaceResponse();
- raiResponse.setHmiCapabilities(Test.GENERAL_HMICAPABILITIES);
- raiResponse.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
- raiResponse.setAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
- raiResponse.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- raiResponse.setHmiZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST);
- raiResponse.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
- raiResponse.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- raiResponse.setSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST);
- raiResponse.setPrerecordedSpeech(Test.GENERAL_PRERECORDEDSPEECH_LIST);
+ raiResponse.setHmiCapabilities(TestValues.GENERAL_HMICAPABILITIES);
+ raiResponse.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ raiResponse.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ raiResponse.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ raiResponse.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
+ raiResponse.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ raiResponse.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ raiResponse.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
+ raiResponse.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
raiResponse.setSuccess(true);
systemCapabilityManager.parseRAIResponse(raiResponse);
@@ -174,44 +178,47 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
return convertedCapabilities;
}
+ @Test
public void testParseRAI() {
systemCapabilityManager = createSampleManager();
- List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(Test.GENERAL_DISPLAYCAPABILITIES, Test.GENERAL_BUTTONCAPABILITIES_LIST, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- assertTrue(Test.TRUE,
+ List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ assertTrue(TestValues.TRUE,
Validator.validateDisplayCapabilityList(displayCapabilityList, (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS)));
- assertTrue(Test.TRUE,
- Validator.validateHMICapabilities(Test.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI)));
- assertTrue(Test.TRUE,
- Validator.validateDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY)));
- assertTrue(Test.TRUE,
- Validator.validateAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH)));
- assertTrue(Test.TRUE,
- Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities> )systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON)));
- assertTrue(Test.TRUE,
- Validator.validateHMIZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE)));
- assertTrue(Test.TRUE,
- Validator.validatePresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK)));
- assertTrue(Test.TRUE,
- Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON)));
- assertTrue(Test.TRUE,
- Validator.validateSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH)));
- assertTrue(Test.TRUE,
- Validator.validatePreRecordedSpeechCapabilities(Test.GENERAL_PRERECORDEDSPEECH_LIST, (List<PrerecordedSpeech>) systemCapabilityManager.getCapability(SystemCapabilityType.PRERECORDED_SPEECH)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateHMICapabilities(TestValues.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities> )systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateHMIZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE)));
+ assertTrue(TestValues.TRUE,
+ Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH)));
+ assertTrue(TestValues.TRUE,
+ Validator.validatePreRecordedSpeechCapabilities(TestValues.GENERAL_PRERECORDEDSPEECH_LIST, (List<PrerecordedSpeech>) systemCapabilityManager.getCapability(SystemCapabilityType.PRERECORDED_SPEECH)));
}
+ @Test
public void testNullDisplayCapabilitiesEnablesAllTextAndImageFields() {
- List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(null, Test.GENERAL_BUTTONCAPABILITIES_LIST, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(null, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getTextFields().size(), 29);
assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getImageFields().size(), 14);
}
+ @Test
public void testGetVSCapability(){
VideoStreamingCapability vsCapability = new VideoStreamingCapability();
- vsCapability.setMaxBitrate(Test.GENERAL_INT);
- vsCapability.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
- vsCapability.setSupportedFormats(Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ vsCapability.setMaxBitrate(TestValues.GENERAL_INT);
+ vsCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ vsCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
SystemCapability cap = new SystemCapability();
cap.setSystemCapabilityType(SystemCapabilityType.VIDEO_STREAMING);
@@ -240,7 +247,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
- assertTrue(Test.TRUE,
+ assertTrue(TestValues.TRUE,
Validator.validateVideoStreamingCapability(
(VideoStreamingCapability) referenceCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING),
(VideoStreamingCapability) capability));
@@ -291,6 +298,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
return onSendGetSystemCapabilityAnswer;
}
+ @Test
public void testGetCapability() {
ISdl internalInterface;
SystemCapabilityManager scm;
@@ -319,7 +327,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
- assertTrue(Test.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
@@ -332,7 +340,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
- assertTrue(Test.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
@@ -344,10 +352,11 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
- assertTrue(Test.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testGetCapabilityHmiNone() {
ISdl internalInterface = mock(ISdl.class);
doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_NONE)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
@@ -362,6 +371,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(onSystemCapabilityListener, times(1)).onError(any(String.class));
}
+ @Test
public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityCached() {
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
sdlMsgVersion.setPatchVersion(0);
@@ -408,6 +418,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityNotCached() {
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
sdlMsgVersion.setPatchVersion(0);
@@ -454,6 +465,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityCached() {
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
sdlMsgVersion.setPatchVersion(0);
@@ -500,6 +512,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityNotCached() {
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
sdlMsgVersion.setPatchVersion(0);
@@ -546,6 +559,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsAreNotSupported() {
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
sdlMsgVersion.setPatchVersion(0);
@@ -635,6 +649,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
}
+ @Test
public void testGetAndAddListenerForDisplaysCapability() {
ISdl internalInterface;
SystemCapabilityManager scm;
@@ -670,6 +685,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
}
+ @Test
public void testListConversion(){
SystemCapabilityManager systemCapabilityManager = createSampleManager();
Object capability = systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON);
@@ -678,12 +694,14 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertNotNull(list);
}
+ @Test
public void testFalsePositive(){
SystemCapabilityManager systemCapabilityManager = createSampleManager();
systemCapabilityManager.setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, null);
assertFalse(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.AUDIO_PASSTHROUGH));
}
+ @Test
public void testOnSystemCapabilityUpdateWithNoExistingCap(){
InternalSDLInterface iSDL = new InternalSDLInterface();
SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
@@ -709,6 +727,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES));
}
+ @Test
public void testOnSystemCapabilityUpdatedForDISPLAYS() {
InternalSDLInterface iSDL = new InternalSDLInterface();
SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
@@ -718,7 +737,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS));
assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY));
- List<DisplayCapability> newCaps = createDisplayCapabilityList(Test.GENERAL_DISPLAYCAPABILITIES, Test.GENERAL_BUTTONCAPABILITIES_LIST, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);;
+ List<DisplayCapability> newCaps = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);;
SystemCapability systemCapability = new SystemCapability();
systemCapability.setSystemCapabilityType(SystemCapabilityType.DISPLAYS);
@@ -739,6 +758,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertTrue(Validator.validateDisplayCapabilities(appliedConvertedCaps, testConvertedCaps));
}
+ @Test
public void testOnSystemCapabilityUpdated(){
InternalSDLInterface iSDL = new InternalSDLInterface();
String baseName = "NavTest", baseID = "37F98053AE";
@@ -849,18 +869,19 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
}
+ @Test
public void testOnSystemCapabilityUpdatedOverwrite(){
InternalSDLInterface iSDL = new InternalSDLInterface();
SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
assertNotNull(scmRpcListener);
- systemCapabilityManager.setCapability(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
+ systemCapabilityManager.setCapability(SystemCapabilityType.PHONE_CALL, TestValues.GENERAL_PHONECAPABILITY);
PhoneCapability phoneCapability = (PhoneCapability)systemCapabilityManager.getCapability(SystemCapabilityType.PHONE_CALL);
assertNotNull(phoneCapability);
- assertEquals(phoneCapability, Test.GENERAL_PHONECAPABILITY);
+ assertEquals(phoneCapability, TestValues.GENERAL_PHONECAPABILITY);
- phoneCapability.setDialNumberEnabled(!Test.GENERAL_PHONECAPABILITY.getDialNumberEnabled()); //Flip it
+ phoneCapability.setDialNumberEnabled(!TestValues.GENERAL_PHONECAPABILITY.getDialNumberEnabled()); //Flip it
SystemCapability systemCapability = new SystemCapability();
systemCapability.setSystemCapabilityType(SystemCapabilityType.PHONE_CALL);
systemCapability.setCapabilityForType(SystemCapabilityType.PHONE_CALL, phoneCapability);
@@ -875,6 +896,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertEquals(phoneCapability, phoneCapabilityUpdated);
}
+ @Test
public void testOnSetDisplayLayout() {
InternalSDLInterface iSDL = new InternalSDLInterface();
SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
@@ -882,10 +904,10 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertNotNull(dlRpcListener);
SetDisplayLayoutResponse newLayout = new SetDisplayLayoutResponse();
- newLayout.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
- newLayout.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- newLayout.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- newLayout.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
+ newLayout.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ newLayout.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ newLayout.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ newLayout.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
newLayout.setSuccess(true);
newLayout.setResultCode(Result.SUCCESS);
@@ -907,6 +929,7 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertNull(systemCapabilityManager.getWindowCapability(42));
}
+ @Test
public void testManagerBeforeDisplayUpdate() {
InternalSDLInterface iSDL = new InternalSDLInterface();
SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSDL);
@@ -1069,5 +1092,10 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
@Override
public void startRPCEncryption() {}
+
+ @Override
+ public Taskmaster getTaskmaster() {
+ return null;
+ }
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/TTSChunkFactoryTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/TTSChunkFactoryTests.java
index 9349a22d9..ad1976cb1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/TTSChunkFactoryTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/TTSChunkFactoryTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.proxy;
import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,40 +24,40 @@ public class TTSChunkFactoryTests extends TestCase {
public void testCreateChunk () {
// Valid Tests
SpeechCapabilities testType = SpeechCapabilities.TEXT;
- testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertEquals(Test.MATCH, testType, testChunk.getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
+ testChunk = TTSChunkFactory.createChunk(testType, TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertEquals(TestValues.MATCH, testType, testChunk.getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.SILENCE;
- testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertEquals(Test.MATCH, testType, testChunk.getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
+ testChunk = TTSChunkFactory.createChunk(testType, TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertEquals(TestValues.MATCH, testType, testChunk.getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.SAPI_PHONEMES;
- testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertEquals(Test.MATCH, testType, testChunk.getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
+ testChunk = TTSChunkFactory.createChunk(testType, TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertEquals(TestValues.MATCH, testType, testChunk.getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.PRE_RECORDED;
- testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertEquals(Test.MATCH, testType, testChunk.getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
+ testChunk = TTSChunkFactory.createChunk(testType, TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertEquals(TestValues.MATCH, testType, testChunk.getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.LHPLUS_PHONEMES;
- testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertEquals(Test.MATCH, testType, testChunk.getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
+ testChunk = TTSChunkFactory.createChunk(testType, TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertEquals(TestValues.MATCH, testType, testChunk.getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunk.getText());
// Invalid/Null Tests
testChunk = TTSChunkFactory.createChunk(null, null);
- assertNotNull(Test.NOT_NULL, testChunk);
- assertNull(Test.NULL, testChunk.getType());
- assertNull(Test.NULL, testChunk.getText());
+ assertNotNull(TestValues.NOT_NULL, testChunk);
+ assertNull(TestValues.NULL, testChunk.getType());
+ assertNull(TestValues.NULL, testChunk.getText());
}
/**
@@ -67,16 +67,16 @@ public class TTSChunkFactoryTests extends TestCase {
public void testCreateSimpleTTSChunks () {
// Test Values
Vector<TTSChunk> testChunks;
- testChunks = TTSChunkFactory.createSimpleTTSChunks(Test.GENERAL_STRING);
+ testChunks = TTSChunkFactory.createSimpleTTSChunks(TestValues.GENERAL_STRING);
// Valid Tests
- assertNotNull(Test.NOT_NULL, testChunks);
- assertEquals(Test.MATCH, SpeechCapabilities.TEXT, testChunks.get(0).getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunks.get(0).getText());
+ assertNotNull(TestValues.NOT_NULL, testChunks);
+ assertEquals(TestValues.MATCH, SpeechCapabilities.TEXT, testChunks.get(0).getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunks.get(0).getText());
// Invalid/Null Tests
testChunks = TTSChunkFactory.createSimpleTTSChunks(null);
- assertNull(Test.NULL, testChunks);
+ assertNull(TestValues.NULL, testChunks);
}
/**
@@ -86,15 +86,15 @@ public class TTSChunkFactoryTests extends TestCase {
public void testCreatePrerecordedTTSChunks () {
// Test Values
Vector<TTSChunk> testChunks;
- testChunks = TTSChunkFactory.createPrerecordedTTSChunks(Test.GENERAL_STRING);
+ testChunks = TTSChunkFactory.createPrerecordedTTSChunks(TestValues.GENERAL_STRING);
// Valid Tests
- assertNotNull(Test.NOT_NULL, testChunks);
- assertEquals(Test.MATCH, SpeechCapabilities.PRE_RECORDED, testChunks.get(0).getType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunks.get(0).getText());
+ assertNotNull(TestValues.NOT_NULL, testChunks);
+ assertEquals(TestValues.MATCH, SpeechCapabilities.PRE_RECORDED, testChunks.get(0).getType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testChunks.get(0).getText());
// Invalid/Null Tests
testChunks = TTSChunkFactory.createPrerecordedTTSChunks(null);
- assertNull(Test.NULL, testChunks);
+ assertNull(TestValues.NULL, testChunks);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
index 6b164eb16..20944a117 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
@@ -1,8 +1,11 @@
package com.smartdevicelink.test.rpc;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -18,13 +21,16 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertTrue;
/**
* This is a unit test class for the SmartDeviceLink library project
* It makes sure that for each RPC, all mandatory parameters are set in a constructor
*/
-public class RPCConstructorsTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class RPCConstructorsTests {
private final String XML_FILE_NAME = "xml/MOBILE_API.xml";
private final String RPC_PACKAGE_PREFIX = "com.smartdevicelink.proxy.rpc.";
@@ -42,13 +48,8 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
}
}
- @Override
+ @Before
public void setUp(){
- try {
- super.setUp();
- } catch (Exception e) {
- e.printStackTrace();
- }
// Map that has keys correspond to the RPC names and values correspond to the
// mandatory params for that RPC. All info are loaded from the RPC spec xml file
rpcMandatoryParamsMapFromXml = getRPCMandatoryParamsMap(XML_FILE_NAME);
@@ -60,7 +61,7 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
private Map<String, List<Parameter>> getRPCMandatoryParamsMap(String fileName) {
Map<String, List<Parameter>> rpcMandatoryParamsMap = new HashMap<>();
try {
- InputStream stream = this.mContext.getAssets().open(fileName);
+ InputStream stream = getTargetContext().getAssets().open(fileName);
XmlPullParserFactory xmlFactoryObject = XmlPullParserFactory.newInstance();
XmlPullParser myParser = xmlFactoryObject.newPullParser();
myParser.setInput(stream, null);
@@ -144,6 +145,7 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
// This method makes sure that for every RPC, there is a constructor that has all the mandatory params
// It also checks if there are RPC in the XML file that don't exist in the code
+ @Test
public void testMandatoryParamsMatch() {
// List of RPC names that don't have a constructor that has all mandatory params
List<String> rpcsWithInvalidConstructor = new ArrayList<>();
@@ -207,6 +209,7 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
}
// This method makes sure that for every RPC, the constructor that has the mandatory params is setting the values correctly
+ @Test
public void testMandatoryParamsValues() {
// List of RPC names that have a constructor which is not settings the values for the mandatory params correctly
List<String> rpcsWithInvalidConstructor = new ArrayList<>();
@@ -278,7 +281,7 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
if (param.isArray){
valueString += "_LIST";
}
- value = Class.forName("com.smartdevicelink.test.Test").getDeclaredField(valueString).get(null);
+ value = Class.forName("com.smartdevicelink.test.TestValues").getDeclaredField(valueString).get(null);
}
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
index dae248b74..82fa603f6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.AirbagStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,16 +23,16 @@ public class AirbagStatusTests extends TestCase{
@Override
public void setUp(){
msg = new AirbagStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- msg.setDriverAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setDriverCurtainAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setDriverKneeAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setDriverSideAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerCurtainAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerKneeAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerSideAirbagDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverCurtainAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverKneeAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverSideAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerCurtainAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerKneeAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerSideAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
}
@@ -51,52 +51,52 @@ public class AirbagStatusTests extends TestCase{
VehicleDataEventStatus passengerSideStatus = msg.getPassengerSideAirbagDeployed();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, airbagStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, curtainStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, kneeStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, sideStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, passengerStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, passengerCurtainStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, passengerKneeStatus);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, passengerSideStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, airbagStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, curtainStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, kneeStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, sideStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerCurtainStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerKneeStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerSideStatus);
// Invalid/Null Tests
AirbagStatus msg = new AirbagStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getDriverAirbagDeployed());
- assertNull(Test.NULL, msg.getDriverSideAirbagDeployed());
- assertNull(Test.NULL, msg.getDriverCurtainAirbagDeployed());
- assertNull(Test.NULL, msg.getPassengerAirbagDeployed());
- assertNull(Test.NULL, msg.getPassengerCurtainAirbagDeployed());
- assertNull(Test.NULL, msg.getDriverKneeAirbagDeployed());
- assertNull(Test.NULL, msg.getPassengerSideAirbagDeployed());
- assertNull(Test.NULL, msg.getPassengerKneeAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getDriverAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getDriverSideAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getDriverCurtainAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getPassengerAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getPassengerCurtainAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getDriverKneeAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getPassengerSideAirbagDeployed());
+ assertNull(TestValues.NULL, msg.getPassengerKneeAirbagDeployed());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
index d67f49159..1f143cb61 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
@@ -34,7 +34,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.AppInfo;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -55,10 +55,10 @@ public class AppInfoTests extends TestCase {
public void setUp() {
msg = new AppInfo();
- msg.setAppDisplayName(Test.GENERAL_STRING);
- msg.setAppBundleID(Test.GENERAL_STRING);
- msg.setAppVersion(Test.GENERAL_STRING);
- msg.setAppIcon(Test.GENERAL_STRING);
+ msg.setAppDisplayName(TestValues.GENERAL_STRING);
+ msg.setAppBundleID(TestValues.GENERAL_STRING);
+ msg.setAppVersion(TestValues.GENERAL_STRING);
+ msg.setAppIcon(TestValues.GENERAL_STRING);
}
/**
@@ -72,40 +72,40 @@ public class AppInfoTests extends TestCase {
String appIcon = msg.getAppIcon();
// Valid Tests
- assertEquals(Test.GENERAL_STRING, appDisplayName);
- assertEquals(Test.GENERAL_STRING, appBundleID);
- assertEquals(Test.GENERAL_STRING, appVersion);
- assertEquals(Test.GENERAL_STRING, appIcon);
+ assertEquals(TestValues.GENERAL_STRING, appDisplayName);
+ assertEquals(TestValues.GENERAL_STRING, appBundleID);
+ assertEquals(TestValues.GENERAL_STRING, appVersion);
+ assertEquals(TestValues.GENERAL_STRING, appIcon);
// Invalid/Null Tests
AppInfo msg = new AppInfo();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAppDisplayName());
- assertNull(Test.NULL, msg.getAppBundleID());
- assertNull(Test.NULL, msg.getAppVersion());
- assertNull(Test.NULL, msg.getAppIcon());
+ assertNull(TestValues.NULL, msg.getAppDisplayName());
+ assertNull(TestValues.NULL, msg.getAppBundleID());
+ assertNull(TestValues.NULL, msg.getAppVersion());
+ assertNull(TestValues.NULL, msg.getAppIcon());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AppInfo.KEY_APP_DISPLAY_NAME, Test.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_BUNDLE_ID, Test.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_VERSION, Test.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_ICON, Test.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_DISPLAY_NAME, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_BUNDLE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_VERSION, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_ICON, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
index 997984514..1579e1ec1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.AppServiceRecord;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.utl.AppServiceFactory;
@@ -34,8 +34,8 @@ public class AppServiceCapabilityTest extends TestCase {
public void setUp(){
msg = new AppServiceCapability();
- msg.setUpdatedAppServiceRecord(Test.GENERAL_APPSERVICERECORD);
- msg.setUpdateReason(Test.GENERAL_SERVICE_UPDATE_REASON);
+ msg.setUpdatedAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
+ msg.setUpdateReason(TestValues.GENERAL_SERVICE_UPDATE_REASON);
}
/**
@@ -47,32 +47,32 @@ public class AppServiceCapabilityTest extends TestCase {
ServiceUpdateReason updateReason = msg.getUpdateReason();
// Valid Tests
- assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APPSERVICERECORD);
- assertEquals(Test.MATCH, updateReason, Test.GENERAL_SERVICE_UPDATE_REASON);
+ assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
+ assertEquals(TestValues.MATCH, updateReason, TestValues.GENERAL_SERVICE_UPDATE_REASON);
// Invalid/Null Tests
AppServiceCapability msg = new AppServiceCapability();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getUpdatedAppServiceRecord());
- assertNull(Test.NULL, msg.getUpdateReason());
+ assertNull(TestValues.NULL, msg.getUpdatedAppServiceRecord());
+ assertNull(TestValues.NULL, msg.getUpdateReason());
}
public void testRequiredParamsConstructor(){
- msg = new AppServiceCapability(Test.GENERAL_APPSERVICERECORD);
+ msg = new AppServiceCapability(TestValues.GENERAL_APPSERVICERECORD);
AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
- assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APPSERVICERECORD);
+ assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AppServiceCapability.KEY_UPDATE_REASON, Test.GENERAL_SERVICE_UPDATE_REASON);
- reference.put(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD, Test.GENERAL_APPSERVICERECORD);
+ reference.put(AppServiceCapability.KEY_UPDATE_REASON, TestValues.GENERAL_SERVICE_UPDATE_REASON);
+ reference.put(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD, TestValues.GENERAL_APPSERVICERECORD);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()) {
@@ -80,13 +80,13 @@ public class AppServiceCapabilityTest extends TestCase {
if (key.equals(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateAppServiceRecord(Test.GENERAL_APPSERVICERECORD, new AppServiceRecord(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, new AppServiceRecord(hashTest)));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
index 54aff3ef5..d909d0d5d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceData;
import com.smartdevicelink.proxy.rpc.NavigationServiceData;
import com.smartdevicelink.proxy.rpc.WeatherServiceData;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,11 +29,11 @@ public class AppServiceDataTests extends TestCase {
public void setUp() {
msg = new AppServiceData();
- msg.setServiceType(Test.GENERAL_STRING);
- msg.setServiceID(Test.GENERAL_STRING);
- msg.setMediaServiceData(Test.GENERAL_MEDIASERVICEDATA);
- msg.setWeatherServiceData(Test.GENERAL_WEATHERSERVICEDATA);
- msg.setNavigationServiceData(Test.GENERAL_NAVIGATIONSERVICEDATA);
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setServiceID(TestValues.GENERAL_STRING);
+ msg.setMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA);
+ msg.setWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA);
+ msg.setNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA);
}
@@ -49,31 +49,31 @@ public class AppServiceDataTests extends TestCase {
NavigationServiceData navigationServiceData = msg.getNavigationServiceData();
// Valid Tests
- assertEquals(Test.GENERAL_STRING, appServiceType);
- assertEquals(Test.GENERAL_STRING, serviceId);
- assertEquals(Test.GENERAL_MEDIASERVICEDATA, mediaServiceData);
- assertEquals(Test.GENERAL_WEATHERSERVICEDATA, weatherServiceData);
- assertEquals(Test.GENERAL_NAVIGATIONSERVICEDATA, navigationServiceData);
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_STRING, serviceId);
+ assertEquals(TestValues.GENERAL_MEDIASERVICEDATA, mediaServiceData);
+ assertEquals(TestValues.GENERAL_WEATHERSERVICEDATA, weatherServiceData);
+ assertEquals(TestValues.GENERAL_NAVIGATIONSERVICEDATA, navigationServiceData);
// Invalid/Null Tests
AppServiceData msg = new AppServiceData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getServiceType());
- assertNull(Test.NULL, msg.getServiceID());
- assertNull(Test.NULL, msg.getMediaServiceData());
- assertNull(Test.NULL, msg.getWeatherServiceData());
- assertNull(Test.NULL, msg.getNavigationServiceData());
+ assertNull(TestValues.NULL, msg.getServiceType());
+ assertNull(TestValues.NULL, msg.getServiceID());
+ assertNull(TestValues.NULL, msg.getMediaServiceData());
+ assertNull(TestValues.NULL, msg.getWeatherServiceData());
+ assertNull(TestValues.NULL, msg.getNavigationServiceData());
}
public void testRequiredParamsConstructor(){
- msg = new AppServiceData(Test.GENERAL_STRING, Test.GENERAL_STRING);
+ msg = new AppServiceData(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
String appServiceType = msg.getServiceType();
String serviceId = msg.getServiceID();
- assertEquals(Test.GENERAL_STRING, appServiceType);
- assertEquals(Test.GENERAL_STRING, serviceId);
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_STRING, serviceId);
}
@@ -81,14 +81,14 @@ public class AppServiceDataTests extends TestCase {
JSONObject reference = new JSONObject();
try{
- reference.put(AppServiceData.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
- reference.put(AppServiceData.KEY_SERVICE_ID, Test.GENERAL_STRING);
- reference.put(AppServiceData.KEY_MEDIA_SERVICE_DATA, Test.GENERAL_MEDIASERVICEDATA);
- reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, Test.GENERAL_WEATHERSERVICEDATA);
- reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, Test.GENERAL_NAVIGATIONSERVICEDATA);
+ reference.put(AppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_MEDIA_SERVICE_DATA, TestValues.GENERAL_MEDIASERVICEDATA);
+ reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, TestValues.GENERAL_WEATHERSERVICEDATA);
+ reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, TestValues.GENERAL_NAVIGATIONSERVICEDATA);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -97,21 +97,21 @@ public class AppServiceDataTests extends TestCase {
if (key.equals(AppServiceData.KEY_MEDIA_SERVICE_DATA)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateMediaServiceData(Test.GENERAL_MEDIASERVICEDATA, new MediaServiceData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA, new MediaServiceData(hashTest)));
} else if (key.equals(AppServiceData.KEY_WEATHER_SERVICE_DATA)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateWeatherServiceData(Test.GENERAL_WEATHERSERVICEDATA, new WeatherServiceData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA, new WeatherServiceData(hashTest)));
} else if (key.equals(AppServiceData.KEY_NAVIGATION_SERVICE_DATA)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateNavigationServiceData(Test.GENERAL_NAVIGATIONSERVICEDATA, new NavigationServiceData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA, new NavigationServiceData(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
index 99bd5b716..8a9f2b0ff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,15 +32,15 @@ public class AppServiceManifestTests extends TestCase {
public void setUp(){
msg = new AppServiceManifest();
- msg.setServiceType(Test.GENERAL_STRING);
- msg.setAllowAppConsumers(Test.GENERAL_BOOLEAN);
- msg.setHandledRpcs(Test.GENERAL_FUNCTION_ID_LIST);
- msg.setMediaServiceManifest(Test.GENERAL_MEDIA_SERVICE_MANIFEST);
- msg.setRpcSpecVersion(Test.GENERAL_SDLMSGVERSION);
- msg.setServiceIcon(Test.GENERAL_IMAGE);
- msg.setServiceName(Test.GENERAL_STRING);
- msg.setWeatherServiceManifest(Test.GENERAL_WEATHER_SERVICE_MANIFEST);
- msg.setNavigationServiceManifest(Test.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setAllowAppConsumers(TestValues.GENERAL_BOOLEAN);
+ msg.setHandledRpcs(TestValues.GENERAL_FUNCTION_ID_LIST);
+ msg.setMediaServiceManifest(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
+ msg.setRpcSpecVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setServiceIcon(TestValues.GENERAL_IMAGE);
+ msg.setServiceName(TestValues.GENERAL_STRING);
+ msg.setWeatherServiceManifest(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
+ msg.setNavigationServiceManifest(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
}
/**
@@ -59,53 +59,53 @@ public class AppServiceManifestTests extends TestCase {
NavigationServiceManifest navigationServiceManifest = msg.getNavigationServiceManifest();
// Valid Tests
- assertEquals(Test.GENERAL_BOOLEAN, allowAppConsumers);
- assertEquals(Test.GENERAL_IMAGE, serviceIcon);
- assertEquals(Test.GENERAL_STRING, serviceName);
- assertEquals(Test.GENERAL_STRING, appServiceType);
- assertEquals(Test.GENERAL_SDLMSGVERSION, version);
- assertEquals(Test.MATCH, Test.GENERAL_FUNCTION_ID_LIST, handledRPCs);
- assertEquals(Test.GENERAL_WEATHER_SERVICE_MANIFEST, weatherServiceManifestTest);
- assertEquals(Test.GENERAL_MEDIA_SERVICE_MANIFEST, mediaServiceManifestTest);
- assertEquals(Test.GENERAL_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
+ assertEquals(TestValues.GENERAL_BOOLEAN, allowAppConsumers);
+ assertEquals(TestValues.GENERAL_IMAGE, serviceIcon);
+ assertEquals(TestValues.GENERAL_STRING, serviceName);
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_SDLMSGVERSION, version);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FUNCTION_ID_LIST, handledRPCs);
+ assertEquals(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, weatherServiceManifestTest);
+ assertEquals(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, mediaServiceManifestTest);
+ assertEquals(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
// Invalid/Null Tests
AppServiceManifest msg = new AppServiceManifest();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getServiceIcon());
- assertNull(Test.NULL, msg.getServiceName());
- assertNull(Test.NULL, msg.getServiceType());
- assertNull(Test.NULL, msg.getAllowAppConsumers());
- assertNull(Test.NULL, msg.getRpcSpecVersion());
- assertNull(Test.NULL, msg.getHandledRpcs());
- assertNull(Test.NULL, msg.getWeatherServiceManifest());
- assertNull(Test.NULL, msg.getMediaServiceManifest());
- assertNull(Test.NULL, msg.getNavigationServiceManifest());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getServiceIcon());
+ assertNull(TestValues.NULL, msg.getServiceName());
+ assertNull(TestValues.NULL, msg.getServiceType());
+ assertNull(TestValues.NULL, msg.getAllowAppConsumers());
+ assertNull(TestValues.NULL, msg.getRpcSpecVersion());
+ assertNull(TestValues.NULL, msg.getHandledRpcs());
+ assertNull(TestValues.NULL, msg.getWeatherServiceManifest());
+ assertNull(TestValues.NULL, msg.getMediaServiceManifest());
+ assertNull(TestValues.NULL, msg.getNavigationServiceManifest());
}
public void testRequiredParamsConstructor(){
- msg = new AppServiceManifest(Test.GENERAL_STRING);
+ msg = new AppServiceManifest(TestValues.GENERAL_STRING);
String appServiceType = msg.getServiceType();
- assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AppServiceManifest.KEY_SERVICE_NAME, Test.GENERAL_STRING);
- reference.put(AppServiceManifest.KEY_SERVICE_ICON, Test.GENERAL_IMAGE);
- reference.put(AppServiceManifest.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
- reference.put(AppServiceManifest.KEY_ALLOW_APP_CONSUMERS, Test.GENERAL_BOOLEAN);
- reference.put(AppServiceManifest.KEY_RPC_SPEC_VERSION, Test.GENERAL_SDLMSGVERSION.serializeJSON());
- reference.put(AppServiceManifest.KEY_HANDLED_RPCS, Test.GENERAL_FUNCTION_ID_LIST);
- reference.put(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST, Test.GENERAL_WEATHER_SERVICE_MANIFEST);
- reference.put(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST, Test.GENERAL_MEDIA_SERVICE_MANIFEST);
- reference.put(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST, Test.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_SERVICE_NAME, TestValues.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_SERVICE_ICON, TestValues.GENERAL_IMAGE);
+ reference.put(AppServiceManifest.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_ALLOW_APP_CONSUMERS, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceManifest.KEY_RPC_SPEC_VERSION, TestValues.GENERAL_SDLMSGVERSION.serializeJSON());
+ reference.put(AppServiceManifest.KEY_HANDLED_RPCS, TestValues.GENERAL_FUNCTION_ID_LIST);
+ reference.put(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST, TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST, TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST, TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -116,33 +116,33 @@ public class AppServiceManifestTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion( new SdlMsgVersion(hashReference), new SdlMsgVersion(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion( new SdlMsgVersion(hashReference), new SdlMsgVersion(hashTest)));
}else if(key.equals(AppServiceManifest.KEY_HANDLED_RPCS)){
- List<Integer> list1 = Test.GENERAL_FUNCTION_ID_LIST;
+ List<Integer> list1 = TestValues.GENERAL_FUNCTION_ID_LIST;
List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateIntegerList(list1,list2));
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1,list2));
}else if(key.equals(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateWeatherServiceManifest( Test.GENERAL_WEATHER_SERVICE_MANIFEST, new WeatherServiceManifest(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateWeatherServiceManifest( TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, new WeatherServiceManifest(hashTest)));
}else if(key.equals(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateMediaServiceManifest( Test.GENERAL_MEDIA_SERVICE_MANIFEST, new MediaServiceManifest(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateMediaServiceManifest( TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, new MediaServiceManifest(hashTest)));
} else if(key.equals(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateNavigationServiceManifest( Test.GENERAL_NAVIGATION_SERVICE_MANIFEST, new NavigationServiceManifest(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateNavigationServiceManifest( TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, new NavigationServiceManifest(hashTest)));
}else if(key.equals(AppServiceManifest.KEY_SERVICE_ICON)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
- assertTrue(Test.TRUE, Validator.validateImage(refIcon1, msg.getServiceIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getServiceIcon()));
}else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
index 0e00a1d70..c8c70f0de 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AppServiceManifest;
import com.smartdevicelink.proxy.rpc.AppServiceRecord;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,10 +27,10 @@ public class AppServiceRecordTests extends TestCase {
public void setUp(){
msg = new AppServiceRecord();
- msg.setServicePublished(Test.GENERAL_BOOLEAN);
- msg.setServiceActive(Test.GENERAL_BOOLEAN);
- msg.setServiceManifest(Test.GENERAL_APPSERVICEMANIFEST);
- msg.setServiceID(Test.GENERAL_STRING);
+ msg.setServicePublished(TestValues.GENERAL_BOOLEAN);
+ msg.setServiceActive(TestValues.GENERAL_BOOLEAN);
+ msg.setServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
+ msg.setServiceID(TestValues.GENERAL_STRING);
}
@@ -46,23 +46,23 @@ public class AppServiceRecordTests extends TestCase {
String serviceID = msg.getServiceID();
// Valid Tests
- assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
- assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
- assertEquals(Test.GENERAL_APPSERVICEMANIFEST, serviceManifest);
- assertEquals(Test.GENERAL_STRING, serviceID);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
+ assertEquals(TestValues.GENERAL_STRING, serviceID);
// Invalid/Null Tests
AppServiceRecord msg = new AppServiceRecord();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getServicePublished());
- assertNull(Test.NULL, msg.getServiceActive());
- assertNull(Test.NULL, msg.getServiceManifest());
- assertNull(Test.NULL, msg.getServiceID());
+ assertNull(TestValues.NULL, msg.getServicePublished());
+ assertNull(TestValues.NULL, msg.getServiceActive());
+ assertNull(TestValues.NULL, msg.getServiceManifest());
+ assertNull(TestValues.NULL, msg.getServiceID());
}
public void testRequiredParamsConstructor(){
- msg = new AppServiceRecord(Test.GENERAL_STRING, Test.GENERAL_APPSERVICEMANIFEST, Test.GENERAL_BOOLEAN, Test.GENERAL_BOOLEAN);
+ msg = new AppServiceRecord(TestValues.GENERAL_STRING, TestValues.GENERAL_APPSERVICEMANIFEST, TestValues.GENERAL_BOOLEAN, TestValues.GENERAL_BOOLEAN);
boolean isServicePublished = msg.getServicePublished();
boolean isServiceActive = msg.getServiceActive();
@@ -70,23 +70,23 @@ public class AppServiceRecordTests extends TestCase {
String serviceID = msg.getServiceID();
// Valid Tests
- assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
- assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
- assertEquals(Test.GENERAL_APPSERVICEMANIFEST, serviceManifest);
- assertEquals(Test.GENERAL_STRING, serviceID);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
+ assertEquals(TestValues.GENERAL_STRING, serviceID);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AppServiceRecord.KEY_SERVICE_ACTIVE, Test.GENERAL_BOOLEAN);
- reference.put(AppServiceRecord.KEY_SERVICE_PUBLISHED, Test.GENERAL_BOOLEAN);
- reference.put(AppServiceRecord.KEY_SERVICE_ID, Test.GENERAL_STRING);
- reference.put(AppServiceRecord.KEY_SERVICE_MANIFEST, Test.GENERAL_APPSERVICEMANIFEST);
+ reference.put(AppServiceRecord.KEY_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_PUBLISHED, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppServiceRecord.KEY_SERVICE_MANIFEST, TestValues.GENERAL_APPSERVICEMANIFEST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -95,13 +95,13 @@ public class AppServiceRecordTests extends TestCase {
if(key.equals(AppServiceRecord.KEY_SERVICE_MANIFEST)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateAppServiceManifest( Test.GENERAL_APPSERVICEMANIFEST, new AppServiceManifest(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest( TestValues.GENERAL_APPSERVICEMANIFEST, new AppServiceManifest(hashTest)));
}else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
index a069e2b69..f39df464a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.utl.AppServiceFactory;
@@ -31,7 +31,7 @@ public class AppServicesCapabilitiesTests extends TestCase {
public void setUp(){
msg = new AppServicesCapabilities();
- msg.setAppServices(Test.GENERAL_APPSERVICECAPABILITY_LIST);
+ msg.setAppServices(TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
}
/**
@@ -42,37 +42,37 @@ public class AppServicesCapabilitiesTests extends TestCase {
List<AppServiceCapability> serviceCapabilityList = msg.getAppServices();
// Valid Tests
- assertEquals(Test.MATCH, serviceCapabilityList, Test.GENERAL_APPSERVICECAPABILITY_LIST);
+ assertEquals(TestValues.MATCH, serviceCapabilityList, TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
// Invalid/Null Tests
AppServicesCapabilities msg = new AppServicesCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAppServices());
+ assertNull(TestValues.NULL, msg.getAppServices());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AppServicesCapabilities.KEY_APP_SERVICES, Test.GENERAL_APPSERVICETYPE_LIST);
+ reference.put(AppServicesCapabilities.KEY_APP_SERVICES, TestValues.GENERAL_APPSERVICETYPE_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(AppServicesCapabilities.KEY_APP_SERVICES)) {
- List<AppServiceCapability> list1 = Test.GENERAL_APPSERVICECAPABILITY_LIST;
+ List<AppServiceCapability> list1 = TestValues.GENERAL_APPSERVICECAPABILITY_LIST;
List<AppServiceCapability> list2 = JsonUtils.readAppServiceCapabilityListFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateAppServiceCapabilityList(list1,list2));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilityList(list1,list2));
}else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
index 5351bf7a1..905c568c9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,14 +27,14 @@ public class AudioControlCapabilitiesTests extends TestCase {
public void setUp() {
msg = new AudioControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setSourceAvailable(Test.GENERAL_BOOLEAN);
- msg.setKeepContextAvailable(Test.GENERAL_BOOLEAN);
- msg.setVolumeAvailable(Test.GENERAL_BOOLEAN);
- msg.setEqualizerAvailable(Test.GENERAL_BOOLEAN);
- msg.setVolumeAvailable(Test.GENERAL_BOOLEAN);
- msg.setEqualizerMaxChannelId(Test.GENERAL_INT);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setSourceAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setKeepContextAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setEqualizerAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setEqualizerMaxChannelId(TestValues.GENERAL_INT);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
}
/**
@@ -52,25 +52,25 @@ public class AudioControlCapabilitiesTests extends TestCase {
ModuleInfo info = msg.getModuleInfo();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) sourceAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) keepContextAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) volumeAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_INT, equalizerMaxChannelId);
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) sourceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContextAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) volumeAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, equalizerMaxChannelId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
AudioControlCapabilities msg = new AudioControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getSourceAvailable());
- assertNull(Test.NULL, msg.getKeepContextAvailable());
- assertNull(Test.NULL, msg.getVolumeAvailable());
- assertNull(Test.NULL, msg.getEqualizerAvailable());
- assertNull(Test.NULL, msg.getEqualizerMaxChannelId());
- assertNull(Test.NULL, msg.getModuleInfo());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getSourceAvailable());
+ assertNull(TestValues.NULL, msg.getKeepContextAvailable());
+ assertNull(TestValues.NULL, msg.getVolumeAvailable());
+ assertNull(TestValues.NULL, msg.getEqualizerAvailable());
+ assertNull(TestValues.NULL, msg.getEqualizerMaxChannelId());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -78,16 +78,16 @@ public class AudioControlCapabilitiesTests extends TestCase {
try {
- reference.put(AudioControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(AudioControlCapabilities.KEY_SOURCE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_KEEP_CONTEXT_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, Test.GENERAL_INT);
- reference.put(AudioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(AudioControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(AudioControlCapabilities.KEY_SOURCE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_KEEP_CONTEXT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, TestValues.GENERAL_INT);
+ reference.put(AudioControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -97,13 +97,13 @@ public class AudioControlCapabilitiesTests extends TestCase {
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
index 4dba080ac..dee89750c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.AudioControlData;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,10 +29,10 @@ public class AudioControlDataTests extends TestCase {
public void setUp() {
msg = new AudioControlData();
- msg.setSource(Test.GENERAL_PRIMARYAUDIOSOURCE);
- msg.setKeepContext(Test.GENERAL_BOOLEAN);
- msg.setVolume(Test.GENERAL_INT);
- msg.setEqualizerSettings(Test.GENERAL_EQUALIZERSETTINGS_LIST);
+ msg.setSource(TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ msg.setKeepContext(TestValues.GENERAL_BOOLEAN);
+ msg.setVolume(TestValues.GENERAL_INT);
+ msg.setEqualizerSettings(TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
}
/**
@@ -46,34 +46,34 @@ public class AudioControlDataTests extends TestCase {
List<EqualizerSettings> equalizerSettings = msg.getEqualizerSettings();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_PRIMARYAUDIOSOURCE, source);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) keepContext);
- assertEquals(Test.MATCH, Test.GENERAL_INT, volume);
- assertEquals(Test.MATCH, Test.GENERAL_EQUALIZERSETTINGS_LIST.size(), equalizerSettings.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PRIMARYAUDIOSOURCE, source);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContext);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, volume);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_EQUALIZERSETTINGS_LIST.size(), equalizerSettings.size());
- assertTrue(Test.TRUE, Validator.validateEqualizerSettingsList(Test.GENERAL_EQUALIZERSETTINGS_LIST, equalizerSettings));
+ assertTrue(TestValues.TRUE, Validator.validateEqualizerSettingsList(TestValues.GENERAL_EQUALIZERSETTINGS_LIST, equalizerSettings));
// Invalid/Null Tests
AudioControlData msg = new AudioControlData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getSource());
- assertNull(Test.NULL, msg.getVolume());
- assertNull(Test.NULL, msg.getKeepContext());
- assertNull(Test.NULL, msg.getEqualizerSettings());
+ assertNull(TestValues.NULL, msg.getSource());
+ assertNull(TestValues.NULL, msg.getVolume());
+ assertNull(TestValues.NULL, msg.getKeepContext());
+ assertNull(TestValues.NULL, msg.getEqualizerSettings());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(AudioControlData.KEY_SOURCE, Test.GENERAL_PRIMARYAUDIOSOURCE);
- reference.put(AudioControlData.KEY_KEEP_CONTEXT, Test.GENERAL_BOOLEAN);
- reference.put(AudioControlData.KEY_VOLUME, Test.GENERAL_INT);
- reference.put(AudioControlData.KEY_EQUALIZER_SETTINGS, Test.GENERAL_EQUALIZERSETTINGS_LIST);
+ reference.put(AudioControlData.KEY_SOURCE, TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ reference.put(AudioControlData.KEY_KEEP_CONTEXT, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlData.KEY_VOLUME, TestValues.GENERAL_INT);
+ reference.put(AudioControlData.KEY_EQUALIZER_SETTINGS, TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -87,12 +87,12 @@ public class AudioControlDataTests extends TestCase {
assertTrue(Validator.validateEqualizerSettings(es, new EqualizerSettings(JsonRPCMarshaller.deserializeJSONObject(esArray.getJSONObject(i++)))));
}
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
index 55af9d881..6e03961bc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.enums.AudioType;
import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,11 +25,11 @@ public class AudioPassThruCapabilitiesTest extends TestCase{
@Override
public void setUp(){
msg = new AudioPassThruCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- msg.setAudioType(Test.GENERAL_AUDIOTYPE);
- msg.setBitsPerSample(Test.GENERAL_BITSPERSAMPLE);
- msg.setSamplingRate(Test.GENERAL_SAMPLINGRATE);
+ msg.setAudioType(TestValues.GENERAL_AUDIOTYPE);
+ msg.setBitsPerSample(TestValues.GENERAL_BITSPERSAMPLE);
+ msg.setSamplingRate(TestValues.GENERAL_SAMPLINGRATE);
}
/**
@@ -42,37 +42,37 @@ public class AudioPassThruCapabilitiesTest extends TestCase{
AudioType audioType = msg.getAudioType();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SAMPLINGRATE, samplingRate);
- assertEquals(Test.MATCH, Test.GENERAL_BITSPERSAMPLE, bitsPerSample);
- assertEquals(Test.MATCH, Test.GENERAL_AUDIOTYPE, audioType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SAMPLINGRATE, samplingRate);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BITSPERSAMPLE, bitsPerSample);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOTYPE, audioType);
// Invalid/Null Tests
AudioPassThruCapabilities msg = new AudioPassThruCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAudioType());
- assertNull(Test.NULL, msg.getBitsPerSample());
- assertNull(Test.NULL, msg.getSamplingRate());
+ assertNull(TestValues.NULL, msg.getAudioType());
+ assertNull(TestValues.NULL, msg.getBitsPerSample());
+ assertNull(TestValues.NULL, msg.getSamplingRate());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, Test.GENERAL_AUDIOTYPE);
- reference.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, Test.GENERAL_BITSPERSAMPLE);
- reference.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, Test.GENERAL_SAMPLINGRATE);
+ reference.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, TestValues.GENERAL_AUDIOTYPE);
+ reference.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, TestValues.GENERAL_BITSPERSAMPLE);
+ reference.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, TestValues.GENERAL_SAMPLINGRATE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
index a5f613aed..3b437d0ad 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.BeltStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,23 +23,23 @@ public class BeltStatusTests extends TestCase{
@Override
protected void setUp() throws Exception{
msg = new BeltStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- msg.setLeftRearInflatableBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerChildDetected(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setRightRearInflatableBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setDriverBuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerBuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setRightRow2BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setDriverBeltDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setPassengerBeltDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setMiddleRow1BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setMiddleRow1BeltDeployed(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setLeftRow2BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setMiddleRow2BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setMiddleRow3BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setLeftRow3BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setRightRow3BuckleBelted(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setLeftRearInflatableBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerChildDetected(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setRightRearInflatableBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverBuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerBuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setRightRow2BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setDriverBeltDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setPassengerBeltDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setMiddleRow1BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setMiddleRow1BeltDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setLeftRow2BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setMiddleRow2BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setMiddleRow3BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setLeftRow3BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setRightRow3BuckleBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
}
/**
@@ -48,90 +48,90 @@ public class BeltStatusTests extends TestCase{
public void testRpcValues () {
// Valid Tests
VehicleDataEventStatus leftRearInflatable = msg.getLeftRearInflatableBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, leftRearInflatable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, leftRearInflatable);
VehicleDataEventStatus rightRearInflatable = msg.getRightRearInflatableBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, rightRearInflatable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, rightRearInflatable);
VehicleDataEventStatus passengerChild = msg.getPassengerChildDetected();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, passengerChild);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerChild);
VehicleDataEventStatus driverBuckled = msg.getDriverBuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getPassengerBuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getRightRow2BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getMiddleRow1BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getLeftRow2BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getMiddleRow2BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getMiddleRow3BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getLeftRow3BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
driverBuckled = msg.getRightRow3BuckleBelted();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
VehicleDataEventStatus driverBeltDeployed = msg.getDriverBeltDeployed();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
driverBeltDeployed = msg.getPassengerBeltDeployed();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
driverBeltDeployed = msg.getMiddleRow1BeltDeployed();
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
// Invalid/Null Tests
BeltStatus msg = new BeltStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getLeftRearInflatableBelted());
- assertNull(Test.NULL, msg.getRightRearInflatableBelted());
- assertNull(Test.NULL, msg.getPassengerChildDetected());
- assertNull(Test.NULL, msg.getDriverBuckleBelted());
- assertNull(Test.NULL, msg.getPassengerBuckleBelted());
- assertNull(Test.NULL, msg.getRightRow2BuckleBelted());
- assertNull(Test.NULL, msg.getMiddleRow1BuckleBelted());
- assertNull(Test.NULL, msg.getLeftRow2BuckleBelted());
- assertNull(Test.NULL, msg.getMiddleRow2BuckleBelted());
- assertNull(Test.NULL, msg.getMiddleRow3BuckleBelted());
- assertNull(Test.NULL, msg.getLeftRow3BuckleBelted());
- assertNull(Test.NULL, msg.getRightRow3BuckleBelted());
- assertNull(Test.NULL, msg.getPassengerBeltDeployed());
- assertNull(Test.NULL, msg.getMiddleRow1BeltDeployed());
+ assertNull(TestValues.NULL, msg.getLeftRearInflatableBelted());
+ assertNull(TestValues.NULL, msg.getRightRearInflatableBelted());
+ assertNull(TestValues.NULL, msg.getPassengerChildDetected());
+ assertNull(TestValues.NULL, msg.getDriverBuckleBelted());
+ assertNull(TestValues.NULL, msg.getPassengerBuckleBelted());
+ assertNull(TestValues.NULL, msg.getRightRow2BuckleBelted());
+ assertNull(TestValues.NULL, msg.getMiddleRow1BuckleBelted());
+ assertNull(TestValues.NULL, msg.getLeftRow2BuckleBelted());
+ assertNull(TestValues.NULL, msg.getMiddleRow2BuckleBelted());
+ assertNull(TestValues.NULL, msg.getMiddleRow3BuckleBelted());
+ assertNull(TestValues.NULL, msg.getLeftRow3BuckleBelted());
+ assertNull(TestValues.NULL, msg.getRightRow3BuckleBelted());
+ assertNull(TestValues.NULL, msg.getPassengerBeltDeployed());
+ assertNull(TestValues.NULL, msg.getMiddleRow1BeltDeployed());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
index ce3d8b9a0..ea342a00f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.BodyInformation;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,14 +24,14 @@ public class BodyInformationTests extends TestCase{
@Override
public void setUp(){
msg = new BodyInformation();
- msg.setParkBrakeActive(Test.GENERAL_BOOLEAN);
- msg.setIgnitionStatus(Test.GENERAL_IGNITIONSTATUS);
- msg.setIgnitionStableStatus(Test.GENERAL_IGNITIONSTABLESTATUS);
+ msg.setParkBrakeActive(TestValues.GENERAL_BOOLEAN);
+ msg.setIgnitionStatus(TestValues.GENERAL_IGNITIONSTATUS);
+ msg.setIgnitionStableStatus(TestValues.GENERAL_IGNITIONSTABLESTATUS);
- msg.setDriverDoorAjar(Test.GENERAL_BOOLEAN);
- msg.setPassengerDoorAjar(Test.GENERAL_BOOLEAN);
- msg.setRearLeftDoorAjar(Test.GENERAL_BOOLEAN);
- msg.setRearRightDoorAjar(Test.GENERAL_BOOLEAN);
+ msg.setDriverDoorAjar(TestValues.GENERAL_BOOLEAN);
+ msg.setPassengerDoorAjar(TestValues.GENERAL_BOOLEAN);
+ msg.setRearLeftDoorAjar(TestValues.GENERAL_BOOLEAN);
+ msg.setRearRightDoorAjar(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -44,50 +44,50 @@ public class BodyInformationTests extends TestCase{
IgnitionStableStatus ignitionStable = msg.getIgnitionStableStatus();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, parkBrake);
- assertEquals(Test.MATCH, Test.GENERAL_IGNITIONSTATUS, ignitionStatus);
- assertEquals(Test.MATCH, Test.GENERAL_IGNITIONSTABLESTATUS, ignitionStable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, parkBrake);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IGNITIONSTATUS, ignitionStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IGNITIONSTABLESTATUS, ignitionStable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) msg.getDriverDoorAjar());
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) msg.getPassengerDoorAjar());
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) msg.getRearLeftDoorAjar());
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) msg.getRearRightDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getDriverDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getPassengerDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearLeftDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearRightDoorAjar());
// Invalid/Null Tests
BodyInformation msg = new BodyInformation();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getParkBrakeActive());
- assertNull(Test.NULL, msg.getIgnitionStatus());
- assertNull(Test.NULL, msg.getIgnitionStatus());
- assertNull(Test.NULL, msg.getDriverDoorAjar());
- assertNull(Test.NULL, msg.getPassengerDoorAjar());
- assertNull(Test.NULL, msg.getRearLeftDoorAjar());
- assertNull(Test.NULL, msg.getRearRightDoorAjar());
+ assertNull(TestValues.NULL, msg.getParkBrakeActive());
+ assertNull(TestValues.NULL, msg.getIgnitionStatus());
+ assertNull(TestValues.NULL, msg.getIgnitionStatus());
+ assertNull(TestValues.NULL, msg.getDriverDoorAjar());
+ assertNull(TestValues.NULL, msg.getPassengerDoorAjar());
+ assertNull(TestValues.NULL, msg.getRearLeftDoorAjar());
+ assertNull(TestValues.NULL, msg.getRearRightDoorAjar());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, Test.GENERAL_BOOLEAN);
- reference.put(BodyInformation.KEY_IGNITION_STATUS, Test.GENERAL_IGNITIONSTATUS);
- reference.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, Test.GENERAL_IGNITIONSTABLESTATUS);
- reference.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, Test.GENERAL_BOOLEAN);
- reference.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, Test.GENERAL_BOOLEAN);
- reference.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, Test.GENERAL_BOOLEAN);
- reference.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, Test.GENERAL_BOOLEAN);
+ reference.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(BodyInformation.KEY_IGNITION_STATUS, TestValues.GENERAL_IGNITIONSTATUS);
+ reference.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, TestValues.GENERAL_IGNITIONSTABLESTATUS);
+ reference.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
+ reference.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
+ reference.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
+ reference.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
index 71f7d3ecf..c6977324d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -28,11 +28,11 @@ public class ButtonCapabilitiesTests extends TestCase{
public void setUp(){
msg = new ButtonCapabilities();
- msg.setLongPressAvailable(Test.GENERAL_BOOLEAN);
- msg.setName(Test.GENERAL_BUTTONNAME);
- msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
- msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setLongPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setName(TestValues.GENERAL_BUTTONNAME);
+ msg.setShortPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setUpDownAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
}
@@ -48,35 +48,35 @@ public class ButtonCapabilitiesTests extends TestCase{
ModuleInfo info = msg.getModuleInfo();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shortPress);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, longPress);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, upDown);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName);
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, shortPress);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, longPress);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, upDown);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
ButtonCapabilities msg = new ButtonCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getShortPressAvailable());
- assertNull(Test.NULL, msg.getLongPressAvailable());
- assertNull(Test.NULL, msg.getUpDownAvailable());
- assertNull(Test.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getShortPressAvailable());
+ assertNull(TestValues.NULL, msg.getLongPressAvailable());
+ assertNull(TestValues.NULL, msg.getUpDownAvailable());
+ assertNull(TestValues.NULL, msg.getName());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ButtonCapabilities.KEY_NAME, Test.GENERAL_BUTTONNAME);
- reference.put(ButtonCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(ButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ButtonCapabilities.KEY_NAME, TestValues.GENERAL_BUTTONNAME);
+ reference.put(ButtonCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -86,13 +86,13 @@ public class ButtonCapabilitiesTests extends TestCase{
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
index 5374ae2bf..6eecece4e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -28,13 +28,13 @@ public class ChoiceTests extends TestCase{
public void setUp(){
msg = new Choice();
- msg.setChoiceID(Test.GENERAL_INT);
- msg.setMenuName(Test.GENERAL_STRING);
- msg.setImage(Test.GENERAL_IMAGE);
- msg.setSecondaryImage(Test.GENERAL_IMAGE);
- msg.setSecondaryText(Test.GENERAL_STRING);
- msg.setTertiaryText(Test.GENERAL_STRING);
- msg.setVrCommands(Test.GENERAL_STRING_LIST);
+ msg.setChoiceID(TestValues.GENERAL_INT);
+ msg.setMenuName(TestValues.GENERAL_STRING);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ msg.setSecondaryImage(TestValues.GENERAL_IMAGE);
+ msg.setSecondaryText(TestValues.GENERAL_STRING);
+ msg.setTertiaryText(TestValues.GENERAL_STRING);
+ msg.setVrCommands(TestValues.GENERAL_STRING_LIST);
}
/**
@@ -51,48 +51,48 @@ public class ChoiceTests extends TestCase{
Image image = msg.getImage();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text3);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, menuName);
- assertEquals(Test.MATCH, Test.GENERAL_INT, choiceId);
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, vrCommands));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, image2));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, image));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, menuName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, choiceId);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, vrCommands));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image2));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
// Invalid/Null Tests
Choice msg = new Choice();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getChoiceID());
- assertNull(Test.NULL, msg.getImage());
- assertNull(Test.NULL, msg.getSecondaryImage());
- assertNull(Test.NULL, msg.getMenuName());
- assertNull(Test.NULL, msg.getSecondaryText());
- assertNull(Test.NULL, msg.getTertiaryText());
- assertNull(Test.NULL, msg.getVrCommands());
+ assertNull(TestValues.NULL, msg.getChoiceID());
+ assertNull(TestValues.NULL, msg.getImage());
+ assertNull(TestValues.NULL, msg.getSecondaryImage());
+ assertNull(TestValues.NULL, msg.getMenuName());
+ assertNull(TestValues.NULL, msg.getSecondaryText());
+ assertNull(TestValues.NULL, msg.getTertiaryText());
+ assertNull(TestValues.NULL, msg.getVrCommands());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Choice.KEY_CHOICE_ID, Test.GENERAL_INT);
- reference.put(Choice.KEY_MENU_NAME, Test.GENERAL_STRING);
- reference.put(Choice.KEY_SECONDARY_TEXT, Test.GENERAL_STRING);
- reference.put(Choice.KEY_TERTIARY_TEXT, Test.GENERAL_STRING);
- reference.put(Choice.KEY_IMAGE, Test.JSON_IMAGE);
- reference.put(Choice.KEY_SECONDARY_IMAGE, Test.JSON_IMAGE);
- reference.put(Choice.KEY_VR_COMMANDS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(Choice.KEY_CHOICE_ID, TestValues.GENERAL_INT);
+ reference.put(Choice.KEY_MENU_NAME, TestValues.GENERAL_STRING);
+ reference.put(Choice.KEY_SECONDARY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(Choice.KEY_TERTIARY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(Choice.KEY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(Choice.KEY_SECONDARY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(Choice.KEY_VR_COMMANDS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
if(key.equals(Choice.KEY_VR_COMMANDS)){
- assertTrue(Test.TRUE,
+ assertTrue(TestValues.TRUE,
Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key),
JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if(key.equals(Choice.KEY_IMAGE) || key.equals(Choice.KEY_SECONDARY_IMAGE)){
@@ -101,13 +101,13 @@ public class ChoiceTests extends TestCase{
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
index a33f35b27..ee494ff43 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,24 +32,24 @@ public class ClimateControlCapabilitiesTests extends TestCase{
public void setUp(){
msg = new ClimateControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setFanSpeedAvailable(Test.GENERAL_BOOLEAN);
- msg.setDesiredTemperatureAvailable(Test.GENERAL_BOOLEAN);
- msg.setAcEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setAcMaxEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setCirculateAirEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setAutoModeEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setDualModeEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setDefrostZoneAvailable(Test.GENERAL_BOOLEAN);
- msg.setDefrostZone(Test.GENERAL_DEFROSTZONE_LIST);
- msg.setVentilationModeAvailable(Test.GENERAL_BOOLEAN);
- msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE_LIST);
- msg.setHeatedSteeringWheelAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeatedWindshieldAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeatedRearWindowAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeatedMirrorsAvailable(Test.GENERAL_BOOLEAN);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
- msg.setClimateEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setFanSpeedAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDesiredTemperatureAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setAcEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setAcMaxEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setCirculateAirEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setAutoModeEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDualModeEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDefrostZoneAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDefrostZone(TestValues.GENERAL_DEFROSTZONE_LIST);
+ msg.setVentilationModeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVentilationMode(TestValues.GENERAL_VENTILATIONMODE_LIST);
+ msg.setHeatedSteeringWheelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedWindshieldAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedRearWindowAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedMirrorsAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
+ msg.setClimateEnableAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -77,82 +77,82 @@ public class ClimateControlCapabilitiesTests extends TestCase{
boolean climateEnableAvailable = msg.getClimateEnableAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, fanSpeedAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, desiredTemperatureAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
-
- assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
- assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
-
- for(int i = 0; i < Test.GENERAL_DEFROSTZONE_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.get(i), defrostZone.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, fanSpeedAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, desiredTemperatureAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, acEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, acMaxEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, circulateAirEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, autoModeEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, dualModeEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, defrostZoneAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, ventilationModeAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
+
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
+
+ for(int i = 0; i < TestValues.GENERAL_DEFROSTZONE_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DEFROSTZONE_LIST.get(i), defrostZone.get(i));
}
- for(int i = 0; i < Test.GENERAL_VENTILATIONMODE_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.get(i), ventilationMode.get(i));
+ for(int i = 0; i < TestValues.GENERAL_VENTILATIONMODE_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VENTILATIONMODE_LIST.get(i), ventilationMode.get(i));
}
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedSteeringWheelAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedWindshieldAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedRearWindowAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedMirrorsAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, climateEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedSteeringWheelAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedWindshieldAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedRearWindowAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedMirrorsAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, climateEnableAvailable);
// Invalid/Null Tests
ClimateControlCapabilities msg = new ClimateControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getFanSpeedAvailable());
- assertNull(Test.NULL, msg.getDesiredTemperatureAvailable());
- assertNull(Test.NULL, msg.getAcEnableAvailable());
- assertNull(Test.NULL, msg.getAcMaxEnableAvailable());
- assertNull(Test.NULL, msg.getAutoModeEnableAvailable());
- assertNull(Test.NULL, msg.getDualModeEnableAvailable());
- assertNull(Test.NULL, msg.getDefrostZoneAvailable());
- assertNull(Test.NULL, msg.getDefrostZone());
- assertNull(Test.NULL, msg.getVentilationModeAvailable());
- assertNull(Test.NULL, msg.getVentilationMode());
- assertNull(Test.NULL, msg.getHeatedSteeringWheelAvailable());
- assertNull(Test.NULL, msg.getHeatedWindshieldAvailable());
- assertNull(Test.NULL, msg.getHeatedRearWindowAvailable());
- assertNull(Test.NULL, msg.getHeatedMirrorsAvailable());
- assertNull(Test.NULL, msg.getModuleInfo());
- assertNull(Test.NULL, msg.getClimateEnableAvailable());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getFanSpeedAvailable());
+ assertNull(TestValues.NULL, msg.getDesiredTemperatureAvailable());
+ assertNull(TestValues.NULL, msg.getAcEnableAvailable());
+ assertNull(TestValues.NULL, msg.getAcMaxEnableAvailable());
+ assertNull(TestValues.NULL, msg.getAutoModeEnableAvailable());
+ assertNull(TestValues.NULL, msg.getDualModeEnableAvailable());
+ assertNull(TestValues.NULL, msg.getDefrostZoneAvailable());
+ assertNull(TestValues.NULL, msg.getDefrostZone());
+ assertNull(TestValues.NULL, msg.getVentilationModeAvailable());
+ assertNull(TestValues.NULL, msg.getVentilationMode());
+ assertNull(TestValues.NULL, msg.getHeatedSteeringWheelAvailable());
+ assertNull(TestValues.NULL, msg.getHeatedWindshieldAvailable());
+ assertNull(TestValues.NULL, msg.getHeatedRearWindowAvailable());
+ assertNull(TestValues.NULL, msg.getHeatedMirrorsAvailable());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
+ assertNull(TestValues.NULL, msg.getClimateEnableAvailable());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ClimateControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, JsonUtils.createJsonArray(Test.GENERAL_DEFROSTZONE_LIST));
- reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, JsonUtils.createJsonArray(Test.GENERAL_VENTILATIONMODE_LIST));
- reference.put(ClimateControlCapabilities.KEY_HEATED_STEERING_WHEEL_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
- reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, JsonUtils.createJsonArray(TestValues.GENERAL_DEFROSTZONE_LIST));
+ reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, JsonUtils.createJsonArray(TestValues.GENERAL_VENTILATIONMODE_LIST));
+ reference.put(ClimateControlCapabilities.KEY_HEATED_STEERING_WHEEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
+ reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -164,38 +164,38 @@ public class ClimateControlCapabilitiesTests extends TestCase{
List<DefrostZone> defrostZoneListReference = new ArrayList<DefrostZone>();
List<DefrostZone> defrostZoneListTest = new ArrayList<DefrostZone>();
- assertEquals(Test.MATCH, defrostZoneArrayReference.length(), defrostZoneArrayTest.length());
+ assertEquals(TestValues.MATCH, defrostZoneArrayReference.length(), defrostZoneArrayTest.length());
for (int index = 0 ; index < defrostZoneArrayReference.length(); index++) {
defrostZoneListReference.add( (DefrostZone)defrostZoneArrayReference.get(index) );
defrostZoneListTest.add( (DefrostZone)defrostZoneArrayTest.get(index) );
}
- assertTrue(Test.TRUE, defrostZoneListReference.containsAll(defrostZoneListTest) && defrostZoneListTest.containsAll(defrostZoneListReference));
+ assertTrue(TestValues.TRUE, defrostZoneListReference.containsAll(defrostZoneListTest) && defrostZoneListTest.containsAll(defrostZoneListReference));
} else if(key.equals(ClimateControlCapabilities.KEY_VENTILATION_MODE)) {
JSONArray ventilationModeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray ventilationModeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<VentilationMode> ventilationModeListReference = new ArrayList<VentilationMode>();
List<VentilationMode> ventilationModeListTest = new ArrayList<VentilationMode>();
- assertEquals(Test.MATCH, ventilationModeArrayReference.length(), ventilationModeArrayTest.length());
+ assertEquals(TestValues.MATCH, ventilationModeArrayReference.length(), ventilationModeArrayTest.length());
for (int index = 0 ; index < ventilationModeArrayReference.length(); index++) {
ventilationModeListReference.add( (VentilationMode)ventilationModeArrayReference.get(index) );
ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) );
}
- assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
+ assertTrue(TestValues.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
} else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) {
JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
index 7aeeb76cd..fba46eb9a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,21 +29,21 @@ public class ClimateControlDataTests extends TestCase{
public void setUp(){
msg = new ClimateControlData();
- msg.setFanSpeed(Test.GENERAL_INT);
- msg.setCurrentTemperature(Test.GENERAL_TEMPERATURE);
- msg.setDesiredTemperature(Test.GENERAL_TEMPERATURE);
- msg.setAcEnable(Test.GENERAL_BOOLEAN);
- msg.setCirculateAirEnable(Test.GENERAL_BOOLEAN);
- msg.setAutoModeEnable(Test.GENERAL_BOOLEAN);
- msg.setDefrostZone(Test.GENERAL_DEFROSTZONE);
- msg.setDualModeEnable(Test.GENERAL_BOOLEAN);
- msg.setAcMaxEnable(Test.GENERAL_BOOLEAN);
- msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE);
- msg.setHeatedSteeringWheelEnable(Test.GENERAL_BOOLEAN);
- msg.setHeatedWindshieldEnable(Test.GENERAL_BOOLEAN);
- msg.setHeatedRearWindowEnable(Test.GENERAL_BOOLEAN);
- msg.setHeatedMirrorsEnable(Test.GENERAL_BOOLEAN);
- msg.setClimateEnable(Test.GENERAL_BOOLEAN);
+ msg.setFanSpeed(TestValues.GENERAL_INT);
+ msg.setCurrentTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setDesiredTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setAcEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setCirculateAirEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setAutoModeEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setDefrostZone(TestValues.GENERAL_DEFROSTZONE);
+ msg.setDualModeEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setAcMaxEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setVentilationMode(TestValues.GENERAL_VENTILATIONMODE);
+ msg.setHeatedSteeringWheelEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedWindshieldEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedRearWindowEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatedMirrorsEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setClimateEnable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -68,65 +68,65 @@ public class ClimateControlDataTests extends TestCase{
boolean climateEnable = msg.getClimateEnable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, fanSpeed);
- assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, currentTemperature));
- assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, desiredTemperature));
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnable);
- assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE, defrostZone);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnable);
- assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE, ventilationMode);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedSteeringWheelEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedWindshieldEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedRearWindowEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedMirrorsEnable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, climateEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, fanSpeed);
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(TestValues.GENERAL_TEMPERATURE, currentTemperature));
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(TestValues.GENERAL_TEMPERATURE, desiredTemperature));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, acEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, circulateAirEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, autoModeEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DEFROSTZONE, defrostZone);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, dualModeEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, acMaxEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VENTILATIONMODE, ventilationMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedSteeringWheelEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedWindshieldEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedRearWindowEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, heatedMirrorsEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, climateEnable);
// Invalid/Null Tests
ClimateControlData msg = new ClimateControlData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getFanSpeed());
- assertNull(Test.NULL, msg.getCurrentTemperature());
- assertNull(Test.NULL, msg.getDesiredTemperature());
- assertNull(Test.NULL, msg.getAcEnable());
- assertNull(Test.NULL, msg.getCirculateAirEnable());
- assertNull(Test.NULL, msg.getAutoModeEnable());
- assertNull(Test.NULL, msg.getDefrostZone());
- assertNull(Test.NULL, msg.getDualModeEnable());
- assertNull(Test.NULL, msg.getAcMaxEnable());
- assertNull(Test.NULL, msg.getVentilationMode());
- assertNull(Test.NULL, msg.getHeatedSteeringWheelEnable());
- assertNull(Test.NULL, msg.getHeatedWindshieldEnable());
- assertNull(Test.NULL, msg.getHeatedRearWindowEnable());
- assertNull(Test.NULL, msg.getHeatedMirrorsEnable());
- assertNull(Test.NULL, msg.getClimateEnable());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getFanSpeed());
+ assertNull(TestValues.NULL, msg.getCurrentTemperature());
+ assertNull(TestValues.NULL, msg.getDesiredTemperature());
+ assertNull(TestValues.NULL, msg.getAcEnable());
+ assertNull(TestValues.NULL, msg.getCirculateAirEnable());
+ assertNull(TestValues.NULL, msg.getAutoModeEnable());
+ assertNull(TestValues.NULL, msg.getDefrostZone());
+ assertNull(TestValues.NULL, msg.getDualModeEnable());
+ assertNull(TestValues.NULL, msg.getAcMaxEnable());
+ assertNull(TestValues.NULL, msg.getVentilationMode());
+ assertNull(TestValues.NULL, msg.getHeatedSteeringWheelEnable());
+ assertNull(TestValues.NULL, msg.getHeatedWindshieldEnable());
+ assertNull(TestValues.NULL, msg.getHeatedRearWindowEnable());
+ assertNull(TestValues.NULL, msg.getHeatedMirrorsEnable());
+ assertNull(TestValues.NULL, msg.getClimateEnable());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ClimateControlData.KEY_FAN_SPEED, Test.GENERAL_INT);
- reference.put(ClimateControlData.KEY_CURRENT_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore()));
- reference.put(ClimateControlData.KEY_DESIRED_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore()));
- reference.put(ClimateControlData.KEY_AC_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_CIRCULATE_AIR_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_AUTO_MODE_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_DUAL_MODE_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_AC_MAX_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_DEFROST_ZONE, Test.GENERAL_DEFROSTZONE);
- reference.put(ClimateControlData.KEY_VENTILATION_MODE, Test.GENERAL_VENTILATIONMODE);
- reference.put(ClimateControlData.KEY_HEATED_STEERING_WHEEL_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_HEATED_WIND_SHIELD_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_HEATED_REAR_WINDOW_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_HEATED_MIRRORS_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(ClimateControlData.KEY_CLIMATE_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_FAN_SPEED, TestValues.GENERAL_INT);
+ reference.put(ClimateControlData.KEY_CURRENT_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_TEMPERATURE.getStore()));
+ reference.put(ClimateControlData.KEY_DESIRED_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_TEMPERATURE.getStore()));
+ reference.put(ClimateControlData.KEY_AC_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_CIRCULATE_AIR_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_AUTO_MODE_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_DUAL_MODE_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_AC_MAX_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_DEFROST_ZONE, TestValues.GENERAL_DEFROSTZONE);
+ reference.put(ClimateControlData.KEY_VENTILATION_MODE, TestValues.GENERAL_VENTILATIONMODE);
+ reference.put(ClimateControlData.KEY_HEATED_STEERING_WHEEL_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_HEATED_WIND_SHIELD_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_HEATED_REAR_WINDOW_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_HEATED_MIRRORS_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_CLIMATE_ENABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -137,19 +137,19 @@ public class ClimateControlDataTests extends TestCase{
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
} else if(key.equals(ClimateControlData.KEY_DESIRED_TEMPERATURE)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
index 75be1e9cc..5b1ac322d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.CloudAppProperties;
import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -26,13 +26,13 @@ public class CloudAppPropertiesTests extends TestCase{
public void setUp(){
msg = new CloudAppProperties();
- msg.setNicknames(Test.GENERAL_STRING_LIST);
- msg.setAppID(Test.GENERAL_STRING);
- msg.setEnabled(Test.GENERAL_BOOLEAN);
- msg.setAuthToken(Test.GENERAL_STRING);
- msg.setCloudTransportType(Test.GENERAL_STRING);
- msg.setHybridAppPreference(Test.GENERAL_HYBRID_APP_PREFERENCE);
- msg.setEndpoint(Test.GENERAL_STRING);
+ msg.setNicknames(TestValues.GENERAL_STRING_LIST);
+ msg.setAppID(TestValues.GENERAL_STRING);
+ msg.setEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setAuthToken(TestValues.GENERAL_STRING);
+ msg.setCloudTransportType(TestValues.GENERAL_STRING);
+ msg.setHybridAppPreference(TestValues.GENERAL_HYBRID_APP_PREFERENCE);
+ msg.setEndpoint(TestValues.GENERAL_STRING);
}
/**
@@ -49,42 +49,42 @@ public class CloudAppPropertiesTests extends TestCase{
String endpoint = msg.getEndpoint();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, nicknames);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, appID);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, enabled);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, authToken);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, cloudTransportType);
- assertEquals(Test.MATCH, Test.GENERAL_HYBRID_APP_PREFERENCE, hybridAppPreference);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, endpoint);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, nicknames);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, enabled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, authToken);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, cloudTransportType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HYBRID_APP_PREFERENCE, hybridAppPreference);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, endpoint);
// Invalid/Null Tests
CloudAppProperties msg = new CloudAppProperties();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getNicknames());
- assertNull(Test.NULL, msg.getAppID());
- assertNull(Test.NULL, msg.isEnabled());
- assertNull(Test.NULL, msg.getAuthToken());
- assertNull(Test.NULL, msg.getCloudTransportType());
- assertNull(Test.NULL, msg.getHybridAppPreference());
- assertNull(Test.NULL, msg.getEndpoint());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getNicknames());
+ assertNull(TestValues.NULL, msg.getAppID());
+ assertNull(TestValues.NULL, msg.isEnabled());
+ assertNull(TestValues.NULL, msg.getAuthToken());
+ assertNull(TestValues.NULL, msg.getCloudTransportType());
+ assertNull(TestValues.NULL, msg.getHybridAppPreference());
+ assertNull(TestValues.NULL, msg.getEndpoint());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(CloudAppProperties.KEY_NICKNAMES, Test.GENERAL_STRING_LIST);
- reference.put(CloudAppProperties.KEY_APP_ID, Test.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_ENABLED, Test.GENERAL_BOOLEAN);
- reference.put(CloudAppProperties.KEY_AUTH_TOKEN, Test.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_CLOUD_TRANSPORT_TYPE, Test.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_HYBRID_APP_PREFERENCE, Test.GENERAL_HYBRID_APP_PREFERENCE);
- reference.put(CloudAppProperties.KEY_ENDPOINT, Test.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_NICKNAMES, TestValues.GENERAL_STRING_LIST);
+ reference.put(CloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(CloudAppProperties.KEY_AUTH_TOKEN, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_CLOUD_TRANSPORT_TYPE, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_HYBRID_APP_PREFERENCE, TestValues.GENERAL_HYBRID_APP_PREFERENCE);
+ reference.put(CloudAppProperties.KEY_ENDPOINT, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -94,11 +94,11 @@ public class CloudAppPropertiesTests extends TestCase{
Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key),
JsonUtils.readStringListFromJsonObject(underTest, key));
}else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
index 366339818..4c500ab48 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.enums.CarModeStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -26,10 +26,10 @@ public class ClusterModeStatusTests extends TestCase{
public void setUp(){
msg = new ClusterModeStatus();
- msg.setPowerModeActive(Test.GENERAL_BOOLEAN);
- msg.setCarModeStatus(Test.GENERAL_CARMODESTATUS);
- msg.setPowerModeQualificationStatus(Test.GENERAL_POWERMODEQUALIFICATIONSTATUS);
- msg.setPowerModeStatus(Test.GENERAL_POWERMODESTATUS);
+ msg.setPowerModeActive(TestValues.GENERAL_BOOLEAN);
+ msg.setCarModeStatus(TestValues.GENERAL_CARMODESTATUS);
+ msg.setPowerModeQualificationStatus(TestValues.GENERAL_POWERMODEQUALIFICATIONSTATUS);
+ msg.setPowerModeStatus(TestValues.GENERAL_POWERMODESTATUS);
}
/**
@@ -43,40 +43,40 @@ public class ClusterModeStatusTests extends TestCase{
CarModeStatus carStatus = msg.getCarModeStatus();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, powerMode);
- assertEquals(Test.MATCH, Test.GENERAL_POWERMODEQUALIFICATIONSTATUS, qualification);
- assertEquals(Test.MATCH, Test.GENERAL_POWERMODESTATUS, status);
- assertEquals(Test.MATCH, Test.GENERAL_CARMODESTATUS, carStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, powerMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_POWERMODEQUALIFICATIONSTATUS, qualification);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_POWERMODESTATUS, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CARMODESTATUS, carStatus);
// Invalid/Null Tests
ClusterModeStatus msg = new ClusterModeStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getPowerModeActive());
- assertNull(Test.NULL, msg.getPowerModeStatus());
- assertNull(Test.NULL, msg.getPowerModeQualificationStatus());
- assertNull(Test.NULL, msg.getCarModeStatus());
+ assertNull(TestValues.NULL, msg.getPowerModeActive());
+ assertNull(TestValues.NULL, msg.getPowerModeStatus());
+ assertNull(TestValues.NULL, msg.getPowerModeQualificationStatus());
+ assertNull(TestValues.NULL, msg.getCarModeStatus());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, Test.GENERAL_BOOLEAN);
- reference.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, Test.GENERAL_POWERMODESTATUS);
- reference.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, Test.GENERAL_POWERMODEQUALIFICATIONSTATUS);
- reference.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, Test.GENERAL_CARMODESTATUS);
+ reference.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, TestValues.GENERAL_POWERMODESTATUS);
+ reference.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, TestValues.GENERAL_POWERMODEQUALIFICATIONSTATUS);
+ reference.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, TestValues.GENERAL_CARMODESTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
index 5f8a8327f..40931dc1e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,8 +23,8 @@ public class CoordinateTests extends TestCase {
public void setUp(){
msg = new Coordinate();
- msg.setLatitudeDegrees(Test.GENERAL_FLOAT);
- msg.setLongitudeDegrees(Test.GENERAL_FLOAT);
+ msg.setLatitudeDegrees(TestValues.GENERAL_FLOAT);
+ msg.setLongitudeDegrees(TestValues.GENERAL_FLOAT);
}
/**
@@ -36,26 +36,26 @@ public class CoordinateTests extends TestCase {
float floatLong = msg.getLongitudeDegrees();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, floatLat);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, floatLong);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, floatLat);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, floatLong);
// Invalid/Null Tests
Coordinate msg = new Coordinate();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getLatitudeDegrees());
- assertNull(Test.NULL, msg.getLongitudeDegrees());
+ assertNull(TestValues.NULL, msg.getLatitudeDegrees());
+ assertNull(TestValues.NULL, msg.getLongitudeDegrees());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Coordinate.KEY_LATITUDE_DEGREES, (Float) Test.GENERAL_FLOAT);
- reference.put(Coordinate.KEY_LONGITUDE_DEGREES, (Float) Test.GENERAL_FLOAT);
+ reference.put(Coordinate.KEY_LATITUDE_DEGREES, (Float) TestValues.GENERAL_FLOAT);
+ reference.put(Coordinate.KEY_LONGITUDE_DEGREES, (Float) TestValues.GENERAL_FLOAT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -64,10 +64,10 @@ public class CoordinateTests extends TestCase {
Object a = JsonUtils.readObjectFromJsonObject(reference, key);
Object b = JsonUtils.readObjectFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, a, b);
+ assertEquals(TestValues.MATCH, a, b);
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
index 245abf45b..85f0d41fa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class DIDResultTests extends TestCase {
public void setUp(){
msg = new DIDResult();
- msg.setData(Test.GENERAL_STRING);
- msg.setResultCode(Test.GENERAL_VEHICLEDATARESULTCODE);
+ msg.setData(TestValues.GENERAL_STRING);
+ msg.setResultCode(TestValues.GENERAL_VEHICLEDATARESULTCODE);
}
/**
@@ -37,34 +37,34 @@ public class DIDResultTests extends TestCase {
VehicleDataResultCode resultCode = msg.getResultCode();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, data);
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATARESULTCODE, resultCode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, data);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATARESULTCODE, resultCode);
// Invalid/Null Tests
DIDResult msg = new DIDResult();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getData());
- assertNull(Test.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getData());
+ assertNull(TestValues.NULL, msg.getResultCode());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DIDResult.KEY_DATA, Test.GENERAL_STRING);
- reference.put(DIDResult.KEY_RESULT_CODE, Test.GENERAL_VEHICLEDATARESULTCODE);
+ reference.put(DIDResult.KEY_DATA, TestValues.GENERAL_STRING);
+ reference.put(DIDResult.KEY_RESULT_CODE, TestValues.GENERAL_VEHICLEDATARESULTCODE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
index 7104e8c6d..09457ef60 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.DTC;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,8 +23,8 @@ public class DTCTests extends TestCase{
public void setUp(){
msg = new DTC();
- msg.setIdentifier(Test.GENERAL_STRING);
- msg.setStatusByte(Test.GENERAL_STRING);
+ msg.setIdentifier(TestValues.GENERAL_STRING);
+ msg.setStatusByte(TestValues.GENERAL_STRING);
}
/**
@@ -36,34 +36,34 @@ public class DTCTests extends TestCase{
String statusByte = msg.getStatusByte();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, identifier);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, statusByte);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, identifier);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, statusByte);
// Invalid/Null Tests
DTC msg = new DTC();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getIdentifier());
- assertNull(Test.NULL, msg.getStatusByte());
+ assertNull(TestValues.NULL, msg.getIdentifier());
+ assertNull(TestValues.NULL, msg.getStatusByte());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DTC.KEY_IDENTIFIER, Test.GENERAL_STRING);
- reference.put(DTC.KEY_STATUS_BYTE, Test.GENERAL_STRING);
+ reference.put(DTC.KEY_IDENTIFIER, TestValues.GENERAL_STRING);
+ reference.put(DTC.KEY_STATUS_BYTE, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
index 2cf38b68f..b0bd3a2dd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,15 +23,15 @@ public class DateTimeTests extends TestCase {
public void setUp(){
msg = new DateTime();
- msg.setYear(Test.GENERAL_INT);
- msg.setMonth(Test.GENERAL_INT);
- msg.setDay(Test.GENERAL_INT);
- msg.setHour(Test.GENERAL_INT);
- msg.setMinute(Test.GENERAL_INT);
- msg.setSecond(Test.GENERAL_INT);
- msg.setMilliSecond(Test.GENERAL_INT);
- msg.setTzHour(Test.GENERAL_INT);
- msg.setTzMinute(Test.GENERAL_INT);
+ msg.setYear(TestValues.GENERAL_INT);
+ msg.setMonth(TestValues.GENERAL_INT);
+ msg.setDay(TestValues.GENERAL_INT);
+ msg.setHour(TestValues.GENERAL_INT);
+ msg.setMinute(TestValues.GENERAL_INT);
+ msg.setSecond(TestValues.GENERAL_INT);
+ msg.setMilliSecond(TestValues.GENERAL_INT);
+ msg.setTzHour(TestValues.GENERAL_INT);
+ msg.setTzMinute(TestValues.GENERAL_INT);
}
/**
@@ -50,48 +50,48 @@ public class DateTimeTests extends TestCase {
Integer tzMin = msg.getTzMinute();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, year);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, month);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, day);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, hour);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, min);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, sec);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, ms);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, tzHour);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, tzMin);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, year);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, month);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, day);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, hour);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, min);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, sec);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, ms);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, tzHour);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, tzMin);
// Invalid/Null Tests
DateTime msg = new DateTime();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getYear());
- assertNull(Test.NULL, msg.getMonth());
- assertNull(Test.NULL, msg.getDay());
- assertNull(Test.NULL, msg.getHour());
- assertNull(Test.NULL, msg.getMinute());
- assertNull(Test.NULL, msg.getSecond());
- assertNull(Test.NULL, msg.getMilliSecond());
- assertNull(Test.NULL, msg.getTzHour());
- assertNull(Test.NULL, msg.getTzMinute());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getYear());
+ assertNull(TestValues.NULL, msg.getMonth());
+ assertNull(TestValues.NULL, msg.getDay());
+ assertNull(TestValues.NULL, msg.getHour());
+ assertNull(TestValues.NULL, msg.getMinute());
+ assertNull(TestValues.NULL, msg.getSecond());
+ assertNull(TestValues.NULL, msg.getMilliSecond());
+ assertNull(TestValues.NULL, msg.getTzHour());
+ assertNull(TestValues.NULL, msg.getTzMinute());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DateTime.KEY_YEAR, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_MONTH, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_DAY, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_HOUR, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_MINUTE, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_SECOND, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_MILLISECOND, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_TZ_HOUR, (Integer) Test.GENERAL_INT);
- reference.put(DateTime.KEY_TZ_MINUTE, (Integer) Test.GENERAL_INT);
+ reference.put(DateTime.KEY_YEAR, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_MONTH, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_DAY, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_HOUR, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_MINUTE, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_SECOND, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_MILLISECOND, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_TZ_HOUR, (Integer) TestValues.GENERAL_INT);
+ reference.put(DateTime.KEY_TZ_MINUTE, (Integer) TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -100,10 +100,10 @@ public class DateTimeTests extends TestCase {
Object a = JsonUtils.readObjectFromJsonObject(reference, key);
Object b = JsonUtils.readObjectFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, a, b);
+ assertEquals(TestValues.MATCH, a, b);
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
index dfe75fd30..451f1475e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,12 +23,12 @@ public class DeviceInfoTests extends TestCase{
public void setUp(){
msg = new DeviceInfo();
- msg.setCarrier(Test.GENERAL_STRING);
- msg.setFirmwareRev(Test.GENERAL_STRING);
- msg.setHardware(Test.GENERAL_STRING);
- msg.setMaxNumberRFCOMMPorts(Test.GENERAL_INT);
- msg.setOs(Test.GENERAL_STRING);
- msg.setOsVersion(Test.GENERAL_STRING);
+ msg.setCarrier(TestValues.GENERAL_STRING);
+ msg.setFirmwareRev(TestValues.GENERAL_STRING);
+ msg.setHardware(TestValues.GENERAL_STRING);
+ msg.setMaxNumberRFCOMMPorts(TestValues.GENERAL_INT);
+ msg.setOs(TestValues.GENERAL_STRING);
+ msg.setOsVersion(TestValues.GENERAL_STRING);
}
/**
@@ -44,46 +44,46 @@ public class DeviceInfoTests extends TestCase{
int maxNum = msg.getMaxNumberRFCOMMPorts();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, maxNum);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, osVer);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, os);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, firmwareRev);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, hardware);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, carrier);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, maxNum);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, osVer);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, os);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, firmwareRev);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, hardware);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, carrier);
// Invalid/Null Tests
DeviceInfo msg = new DeviceInfo();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getCarrier());
- assertNull(Test.NULL, msg.getHardware());
- assertNull(Test.NULL, msg.getFirmwareRev());
- assertNull(Test.NULL, msg.getOs());
- assertNull(Test.NULL, msg.getOsVersion());
- assertNull(Test.NULL, msg.getMaxNumberRFCOMMPorts());
+ assertNull(TestValues.NULL, msg.getCarrier());
+ assertNull(TestValues.NULL, msg.getHardware());
+ assertNull(TestValues.NULL, msg.getFirmwareRev());
+ assertNull(TestValues.NULL, msg.getOs());
+ assertNull(TestValues.NULL, msg.getOsVersion());
+ assertNull(TestValues.NULL, msg.getMaxNumberRFCOMMPorts());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DeviceInfo.KEY_CARRIER, Test.GENERAL_STRING);
- reference.put(DeviceInfo.KEY_HARDWARE, Test.GENERAL_STRING);
- reference.put(DeviceInfo.KEY_FIRMWARE_REV, Test.GENERAL_STRING);
- reference.put(DeviceInfo.KEY_OS, Test.GENERAL_STRING);
- reference.put(DeviceInfo.KEY_OS_VERSION, Test.GENERAL_STRING);
- reference.put(DeviceInfo.KEY_MAX_NUMBER_RFCOMM_PORTS, Test.GENERAL_INT);
+ reference.put(DeviceInfo.KEY_CARRIER, TestValues.GENERAL_STRING);
+ reference.put(DeviceInfo.KEY_HARDWARE, TestValues.GENERAL_STRING);
+ reference.put(DeviceInfo.KEY_FIRMWARE_REV, TestValues.GENERAL_STRING);
+ reference.put(DeviceInfo.KEY_OS, TestValues.GENERAL_STRING);
+ reference.put(DeviceInfo.KEY_OS_VERSION, TestValues.GENERAL_STRING);
+ reference.put(DeviceInfo.KEY_MAX_NUMBER_RFCOMM_PORTS, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
index e696e48c2..cc7b23cce 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.DeviceStatus;
import com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,17 +25,17 @@ public class DeviceStatusTests extends TestCase {
public void setUp(){
msg = new DeviceStatus();
- msg.setBattLevelStatus(Test.GENERAL_DEVICELEVELSTATUS);
- msg.setBtIconOn(Test.GENERAL_BOOLEAN);
- msg.setCallActive(Test.GENERAL_BOOLEAN);
- msg.setECallEventActive(Test.GENERAL_BOOLEAN);
- msg.setMonoAudioOutputMuted(Test.GENERAL_BOOLEAN);
- msg.setPhoneRoaming(Test.GENERAL_BOOLEAN);
- msg.setPrimaryAudioSource(Test.GENERAL_PRIMARYAUDIOSOURCE);
- msg.setSignalLevelStatus(Test.GENERAL_DEVICELEVELSTATUS);
- msg.setStereoAudioOutputMuted(Test.GENERAL_BOOLEAN);
- msg.setTextMsgAvailable(Test.GENERAL_BOOLEAN);
- msg.setVoiceRecOn(Test.GENERAL_BOOLEAN);
+ msg.setBattLevelStatus(TestValues.GENERAL_DEVICELEVELSTATUS);
+ msg.setBtIconOn(TestValues.GENERAL_BOOLEAN);
+ msg.setCallActive(TestValues.GENERAL_BOOLEAN);
+ msg.setECallEventActive(TestValues.GENERAL_BOOLEAN);
+ msg.setMonoAudioOutputMuted(TestValues.GENERAL_BOOLEAN);
+ msg.setPhoneRoaming(TestValues.GENERAL_BOOLEAN);
+ msg.setPrimaryAudioSource(TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ msg.setSignalLevelStatus(TestValues.GENERAL_DEVICELEVELSTATUS);
+ msg.setStereoAudioOutputMuted(TestValues.GENERAL_BOOLEAN);
+ msg.setTextMsgAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVoiceRecOn(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -56,61 +56,61 @@ public class DeviceStatusTests extends TestCase {
boolean voiceRec = msg.getVoiceRecOn();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_DEVICELEVELSTATUS, battLevel);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, btIcon);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, callActive);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ecall);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, monoAudio);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, phoneRoaming);
- assertEquals(Test.MATCH, Test.GENERAL_PRIMARYAUDIOSOURCE, primaryAudio);
- assertEquals(Test.MATCH, Test.GENERAL_DEVICELEVELSTATUS, signalLevel);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, stereoAudio);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, textAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, voiceRec);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DEVICELEVELSTATUS, battLevel);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, btIcon);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, callActive);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, ecall);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, monoAudio);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, phoneRoaming);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PRIMARYAUDIOSOURCE, primaryAudio);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DEVICELEVELSTATUS, signalLevel);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, stereoAudio);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, textAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, voiceRec);
// Invalid/Null Tests
DeviceStatus msg = new DeviceStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getBattLevelStatus());
- assertNull(Test.NULL, msg.getBtIconOn());
- assertNull(Test.NULL, msg.getCallActive());
- assertNull(Test.NULL, msg.getECallEventActive());
- assertNull(Test.NULL, msg.getMonoAudioOutputMuted());
- assertNull(Test.NULL, msg.getPhoneRoaming());
- assertNull(Test.NULL, msg.getPrimaryAudioSource());
- assertNull(Test.NULL, msg.getSignalLevelStatus());
- assertNull(Test.NULL, msg.getStereoAudioOutputMuted());
- assertNull(Test.NULL, msg.getTextMsgAvailable());
- assertNull(Test.NULL, msg.getVoiceRecOn());
+ assertNull(TestValues.NULL, msg.getBattLevelStatus());
+ assertNull(TestValues.NULL, msg.getBtIconOn());
+ assertNull(TestValues.NULL, msg.getCallActive());
+ assertNull(TestValues.NULL, msg.getECallEventActive());
+ assertNull(TestValues.NULL, msg.getMonoAudioOutputMuted());
+ assertNull(TestValues.NULL, msg.getPhoneRoaming());
+ assertNull(TestValues.NULL, msg.getPrimaryAudioSource());
+ assertNull(TestValues.NULL, msg.getSignalLevelStatus());
+ assertNull(TestValues.NULL, msg.getStereoAudioOutputMuted());
+ assertNull(TestValues.NULL, msg.getTextMsgAvailable());
+ assertNull(TestValues.NULL, msg.getVoiceRecOn());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, Test.GENERAL_DEVICELEVELSTATUS);
- reference.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, Test.GENERAL_DEVICELEVELSTATUS);
- reference.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, Test.GENERAL_PRIMARYAUDIOSOURCE);
- reference.put(DeviceStatus.KEY_BT_ICON_ON, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_CALL_ACTIVE, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_PHONE_ROAMING, Test.GENERAL_BOOLEAN);
- reference.put(DeviceStatus.KEY_VOICE_REC_ON, Test.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, TestValues.GENERAL_DEVICELEVELSTATUS);
+ reference.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, TestValues.GENERAL_DEVICELEVELSTATUS);
+ reference.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ reference.put(DeviceStatus.KEY_BT_ICON_ON, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_CALL_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_PHONE_ROAMING, TestValues.GENERAL_BOOLEAN);
+ reference.put(DeviceStatus.KEY_VOICE_REC_ON, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
index 4f0256f79..a533df277 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -33,15 +33,15 @@ public class DisplayCapabilitiesTests extends TestCase{
public void setUp(){
msg = new DisplayCapabilities();
- msg.setGraphicSupported(Test.GENERAL_BOOLEAN);
- msg.setNumCustomPresetsAvailable(Test.GENERAL_INT);
- msg.setDisplayType(Test.GENERAL_DISPLAYTYPE);
- msg.setDisplayName(Test.GENERAL_STRING);
- msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST);
- msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST);
- msg.setMediaClockFormats(Test.GENERAL_MEDIACLOCKFORMAT_LIST);
- msg.setScreenParams(Test.GENERAL_SCREENPARAMS);
- msg.setTemplatesAvailable(Test.GENERAL_STRING_LIST);
+ msg.setGraphicSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setNumCustomPresetsAvailable(TestValues.GENERAL_INT);
+ msg.setDisplayType(TestValues.GENERAL_DISPLAYTYPE);
+ msg.setDisplayName(TestValues.GENERAL_STRING);
+ msg.setImageFields(TestValues.GENERAL_IMAGEFIELD_LIST);
+ msg.setTextFields(TestValues.GENERAL_TEXTFIELD_LIST);
+ msg.setMediaClockFormats(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST);
+ msg.setScreenParams(TestValues.GENERAL_SCREENPARAMS);
+ msg.setTemplatesAvailable(TestValues.GENERAL_STRING_LIST);
}
/**
@@ -60,64 +60,64 @@ public class DisplayCapabilitiesTests extends TestCase{
List<ImageField> imageFields = msg.getImageFields();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, graphicSupported);
- assertEquals(Test.MATCH, Test.GENERAL_INT, numPresets);
- assertEquals(Test.MATCH, Test.GENERAL_DISPLAYTYPE, displayType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, displayName);
- assertTrue(Test.TRUE, Validator.validateScreenParams(Test.GENERAL_SCREENPARAMS, screenParams));
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), templatesAvailable.size());
- assertEquals(Test.MATCH, Test.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size());
- assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
- assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
-
- for(int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, graphicSupported);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, numPresets);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DISPLAYTYPE, displayType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, displayName);
+ assertTrue(TestValues.TRUE, Validator.validateScreenParams(TestValues.GENERAL_SCREENPARAMS, screenParams));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), templatesAvailable.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
+
+ for(int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
}
- for(int i = 0; i < Test.GENERAL_MEDIACLOCKFORMAT_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_MEDIACLOCKFORMAT_LIST.get(i), mediaClock.get(i));
+ for(int i = 0; i < TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.get(i), mediaClock.get(i));
}
- for(int i = 0; i < Test.GENERAL_TEXTFIELD_LIST.size(); i++){
- assertTrue(Test.TRUE, Validator.validateTextFields(Test.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
+ for(int i = 0; i < TestValues.GENERAL_TEXTFIELD_LIST.size(); i++){
+ assertTrue(TestValues.TRUE, Validator.validateTextFields(TestValues.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
}
- for(int i = 0; i < Test.GENERAL_IMAGEFIELD_LIST.size(); i++){
- assertTrue(Test.TRUE, Validator.validateImageFields(Test.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
+ for(int i = 0; i < TestValues.GENERAL_IMAGEFIELD_LIST.size(); i++){
+ assertTrue(TestValues.TRUE, Validator.validateImageFields(TestValues.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
}
// Invalid/Null Tests
DisplayCapabilities msg = new DisplayCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getDisplayType());
- assertNull(Test.NULL, msg.getDisplayName());
- assertNull(Test.NULL, msg.getGraphicSupported());
- assertNull(Test.NULL, msg.getImageFields());
- assertNull(Test.NULL, msg.getMediaClockFormats());
- assertNull(Test.NULL, msg.getNumCustomPresetsAvailable());
- assertNull(Test.NULL, msg.getScreenParams());
- assertNull(Test.NULL, msg.getTemplatesAvailable());
- assertNull(Test.NULL, msg.getTextFields());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getDisplayType());
+ assertNull(TestValues.NULL, msg.getDisplayName());
+ assertNull(TestValues.NULL, msg.getGraphicSupported());
+ assertNull(TestValues.NULL, msg.getImageFields());
+ assertNull(TestValues.NULL, msg.getMediaClockFormats());
+ assertNull(TestValues.NULL, msg.getNumCustomPresetsAvailable());
+ assertNull(TestValues.NULL, msg.getScreenParams());
+ assertNull(TestValues.NULL, msg.getTemplatesAvailable());
+ assertNull(TestValues.NULL, msg.getTextFields());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(DisplayCapabilities.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, Test.GENERAL_INT);
- reference.put(DisplayCapabilities.KEY_GRAPHIC_SUPPORTED, Test.GENERAL_BOOLEAN);
- reference.put(DisplayCapabilities.KEY_DISPLAY_TYPE, Test.GENERAL_DISPLAYTYPE);
- reference.put(DisplayCapabilities.KEY_DISPLAY_NAME, Test.GENERAL_STRING);
- reference.put(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS, JsonUtils.createJsonArray(Test.GENERAL_MEDIACLOCKFORMAT_LIST));
- reference.put(DisplayCapabilities.KEY_TEXT_FIELDS, Test.JSON_TEXTFIELDS);
- reference.put(DisplayCapabilities.KEY_IMAGE_FIELDS, Test.JSON_IMAGEFIELDS);
- reference.put(DisplayCapabilities.KEY_SCREEN_PARAMS, Test.JSON_SCREENPARAMS);
+ reference.put(DisplayCapabilities.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, TestValues.GENERAL_INT);
+ reference.put(DisplayCapabilities.KEY_GRAPHIC_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(DisplayCapabilities.KEY_DISPLAY_TYPE, TestValues.GENERAL_DISPLAYTYPE);
+ reference.put(DisplayCapabilities.KEY_DISPLAY_NAME, TestValues.GENERAL_STRING);
+ reference.put(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS, JsonUtils.createJsonArray(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST));
+ reference.put(DisplayCapabilities.KEY_TEXT_FIELDS, TestValues.JSON_TEXTFIELDS);
+ reference.put(DisplayCapabilities.KEY_IMAGE_FIELDS, TestValues.JSON_IMAGEFIELDS);
+ reference.put(DisplayCapabilities.KEY_SCREEN_PARAMS, TestValues.JSON_SCREENPARAMS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -125,49 +125,49 @@ public class DisplayCapabilitiesTests extends TestCase{
if(key.equals(DisplayCapabilities.KEY_IMAGE_FIELDS)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for(int i = 0; i < referenceArray.length(); i++){
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
}
} else if(key.equals(DisplayCapabilities.KEY_TEXT_FIELDS)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for(int i = 0; i < referenceArray.length(); i++){
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
}
} else if(key.equals(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if(key.equals(DisplayCapabilities.KEY_SCREEN_PARAMS)){
JSONObject referenceArray = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject underTestArray = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray);
- assertTrue(Test.TRUE, Validator.validateScreenParams(new ScreenParams(hashReference), new ScreenParams(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateScreenParams(new ScreenParams(hashReference), new ScreenParams(hashTest)));
} else if(key.equals(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for(int i = 0; i < referenceArray.length(); i++){
- assertTrue(Test.TRUE, Validator.validateText(referenceArray.getString(i), underTestArray.getString(i)));// not a string?
+ assertTrue(TestValues.TRUE, Validator.validateText(referenceArray.getString(i), underTestArray.getString(i)));// not a string?
}
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
index 6bb57761f..4d745edbd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -30,9 +30,9 @@ public class DisplayCapabilityTests extends TestCase {
public void setUp() {
msg = new DisplayCapability();
- msg.setDisplayName(Test.GENERAL_STRING);
- msg.setWindowTypeSupported(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
- msg.setWindowCapabilities(Test.GENERAL_WINDOW_CAPABILITY_LIST);
+ msg.setDisplayName(TestValues.GENERAL_STRING);
+ msg.setWindowTypeSupported(TestValues.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
+ msg.setWindowCapabilities(TestValues.GENERAL_WINDOW_CAPABILITY_LIST);
}
/**
@@ -45,37 +45,37 @@ public class DisplayCapabilityTests extends TestCase {
List<WindowCapability> windowCapabilities = msg.getWindowCapabilities();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, displayName);
- assertEquals(Test.MATCH, Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(), windowTypeSupported.size());
- assertEquals(Test.MATCH, Test.GENERAL_WINDOW_CAPABILITY_LIST.size(), windowCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, displayName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(), windowTypeSupported.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WINDOW_CAPABILITY_LIST.size(), windowCapabilities.size());
- for (int i = 0; i < Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(); i++) {
- assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.get(i), windowTypeSupported.get(i)));
+ for (int i = 0; i < TestValues.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateWindowTypeCapabilities(TestValues.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.get(i), windowTypeSupported.get(i)));
}
- for (int i = 0; i < Test.GENERAL_WINDOW_CAPABILITY_LIST.size(); i++) {
- assertTrue(Test.TRUE, Validator.validateWindowCapability(Test.GENERAL_WINDOW_CAPABILITY_LIST.get(i), windowCapabilities.get(i)));
+ for (int i = 0; i < TestValues.GENERAL_WINDOW_CAPABILITY_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateWindowCapability(TestValues.GENERAL_WINDOW_CAPABILITY_LIST.get(i), windowCapabilities.get(i)));
}
// Invalid/Null Tests
DisplayCapability msg = new DisplayCapability();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getDisplayName());
- assertNull(Test.NULL, msg.getWindowTypeSupported());
- assertNull(Test.NULL, msg.getWindowCapabilities());
+ assertNull(TestValues.NULL, msg.getDisplayName());
+ assertNull(TestValues.NULL, msg.getWindowTypeSupported());
+ assertNull(TestValues.NULL, msg.getWindowCapabilities());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(DisplayCapability.KEY_DISPLAY_NAME, Test.GENERAL_STRING);
- reference.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, Test.JSON_WINDOW_TYPE_CAPABILITIES_LIST);
- reference.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, Test.JSON_WINDOW_CAPABILITIES);
+ reference.put(DisplayCapability.KEY_DISPLAY_NAME, TestValues.GENERAL_STRING);
+ reference.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, TestValues.JSON_WINDOW_TYPE_CAPABILITIES_LIST);
+ reference.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, TestValues.JSON_WINDOW_CAPABILITIES);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -83,29 +83,29 @@ public class DisplayCapabilityTests extends TestCase {
if (key.equals(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(new WindowTypeCapabilities(hashReference), new WindowTypeCapabilities(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateWindowTypeCapabilities(new WindowTypeCapabilities(hashReference), new WindowTypeCapabilities(hashTest)));
}
} else if (key.equals(DisplayCapability.KEY_WINDOW_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateWindowCapability(new WindowCapability(hashReference), new WindowCapability(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateWindowCapability(new WindowCapability(hashReference), new WindowCapability(hashTest)));
}
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
index 229b2300d..31b068570 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.ECallInfo;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,9 +25,9 @@ public class ECallInfoTests extends TestCase{
public void setUp(){
msg = new ECallInfo();
- msg.setAuxECallNotificationStatus(Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
- msg.setECallConfirmationStatus(Test.GENERAL_ECALLCONFIRMATIONSTATUS);
- msg.setECallNotificationStatus(Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
+ msg.setAuxECallNotificationStatus(TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
+ msg.setECallConfirmationStatus(TestValues.GENERAL_ECALLCONFIRMATIONSTATUS);
+ msg.setECallNotificationStatus(TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
}
/**
@@ -40,37 +40,37 @@ public class ECallInfoTests extends TestCase{
ECallConfirmationStatus ecallConfirm = msg.getECallConfirmationStatus();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, auxEcall);
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, ecallNotify);
- assertEquals(Test.MATCH, Test.GENERAL_ECALLCONFIRMATIONSTATUS, ecallConfirm);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, auxEcall);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, ecallNotify);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_ECALLCONFIRMATIONSTATUS, ecallConfirm);
// Invalid/Null Tests
ECallInfo msg = new ECallInfo();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getECallConfirmationStatus());
- assertNull(Test.NULL, msg.getECallNotificationStatus());
- assertNull(Test.NULL, msg.getAuxECallNotificationStatus());
+ assertNull(TestValues.NULL, msg.getECallConfirmationStatus());
+ assertNull(TestValues.NULL, msg.getECallNotificationStatus());
+ assertNull(TestValues.NULL, msg.getAuxECallNotificationStatus());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
- reference.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, Test.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
- reference.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, Test.GENERAL_ECALLCONFIRMATIONSTATUS);
+ reference.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
+ reference.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
+ reference.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, TestValues.GENERAL_ECALLCONFIRMATIONSTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
index 1380c211d..60b2ee390 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.enums.EmergencyEventType;
import com.smartdevicelink.proxy.rpc.enums.FuelCutoffStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -26,11 +26,11 @@ public class EmergencyEventTests extends TestCase{
public void setUp(){
msg = new EmergencyEvent();
- msg.setEmergencyEventType(Test.GENERAL_EMERGENCYEVENTTYPE);
- msg.setFuelCutoffStatus(Test.GENERAL_FUELCUTOFFSTATUS);
- msg.setMaximumChangeVelocity(Test.GENERAL_INT);
- msg.setMultipleEvents(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- msg.setRolloverEvent(Test.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setEmergencyEventType(TestValues.GENERAL_EMERGENCYEVENTTYPE);
+ msg.setFuelCutoffStatus(TestValues.GENERAL_FUELCUTOFFSTATUS);
+ msg.setMaximumChangeVelocity(TestValues.GENERAL_INT);
+ msg.setMultipleEvents(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ msg.setRolloverEvent(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
}
/**
@@ -45,43 +45,43 @@ public class EmergencyEventTests extends TestCase{
VehicleDataEventStatus rollover = msg.getRolloverEvent();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_EMERGENCYEVENTTYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_FUELCUTOFFSTATUS, cutoffStatus);
- assertEquals(Test.MATCH, Test.GENERAL_INT, changeVelocity);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, multipleEvents);
- assertEquals(Test.MATCH, Test.GENERAL_VEHCILEDATAEVENTSTATUS, rollover);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_EMERGENCYEVENTTYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FUELCUTOFFSTATUS, cutoffStatus);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, changeVelocity);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, multipleEvents);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, rollover);
// Invalid/Null Tests
EmergencyEvent msg = new EmergencyEvent();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getEmergencyEventType());
- assertNull(Test.NULL, msg.getFuelCutoffStatus());
- assertNull(Test.NULL, msg.getMaximumChangeVelocity());
- assertNull(Test.NULL, msg.getMultipleEvents());
- assertNull(Test.NULL, msg.getRolloverEvent());
+ assertNull(TestValues.NULL, msg.getEmergencyEventType());
+ assertNull(TestValues.NULL, msg.getFuelCutoffStatus());
+ assertNull(TestValues.NULL, msg.getMaximumChangeVelocity());
+ assertNull(TestValues.NULL, msg.getMultipleEvents());
+ assertNull(TestValues.NULL, msg.getRolloverEvent());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, Test.GENERAL_FUELCUTOFFSTATUS);
- reference.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(EmergencyEvent.KEY_ROLLOVER_EVENT, Test.GENERAL_VEHCILEDATAEVENTSTATUS);
- reference.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, Test.GENERAL_EMERGENCYEVENTTYPE);
- reference.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, Test.GENERAL_INT);
+ reference.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, TestValues.GENERAL_FUELCUTOFFSTATUS);
+ reference.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(EmergencyEvent.KEY_ROLLOVER_EVENT, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
+ reference.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, TestValues.GENERAL_EMERGENCYEVENTTYPE);
+ reference.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
index a803b1ded..f15e74962 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class EqualizerSettingsTests extends TestCase {
public void setUp() {
msg = new EqualizerSettings();
- msg.setChannelId(Test.GENERAL_INT);
- msg.setChannelName(Test.GENERAL_STRING);
- msg.setChannelSetting(Test.GENERAL_INT);
+ msg.setChannelId(TestValues.GENERAL_INT);
+ msg.setChannelName(TestValues.GENERAL_STRING);
+ msg.setChannelSetting(TestValues.GENERAL_INT);
}
/**
@@ -39,17 +39,17 @@ public class EqualizerSettingsTests extends TestCase {
int channelSetting = msg.getChannelSetting();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, channelId);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, channelName);
- assertEquals(Test.MATCH, Test.GENERAL_INT, channelSetting);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, channelName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelSetting);
// Invalid/Null Tests
EqualizerSettings msg = new EqualizerSettings();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getChannelId());
- assertNull(Test.NULL, msg.getChannelName());
- assertNull(Test.NULL, msg.getChannelSetting());
+ assertNull(TestValues.NULL, msg.getChannelId());
+ assertNull(TestValues.NULL, msg.getChannelName());
+ assertNull(TestValues.NULL, msg.getChannelSetting());
}
public void testJson() {
@@ -57,22 +57,22 @@ public class EqualizerSettingsTests extends TestCase {
try {
- reference.put(EqualizerSettings.KEY_CHANNEL_ID, Test.GENERAL_INT);
- reference.put(EqualizerSettings.KEY_CHANNEL_NAME, Test.GENERAL_STRING);
- reference.put(EqualizerSettings.KEY_CHANNEL_SETTING, Test.GENERAL_INT);
+ reference.put(EqualizerSettings.KEY_CHANNEL_ID, TestValues.GENERAL_INT);
+ reference.put(EqualizerSettings.KEY_CHANNEL_NAME, TestValues.GENERAL_STRING);
+ reference.put(EqualizerSettings.KEY_CHANNEL_SETTING, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
index 2dffd2f5b..f8bb07caf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.FuelRange;
import com.smartdevicelink.proxy.rpc.enums.FuelType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class FuelRangeTests extends TestCase{
public void setUp(){
msg = new FuelRange();
- msg.setType(Test.GENERAL_FUELTYPE);
- msg.setRange(Test.GENERAL_FLOAT);
+ msg.setType(TestValues.GENERAL_FUELTYPE);
+ msg.setRange(TestValues.GENERAL_FLOAT);
}
/**
@@ -37,35 +37,35 @@ public class FuelRangeTests extends TestCase{
float range = msg.getRange();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, range);
- assertEquals(Test.MATCH, Test.GENERAL_FUELTYPE, fuelType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, range);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FUELTYPE, fuelType);
// Invalid/Null Tests
FuelRange msg = new FuelRange();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getType());
- assertNull(Test.NULL, msg.getRange());
+ assertNull(TestValues.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getRange());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(FuelRange.KEY_TYPE, Test.GENERAL_FUELTYPE);
- reference.put(FuelRange.KEY_RANGE, (Float) Test.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_TYPE, TestValues.GENERAL_FUELTYPE);
+ reference.put(FuelRange.KEY_RANGE, (Float) TestValues.GENERAL_FLOAT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
index 357e178c0..050473ad6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.GPSData;
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
import com.smartdevicelink.proxy.rpc.enums.Dimension;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,25 +25,25 @@ public class GPSDataTests extends TestCase{
public void setUp(){
msg = new GPSData();
- msg.setActual(Test.GENERAL_BOOLEAN);
- msg.setAltitude(Test.GENERAL_DOUBLE);
- msg.setCompassDirection(Test.GENERAL_COMPASSDIRECTION);
- msg.setDimension(Test.GENERAL_DIMENSION);
- msg.setHdop(Test.GENERAL_DOUBLE);
- msg.setHeading(Test.GENERAL_DOUBLE);
- msg.setLatitudeDegrees(Test.GENERAL_DOUBLE);
- msg.setLongitudeDegrees(Test.GENERAL_DOUBLE);
- msg.setPdop(Test.GENERAL_DOUBLE);
- msg.setSatellites(Test.GENERAL_INT);
- msg.setSpeed(Test.GENERAL_DOUBLE);
- msg.setUtcDay(Test.GENERAL_INT);
- msg.setUtcHours(Test.GENERAL_INT);
- msg.setUtcMinutes(Test.GENERAL_INT);
- msg.setUtcMonth(Test.GENERAL_INT);
- msg.setUtcSeconds(Test.GENERAL_INT);
- msg.setUtcYear(Test.GENERAL_INT);
- msg.setVdop(Test.GENERAL_DOUBLE);
- msg.setShifted(Test.GENERAL_BOOLEAN);
+ msg.setActual(TestValues.GENERAL_BOOLEAN);
+ msg.setAltitude(TestValues.GENERAL_DOUBLE);
+ msg.setCompassDirection(TestValues.GENERAL_COMPASSDIRECTION);
+ msg.setDimension(TestValues.GENERAL_DIMENSION);
+ msg.setHdop(TestValues.GENERAL_DOUBLE);
+ msg.setHeading(TestValues.GENERAL_DOUBLE);
+ msg.setLatitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setLongitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setPdop(TestValues.GENERAL_DOUBLE);
+ msg.setSatellites(TestValues.GENERAL_INT);
+ msg.setSpeed(TestValues.GENERAL_DOUBLE);
+ msg.setUtcDay(TestValues.GENERAL_INT);
+ msg.setUtcHours(TestValues.GENERAL_INT);
+ msg.setUtcMinutes(TestValues.GENERAL_INT);
+ msg.setUtcMonth(TestValues.GENERAL_INT);
+ msg.setUtcSeconds(TestValues.GENERAL_INT);
+ msg.setUtcYear(TestValues.GENERAL_INT);
+ msg.setVdop(TestValues.GENERAL_DOUBLE);
+ msg.setShifted(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -72,85 +72,85 @@ public class GPSDataTests extends TestCase{
boolean shifted = msg.getShifted();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, actual);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, latitude);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, longitude);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, altitude);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, heading);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, speed);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, pdop);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, hdop);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, vdop);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcYear);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcMin);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcMonths);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcDay);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcHours);
- assertEquals(Test.MATCH, Test.GENERAL_INT, utcSec);
- assertEquals(Test.MATCH, Test.GENERAL_INT, satellites);
- assertEquals(Test.MATCH, Test.GENERAL_DIMENSION, dimension);
- assertEquals(Test.MATCH, Test.GENERAL_COMPASSDIRECTION, direction);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shifted);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, actual);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, latitude);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, longitude);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, altitude);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, heading);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, speed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, pdop);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, hdop);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, vdop);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcYear);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcMin);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcMonths);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcDay);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcHours);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, utcSec);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, satellites);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DIMENSION, dimension);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPASSDIRECTION, direction);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, shifted);
// Invalid/Null Tests
GPSData msg = new GPSData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getActual());
- assertNull(Test.NULL, msg.getAltitude());
- assertNull(Test.NULL, msg.getCompassDirection());
- assertNull(Test.NULL, msg.getDimension());
- assertNull(Test.NULL, msg.getHdop());
- assertNull(Test.NULL, msg.getHeading());
- assertNull(Test.NULL, msg.getLatitudeDegrees());
- assertNull(Test.NULL, msg.getLongitudeDegrees());
- assertNull(Test.NULL, msg.getPdop());
- assertNull(Test.NULL, msg.getSatellites());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getUtcDay());
- assertNull(Test.NULL, msg.getUtcHours());
- assertNull(Test.NULL, msg.getUtcMinutes());
- assertNull(Test.NULL, msg.getUtcMonth());
- assertNull(Test.NULL, msg.getUtcSeconds());
- assertNull(Test.NULL, msg.getUtcYear());
- assertNull(Test.NULL, msg.getVdop());
- assertNull(Test.NULL, msg.getShifted());
+ assertNull(TestValues.NULL, msg.getActual());
+ assertNull(TestValues.NULL, msg.getAltitude());
+ assertNull(TestValues.NULL, msg.getCompassDirection());
+ assertNull(TestValues.NULL, msg.getDimension());
+ assertNull(TestValues.NULL, msg.getHdop());
+ assertNull(TestValues.NULL, msg.getHeading());
+ assertNull(TestValues.NULL, msg.getLatitudeDegrees());
+ assertNull(TestValues.NULL, msg.getLongitudeDegrees());
+ assertNull(TestValues.NULL, msg.getPdop());
+ assertNull(TestValues.NULL, msg.getSatellites());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getUtcDay());
+ assertNull(TestValues.NULL, msg.getUtcHours());
+ assertNull(TestValues.NULL, msg.getUtcMinutes());
+ assertNull(TestValues.NULL, msg.getUtcMonth());
+ assertNull(TestValues.NULL, msg.getUtcSeconds());
+ assertNull(TestValues.NULL, msg.getUtcYear());
+ assertNull(TestValues.NULL, msg.getVdop());
+ assertNull(TestValues.NULL, msg.getShifted());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(GPSData.KEY_ACTUAL, Test.GENERAL_BOOLEAN);
- reference.put(GPSData.KEY_LATITUDE_DEGREES, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_LONGITUDE_DEGREES, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_ALTITUDE, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_HEADING, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_SPEED, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_PDOP, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_HDOP, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_VDOP, Test.GENERAL_DOUBLE);
- reference.put(GPSData.KEY_UTC_YEAR, Test.GENERAL_INT);
- reference.put(GPSData.KEY_UTC_MONTH, Test.GENERAL_INT);
- reference.put(GPSData.KEY_UTC_HOURS, Test.GENERAL_INT);
- reference.put(GPSData.KEY_UTC_DAY, Test.GENERAL_INT);
- reference.put(GPSData.KEY_UTC_MINUTES, Test.GENERAL_INT);
- reference.put(GPSData.KEY_UTC_SECONDS, Test.GENERAL_INT);
- reference.put(GPSData.KEY_SATELLITES, Test.GENERAL_INT);
- reference.put(GPSData.KEY_DIMENSION, Test.GENERAL_DIMENSION);
- reference.put(GPSData.KEY_COMPASS_DIRECTION, Test.GENERAL_COMPASSDIRECTION);
- reference.put(GPSData.KEY_SHIFTED, Test.GENERAL_BOOLEAN);
+ reference.put(GPSData.KEY_ACTUAL, TestValues.GENERAL_BOOLEAN);
+ reference.put(GPSData.KEY_LATITUDE_DEGREES, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_LONGITUDE_DEGREES, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_ALTITUDE, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_HEADING, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_SPEED, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_PDOP, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_HDOP, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_VDOP, TestValues.GENERAL_DOUBLE);
+ reference.put(GPSData.KEY_UTC_YEAR, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_UTC_MONTH, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_UTC_HOURS, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_UTC_DAY, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_UTC_MINUTES, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_UTC_SECONDS, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_SATELLITES, TestValues.GENERAL_INT);
+ reference.put(GPSData.KEY_DIMENSION, TestValues.GENERAL_DIMENSION);
+ reference.put(GPSData.KEY_COMPASS_DIRECTION, TestValues.GENERAL_COMPASSDIRECTION);
+ reference.put(GPSData.KEY_SHIFTED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
index 1d9bccf92..ab45ec434 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.Grid;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -18,12 +18,12 @@ public class GridTests extends TestCase {
@Override
public void setUp() {
msg = new Grid();
- msg.setCol(Test.GENERAL_INT);
- msg.setRow(Test.GENERAL_INT);
- msg.setLevel(Test.GENERAL_INT);
- msg.setColSpan(Test.GENERAL_INT);
- msg.setRowSpan(Test.GENERAL_INT);
- msg.setLevelSpan(Test.GENERAL_INT);
+ msg.setCol(TestValues.GENERAL_INT);
+ msg.setRow(TestValues.GENERAL_INT);
+ msg.setLevel(TestValues.GENERAL_INT);
+ msg.setColSpan(TestValues.GENERAL_INT);
+ msg.setRowSpan(TestValues.GENERAL_INT);
+ msg.setLevelSpan(TestValues.GENERAL_INT);
}
public void testRpcValues() {
@@ -35,39 +35,39 @@ public class GridTests extends TestCase {
int levelSpan = msg.getLevelSpan();
//valid tests
- assertEquals(Test.MATCH, col, Test.GENERAL_INT);
- assertEquals(Test.MATCH, row, Test.GENERAL_INT);
- assertEquals(Test.MATCH, level, Test.GENERAL_INT);
- assertEquals(Test.MATCH, colSpan, Test.GENERAL_INT);
- assertEquals(Test.MATCH, rowSpan, Test.GENERAL_INT);
- assertEquals(Test.MATCH, levelSpan, Test.GENERAL_INT);
+ assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, colSpan, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, rowSpan, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, levelSpan, TestValues.GENERAL_INT);
//null tests
Grid msg = new Grid();
- assertNull(Test.NULL, msg.getCol());
- assertNull(Test.NULL, msg.getRow());
- assertNull(Test.NULL, msg.getLevel());
- assertNull(Test.NULL, msg.getColSpan());
- assertNull(Test.NULL, msg.getRowSpan());
- assertNull(Test.NULL, msg.getLevelSpan());
+ assertNull(TestValues.NULL, msg.getCol());
+ assertNull(TestValues.NULL, msg.getRow());
+ assertNull(TestValues.NULL, msg.getLevel());
+ assertNull(TestValues.NULL, msg.getColSpan());
+ assertNull(TestValues.NULL, msg.getRowSpan());
+ assertNull(TestValues.NULL, msg.getLevelSpan());
//test required constructor
- Grid msg2 = new Grid(Test.GENERAL_INT, Test.GENERAL_INT);
+ Grid msg2 = new Grid(TestValues.GENERAL_INT, TestValues.GENERAL_INT);
int row2 = msg2.getRow();
int col2 = msg2.getCol();
- assertEquals(Test.MATCH, col2, Test.GENERAL_INT);
- assertEquals(Test.MATCH, row2, Test.GENERAL_INT);
+ assertEquals(TestValues.MATCH, col2, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, row2, TestValues.GENERAL_INT);
}
public void testJson() {
JSONObject original = new JSONObject();
try {
- original.put(Grid.KEY_COL, Test.GENERAL_INT);
- original.put(Grid.KEY_ROW, Test.GENERAL_INT);
- original.put(Grid.KEY_LEVEL, Test.GENERAL_INT);
- original.put(Grid.KEY_COL_SPAN, Test.GENERAL_INT);
- original.put(Grid.KEY_ROW_SPAN, Test.GENERAL_INT);
- original.put(Grid.KEY_LEVEL_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_COL, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_ROW, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_COL_SPAN, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_ROW_SPAN, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL_SPAN, TestValues.GENERAL_INT);
JSONObject serialized = msg.serializeJSON();
assertEquals(serialized.length(), original.length());
@@ -80,21 +80,21 @@ public class GridTests extends TestCase {
grid1 = new Grid(JsonRPCMarshaller.deserializeJSONObject(original));
grid2 = new Grid(JsonRPCMarshaller.deserializeJSONObject(serialized));
if (key.equals(Grid.KEY_COL)) {
- assertEquals(Test.MATCH, grid1.getCol(), grid2.getCol());
+ assertEquals(TestValues.MATCH, grid1.getCol(), grid2.getCol());
} else if (key.equals(Grid.KEY_ROW)) {
- assertEquals(Test.MATCH, grid1.getRow(), grid2.getRow());
+ assertEquals(TestValues.MATCH, grid1.getRow(), grid2.getRow());
} else if (key.equals(Grid.KEY_LEVEL)) {
- assertEquals(Test.MATCH, grid1.getLevel(), grid2.getLevel());
+ assertEquals(TestValues.MATCH, grid1.getLevel(), grid2.getLevel());
} else if (key.equals(Grid.KEY_COL_SPAN)) {
- assertEquals(Test.MATCH, grid1.getColSpan(), grid2.getColSpan());
+ assertEquals(TestValues.MATCH, grid1.getColSpan(), grid2.getColSpan());
} else if (key.equals(Grid.KEY_ROW_SPAN)) {
- assertEquals(Test.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
+ assertEquals(TestValues.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
} else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
- assertEquals(Test.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
+ assertEquals(TestValues.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
index cc4813caa..87c83cb74 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -20,9 +20,9 @@ public class HMICapabilitiesTests extends TestCase {
public void setUp(){
msg = new HMICapabilities();
- msg.setNavigationAvilable(Test.GENERAL_BOOLEAN);
- msg.setPhoneCallAvilable(Test.GENERAL_BOOLEAN);
- msg.setVideoStreamingAvailable(Test.GENERAL_BOOLEAN);
+ msg.setNavigationAvilable(TestValues.GENERAL_BOOLEAN);
+ msg.setPhoneCallAvilable(TestValues.GENERAL_BOOLEAN);
+ msg.setVideoStreamingAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -35,13 +35,13 @@ public class HMICapabilitiesTests extends TestCase {
Boolean vidStreamAvail = msg.isVideoStreamingAvailable();
// Valid Tests
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, navAvail);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, phoneAvail);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, vidStreamAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, navAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, phoneAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, vidStreamAvail);
// Invalid/Null Tests
HMICapabilities msg = new HMICapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
assertFalse(msg.isNavigationAvailable());
assertFalse(msg.isPhoneCallAvailable());
@@ -52,23 +52,23 @@ public class HMICapabilitiesTests extends TestCase {
JSONObject reference = new JSONObject();
try{
- reference.put(KEY_NAVIGATION, Test.GENERAL_BOOLEAN);
- reference.put(HMICapabilities.KEY_PHONE_CALL, Test.GENERAL_BOOLEAN);
- reference.put(HMICapabilities.KEY_VIDEO_STREAMING, Test.GENERAL_BOOLEAN);
+ reference.put(KEY_NAVIGATION, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMICapabilities.KEY_PHONE_CALL, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMICapabilities.KEY_VIDEO_STREAMING, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_NAVIGATION),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_NAVIGATION),
JsonUtils.readStringListFromJsonObject(underTest, KEY_NAVIGATION));
- assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_PHONE_CALL),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_PHONE_CALL),
JsonUtils.readStringListFromJsonObject(underTest, KEY_PHONE_CALL));
- assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_VIDEO_STREAMING),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_VIDEO_STREAMING),
JsonUtils.readStringListFromJsonObject(underTest, KEY_VIDEO_STREAMING));
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
index 7c66ba6c7..3a73e425f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,8 +25,8 @@ public class HMIPermissionsTests extends TestCase{
public void setUp(){
msg = new HMIPermissions();
- msg.setAllowed(Test.GENERAL_HMILEVEL_LIST);
- msg.setUserDisallowed(Test.GENERAL_HMILEVEL_LIST);
+ msg.setAllowed(TestValues.GENERAL_HMILEVEL_LIST);
+ msg.setUserDisallowed(TestValues.GENERAL_HMILEVEL_LIST);
}
/**
@@ -38,33 +38,33 @@ public class HMIPermissionsTests extends TestCase{
List<HMILevel> disallowed = msg.getUserDisallowed();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL_LIST.size(), allowed.size());
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL_LIST.size(), disallowed.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.size(), allowed.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.size(), disallowed.size());
- for(int i = 0; i < Test.GENERAL_HMILEVEL_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL_LIST.get(i), allowed.get(i));
+ for(int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.get(i), allowed.get(i));
}
- for(int i = 0; i < Test.GENERAL_HMILEVEL_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL_LIST.get(i), disallowed.get(i));
+ for(int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.get(i), disallowed.get(i));
}
// Invalid/Null Tests
HMIPermissions msg = new HMIPermissions();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAllowed());
- assertNull(Test.NULL, msg.getUserDisallowed());
+ assertNull(TestValues.NULL, msg.getAllowed());
+ assertNull(TestValues.NULL, msg.getUserDisallowed());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(HMIPermissions.KEY_ALLOWED, Test.JSON_HMILEVELS);
- reference.put(HMIPermissions.KEY_USER_DISALLOWED, Test.JSON_HMILEVELS);
+ reference.put(HMIPermissions.KEY_ALLOWED, TestValues.JSON_HMILEVELS);
+ reference.put(HMIPermissions.KEY_USER_DISALLOWED, TestValues.JSON_HMILEVELS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -72,13 +72,13 @@ public class HMIPermissionsTests extends TestCase{
List<String> referenceList = JsonUtils.readStringListFromJsonObject(reference, key);
List<String> underTestList = JsonUtils.readStringListFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceList.size(), underTestList.size());
+ assertEquals(TestValues.MATCH, referenceList.size(), underTestList.size());
for(int i = 0; i < referenceList.size(); i++){
- assertEquals(Test.MATCH, referenceList.get(i), underTestList.get(i));
+ assertEquals(TestValues.MATCH, referenceList.get(i), underTestList.get(i));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
index aa49bf0ac..413d0e394 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,11 +27,11 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
public void setUp() {
msg = new HMISettingsControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setDistanceUnitAvailable(Test.GENERAL_BOOLEAN);
- msg.setTemperatureUnitAvailable(Test.GENERAL_BOOLEAN);
- msg.setDisplayModeUnitAvailable(Test.GENERAL_BOOLEAN);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setDistanceUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setTemperatureUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDisplayModeUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
}
/**
@@ -46,35 +46,35 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
ModuleInfo info = msg.getModuleInfo();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getDistanceUnitAvailable());
- assertNull(Test.NULL, msg.getTemperatureUnitAvailable());
- assertNull(Test.NULL, msg.getDisplayModeUnitAvailable());
- assertNull(Test.NULL, msg.getModuleInfo());
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getDistanceUnitAvailable());
+ assertNull(TestValues.NULL, msg.getTemperatureUnitAvailable());
+ assertNull(TestValues.NULL, msg.getDisplayModeUnitAvailable());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(HMISettingsControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -84,13 +84,13 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
index 85205f617..8b1ae345a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.enums.DisplayMode;
import com.smartdevicelink.proxy.rpc.enums.DistanceUnit;
import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -26,9 +26,9 @@ public class HMISettingsControlDataTests extends TestCase {
public void setUp() {
msg = new HMISettingsControlData();
- msg.setDisplayMode(Test.GENERAL_DISPLAYMODE);
- msg.setTemperatureUnit(Test.GENERAL_TEMPERATUREUNIT);
- msg.setDistanceUnit(Test.GENERAL_DISTANCEUNIT);
+ msg.setDisplayMode(TestValues.GENERAL_DISPLAYMODE);
+ msg.setTemperatureUnit(TestValues.GENERAL_TEMPERATUREUNIT);
+ msg.setDistanceUnit(TestValues.GENERAL_DISTANCEUNIT);
}
/**
@@ -41,38 +41,38 @@ public class HMISettingsControlDataTests extends TestCase {
DistanceUnit distanceUnit = msg.getDistanceUnit();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_DISPLAYMODE, displayMode);
- assertEquals(Test.MATCH, Test.GENERAL_TEMPERATUREUNIT, temperatureUnit);
- assertEquals(Test.MATCH, Test.GENERAL_DISTANCEUNIT, distanceUnit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DISPLAYMODE, displayMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEMPERATUREUNIT, temperatureUnit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DISTANCEUNIT, distanceUnit);
// Invalid/Null Tests
HMISettingsControlData msg = new HMISettingsControlData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getDisplayMode());
- assertNull(Test.NULL, msg.getTemperatureUnit());
- assertNull(Test.NULL, msg.getDistanceUnit());
+ assertNull(TestValues.NULL, msg.getDisplayMode());
+ assertNull(TestValues.NULL, msg.getTemperatureUnit());
+ assertNull(TestValues.NULL, msg.getDistanceUnit());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(HMISettingsControlData.KEY_DISPLAY_MODE, Test.GENERAL_DISPLAYMODE);
- reference.put(HMISettingsControlData.KEY_TEMPERATURE_UNIT, Test.GENERAL_TEMPERATUREUNIT);
- reference.put(HMISettingsControlData.KEY_DISTANCE_UNIT, Test.GENERAL_DISTANCEUNIT);
+ reference.put(HMISettingsControlData.KEY_DISPLAY_MODE, TestValues.GENERAL_DISPLAYMODE);
+ reference.put(HMISettingsControlData.KEY_TEMPERATURE_UNIT, TestValues.GENERAL_TEMPERATUREUNIT);
+ reference.put(HMISettingsControlData.KEY_DISTANCE_UNIT, TestValues.GENERAL_DISTANCEUNIT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
index c72204640..f235761bf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class HapticRectTests extends TestCase {
public void setUp() {
msg = new HapticRect();
- msg.setId(Test.GENERAL_INTEGER);
- msg.setRect(Test.GENERAL_RECTANGLE);
+ msg.setId(TestValues.GENERAL_INTEGER);
+ msg.setRect(TestValues.GENERAL_RECTANGLE);
}
/**
@@ -37,28 +37,28 @@ public class HapticRectTests extends TestCase {
Rectangle rect = msg.getRect();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, id);
- assertEquals(Test.MATCH, Test.GENERAL_RECTANGLE, rect);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RECTANGLE, rect);
// Invalid/Null Tests
HapticRect msg = new HapticRect();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getId());
- assertNull(Test.NULL, msg.getRect());
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getRect());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(HapticRect.KEY_ID, Test.GENERAL_INTEGER);
- reference.put(HapticRect.KEY_RECT, Test.GENERAL_RECTANGLE);
+ reference.put(HapticRect.KEY_ID, TestValues.GENERAL_INTEGER);
+ reference.put(HapticRect.KEY_RECT, TestValues.GENERAL_RECTANGLE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(reference, HapticRect.KEY_ID),
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(reference, HapticRect.KEY_ID),
JsonUtils.readIntegerFromJsonObject(underTest, HapticRect.KEY_ID));
assertTrue(Validator.validateRectangle(
@@ -67,7 +67,7 @@ public class HapticRectTests extends TestCase {
);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
index ecce440c5..8aa7f3b01 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.HeadLampStatus;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,9 +24,9 @@ public class HeadLampStatusTests extends TestCase{
public void setUp(){
msg = new HeadLampStatus();
- msg.setAmbientLightStatus(Test.GENERAL_AMBIENTLIGHTSTATUS);
- msg.setLowBeamsOn(Test.GENERAL_BOOLEAN);
- msg.setHighBeamsOn(Test.GENERAL_BOOLEAN);
+ msg.setAmbientLightStatus(TestValues.GENERAL_AMBIENTLIGHTSTATUS);
+ msg.setLowBeamsOn(TestValues.GENERAL_BOOLEAN);
+ msg.setHighBeamsOn(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -39,37 +39,37 @@ public class HeadLampStatusTests extends TestCase{
AmbientLightStatus ambientLights = msg.getAmbientLightStatus();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_AMBIENTLIGHTSTATUS, ambientLights);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, highBeams);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, lowBeams);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AMBIENTLIGHTSTATUS, ambientLights);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, highBeams);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, lowBeams);
// Invalid/Null Tests
HeadLampStatus msg = new HeadLampStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getLowBeamsOn());
- assertNull(Test.NULL, msg.getHighBeamsOn());
- assertNull(Test.NULL, msg.getAmbientLightStatus());
+ assertNull(TestValues.NULL, msg.getLowBeamsOn());
+ assertNull(TestValues.NULL, msg.getHighBeamsOn());
+ assertNull(TestValues.NULL, msg.getAmbientLightStatus());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, Test.GENERAL_BOOLEAN);
- reference.put(HeadLampStatus.KEY_LOW_BEAMS_ON, Test.GENERAL_BOOLEAN);
- reference.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, Test.GENERAL_AMBIENTLIGHTSTATUS);
+ reference.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, TestValues.GENERAL_BOOLEAN);
+ reference.put(HeadLampStatus.KEY_LOW_BEAMS_ON, TestValues.GENERAL_BOOLEAN);
+ reference.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, TestValues.GENERAL_AMBIENTLIGHTSTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
index e271ccd3c..f4baa874b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Headers;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,16 +23,16 @@ public class HeadersTests extends TestCase{
public void setUp(){
msg = new Headers();
- msg.setCharset(Test.GENERAL_STRING);
- msg.setConnectTimeout(Test.GENERAL_INT);
- msg.setContentLength(Test.GENERAL_INT);
- msg.setContentType(Test.GENERAL_STRING);
- msg.setDoInput(Test.GENERAL_BOOLEAN);
- msg.setDoOutput(Test.GENERAL_BOOLEAN);
- msg.setInstanceFollowRedirects(Test.GENERAL_BOOLEAN);
- msg.setReadTimeout(Test.GENERAL_INT);
- msg.setRequestMethod(Test.GENERAL_STRING);
- msg.setUseCaches(Test.GENERAL_BOOLEAN);
+ msg.setCharset(TestValues.GENERAL_STRING);
+ msg.setConnectTimeout(TestValues.GENERAL_INT);
+ msg.setContentLength(TestValues.GENERAL_INT);
+ msg.setContentType(TestValues.GENERAL_STRING);
+ msg.setDoInput(TestValues.GENERAL_BOOLEAN);
+ msg.setDoOutput(TestValues.GENERAL_BOOLEAN);
+ msg.setInstanceFollowRedirects(TestValues.GENERAL_BOOLEAN);
+ msg.setReadTimeout(TestValues.GENERAL_INT);
+ msg.setRequestMethod(TestValues.GENERAL_STRING);
+ msg.setUseCaches(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -52,58 +52,58 @@ public class HeadersTests extends TestCase{
boolean instanceFollow = msg.getInstanceFollowRedirects();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, charset);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, contentType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, requestMode);
- assertEquals(Test.MATCH, Test.GENERAL_INT, connectTimeout);
- assertEquals(Test.MATCH, Test.GENERAL_INT, readTimeout);
- assertEquals(Test.MATCH, Test.GENERAL_INT, contentLength);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, doOutput);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, doInput);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, useCache);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, instanceFollow);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, charset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, contentType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, requestMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, connectTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, readTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, contentLength);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, doOutput);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, doInput);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, useCache);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, instanceFollow);
// Invalid/Null Tests
Headers msg = new Headers();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getCharset());
- assertNull(Test.NULL, msg.getConnectTimeout());
- assertNull(Test.NULL, msg.getContentLength());
- assertNull(Test.NULL, msg.getContentType());
- assertNull(Test.NULL, msg.getDoInput());
- assertNull(Test.NULL, msg.getDoOutput());
- assertNull(Test.NULL, msg.getInstanceFollowRedirects());
- assertNull(Test.NULL, msg.getReadTimeout());
- assertNull(Test.NULL, msg.getRequestMethod());
- assertNull(Test.NULL, msg.getUseCaches());
+ assertNull(TestValues.NULL, msg.getCharset());
+ assertNull(TestValues.NULL, msg.getConnectTimeout());
+ assertNull(TestValues.NULL, msg.getContentLength());
+ assertNull(TestValues.NULL, msg.getContentType());
+ assertNull(TestValues.NULL, msg.getDoInput());
+ assertNull(TestValues.NULL, msg.getDoOutput());
+ assertNull(TestValues.NULL, msg.getInstanceFollowRedirects());
+ assertNull(TestValues.NULL, msg.getReadTimeout());
+ assertNull(TestValues.NULL, msg.getRequestMethod());
+ assertNull(TestValues.NULL, msg.getUseCaches());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Headers.KEY_CHARSET, Test.GENERAL_STRING);
- reference.put(Headers.KEY_CONTENT_TYPE, Test.GENERAL_STRING);
- reference.put(Headers.KEY_REQUEST_METHOD, Test.GENERAL_STRING);
- reference.put(Headers.KEY_CONNECT_TIMEOUT, Test.GENERAL_INT);
- reference.put(Headers.KEY_READ_TIMEOUT, Test.GENERAL_INT);
- reference.put(Headers.KEY_CONTENT_LENGTH, Test.GENERAL_INT);
- reference.put(Headers.KEY_DO_OUTPUT, Test.GENERAL_BOOLEAN);
- reference.put(Headers.KEY_DO_INPUT, Test.GENERAL_BOOLEAN);
- reference.put(Headers.KEY_USE_CACHES, Test.GENERAL_BOOLEAN);
- reference.put(Headers.KEY_INSTANCE_FOLLOW_REDIRECTS, Test.GENERAL_BOOLEAN);
+ reference.put(Headers.KEY_CHARSET, TestValues.GENERAL_STRING);
+ reference.put(Headers.KEY_CONTENT_TYPE, TestValues.GENERAL_STRING);
+ reference.put(Headers.KEY_REQUEST_METHOD, TestValues.GENERAL_STRING);
+ reference.put(Headers.KEY_CONNECT_TIMEOUT, TestValues.GENERAL_INT);
+ reference.put(Headers.KEY_READ_TIMEOUT, TestValues.GENERAL_INT);
+ reference.put(Headers.KEY_CONTENT_LENGTH, TestValues.GENERAL_INT);
+ reference.put(Headers.KEY_DO_OUTPUT, TestValues.GENERAL_BOOLEAN);
+ reference.put(Headers.KEY_DO_INPUT, TestValues.GENERAL_BOOLEAN);
+ reference.put(Headers.KEY_USE_CACHES, TestValues.GENERAL_BOOLEAN);
+ reference.put(Headers.KEY_INSTANCE_FOLLOW_REDIRECTS, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
index 98f4639a8..d8715e4ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,9 +32,9 @@ public class ImageFieldTests extends TestCase{
public void setUp(){
msg = new ImageField();
- msg.setImageResolution(Test.GENERAL_IMAGERESOLUTION);
- msg.setImageTypeSupported(Test.GENERAL_FILETYPE_LIST);
- msg.setName(Test.GENERAL_IMAGEFIELDNAME);
+ msg.setImageResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ msg.setImageTypeSupported(TestValues.GENERAL_FILETYPE_LIST);
+ msg.setName(TestValues.GENERAL_IMAGEFIELDNAME);
}
/**
@@ -47,29 +47,29 @@ public class ImageFieldTests extends TestCase{
ImageFieldName name = msg.getName();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateImageResolution(Test.GENERAL_IMAGERESOLUTION, imageRes));
- assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELDNAME, name);
- assertTrue(Test.TRUE, Validator.validateFileTypes(Test.GENERAL_FILETYPE_LIST, imageTypes));
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(TestValues.GENERAL_IMAGERESOLUTION, imageRes));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELDNAME, name);
+ assertTrue(TestValues.TRUE, Validator.validateFileTypes(TestValues.GENERAL_FILETYPE_LIST, imageTypes));
// Invalid/Null Tests
ImageField msg = new ImageField();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getImageResolution());
- assertNull(Test.NULL, msg.getImageTypeSupported());
- assertNull(Test.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getImageResolution());
+ assertNull(TestValues.NULL, msg.getImageTypeSupported());
+ assertNull(TestValues.NULL, msg.getName());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ImageField.KEY_IMAGE_RESOLUTION, Test.JSON_IMAGERESOLUTION);
- reference.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(Test.GENERAL_FILETYPE_LIST));
- reference.put(ImageField.KEY_NAME, Test.GENERAL_IMAGEFIELDNAME);
+ reference.put(ImageField.KEY_IMAGE_RESOLUTION, TestValues.JSON_IMAGERESOLUTION);
+ reference.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(TestValues.GENERAL_FILETYPE_LIST));
+ reference.put(ImageField.KEY_NAME, TestValues.GENERAL_IMAGEFIELDNAME);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -80,26 +80,26 @@ public class ImageFieldTests extends TestCase{
JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateImageResolution( new ImageResolution(hashReference), new ImageResolution(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution( new ImageResolution(hashReference), new ImageResolution(hashTest)));
} else if(key.equals(ImageField.KEY_IMAGE_TYPE_SUPPORTED)) {
JSONArray imageTypeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray imageTypeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<FileType> imageTypeListReference = new ArrayList<FileType>();
List<FileType> imageTypeListTest = new ArrayList<FileType>();
- assertEquals(Test.MATCH, imageTypeArrayReference.length(), imageTypeArrayTest.length());
+ assertEquals(TestValues.MATCH, imageTypeArrayReference.length(), imageTypeArrayTest.length());
for (int index = 0 ; index < imageTypeArrayReference.length(); index++) {
imageTypeListReference.add( (FileType)imageTypeArrayReference.get(index) );
imageTypeListTest.add( (FileType)imageTypeArrayTest.get(index) );
}
- assertTrue(Test.TRUE, imageTypeListReference.containsAll(imageTypeListTest) && imageTypeListTest.containsAll(imageTypeListReference));
+ assertTrue(TestValues.TRUE, imageTypeListReference.containsAll(imageTypeListTest) && imageTypeListTest.containsAll(imageTypeListReference));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
index 68baaba62..f62ddad4c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class ImageResolutionTests extends TestCase{
public void setUp(){
msg = new ImageResolution();
- msg.setResolutionHeight(Test.GENERAL_INT);
- msg.setResolutionWidth(Test.GENERAL_INT);
+ msg.setResolutionHeight(TestValues.GENERAL_INT);
+ msg.setResolutionWidth(TestValues.GENERAL_INT);
}
/**
@@ -37,34 +37,34 @@ public class ImageResolutionTests extends TestCase{
int width = msg.getResolutionWidth();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, height);
- assertEquals(Test.MATCH, Test.GENERAL_INT, width);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, height);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, width);
// Invalid/Null Tests
ImageResolution msg = new ImageResolution();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getResolutionHeight());
- assertNull(Test.NULL, msg.getResolutionWidth());
+ assertNull(TestValues.NULL, msg.getResolutionHeight());
+ assertNull(TestValues.NULL, msg.getResolutionWidth());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ImageResolution.KEY_RESOLUTION_HEIGHT, Test.GENERAL_INT);
- reference.put(ImageResolution.KEY_RESOLUTION_WIDTH, Test.GENERAL_INT);
+ reference.put(ImageResolution.KEY_RESOLUTION_HEIGHT, TestValues.GENERAL_INT);
+ reference.put(ImageResolution.KEY_RESOLUTION_WIDTH, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
index ccc9b2bdb..4b1cb50f1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,9 +24,9 @@ public class ImageTests extends TestCase{
public void setUp(){
msg = new Image();
- msg.setImageType(Test.GENERAL_IMAGETYPE);
- msg.setValue(Test.GENERAL_STRING);
- msg.setIsTemplate(Test.GENERAL_BOOLEAN);
+ msg.setImageType(TestValues.GENERAL_IMAGETYPE);
+ msg.setValue(TestValues.GENERAL_STRING);
+ msg.setIsTemplate(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -39,38 +39,38 @@ public class ImageTests extends TestCase{
Boolean isTemplate = msg.getIsTemplate();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_IMAGETYPE, imageType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, value);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isTemplate);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGETYPE, imageType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, value);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isTemplate);
// Invalid/Null Tests
Image msg = new Image();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getImageType());
- assertNull(Test.NULL, msg.getValue());
- assertNull(Test.NULL, msg.getBulkData());
- assertNull(Test.NULL, msg.getIsTemplate());
+ assertNull(TestValues.NULL, msg.getImageType());
+ assertNull(TestValues.NULL, msg.getValue());
+ assertNull(TestValues.NULL, msg.getBulkData());
+ assertNull(TestValues.NULL, msg.getIsTemplate());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Image.KEY_IMAGE_TYPE, Test.GENERAL_IMAGETYPE);
- reference.put(Image.KEY_VALUE, Test.GENERAL_STRING);
- reference.put(Image.KEY_IS_TEMPLATE, Test.GENERAL_BOOLEAN);
+ reference.put(Image.KEY_IMAGE_TYPE, TestValues.GENERAL_IMAGETYPE);
+ reference.put(Image.KEY_VALUE, TestValues.GENERAL_STRING);
+ reference.put(Image.KEY_IS_TEMPLATE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
index 9d627258b..cfb0c1c7d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -28,12 +28,12 @@ public class KeyboardPropertiesTests extends TestCase{
public void setUp(){
msg = new KeyboardProperties();
- msg.setAutoCompleteText(Test.GENERAL_STRING);
- msg.setAutoCompleteList(Test.GENERAL_STRING_LIST);
- msg.setKeyboardLayout(Test.GENERAL_KEYBOARDLAYOUT);
- msg.setKeypressMode(Test.GENERAL_KEYPRESSMODE);
- msg.setLanguage(Test.GENERAL_LANGUAGE);
- msg.setLimitedCharacterList(Test.GENERAL_STRING_LIST);
+ msg.setAutoCompleteText(TestValues.GENERAL_STRING);
+ msg.setAutoCompleteList(TestValues.GENERAL_STRING_LIST);
+ msg.setKeyboardLayout(TestValues.GENERAL_KEYBOARDLAYOUT);
+ msg.setKeypressMode(TestValues.GENERAL_KEYPRESSMODE);
+ msg.setLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setLimitedCharacterList(TestValues.GENERAL_STRING_LIST);
}
/**
@@ -49,53 +49,53 @@ public class KeyboardPropertiesTests extends TestCase{
List<String> limitedChars = msg.getLimitedCharacterList();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, autoCompleteText);
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), autoCompleteList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, autoCompleteList));
- assertEquals(Test.MATCH, Test.GENERAL_KEYBOARDLAYOUT, keyboardLayout);
- assertEquals(Test.MATCH, Test.GENERAL_KEYPRESSMODE, keypressMode);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, language);
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), limitedChars.size());
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, limitedChars));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, autoCompleteText);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), autoCompleteList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, autoCompleteList));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_KEYBOARDLAYOUT, keyboardLayout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_KEYPRESSMODE, keypressMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, language);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), limitedChars.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, limitedChars));
// Invalid/Null Tests
KeyboardProperties msg = new KeyboardProperties();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
// Keypress mode is created in the object constructor
- assertNotNull(Test.NOT_NULL, msg.getKeypressMode());
- assertNull(Test.NULL, msg.getAutoCompleteText());
- assertNull(Test.NULL, msg.getAutoCompleteList());
- assertNull(Test.NULL, msg.getLanguage());
- assertNull(Test.NULL, msg.getKeyboardLayout());
- assertNull(Test.NULL, msg.getLimitedCharacterList());
+ assertNotNull(TestValues.NOT_NULL, msg.getKeypressMode());
+ assertNull(TestValues.NULL, msg.getAutoCompleteText());
+ assertNull(TestValues.NULL, msg.getAutoCompleteList());
+ assertNull(TestValues.NULL, msg.getLanguage());
+ assertNull(TestValues.NULL, msg.getKeyboardLayout());
+ assertNull(TestValues.NULL, msg.getLimitedCharacterList());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, Test.GENERAL_STRING);
- reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_LIST, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, Test.GENERAL_KEYBOARDLAYOUT);
- reference.put(KeyboardProperties.KEY_KEYPRESS_MODE, Test.GENERAL_KEYPRESSMODE);
- reference.put(KeyboardProperties.KEY_LANGUAGE, Test.GENERAL_LANGUAGE);
- reference.put(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, TestValues.GENERAL_STRING);
+ reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, TestValues.GENERAL_KEYBOARDLAYOUT);
+ reference.put(KeyboardProperties.KEY_KEYPRESS_MODE, TestValues.GENERAL_KEYPRESSMODE);
+ reference.put(KeyboardProperties.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ reference.put(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
if(key.equals(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST) || key.equals(KeyboardProperties.KEY_AUTO_COMPLETE_LIST)){
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
index 6122f4305..fba90ca79 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.enums.LightName;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,10 +24,10 @@ public class LightCapabilitiesTests extends TestCase {
public void setUp() {
msg = new LightCapabilities();
- msg.setName(Test.GENERAL_LIGHTNAME);
- msg.setDensityAvailable(Test.GENERAL_BOOLEAN);
- msg.setRGBColorSpaceAvailable(Test.GENERAL_BOOLEAN);
- msg.setStatusAvailable(Test.GENERAL_BOOLEAN);
+ msg.setName(TestValues.GENERAL_LIGHTNAME);
+ msg.setDensityAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setRGBColorSpaceAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setStatusAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -41,41 +41,41 @@ public class LightCapabilitiesTests extends TestCase {
Boolean statusAvailable = msg.getStatusAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LIGHTNAME, name);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) densityAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) rgbColorSpaceAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) statusAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, name);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) densityAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) rgbColorSpaceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) statusAvailable);
// Invalid/Null Tests
LightCapabilities msg = new LightCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getName());
- assertNull(Test.NULL, msg.getDensityAvailable());
- assertNull(Test.NULL, msg.getRGBColorSpaceAvailable());
- assertNull(Test.NULL, msg.getStatusAvailable());
+ assertNull(TestValues.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getDensityAvailable());
+ assertNull(TestValues.NULL, msg.getRGBColorSpaceAvailable());
+ assertNull(TestValues.NULL, msg.getStatusAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(LightCapabilities.KEY_NAME, Test.GENERAL_LIGHTNAME);
- reference.put(LightCapabilities.KEY_DENSITY_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(LightCapabilities.KEY_RGB_COLOR_SPACE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(LightCapabilities.KEY_STATUS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(LightCapabilities.KEY_NAME, TestValues.GENERAL_LIGHTNAME);
+ reference.put(LightCapabilities.KEY_DENSITY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(LightCapabilities.KEY_RGB_COLOR_SPACE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(LightCapabilities.KEY_STATUS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
index ad6e5a4ac..24c5a54c7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -30,9 +30,9 @@ public class LightControlCapabilitiesTests extends TestCase {
public void setUp() {
msg = new LightControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setSupportedLights(Test.GENERAL_LIGHTCAPABILITIES_LIST);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setSupportedLights(TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
}
/**
@@ -45,31 +45,31 @@ public class LightControlCapabilitiesTests extends TestCase {
ModuleInfo info = msg.getModuleInfo();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, Test.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
- assertTrue(Test.TRUE, Validator.validateLightCapabilitiesList(Test.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
+ assertTrue(TestValues.TRUE, Validator.validateLightCapabilitiesList(TestValues.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
// Invalid/Null Tests
LightControlCapabilities msg = new LightControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getSupportedLights());
- assertNull(Test.NULL, msg.getModuleInfo());
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getSupportedLights());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(LightControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, Test.GENERAL_LIGHTCAPABILITIES_LIST);
- reference.put(LightControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(LightControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
+ reference.put(LightControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -87,14 +87,14 @@ public class LightControlCapabilitiesTests extends TestCase {
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
}
else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
index c891e0769..d35c6568f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.LightControlData;
import com.smartdevicelink.proxy.rpc.LightState;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -28,7 +28,7 @@ public class LightControlDataTests extends TestCase {
public void setUp() {
msg = new LightControlData();
- msg.setLightState(Test.GENERAL_LIGHTSTATE_LIST);
+ msg.setLightState(TestValues.GENERAL_LIGHTSTATE_LIST);
}
/**
@@ -39,25 +39,25 @@ public class LightControlDataTests extends TestCase {
List<LightState> lightState = msg.getLightState();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LIGHTSTATE_LIST.size(), lightState.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATE_LIST.size(), lightState.size());
- assertTrue(Test.TRUE, Validator.validateLightStateList(Test.GENERAL_LIGHTSTATE_LIST, lightState));
+ assertTrue(TestValues.TRUE, Validator.validateLightStateList(TestValues.GENERAL_LIGHTSTATE_LIST, lightState));
// Invalid/Null Tests
LightControlData msg = new LightControlData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getLightState());
+ assertNull(TestValues.NULL, msg.getLightState());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(LightControlData.KEY_LIGHT_STATE, Test.GENERAL_LIGHTSTATE_LIST);
+ reference.put(LightControlData.KEY_LIGHT_STATE, TestValues.GENERAL_LIGHTSTATE_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -73,7 +73,7 @@ public class LightControlDataTests extends TestCase {
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
index 196769e00..d2094d501 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.RGBColor;
import com.smartdevicelink.proxy.rpc.enums.LightName;
import com.smartdevicelink.proxy.rpc.enums.LightStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,10 +29,10 @@ public class LightStateTests extends TestCase {
public void setUp() {
msg = new LightState();
- msg.setId(Test.GENERAL_LIGHTNAME);
- msg.setStatus(Test.GENERAL_LIGHTSTATUS);
- msg.setDensity(Test.GENERAL_FLOAT);
- msg.setColor(Test.GENERAL_RGBCOLOR);
+ msg.setId(TestValues.GENERAL_LIGHTNAME);
+ msg.setStatus(TestValues.GENERAL_LIGHTSTATUS);
+ msg.setDensity(TestValues.GENERAL_FLOAT);
+ msg.setColor(TestValues.GENERAL_RGBCOLOR);
}
/**
@@ -46,32 +46,32 @@ public class LightStateTests extends TestCase {
RGBColor color = msg.getColor();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LIGHTNAME, id);
- assertEquals(Test.MATCH, Test.GENERAL_LIGHTSTATUS, status);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, (float) density);
- assertEquals(Test.MATCH, Test.GENERAL_RGBCOLOR, color);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATUS, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, (float) density);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RGBCOLOR, color);
// Invalid/Null Tests
LightState msg = new LightState();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getId());
- assertNull(Test.NULL, msg.getStatus());
- assertNull(Test.NULL, msg.getDensity());
- assertNull(Test.NULL, msg.getColor());
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getStatus());
+ assertNull(TestValues.NULL, msg.getDensity());
+ assertNull(TestValues.NULL, msg.getColor());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(LightState.KEY_ID, Test.GENERAL_LIGHTNAME);
- reference.put(LightState.KEY_STATUS, Test.GENERAL_LIGHTSTATUS);
- reference.put(LightState.KEY_DENSITY, Test.GENERAL_FLOAT);
- reference.put(LightState.KEY_COLOR, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RGBCOLOR.getStore()));
+ reference.put(LightState.KEY_ID, TestValues.GENERAL_LIGHTNAME);
+ reference.put(LightState.KEY_STATUS, TestValues.GENERAL_LIGHTSTATUS);
+ reference.put(LightState.KEY_DENSITY, TestValues.GENERAL_FLOAT);
+ reference.put(LightState.KEY_COLOR, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RGBCOLOR.getStore()));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -82,13 +82,13 @@ public class LightStateTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateRGBColor(new RGBColor(hashReference), new RGBColor(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(new RGBColor(hashReference), new RGBColor(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
index 18da17eac..3792f64b7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -25,7 +25,7 @@ public class LocationDetailsTests extends TestCase {
@Override
public void setUp(){
- msg = Test.GENERAL_LOCATIONDETAILS;
+ msg = TestValues.GENERAL_LOCATIONDETAILS;
}
/**
@@ -42,17 +42,17 @@ public class LocationDetailsTests extends TestCase {
OasisAddress field7 = msg.getSearchAddress();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, field1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, field2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, field3);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, field4);
- assertEquals(Test.MATCH, Test.GENERAL_COORDINATE, field5);
- assertEquals(Test.MATCH, Test.GENERAL_IMAGE, field6);
- assertEquals(Test.MATCH, Test.GENERAL_OASISADDRESS, field7);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, field1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, field2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, field3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, field4);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COORDINATE, field5);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGE, field6);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_OASISADDRESS, field7);
// Invalid/Null Tests
LocationDetails msg = new LocationDetails();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
assertNull(msg.getAddressLines());
@@ -68,27 +68,27 @@ public class LocationDetailsTests extends TestCase {
JSONObject reference = new JSONObject();
try{
- reference.put(LocationDetails.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(LocationDetails.KEY_LOCATION_DESCRIPTION, Test.GENERAL_STRING);
- reference.put(LocationDetails.KEY_LOCATION_NAME, Test.GENERAL_STRING);
- reference.put(LocationDetails.KEY_PHONE_NUMBER, Test.GENERAL_STRING);
- reference.put(LocationDetails.KEY_COORDINATE, Test.GENERAL_COORDINATE);
- reference.put(LocationDetails.KEY_LOCATION_IMAGE, Test.GENERAL_IMAGE);
- reference.put(LocationDetails.KEY_SEARCH_ADDRESS, Test.GENERAL_OASISADDRESS);
+ reference.put(LocationDetails.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(LocationDetails.KEY_LOCATION_DESCRIPTION, TestValues.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_LOCATION_NAME, TestValues.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_PHONE_NUMBER, TestValues.GENERAL_STRING);
+ reference.put(LocationDetails.KEY_COORDINATE, TestValues.GENERAL_COORDINATE);
+ reference.put(LocationDetails.KEY_LOCATION_IMAGE, TestValues.GENERAL_IMAGE);
+ reference.put(LocationDetails.KEY_SEARCH_ADDRESS, TestValues.GENERAL_OASISADDRESS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_ADDRESS_LINES),
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_ADDRESS_LINES),
JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_ADDRESS_LINES));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_DESCRIPTION),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_DESCRIPTION),
JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_LOCATION_DESCRIPTION));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_NAME),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_LOCATION_NAME),
JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_LOCATION_NAME));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_PHONE_NUMBER),
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(reference, LocationDetails.KEY_PHONE_NUMBER),
JsonUtils.readStringFromJsonObject(underTest, LocationDetails.KEY_PHONE_NUMBER));
assertTrue(Validator.validateCoordinate(
@@ -107,7 +107,7 @@ public class LocationDetailsTests extends TestCase {
));
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
index da8a7cbfe..d3454ab8e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
import com.smartdevicelink.proxy.rpc.enums.MassageCushion;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class MassageCushionFirmnessTest extends TestCase {
public void setUp() {
msg = new MassageCushionFirmness();
- msg.setCushion(Test.GENERAL_MASSAGECUSHION);
- msg.setFirmness(Test.GENERAL_INT);
+ msg.setCushion(TestValues.GENERAL_MASSAGECUSHION);
+ msg.setFirmness(TestValues.GENERAL_INT);
}
/**
@@ -37,35 +37,35 @@ public class MassageCushionFirmnessTest extends TestCase {
Integer firmness = msg.getFirmness();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MASSAGECUSHION, cushion);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, firmness);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGECUSHION, cushion);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, firmness);
// Invalid/Null Tests
MassageCushionFirmness msg = new MassageCushionFirmness();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getCushion());
- assertNull(Test.NULL, msg.getFirmness());
+ assertNull(TestValues.NULL, msg.getCushion());
+ assertNull(TestValues.NULL, msg.getFirmness());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(MassageCushionFirmness.KEY_CUSHION, Test.GENERAL_MASSAGECUSHION);
- reference.put(MassageCushionFirmness.KEY_FIRMNESS, Test.GENERAL_INT);
+ reference.put(MassageCushionFirmness.KEY_CUSHION, TestValues.GENERAL_MASSAGECUSHION);
+ reference.put(MassageCushionFirmness.KEY_FIRMNESS, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
index 958de9fa2..3b9f38e3e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.MassageModeData;
import com.smartdevicelink.proxy.rpc.enums.MassageMode;
import com.smartdevicelink.proxy.rpc.enums.MassageZone;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,8 +25,8 @@ public class MassageModeDataTest extends TestCase {
public void setUp() {
msg = new MassageModeData();
- msg.setMassageZone(Test.GENERAL_MASSAGEZONE);
- msg.setMassageMode(Test.GENERAL_MASSAGEMODE);
+ msg.setMassageZone(TestValues.GENERAL_MASSAGEZONE);
+ msg.setMassageMode(TestValues.GENERAL_MASSAGEMODE);
}
/**
@@ -38,37 +38,37 @@ public class MassageModeDataTest extends TestCase {
MassageMode massageMode = msg.getMassageMode();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MASSAGEZONE, massageZone);
- assertEquals(Test.MATCH, Test.GENERAL_MASSAGEMODE, massageMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEZONE, massageZone);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEMODE, massageMode);
// Invalid/Null Tests
MassageModeData msg = new MassageModeData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getMassageMode());
- assertNull(Test.NULL, msg.getMassageZone());
+ assertNull(TestValues.NULL, msg.getMassageMode());
+ assertNull(TestValues.NULL, msg.getMassageZone());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(MassageModeData.KEY_MASSAGE_MODE, Test.GENERAL_MASSAGEMODE);
- reference.put(MassageModeData.KEY_MASSAGE_ZONE, Test.GENERAL_MASSAGEZONE);
+ reference.put(MassageModeData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODE);
+ reference.put(MassageModeData.KEY_MASSAGE_ZONE, TestValues.GENERAL_MASSAGEZONE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
index 2883fca6b..5d1baded5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.MediaServiceData;
import com.smartdevicelink.proxy.rpc.enums.MediaType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -28,19 +28,19 @@ public class MediaServiceDataTests extends TestCase {
public void setUp(){
msg = new MediaServiceData();
- msg.setMediaType(Test.GENERAL_MEDIATYPE);
- msg.setMediaTitle(Test.GENERAL_STRING);
- msg.setMediaArtist(Test.GENERAL_STRING);
- msg.setMediaAlbum(Test.GENERAL_STRING);
- msg.setMediaImage(Test.GENERAL_IMAGE);
- msg.setPlaylistName(Test.GENERAL_STRING);
- msg.setIsExplicit(Test.GENERAL_BOOLEAN);
- msg.setTrackPlaybackProgress(Test.GENERAL_INTEGER);
- msg.setTrackPlaybackDuration(Test.GENERAL_INTEGER);
- msg.setQueuePlaybackProgress(Test.GENERAL_INTEGER);
- msg.setQueuePlaybackDuration(Test.GENERAL_INTEGER);
- msg.setQueueCurrentTrackNumber(Test.GENERAL_INTEGER);
- msg.setQueueTotalTrackCount(Test.GENERAL_INTEGER);
+ msg.setMediaType(TestValues.GENERAL_MEDIATYPE);
+ msg.setMediaTitle(TestValues.GENERAL_STRING);
+ msg.setMediaArtist(TestValues.GENERAL_STRING);
+ msg.setMediaAlbum(TestValues.GENERAL_STRING);
+ msg.setMediaImage(TestValues.GENERAL_IMAGE);
+ msg.setPlaylistName(TestValues.GENERAL_STRING);
+ msg.setIsExplicit(TestValues.GENERAL_BOOLEAN);
+ msg.setTrackPlaybackProgress(TestValues.GENERAL_INTEGER);
+ msg.setTrackPlaybackDuration(TestValues.GENERAL_INTEGER);
+ msg.setQueuePlaybackProgress(TestValues.GENERAL_INTEGER);
+ msg.setQueuePlaybackDuration(TestValues.GENERAL_INTEGER);
+ msg.setQueueCurrentTrackNumber(TestValues.GENERAL_INTEGER);
+ msg.setQueueTotalTrackCount(TestValues.GENERAL_INTEGER);
}
/**
@@ -63,59 +63,59 @@ public class MediaServiceDataTests extends TestCase {
Integer queueTotalTrackCount = msg.getQueueTotalTrackCount();
// Valid Tests
- assertEquals(Test.GENERAL_MEDIATYPE, mediaType);
- assertEquals(Test.GENERAL_STRING, mediaTitle);
- assertEquals(Test.GENERAL_STRING, mediaArtist);
- assertEquals(Test.GENERAL_STRING, mediaAlbum);
- assertEquals(Test.GENERAL_IMAGE, mediaImage);
- assertEquals(Test.GENERAL_STRING, playlistName);
- assertEquals(Test.GENERAL_BOOLEAN, isExplicit);
- assertEquals(Test.GENERAL_INTEGER, trackPlaybackProgress);
- assertEquals(Test.GENERAL_INTEGER, trackPlaybackDuration);
- assertEquals(Test.GENERAL_INTEGER, queuePlaybackProgress);
- assertEquals(Test.GENERAL_INTEGER, queuePlaybackDuration);
- assertEquals(Test.GENERAL_INTEGER, queueCurrentTrackNumber);
- assertEquals(Test.GENERAL_INTEGER, queueTotalTrackCount);
+ assertEquals(TestValues.GENERAL_MEDIATYPE, mediaType);
+ assertEquals(TestValues.GENERAL_STRING, mediaTitle);
+ assertEquals(TestValues.GENERAL_STRING, mediaArtist);
+ assertEquals(TestValues.GENERAL_STRING, mediaAlbum);
+ assertEquals(TestValues.GENERAL_IMAGE, mediaImage);
+ assertEquals(TestValues.GENERAL_STRING, playlistName);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isExplicit);
+ assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackProgress);
+ assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackDuration);
+ assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackProgress);
+ assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackDuration);
+ assertEquals(TestValues.GENERAL_INTEGER, queueCurrentTrackNumber);
+ assertEquals(TestValues.GENERAL_INTEGER, queueTotalTrackCount);
// Invalid/Null Tests
MediaServiceData msg = new MediaServiceData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getMediaType());
- assertNull(Test.NULL, msg.getMediaTitle());
- assertNull(Test.NULL, msg.getMediaArtist());
- assertNull(Test.NULL, msg.getMediaAlbum());
- assertNull(Test.NULL, msg.getMediaImage());
- assertNull(Test.NULL, msg.getPlaylistName());
- assertNull(Test.NULL, msg.getIsExplicit());
- assertNull(Test.NULL, msg.getTrackPlaybackProgress());
- assertNull(Test.NULL, msg.getTrackPlaybackDuration());
- assertNull(Test.NULL, msg.getQueuePlaybackProgress());
- assertNull(Test.NULL, msg.getQueuePlaybackDuration());
- assertNull(Test.NULL, msg.getQueueCurrentTrackNumber());
- assertNull(Test.NULL, msg.getQueueTotalTrackCount());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMediaType());
+ assertNull(TestValues.NULL, msg.getMediaTitle());
+ assertNull(TestValues.NULL, msg.getMediaArtist());
+ assertNull(TestValues.NULL, msg.getMediaAlbum());
+ assertNull(TestValues.NULL, msg.getMediaImage());
+ assertNull(TestValues.NULL, msg.getPlaylistName());
+ assertNull(TestValues.NULL, msg.getIsExplicit());
+ assertNull(TestValues.NULL, msg.getTrackPlaybackProgress());
+ assertNull(TestValues.NULL, msg.getTrackPlaybackDuration());
+ assertNull(TestValues.NULL, msg.getQueuePlaybackProgress());
+ assertNull(TestValues.NULL, msg.getQueuePlaybackDuration());
+ assertNull(TestValues.NULL, msg.getQueueCurrentTrackNumber());
+ assertNull(TestValues.NULL, msg.getQueueTotalTrackCount());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(MediaServiceData.KEY_MEDIA_TYPE, Test.GENERAL_MEDIATYPE);
- reference.put(MediaServiceData.KEY_MEDIA_TITLE, Test.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_ARTIST, Test.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_ALBUM, Test.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_IMAGE, Test.GENERAL_IMAGE);
- reference.put(MediaServiceData.KEY_PLAYLIST_NAME, Test.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_IS_EXPLICIT, Test.GENERAL_BOOLEAN);
- reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, Test.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_DURATION, Test.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_PROGRESS, Test.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_DURATION, Test.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_CURRENT_TRACK_NUMBER, Test.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_TOTAL_TRACK_COUNT, Test.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_MEDIA_TYPE, TestValues.GENERAL_MEDIATYPE);
+ reference.put(MediaServiceData.KEY_MEDIA_TITLE, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ARTIST, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ALBUM, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_IMAGE, TestValues.GENERAL_IMAGE);
+ reference.put(MediaServiceData.KEY_PLAYLIST_NAME, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_IS_EXPLICIT, TestValues.GENERAL_BOOLEAN);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_CURRENT_TRACK_NUMBER, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_TOTAL_TRACK_COUNT, TestValues.GENERAL_INTEGER);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -124,13 +124,13 @@ public class MediaServiceDataTests extends TestCase {
if (key.equals(MediaServiceData.KEY_MEDIA_IMAGE)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, new Image(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
index 85332bc0c..d85e064f4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,7 +24,7 @@ public class MediaServiceManifestTests extends TestCase {
// Invalid/Null Tests
MediaServiceManifest msg = new MediaServiceManifest();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
index b839d9247..0d74473e2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class MenuParamsTests extends TestCase{
public void setUp(){
msg = new MenuParams();
- msg.setMenuName(Test.GENERAL_STRING);
- msg.setParentID(Test.GENERAL_INT);
- msg.setPosition(Test.GENERAL_INT);
+ msg.setMenuName(TestValues.GENERAL_STRING);
+ msg.setParentID(TestValues.GENERAL_INT);
+ msg.setPosition(TestValues.GENERAL_INT);
}
/**
@@ -38,37 +38,37 @@ public class MenuParamsTests extends TestCase{
int position = msg.getPosition();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, menuName);
- assertEquals(Test.MATCH, Test.GENERAL_INT, parentId);
- assertEquals(Test.MATCH, Test.GENERAL_INT, position);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, menuName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, parentId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, position);
// Invalid/Null Tests
MenuParams msg = new MenuParams();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getMenuName());
- assertNull(Test.NULL, msg.getParentID());
- assertNull(Test.NULL, msg.getPosition());
+ assertNull(TestValues.NULL, msg.getMenuName());
+ assertNull(TestValues.NULL, msg.getParentID());
+ assertNull(TestValues.NULL, msg.getPosition());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(MenuParams.KEY_MENU_NAME, Test.GENERAL_STRING);
- reference.put(MenuParams.KEY_PARENT_ID, Test.GENERAL_INT);
- reference.put(MenuParams.KEY_POSITION, Test.GENERAL_INT);
+ reference.put(MenuParams.KEY_MENU_NAME, TestValues.GENERAL_STRING);
+ reference.put(MenuParams.KEY_PARENT_ID, TestValues.GENERAL_INT);
+ reference.put(MenuParams.KEY_POSITION, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
index 5f27cc132..9b08c8e73 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -59,10 +59,10 @@ public class MetadataTagsTests extends TestCase {
List<MetadataType> mainField4Types = msg.getMainField4();
// Valid Tests
- assertEquals(Test.MATCH, exampleList, mainField1Types);
- assertEquals(Test.MATCH, exampleList, mainField2Types);
- assertEquals(Test.MATCH, exampleList, mainField3Types);
- assertEquals(Test.MATCH, exampleList, mainField4Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField1Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField2Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField3Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField4Types);
// Test metadata set without a list
mainField1Types = msg2.getMainField1();
@@ -71,40 +71,40 @@ public class MetadataTagsTests extends TestCase {
mainField4Types = msg2.getMainField4();
// Valid Tests
- assertEquals(Test.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
- assertEquals(Test.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
- assertEquals(Test.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
- assertEquals(Test.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
// Invalid/Null Tests
MetadataTags msg = new MetadataTags();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getMainField1());
- assertNull(Test.NULL, msg.getMainField2());
- assertNull(Test.NULL, msg.getMainField3());
- assertNull(Test.NULL, msg.getMainField4());
+ assertNull(TestValues.NULL, msg.getMainField1());
+ assertNull(TestValues.NULL, msg.getMainField2());
+ assertNull(TestValues.NULL, msg.getMainField3());
+ assertNull(TestValues.NULL, msg.getMainField4());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, Test.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, Test.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, Test.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, TestValues.JSON_TEXTFIELDTYPES);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
index 7f4a78b27..dc7cdf2ce 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.RadioControlData;
import com.smartdevicelink.proxy.rpc.SeatControlData;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,14 +32,14 @@ public class ModuleDataTests extends TestCase {
@Override
public void setUp() {
msg = new ModuleData();
- msg.setModuleType(Test.GENERAL_MODULETYPE);
- msg.setRadioControlData(Test.GENERAL_RADIOCONTROLDATA);
- msg.setClimateControlData(Test.GENERAL_CLIMATECONTROLDATA);
- msg.setSeatControlData(Test.GENERAL_SEATCONTROLDATA);
- msg.setAudioControlData(Test.GENERAL_AUDIOCONTROLDATA);
- msg.setHmiSettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA);
- msg.setLightControlData(Test.GENERAL_LIGHTCONTROLDATA);
- msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA);
+ msg.setClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA);
+ msg.setSeatControlData(TestValues.GENERAL_SEATCONTROLDATA);
+ msg.setAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA);
+ msg.setHmiSettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA);
+ msg.setLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA);
+ msg.setModuleId(TestValues.GENERAL_STRING);
}
/**
@@ -57,44 +57,44 @@ public class ModuleDataTests extends TestCase {
String moduleId = msg.getModuleId();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType);
- assertTrue(Test.TRUE, Validator.validateRadioControlData(Test.GENERAL_RADIOCONTROLDATA, radioControlData));
- assertTrue(Test.TRUE, Validator.validateClimateControlData(Test.GENERAL_CLIMATECONTROLDATA, climateControlData));
- assertTrue(Test.TRUE, Validator.validateSeatControlData(Test.GENERAL_SEATCONTROLDATA, seatControlData));
- assertTrue(Test.TRUE, Validator.validateAudioControlData(Test.GENERAL_AUDIOCONTROLDATA, audioControlData));
- assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
- assertTrue(Test.TRUE, Validator.validateLightControlData(Test.GENERAL_LIGHTCONTROLDATA, lightControlData));
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, moduleType);
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA, radioControlData));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA, climateControlData));
+ assertTrue(TestValues.TRUE, Validator.validateSeatControlData(TestValues.GENERAL_SEATCONTROLDATA, seatControlData));
+ assertTrue(TestValues.TRUE, Validator.validateAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA, audioControlData));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA, lightControlData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleId);
// Invalid/Null Tests
ModuleData msg = new ModuleData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getModuleType());
- assertNull(Test.NULL, msg.getRadioControlData());
- assertNull(Test.NULL, msg.getClimateControlData());
- assertNull(Test.NULL, msg.getSeatControlData());
- assertNull(Test.NULL, msg.getAudioControlData());
- assertNull(Test.NULL, msg.getHmiSettingsControlData());
- assertNull(Test.NULL, msg.getLightControlData());
- assertNull(Test.NULL, msg.getModuleId());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getRadioControlData());
+ assertNull(TestValues.NULL, msg.getClimateControlData());
+ assertNull(TestValues.NULL, msg.getSeatControlData());
+ assertNull(TestValues.NULL, msg.getAudioControlData());
+ assertNull(TestValues.NULL, msg.getHmiSettingsControlData());
+ assertNull(TestValues.NULL, msg.getLightControlData());
+ assertNull(TestValues.NULL, msg.getModuleId());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(ModuleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
- reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RADIOCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_CLIMATECONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_SEAT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_SEATCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_AUDIOCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_MODULE_ID, Test.GENERAL_STRING);
+ reference.put(ModuleData.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RADIOCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_CLIMATECONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_SEAT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SEATCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_AUDIOCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_MODULE_ID, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -105,43 +105,43 @@ public class ModuleDataTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateRadioControlData(new RadioControlData(hashReference), new RadioControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlData(new RadioControlData(hashReference), new RadioControlData(hashTest)));
} else if (key.equals(ModuleData.KEY_CLIMATE_CONTROL_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateClimateControlData(new ClimateControlData(hashReference), new ClimateControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlData(new ClimateControlData(hashReference), new ClimateControlData(hashTest)));
} else if (key.equals(ModuleData.KEY_SEAT_CONTROL_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateSeatControlData(new SeatControlData(hashReference), new SeatControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateSeatControlData(new SeatControlData(hashReference), new SeatControlData(hashTest)));
} else if (key.equals(ModuleData.KEY_AUDIO_CONTROL_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateAudioControlData(new AudioControlData(hashReference), new AudioControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateAudioControlData(new AudioControlData(hashReference), new AudioControlData(hashTest)));
} else if (key.equals(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(new HMISettingsControlData(hashReference), new HMISettingsControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlData(new HMISettingsControlData(hashReference), new HMISettingsControlData(hashTest)));
} else if (key.equals(ModuleData.KEY_LIGHT_CONTROL_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateLightControlData(new LightControlData(hashReference), new LightControlData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlData(new LightControlData(hashReference), new LightControlData(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
index 282e43b4f..ef09a270f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -19,10 +19,10 @@ public class ModuleInfoTests extends TestCase {
@Override
public void setUp() {
msg = new ModuleInfo();
- msg.setModuleId(Test.GENERAL_STRING);
- msg.setModuleLocation(Test.GENERAL_GRID);
- msg.setModuleServiceArea(Test.GENERAL_GRID);
- msg.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
+ msg.setModuleId(TestValues.GENERAL_STRING);
+ msg.setModuleLocation(TestValues.GENERAL_GRID);
+ msg.setModuleServiceArea(TestValues.GENERAL_GRID);
+ msg.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
}
public void testRpcValues() {
@@ -32,39 +32,39 @@ public class ModuleInfoTests extends TestCase {
boolean isAllowed = msg.getMultipleAccessAllowance();
//valid tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
- assertEquals(Test.MATCH, Test.GENERAL_GRID, loc);
- assertEquals(Test.MATCH, Test.GENERAL_GRID, area);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isAllowed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, loc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, area);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isAllowed);
//null test
ModuleInfo msg = new ModuleInfo();
- assertNull(Test.NULL, msg.getModuleId());
- assertNull(Test.NULL, msg.getModuleLocation());
- assertNull(Test.NULL, msg.getModuleServiceArea());
- assertNull(Test.NULL, msg.getMultipleAccessAllowance());
+ assertNull(TestValues.NULL, msg.getModuleId());
+ assertNull(TestValues.NULL, msg.getModuleLocation());
+ assertNull(TestValues.NULL, msg.getModuleServiceArea());
+ assertNull(TestValues.NULL, msg.getMultipleAccessAllowance());
//test required params constructor
- ModuleInfo msg2 = new ModuleInfo(Test.GENERAL_STRING);
- assertEquals(Test.MATCH, msg2.getModuleId(), Test.GENERAL_STRING);
+ ModuleInfo msg2 = new ModuleInfo(TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, msg2.getModuleId(), TestValues.GENERAL_STRING);
}
public void testJson() {
JSONObject original = new JSONObject();
try {
- original.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
- original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
- original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
- original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+ original.put(ModuleInfo.KEY_MODULE_ID, TestValues.GENERAL_STRING);
+ original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
JSONObject serialized = msg.serializeJSON();
- assertEquals(Test.MATCH, original.length(), serialized.length());
+ assertEquals(TestValues.MATCH, original.length(), serialized.length());
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
index a496964ad..deda0f886 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,7 +23,7 @@ public class MyKeyTests extends TestCase{
@Override
public void setUp(){
msg = new MyKey();
- msg.setE911Override(Test.GENERAL_VEHICLEDATASTATUS);
+ msg.setE911Override(TestValues.GENERAL_VEHICLEDATASTATUS);
}
/**
@@ -34,31 +34,31 @@ public class MyKeyTests extends TestCase{
VehicleDataStatus override = msg.getE911Override();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATASTATUS, override);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATASTATUS, override);
// Invalid/Null Tests
MyKey msg = new MyKey();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getE911Override());
+ assertNull(TestValues.NULL, msg.getE911Override());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(MyKey.KEY_E_911_OVERRIDE, Test.GENERAL_VEHICLEDATASTATUS);
+ reference.put(MyKey.KEY_E_911_OVERRIDE, TestValues.GENERAL_VEHICLEDATASTATUS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
index efbf7e30d..518eb6a95 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,8 +23,8 @@ public class NavigationCapabilityTests extends TestCase{
public void setUp(){
msg = new NavigationCapability();
- msg.setSendLocationEnabled(Test.GENERAL_BOOLEAN);
- msg.setWayPointsEnabled(Test.GENERAL_BOOLEAN);
+ msg.setSendLocationEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setWayPointsEnabled(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -36,34 +36,34 @@ public class NavigationCapabilityTests extends TestCase{
boolean getWayPointsEnabled = msg.getWayPointsEnabled();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sendLocationEnabled);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, getWayPointsEnabled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, sendLocationEnabled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, getWayPointsEnabled);
// Invalid/Null Tests
NavigationCapability msg = new NavigationCapability();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getSendLocationEnabled());
- assertNull(Test.NULL, msg.getWayPointsEnabled());
+ assertNull(TestValues.NULL, msg.getSendLocationEnabled());
+ assertNull(TestValues.NULL, msg.getWayPointsEnabled());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(NavigationCapability.KEY_GETWAYPOINTS_ENABLED, Test.GENERAL_BOOLEAN);
- reference.put(NavigationCapability.KEY_LOCATION_ENABLED, Test.GENERAL_BOOLEAN);
+ reference.put(NavigationCapability.KEY_GETWAYPOINTS_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(NavigationCapability.KEY_LOCATION_ENABLED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
index c27d33ee2..cfb791f02 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
@@ -9,7 +9,7 @@ import com.smartdevicelink.proxy.rpc.enums.Direction;
import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,14 +32,14 @@ public class NavigationInstructionTests extends TestCase {
public void setUp(){
msg = new NavigationInstruction();
- msg.setLocationDetails(Test.GENERAL_LOCATIONDETAILS);
- msg.setAction(Test.GENERAL_NAVIGATIONACTION);
- msg.setEta(Test.GENERAL_DATETIME);
- msg.setBearing(Test.GENERAL_INTEGER);
- msg.setJunctionType(Test.GENERAL_NAVIGATION_JUNCTION);
- msg.setDrivingSide(Test.GENERAL_DIRECTION);
- msg.setDetails(Test.GENERAL_STRING);
- msg.setImage(Test.GENERAL_IMAGE);
+ msg.setLocationDetails(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setAction(TestValues.GENERAL_NAVIGATIONACTION);
+ msg.setEta(TestValues.GENERAL_DATETIME);
+ msg.setBearing(TestValues.GENERAL_INTEGER);
+ msg.setJunctionType(TestValues.GENERAL_NAVIGATION_JUNCTION);
+ msg.setDrivingSide(TestValues.GENERAL_DIRECTION);
+ msg.setDetails(TestValues.GENERAL_STRING);
+ msg.setImage(TestValues.GENERAL_IMAGE);
}
/**
@@ -57,55 +57,55 @@ public class NavigationInstructionTests extends TestCase {
Image image = msg.getImage();
// Valid Tests
- assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
- assertEquals(Test.GENERAL_NAVIGATIONACTION, action);
- assertEquals(Test.GENERAL_DATETIME, eta);
- assertEquals(Test.GENERAL_INTEGER, bearing);
- assertEquals(Test.GENERAL_NAVIGATION_JUNCTION, junctionType);
- assertEquals(Test.GENERAL_DIRECTION, drivingSide);
- assertEquals(Test.GENERAL_STRING, details);
- assertEquals(Test.GENERAL_IMAGE, image);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
+ assertEquals(TestValues.GENERAL_DATETIME, eta);
+ assertEquals(TestValues.GENERAL_INTEGER, bearing);
+ assertEquals(TestValues.GENERAL_NAVIGATION_JUNCTION, junctionType);
+ assertEquals(TestValues.GENERAL_DIRECTION, drivingSide);
+ assertEquals(TestValues.GENERAL_STRING, details);
+ assertEquals(TestValues.GENERAL_IMAGE, image);
// Invalid/Null Tests
NavigationInstruction msg = new NavigationInstruction();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getLocationDetails());
- assertNull(Test.NULL, msg.getAction());
- assertNull(Test.NULL, msg.getEta());
- assertNull(Test.NULL, msg.getBearing());
- assertNull(Test.NULL, msg.getJunctionType());
- assertNull(Test.NULL, msg.getDrivingSide());
- assertNull(Test.NULL, msg.getDetails());
- assertNull(Test.NULL, msg.getImage());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getLocationDetails());
+ assertNull(TestValues.NULL, msg.getAction());
+ assertNull(TestValues.NULL, msg.getEta());
+ assertNull(TestValues.NULL, msg.getBearing());
+ assertNull(TestValues.NULL, msg.getJunctionType());
+ assertNull(TestValues.NULL, msg.getDrivingSide());
+ assertNull(TestValues.NULL, msg.getDetails());
+ assertNull(TestValues.NULL, msg.getImage());
}
public void testRequiredConstructor(){
- NavigationInstruction msg = new NavigationInstruction(Test.GENERAL_LOCATIONDETAILS, Test.GENERAL_NAVIGATIONACTION);
- assertNotNull(Test.NOT_NULL, msg);
+ NavigationInstruction msg = new NavigationInstruction(TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_NAVIGATIONACTION);
+ assertNotNull(TestValues.NOT_NULL, msg);
LocationDetails locationDetails = msg.getLocationDetails();
NavigationAction action = msg.getAction();
- assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
- assertEquals(Test.GENERAL_NAVIGATIONACTION, action);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(NavigationInstruction.KEY_LOCATION_DETAILS, Test.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationInstruction.KEY_ACTION, Test.GENERAL_NAVIGATIONACTION);
- reference.put(NavigationInstruction.KEY_ETA, Test.GENERAL_DATETIME);
- reference.put(NavigationInstruction.KEY_BEARING, Test.GENERAL_INTEGER);
- reference.put(NavigationInstruction.KEY_JUNCTION_TYPE, Test.GENERAL_NAVIGATION_JUNCTION);
- reference.put(NavigationInstruction.KEY_DRIVING_SIDE, Test.GENERAL_DIRECTION);
- reference.put(NavigationInstruction.KEY_DETAILS, Test.GENERAL_STRING);
- reference.put(NavigationInstruction.KEY_IMAGE, Test.GENERAL_IMAGE);
+ reference.put(NavigationInstruction.KEY_LOCATION_DETAILS, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationInstruction.KEY_ACTION, TestValues.GENERAL_NAVIGATIONACTION);
+ reference.put(NavigationInstruction.KEY_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationInstruction.KEY_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(NavigationInstruction.KEY_JUNCTION_TYPE, TestValues.GENERAL_NAVIGATION_JUNCTION);
+ reference.put(NavigationInstruction.KEY_DRIVING_SIDE, TestValues.GENERAL_DIRECTION);
+ reference.put(NavigationInstruction.KEY_DETAILS, TestValues.GENERAL_STRING);
+ reference.put(NavigationInstruction.KEY_IMAGE, TestValues.GENERAL_IMAGE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -114,21 +114,21 @@ public class NavigationInstructionTests extends TestCase {
if(key.equals(NavigationInstruction.KEY_IMAGE)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
- assertTrue(Test.TRUE, Validator.validateImage(refIcon1, msg.getImage()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getImage()));
}else if(key.equals(NavigationInstruction.KEY_LOCATION_DETAILS)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
}else if (key.equals(NavigationInstruction.KEY_ETA)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
}else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
index 9b59062d4..9276fc091 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
import com.smartdevicelink.proxy.rpc.NavigationServiceData;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -32,15 +32,15 @@ public class NavigationServiceDataTests extends TestCase {
public void setUp(){
msg = new NavigationServiceData();
- msg.setTimeStamp(Test.GENERAL_DATETIME);
- msg.setOrigin(Test.GENERAL_LOCATIONDETAILS);
- msg.setDestination(Test.GENERAL_LOCATIONDETAILS);
- msg.setDestinationETA(Test.GENERAL_DATETIME);
- msg.setInstructions(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST);
- msg.setNextInstructionETA(Test.GENERAL_DATETIME);
- msg.setNextInstructionDistance(Test.GENERAL_FLOAT);
- msg.setNextInstructionDistanceScale(Test.GENERAL_FLOAT);
- msg.setPrompt(Test.GENERAL_STRING);
+ msg.setTimeStamp(TestValues.GENERAL_DATETIME);
+ msg.setOrigin(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setDestination(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setDestinationETA(TestValues.GENERAL_DATETIME);
+ msg.setInstructions(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ msg.setNextInstructionETA(TestValues.GENERAL_DATETIME);
+ msg.setNextInstructionDistance(TestValues.GENERAL_FLOAT);
+ msg.setNextInstructionDistanceScale(TestValues.GENERAL_FLOAT);
+ msg.setPrompt(TestValues.GENERAL_STRING);
}
/**
@@ -59,57 +59,57 @@ public class NavigationServiceDataTests extends TestCase {
String prompt = msg.getPrompt();
// Valid Tests
- assertEquals(Test.GENERAL_DATETIME, timestamp);
- assertEquals(Test.GENERAL_LOCATIONDETAILS, origin);
- assertEquals(Test.GENERAL_LOCATIONDETAILS, destination);
- assertEquals(Test.GENERAL_DATETIME, destinationETA);
- assertEquals(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST, instructions);
- assertEquals(Test.GENERAL_DATETIME, nextInstructionETA);
- assertEquals(Test.GENERAL_FLOAT, nextInstructionDistance);
- assertEquals(Test.GENERAL_FLOAT, nextInstructionDistanceScale);
- assertEquals(Test.GENERAL_STRING, prompt);
+ assertEquals(TestValues.GENERAL_DATETIME, timestamp);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, origin);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, destination);
+ assertEquals(TestValues.GENERAL_DATETIME, destinationETA);
+ assertEquals(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, instructions);
+ assertEquals(TestValues.GENERAL_DATETIME, nextInstructionETA);
+ assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistance);
+ assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistanceScale);
+ assertEquals(TestValues.GENERAL_STRING, prompt);
// Invalid/Null Tests
NavigationServiceData msg = new NavigationServiceData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getTimeStamp());
- assertNull(Test.NULL, msg.getOrigin());
- assertNull(Test.NULL, msg.getDestination());
- assertNull(Test.NULL, msg.getDestinationETA());
- assertNull(Test.NULL, msg.getInstructions());
- assertNull(Test.NULL, msg.getNextInstructionETA());
- assertNull(Test.NULL, msg.getNextInstructionDistance());
- assertNull(Test.NULL, msg.getNextInstructionDistanceScale());
- assertNull(Test.NULL, msg.getPrompt());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getTimeStamp());
+ assertNull(TestValues.NULL, msg.getOrigin());
+ assertNull(TestValues.NULL, msg.getDestination());
+ assertNull(TestValues.NULL, msg.getDestinationETA());
+ assertNull(TestValues.NULL, msg.getInstructions());
+ assertNull(TestValues.NULL, msg.getNextInstructionETA());
+ assertNull(TestValues.NULL, msg.getNextInstructionDistance());
+ assertNull(TestValues.NULL, msg.getNextInstructionDistanceScale());
+ assertNull(TestValues.NULL, msg.getPrompt());
}
public void testRequiredConstructor(){
- NavigationServiceData msg = new NavigationServiceData(Test.GENERAL_DATETIME);
- assertNotNull(Test.NOT_NULL, msg);
+ NavigationServiceData msg = new NavigationServiceData(TestValues.GENERAL_DATETIME);
+ assertNotNull(TestValues.NOT_NULL, msg);
DateTime locationDetails = msg.getTimeStamp();
- assertEquals(Test.GENERAL_DATETIME, locationDetails);
+ assertEquals(TestValues.GENERAL_DATETIME, locationDetails);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(NavigationServiceData.KEY_TIMESTAMP, Test.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_ORIGIN, Test.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationServiceData.KEY_DESTINATION, Test.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationServiceData.KEY_DESTINATION_ETA, Test.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_INSTRUCTIONS, Test.GENERAL_NAVIGATION_INSTRUCTION_LIST);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA, Test.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE, Test.GENERAL_FLOAT);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, Test.GENERAL_FLOAT);
- reference.put(NavigationServiceData.KEY_PROMPT, Test.GENERAL_STRING);
+ reference.put(NavigationServiceData.KEY_TIMESTAMP, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_ORIGIN, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_INSTRUCTIONS, TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE, TestValues.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, TestValues.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_PROMPT, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -118,11 +118,11 @@ public class NavigationServiceDataTests extends TestCase {
if(key.equals(NavigationServiceData.KEY_TIMESTAMP)||key.equals(NavigationServiceData.KEY_DESTINATION_ETA)||key.equals(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
}else if(key.equals(NavigationServiceData.KEY_DESTINATION)||key.equals(NavigationServiceData.KEY_ORIGIN)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
}else if (key.equals(NavigationServiceData.KEY_INSTRUCTIONS)){
JSONArray NavigationInstructionUnderTestListArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<NavigationInstruction> NavigationInstructionUnderTestList = new ArrayList<>();
@@ -131,13 +131,13 @@ public class NavigationServiceDataTests extends TestCase {
NavigationInstructionUnderTestList.add(NavigationInstructionData);
}
assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateNavigationInstructionList(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
+ Validator.validateNavigationInstructionList(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
}else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
index de4144677..b9298dcf6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,7 +23,7 @@ public class NavigationServiceManifestTests extends TestCase {
public void setUp(){
msg = new NavigationServiceManifest();
- msg.setAcceptsWayPoints(Test.GENERAL_BOOLEAN);
+ msg.setAcceptsWayPoints(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -34,31 +34,31 @@ public class NavigationServiceManifestTests extends TestCase {
boolean acceptsWayPoints = msg.getAcceptsWayPoints();
// Valid Tests
- assertEquals(Test.GENERAL_BOOLEAN, acceptsWayPoints);
+ assertEquals(TestValues.GENERAL_BOOLEAN, acceptsWayPoints);
// Invalid/Null Tests
NavigationServiceManifest msg = new NavigationServiceManifest();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAcceptsWayPoints());
+ assertNull(TestValues.NULL, msg.getAcceptsWayPoints());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, Test.GENERAL_BOOLEAN);
+ reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
index cf39a3c18..2ea76cd1d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.OasisAddress;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -19,7 +19,7 @@ public class OasisAddressTests extends TestCase {
@Override
public void setUp(){
- msg = Test.GENERAL_OASISADDRESS;
+ msg = TestValues.GENERAL_OASISADDRESS;
}
/**
@@ -39,19 +39,19 @@ public class OasisAddressTests extends TestCase {
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f3);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f4);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f5);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f6);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f7);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f8);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, f9);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f4);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f5);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f6);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f7);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f8);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, f9);
// Invalid/Null Tests
OasisAddress msg = new OasisAddress();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
assertNull(msg.getAdministrativeArea());
assertNull(msg.getSubAdministrativeArea());
@@ -68,28 +68,28 @@ public class OasisAddressTests extends TestCase {
JSONObject reference = new JSONObject();
try{
- reference.put(OasisAddress.KEY_ADMINISTRATIVE_AREA, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_SUB_ADMINISTRATIVE_AREA, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_COUNTRY_CODE, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_COUNTRY_NAME, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_LOCALITY, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_SUB_LOCALITY, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_POSTAL_CODE, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_THOROUGH_FARE, Test.GENERAL_STRING);
- reference.put(OasisAddress.KEY_SUB_THOROUGH_FARE, Test.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_ADMINISTRATIVE_AREA, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_ADMINISTRATIVE_AREA, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_COUNTRY_CODE, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_COUNTRY_NAME, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_LOCALITY, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_LOCALITY, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_POSTAL_CODE, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_THOROUGH_FARE, TestValues.GENERAL_STRING);
+ reference.put(OasisAddress.KEY_SUB_THOROUGH_FARE, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, reference.get(key),
+ assertEquals(TestValues.MATCH, reference.get(key),
underTest.get(key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
index a76b1e754..d62d2bdc8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -25,8 +25,8 @@ public class ParameterPermissionsTests extends TestCase{
public void setUp(){
msg = new ParameterPermissions();
- msg.setAllowed(Test.GENERAL_STRING_LIST);
- msg.setUserDisallowed(Test.GENERAL_STRING_LIST);
+ msg.setAllowed(TestValues.GENERAL_STRING_LIST);
+ msg.setUserDisallowed(TestValues.GENERAL_STRING_LIST);
}
/**
@@ -38,34 +38,34 @@ public class ParameterPermissionsTests extends TestCase{
List<String> disallowed = msg.getUserDisallowed();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, allowed));
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, disallowed));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, allowed));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, disallowed));
// Invalid/Null Tests
ParameterPermissions msg = new ParameterPermissions();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getAllowed());
- assertNull(Test.NULL, msg.getUserDisallowed());
+ assertNull(TestValues.NULL, msg.getAllowed());
+ assertNull(TestValues.NULL, msg.getUserDisallowed());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(ParameterPermissions.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(ParameterPermissions.KEY_USER_DISALLOWED, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(ParameterPermissions.KEY_ALLOWED, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(ParameterPermissions.KEY_USER_DISALLOWED, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
index 491803317..819fff516 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -26,10 +26,10 @@ public class PermissionItemTest extends TestCase {
public void setUp() {
msg = new PermissionItem();
- msg.setRpcName(Test.GENERAL_STRING);
- msg.setHMIPermissions(Test.GENERAL_HMIPERMISSIONS);
- msg.setParameterPermissions(Test.GENERAL_PARAMETERPERMISSIONS);
- msg.setRequireEncryption(Test.GENERAL_BOOLEAN);
+ msg.setRpcName(TestValues.GENERAL_STRING);
+ msg.setHMIPermissions(TestValues.GENERAL_HMIPERMISSIONS);
+ msg.setParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS);
+ msg.setRequireEncryption(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -43,49 +43,49 @@ public class PermissionItemTest extends TestCase {
boolean isEncryptionRequired = msg.getRequireEncryption();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, rpcName);
- assertTrue(Test.TRUE, Validator.validateHmiPermissions(Test.GENERAL_HMIPERMISSIONS, hmiPermissions));
- assertTrue(Test.TRUE, Validator.validateParameterPermissions(Test.GENERAL_PARAMETERPERMISSIONS, parameterPermissions));
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isEncryptionRequired);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, rpcName);
+ assertTrue(TestValues.TRUE, Validator.validateHmiPermissions(TestValues.GENERAL_HMIPERMISSIONS, hmiPermissions));
+ assertTrue(TestValues.TRUE, Validator.validateParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS, parameterPermissions));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isEncryptionRequired);
// Invalid/Null Tests
PermissionItem msg = new PermissionItem();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getRpcName());
- assertNull(Test.NULL, msg.getHMIPermissions());
- assertNull(Test.NULL, msg.getParameterPermissions());
- assertNull(Test.NULL, msg.getRequireEncryption());
+ assertNull(TestValues.NULL, msg.getRpcName());
+ assertNull(TestValues.NULL, msg.getHMIPermissions());
+ assertNull(TestValues.NULL, msg.getParameterPermissions());
+ assertNull(TestValues.NULL, msg.getRequireEncryption());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(PermissionItem.KEY_RPC_NAME, Test.GENERAL_STRING);
- reference.put(PermissionItem.KEY_HMI_PERMISSIONS, Test.JSON_HMIPERMISSIONS);
- reference.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, Test.JSON_PARAMETERPERMISSIONS);
- reference.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, Test.GENERAL_BOOLEAN);
+ reference.put(PermissionItem.KEY_RPC_NAME, TestValues.GENERAL_STRING);
+ reference.put(PermissionItem.KEY_HMI_PERMISSIONS, TestValues.JSON_HMIPERMISSIONS);
+ reference.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, TestValues.JSON_PARAMETERPERMISSIONS);
+ reference.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(PermissionItem.KEY_HMI_PERMISSIONS)) {
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if (key.equals(PermissionItem.KEY_PARAMETER_PERMISSIONS)) {
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if (key.equals(PermissionItem.KEY_REQUIRE_ENCRYPTION)) {
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
index 2614db0fd..97966d677 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,7 +23,7 @@ public class PhoneCapabilityTests extends TestCase{
public void setUp(){
msg = new PhoneCapability();
- msg.setDialNumberEnabled(Test.GENERAL_BOOLEAN);
+ msg.setDialNumberEnabled(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -34,31 +34,31 @@ public class PhoneCapabilityTests extends TestCase{
boolean dialNumberEnabled = msg.getDialNumberEnabled();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dialNumberEnabled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, dialNumberEnabled);
// Invalid/Null Tests
PhoneCapability msg = new PhoneCapability();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getDialNumberEnabled());
+ assertNull(TestValues.NULL, msg.getDialNumberEnabled());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, Test.GENERAL_BOOLEAN);
+ reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
index 256ef1383..0b8e160df 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,7 +23,7 @@ public class PresetBankCapabilitiesTest extends TestCase {
public void setUp() {
msg = new PresetBankCapabilities();
- msg.setOnScreenPresetsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setOnScreenPresetsAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -34,31 +34,31 @@ public class PresetBankCapabilitiesTest extends TestCase {
boolean presets = msg.onScreenPresetsAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, presets);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, presets);
// Invalid/Null Tests
PresetBankCapabilities msg = new PresetBankCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.onScreenPresetsAvailable());
+ assertNull(TestValues.NULL, msg.onScreenPresetsAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
index a9c0033a0..d2f0254f4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.RGBColor;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -21,7 +21,7 @@ public class RGBColorTest extends TestCase {
@Override
public void setUp() {
- msg = new RGBColor(Test.GENERAL_INT, Test.GENERAL_INT, Test.GENERAL_INT);
+ msg = new RGBColor(TestValues.GENERAL_INT, TestValues.GENERAL_INT, TestValues.GENERAL_INT);
}
/**
@@ -34,37 +34,37 @@ public class RGBColorTest extends TestCase {
Integer blue = msg.getBlue();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, red);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, green);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, blue);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, red);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, green);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, blue);
// Invalid/Null Tests
RGBColor msg = new RGBColor();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertEquals(Test.MATCH, msg.getRed(), (Integer) 0);
- assertEquals(Test.MATCH, msg.getGreen(), (Integer) 0);
- assertEquals(Test.MATCH, msg.getBlue(), (Integer) 0);
+ assertEquals(TestValues.MATCH, msg.getRed(), (Integer) 0);
+ assertEquals(TestValues.MATCH, msg.getGreen(), (Integer) 0);
+ assertEquals(TestValues.MATCH, msg.getBlue(), (Integer) 0);
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(RGBColor.KEY_RED, Test.GENERAL_INT);
- reference.put(RGBColor.KEY_GREEN, Test.GENERAL_INT);
- reference.put(RGBColor.KEY_BLUE, Test.GENERAL_INT);
+ reference.put(RGBColor.KEY_RED, TestValues.GENERAL_INT);
+ reference.put(RGBColor.KEY_GREEN, TestValues.GENERAL_INT);
+ reference.put(RGBColor.KEY_BLUE, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
index a65a7deef..949a5f8b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,21 +27,21 @@ public class RadioControlCapabilitiesTests extends TestCase{
public void setUp(){
msg = new RadioControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setRadioEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setRadioBandAvailable(Test.GENERAL_BOOLEAN);
- msg.setRadioFrequencyAvailable(Test.GENERAL_BOOLEAN);
- msg.setHdChannelAvailable(Test.GENERAL_BOOLEAN);
- msg.setRdsDataAvailable(Test.GENERAL_BOOLEAN);
- msg.setAvailableHDsAvailable(Test.GENERAL_BOOLEAN);
- msg.setStateAvailable(Test.GENERAL_BOOLEAN);
- msg.setSignalStrengthAvailable(Test.GENERAL_BOOLEAN);
- msg.setSignalChangeThresholdAvailable(Test.GENERAL_BOOLEAN);
- msg.setHdRadioEnableAvailable(Test.GENERAL_BOOLEAN);
- msg.setSiriusXMRadioAvailable(Test.GENERAL_BOOLEAN);
- msg.setSisDataAvailable(Test.GENERAL_BOOLEAN);
- msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
- msg.setAvailableHdChannelsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setRadioEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setRadioBandAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setRadioFrequencyAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHdChannelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setRdsDataAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setAvailableHDsAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setStateAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setSignalStrengthAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setSignalChangeThresholdAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHdRadioEnableAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setSiriusXMRadioAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setSisDataAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
+ msg.setAvailableHdChannelsAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -67,65 +67,65 @@ public class RadioControlCapabilitiesTests extends TestCase{
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioBandAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioFrequencyAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdChannelAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, rdsDataAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHDsAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, stateAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalStrengthAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalChangeThresholdAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnableAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, siriusXMRadioAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sisDataAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHdChannelsAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, radioEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, radioBandAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, radioFrequencyAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, hdChannelAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, rdsDataAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, availableHDsAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, stateAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, signalStrengthAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, signalChangeThresholdAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, hdRadioEnableAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, siriusXMRadioAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, sisDataAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, availableHdChannelsAvailable);
// Invalid/Null Tests
RadioControlCapabilities msg = new RadioControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getRadioEnableAvailable());
- assertNull(Test.NULL, msg.getRadioBandAvailable());
- assertNull(Test.NULL, msg.getRadioFrequencyAvailable());
- assertNull(Test.NULL, msg.getHdChannelAvailable());
- assertNull(Test.NULL, msg.getRdsDataAvailable());
- assertNull(Test.NULL, msg.getAvailableHDsAvailable());
- assertNull(Test.NULL, msg.getStateAvailable());
- assertNull(Test.NULL, msg.getSignalStrengthAvailable());
- assertNull(Test.NULL, msg.getSignalChangeThresholdAvailable());
- assertNull(Test.NULL, msg.getHdRadioEnableAvailable());
- assertNull(Test.NULL, msg.getSiriusXMRadioAvailable());
- assertNull(Test.NULL, msg.getSisDataAvailable());
- assertNull(Test.NULL, msg.getModuleInfo());
- assertNull(Test.NULL, msg.getAvailableHdChannelsAvailable());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getRadioEnableAvailable());
+ assertNull(TestValues.NULL, msg.getRadioBandAvailable());
+ assertNull(TestValues.NULL, msg.getRadioFrequencyAvailable());
+ assertNull(TestValues.NULL, msg.getHdChannelAvailable());
+ assertNull(TestValues.NULL, msg.getRdsDataAvailable());
+ assertNull(TestValues.NULL, msg.getAvailableHDsAvailable());
+ assertNull(TestValues.NULL, msg.getStateAvailable());
+ assertNull(TestValues.NULL, msg.getSignalStrengthAvailable());
+ assertNull(TestValues.NULL, msg.getSignalChangeThresholdAvailable());
+ assertNull(TestValues.NULL, msg.getHdRadioEnableAvailable());
+ assertNull(TestValues.NULL, msg.getSiriusXMRadioAvailable());
+ assertNull(TestValues.NULL, msg.getSisDataAvailable());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
+ assertNull(TestValues.NULL, msg.getAvailableHdChannelsAvailable());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(RadioControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
- reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
+ reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -135,14 +135,14 @@ public class RadioControlCapabilitiesTests extends TestCase{
JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
- assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
index 6094b505a..a948492e3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.SisData;
import com.smartdevicelink.proxy.rpc.enums.RadioBand;
import com.smartdevicelink.proxy.rpc.enums.RadioState;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -31,19 +31,19 @@ public class RadioControlDataTests extends TestCase{
public void setUp(){
msg = new RadioControlData();
- msg.setFrequencyInteger(Test.GENERAL_INT);
- msg.setFrequencyFraction(Test.GENERAL_INT);
- msg.setBand(Test.GENERAL_RADIOBAND);
- msg.setRdsData(Test.GENERAL_RDSDATA);
- msg.setAvailableHDs(Test.GENERAL_INT);
- msg.setHdChannel(Test.GENERAL_INT);
- msg.setSignalStrength(Test.GENERAL_INT);
- msg.setSignalChangeThreshold(Test.GENERAL_INT);
- msg.setRadioEnable(Test.GENERAL_BOOLEAN);
- msg.setState(Test.GENERAL_RADIOSTATE);
- msg.setHdRadioEnable(Test.GENERAL_BOOLEAN);
- msg.setSisData(Test.GENERAL_SISDATA);
- msg.setAvailableHdChannels(Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
+ msg.setFrequencyInteger(TestValues.GENERAL_INT);
+ msg.setFrequencyFraction(TestValues.GENERAL_INT);
+ msg.setBand(TestValues.GENERAL_RADIOBAND);
+ msg.setRdsData(TestValues.GENERAL_RDSDATA);
+ msg.setAvailableHDs(TestValues.GENERAL_INT);
+ msg.setHdChannel(TestValues.GENERAL_INT);
+ msg.setSignalStrength(TestValues.GENERAL_INT);
+ msg.setSignalChangeThreshold(TestValues.GENERAL_INT);
+ msg.setRadioEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setState(TestValues.GENERAL_RADIOSTATE);
+ msg.setHdRadioEnable(TestValues.GENERAL_BOOLEAN);
+ msg.setSisData(TestValues.GENERAL_SISDATA);
+ msg.setAvailableHdChannels(TestValues.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
}
/**
@@ -66,59 +66,59 @@ public class RadioControlDataTests extends TestCase{
List<Integer> availableHdChannels = msg.getAvailableHdChannels();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyInteger);
- assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyFraction);
- assertEquals(Test.MATCH, Test.GENERAL_RADIOBAND, band);
- assertTrue(Test.TRUE, Validator.validateRdsData(Test.GENERAL_RDSDATA, rdsData));
- assertEquals(Test.MATCH, Test.GENERAL_INT, availableHDs);
- assertEquals(Test.MATCH, Test.GENERAL_INT, hdChannel);
- assertEquals(Test.MATCH, Test.GENERAL_INT, signalStrength);
- assertEquals(Test.MATCH, Test.GENERAL_INT, signalChangeThreshold);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnable);
- assertEquals(Test.MATCH, Test.GENERAL_RADIOSTATE, state);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnable);
- assertTrue(Test.TRUE, Validator.validateSisData(Test.GENERAL_SISDATA, sisData));
- assertEquals(Test.MATCH, Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST, availableHdChannels);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, frequencyInteger);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, frequencyFraction);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RADIOBAND, band);
+ assertTrue(TestValues.TRUE, Validator.validateRdsData(TestValues.GENERAL_RDSDATA, rdsData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, availableHDs);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, hdChannel);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, signalStrength);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, signalChangeThreshold);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, radioEnable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RADIOSTATE, state);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, hdRadioEnable);
+ assertTrue(TestValues.TRUE, Validator.validateSisData(TestValues.GENERAL_SISDATA, sisData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AVAILABLE_HD_CHANNELS_LIST, availableHdChannels);
// Invalid/Null Tests
RadioControlData msg = new RadioControlData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getFrequencyInteger());
- assertNull(Test.NULL, msg.getFrequencyFraction());
- assertNull(Test.NULL, msg.getBand());
- assertNull(Test.NULL, msg.getRdsData());
- assertNull(Test.NULL, msg.getAvailableHDs());
- assertNull(Test.NULL, msg.getHdChannel());
- assertNull(Test.NULL, msg.getSignalStrength());
- assertNull(Test.NULL, msg.getSignalChangeThreshold());
- assertNull(Test.NULL, msg.getRadioEnable());
- assertNull(Test.NULL, msg.getState());
- assertNull(Test.NULL, msg.getHdRadioEnable());
- assertNull(Test.NULL, msg.getSisData());
- assertNull(Test.NULL, msg.getAvailableHdChannels());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getFrequencyInteger());
+ assertNull(TestValues.NULL, msg.getFrequencyFraction());
+ assertNull(TestValues.NULL, msg.getBand());
+ assertNull(TestValues.NULL, msg.getRdsData());
+ assertNull(TestValues.NULL, msg.getAvailableHDs());
+ assertNull(TestValues.NULL, msg.getHdChannel());
+ assertNull(TestValues.NULL, msg.getSignalStrength());
+ assertNull(TestValues.NULL, msg.getSignalChangeThreshold());
+ assertNull(TestValues.NULL, msg.getRadioEnable());
+ assertNull(TestValues.NULL, msg.getState());
+ assertNull(TestValues.NULL, msg.getHdRadioEnable());
+ assertNull(TestValues.NULL, msg.getSisData());
+ assertNull(TestValues.NULL, msg.getAvailableHdChannels());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(RadioControlData.KEY_FREQUENCY_INTEGER, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_FREQUENCY_FRACTION, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_BAND, Test.GENERAL_RADIOBAND);
- reference.put(RadioControlData.KEY_RDS_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RDSDATA.getStore()));
- reference.put(RadioControlData.KEY_AVAILABLE_HDS, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_HD_CHANNEL, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_SIGNAL_STRENGTH, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_SIGNAL_CHANGE_THRESHOLD, Test.GENERAL_INT);
- reference.put(RadioControlData.KEY_RADIO_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlData.KEY_STATE, Test.GENERAL_RADIOSTATE);
- reference.put(RadioControlData.KEY_HD_RADIO_ENABLE, Test.GENERAL_BOOLEAN);
- reference.put(RadioControlData.KEY_SIS_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_SISDATA.getStore()));
- reference.put(RadioControlData.KEY_AVAILABLE_HD_CHANNELS, Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
+ reference.put(RadioControlData.KEY_FREQUENCY_INTEGER, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_FREQUENCY_FRACTION, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_BAND, TestValues.GENERAL_RADIOBAND);
+ reference.put(RadioControlData.KEY_RDS_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RDSDATA.getStore()));
+ reference.put(RadioControlData.KEY_AVAILABLE_HDS, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_HD_CHANNEL, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_SIGNAL_STRENGTH, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_SIGNAL_CHANGE_THRESHOLD, TestValues.GENERAL_INT);
+ reference.put(RadioControlData.KEY_RADIO_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlData.KEY_STATE, TestValues.GENERAL_RADIOSTATE);
+ reference.put(RadioControlData.KEY_HD_RADIO_ENABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(RadioControlData.KEY_SIS_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SISDATA.getStore()));
+ reference.put(RadioControlData.KEY_AVAILABLE_HD_CHANNELS, TestValues.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -129,23 +129,23 @@ public class RadioControlDataTests extends TestCase{
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateRdsData(new RdsData(hashReference), new RdsData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateRdsData(new RdsData(hashReference), new RdsData(hashTest)));
} else if (key.equals(RadioControlData.KEY_SIS_DATA)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateSisData(new SisData(hashReference), new SisData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateSisData(new SisData(hashReference), new SisData(hashTest)));
} else if(key.equals(RadioControlData.KEY_AVAILABLE_HD_CHANNELS)){
- List<Integer> list1 = Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST;
+ List<Integer> list1 = TestValues.GENERAL_AVAILABLE_HD_CHANNELS_LIST;
List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateIntegerList(list1,list2));
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1,list2));
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
index 7414304b0..fcdcda9ee 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.RdsData;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,14 +23,14 @@ public class RdsDataTests extends TestCase{
public void setUp(){
msg = new RdsData();
- msg.setProgramService(Test.GENERAL_STRING);
- msg.setRadioText(Test.GENERAL_STRING);
- msg.setClockText(Test.GENERAL_STRING);
- msg.setProgramIdentification(Test.GENERAL_STRING);
- msg.setRegion(Test.GENERAL_STRING);
- msg.setTrafficProgram(Test.GENERAL_BOOLEAN);
- msg.setTrafficAnnouncement(Test.GENERAL_BOOLEAN);
- msg.setProgramType(Test.GENERAL_INT);
+ msg.setProgramService(TestValues.GENERAL_STRING);
+ msg.setRadioText(TestValues.GENERAL_STRING);
+ msg.setClockText(TestValues.GENERAL_STRING);
+ msg.setProgramIdentification(TestValues.GENERAL_STRING);
+ msg.setRegion(TestValues.GENERAL_STRING);
+ msg.setTrafficProgram(TestValues.GENERAL_BOOLEAN);
+ msg.setTrafficAnnouncement(TestValues.GENERAL_BOOLEAN);
+ msg.setProgramType(TestValues.GENERAL_INT);
}
/**
@@ -48,54 +48,54 @@ public class RdsDataTests extends TestCase{
String reg = msg.getRegion();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, ps);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, rt);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, ct);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, pi);
- assertEquals(Test.MATCH, Test.GENERAL_INT, pty);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, tp);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ta);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, reg);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, ps);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, rt);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, ct);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, pi);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, pty);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, tp);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, ta);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, reg);
// Invalid/Null Tests
RdsData msg = new RdsData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getProgramService());
- assertNull(Test.NULL, msg.getRadioText());
- assertNull(Test.NULL, msg.getClockText());
- assertNull(Test.NULL, msg.getProgramIdentification());
- assertNull(Test.NULL, msg.getRegion());
- assertNull(Test.NULL, msg.getTrafficProgram());
- assertNull(Test.NULL, msg.getTrafficAnnouncement());
- assertNull(Test.NULL, msg.getProgramType());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getProgramService());
+ assertNull(TestValues.NULL, msg.getRadioText());
+ assertNull(TestValues.NULL, msg.getClockText());
+ assertNull(TestValues.NULL, msg.getProgramIdentification());
+ assertNull(TestValues.NULL, msg.getRegion());
+ assertNull(TestValues.NULL, msg.getTrafficProgram());
+ assertNull(TestValues.NULL, msg.getTrafficAnnouncement());
+ assertNull(TestValues.NULL, msg.getProgramType());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(RdsData.KEY_PS, Test.GENERAL_STRING);
- reference.put(RdsData.KEY_RT, Test.GENERAL_STRING);
- reference.put(RdsData.KEY_CT, Test.GENERAL_STRING);
- reference.put(RdsData.KEY_PI, Test.GENERAL_STRING);
- reference.put(RdsData.KEY_PTY, Test.GENERAL_INT);
- reference.put(RdsData.KEY_TP, Test.GENERAL_BOOLEAN);
- reference.put(RdsData.KEY_TA, Test.GENERAL_BOOLEAN);
- reference.put(RdsData.KEY_REG, Test.GENERAL_STRING);
+ reference.put(RdsData.KEY_PS, TestValues.GENERAL_STRING);
+ reference.put(RdsData.KEY_RT, TestValues.GENERAL_STRING);
+ reference.put(RdsData.KEY_CT, TestValues.GENERAL_STRING);
+ reference.put(RdsData.KEY_PI, TestValues.GENERAL_STRING);
+ reference.put(RdsData.KEY_PTY, TestValues.GENERAL_INT);
+ reference.put(RdsData.KEY_TP, TestValues.GENERAL_BOOLEAN);
+ reference.put(RdsData.KEY_TA, TestValues.GENERAL_BOOLEAN);
+ reference.put(RdsData.KEY_REG, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
index 569a4db83..ec8bcad9c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,10 +23,10 @@ public class RectangleTests extends TestCase {
public void setUp() {
msg = new Rectangle();
- msg.setX(Test.GENERAL_FLOAT);
- msg.setY(Test.GENERAL_FLOAT);
- msg.setWidth(Test.GENERAL_FLOAT);
- msg.setHeight(Test.GENERAL_FLOAT);
+ msg.setX(TestValues.GENERAL_FLOAT);
+ msg.setY(TestValues.GENERAL_FLOAT);
+ msg.setWidth(TestValues.GENERAL_FLOAT);
+ msg.setHeight(TestValues.GENERAL_FLOAT);
}
/**
@@ -40,40 +40,40 @@ public class RectangleTests extends TestCase {
Float height = msg.getHeight();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, x);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, y);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, width);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, height);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, x);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, y);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, width);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, height);
// Invalid/Null Tests
Rectangle msg = new Rectangle();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getX());
- assertNull(Test.NULL, msg.getY());
- assertNull(Test.NULL, msg.getWidth());
- assertNull(Test.NULL, msg.getHeight());
+ assertNull(TestValues.NULL, msg.getX());
+ assertNull(TestValues.NULL, msg.getY());
+ assertNull(TestValues.NULL, msg.getWidth());
+ assertNull(TestValues.NULL, msg.getHeight());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(Rectangle.KEY_X, (Test.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_Y, (Test.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_WIDTH, (Test.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_HEIGHT, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_X, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_Y, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_WIDTH, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_HEIGHT, (TestValues.GENERAL_FLOAT));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
index e6a2d2b9a..562335bc1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -35,13 +35,13 @@ public class RemoteControlCapabilitiesTests extends TestCase {
@Override
public void setUp() {
msg = new RemoteControlCapabilities();
- msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST);
- msg.setClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
- msg.setSeatControlCapabilities(Test.GENERAL_SEATCONTROLCAPABILITIES_LIST);
- msg.setAudioControlCapabilities(Test.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
- msg.setHmiSettingsControlCapabilities(Test.GENERAL_HMISETTINGSCONTROLCAPABILITIES);
- msg.setLightControlCapabilities(Test.GENERAL_LIGHTCONTROLCAPABILITIES);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST);
+ msg.setClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
+ msg.setSeatControlCapabilities(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
+ msg.setAudioControlCapabilities(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
+ msg.setHmiSettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES);
+ msg.setLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES);
}
/**
@@ -58,46 +58,46 @@ public class RemoteControlCapabilitiesTests extends TestCase {
LightControlCapabilities lightControlCapabilities = msg.getLightControlCapabilities();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
- assertEquals(Test.MATCH, Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size());
- assertEquals(Test.MATCH, Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size());
- assertEquals(Test.MATCH, Test.GENERAL_SEATCONTROLCAPABILITIES_LIST.size(), seatControlCapabilities.size());
-
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
- assertTrue(Test.TRUE, Validator.validateRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateSeatControlCapabilitiesList(Test.GENERAL_SEATCONTROLCAPABILITIES_LIST, seatControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateAudioControlCapabilitiesList(Test.GENERAL_AUDIOCONTROLCAPABILITIES_LIST, audioControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateHMISettingsControlCapabilities(Test.GENERAL_HMISETTINGSCONTROLCAPABILITIES, hmiSettingsControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateLightControlCapabilities(Test.GENERAL_LIGHTCONTROLCAPABILITIES, lightControlCapabilities));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST.size(), seatControlCapabilities.size());
+
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateSeatControlCapabilitiesList(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST, seatControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateAudioControlCapabilitiesList(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST, audioControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES, hmiSettingsControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES, lightControlCapabilities));
// Invalid/Null Tests
RemoteControlCapabilities msg = new RemoteControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getButtonCapabilities());
- assertNull(Test.NULL, msg.getRadioControlCapabilities());
- assertNull(Test.NULL, msg.getClimateControlCapabilities());
- assertNull(Test.NULL, msg.getSeatControlCapabilities());
- assertNull(Test.NULL, msg.getAudioControlCapabilities());
- assertNull(Test.NULL, msg.getHmiSettingsControlCapabilities());
- assertNull(Test.NULL, msg.getLightControlCapabilities());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getRadioControlCapabilities());
+ assertNull(TestValues.NULL, msg.getClimateControlCapabilities());
+ assertNull(TestValues.NULL, msg.getSeatControlCapabilities());
+ assertNull(TestValues.NULL, msg.getAudioControlCapabilities());
+ assertNull(TestValues.NULL, msg.getHmiSettingsControlCapabilities());
+ assertNull(TestValues.NULL, msg.getLightControlCapabilities());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, Test.JSON_RADIOCONTROLCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, Test.JSON_CLIMATECONTROLCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES, Test.GENERAL_SEATCONTROLCAPABILITIES_LIST);
- reference.put(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES, Test.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
- reference.put(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLCAPABILITIES.getStore()));
- reference.put(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLCAPABILITIES.getStore()));
+ reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, TestValues.JSON_RADIOCONTROLCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, TestValues.JSON_CLIMATECONTROLCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
+ reference.put(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES, TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
+ reference.put(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES.getStore()));
+ reference.put(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES.getStore()));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -106,7 +106,7 @@ public class RemoteControlCapabilitiesTests extends TestCase {
if (key.equals(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>();
List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>();
@@ -116,11 +116,11 @@ public class RemoteControlCapabilitiesTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
testList.add(new ButtonCapabilities(hashTest));
}
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
} else if (key.equals(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
List<RadioControlCapabilities> referenceList = new ArrayList<RadioControlCapabilities>();
List<RadioControlCapabilities> testList = new ArrayList<RadioControlCapabilities>();
@@ -130,11 +130,11 @@ public class RemoteControlCapabilitiesTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
testList.add(new RadioControlCapabilities(hashTest));
}
- assertTrue(Test.TRUE, Validator.validateRadioControlCapabilities(referenceList, testList));
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(referenceList, testList));
} else if (key.equals(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
List<ClimateControlCapabilities> referenceList = new ArrayList<ClimateControlCapabilities>();
List<ClimateControlCapabilities> testList = new ArrayList<ClimateControlCapabilities>();
@@ -144,7 +144,7 @@ public class RemoteControlCapabilitiesTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
testList.add(new ClimateControlCapabilities(hashTest));
}
- assertTrue(Test.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList));
} else if (key.equals(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES)) {
List<SeatControlCapabilities> sccReference = (List<SeatControlCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
JSONArray sccArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
@@ -164,17 +164,17 @@ public class RemoteControlCapabilitiesTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateHMISettingsControlCapabilities(new HMISettingsControlCapabilities(hashReference), new HMISettingsControlCapabilities(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(new HMISettingsControlCapabilities(hashReference), new HMISettingsControlCapabilities(hashTest)));
} else if (key.equals(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateLightControlCapabilities(new LightControlCapabilities(hashReference), new LightControlCapabilities(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlCapabilities(new LightControlCapabilities(hashReference), new LightControlCapabilities(hashTest)));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
index 80a5e3258..e0e59a39e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,8 +27,8 @@ public class ScreenParamsTest extends TestCase {
public void setUp() {
msg = new ScreenParams();
- msg.setImageResolution(Test.GENERAL_IMAGERESOLUTION);
- msg.setTouchEventAvailable(Test.GENERAL_TOUCHEVENTCAPABILITIES);
+ msg.setImageResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ msg.setTouchEventAvailable(TestValues.GENERAL_TOUCHEVENTCAPABILITIES);
}
/**
@@ -40,26 +40,26 @@ public class ScreenParamsTest extends TestCase {
TouchEventCapabilities touchEvent = msg.getTouchEventAvailable();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateImageResolution(Test.GENERAL_IMAGERESOLUTION, imageRes));
- assertTrue(Test.TRUE, Validator.validateTouchEventCapabilities(Test.GENERAL_TOUCHEVENTCAPABILITIES, touchEvent));
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(TestValues.GENERAL_IMAGERESOLUTION, imageRes));
+ assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(TestValues.GENERAL_TOUCHEVENTCAPABILITIES, touchEvent));
// Invalid/Null Tests
ScreenParams msg = new ScreenParams();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getImageResolution());
- assertNull(Test.NULL, msg.getTouchEventAvailable());
+ assertNull(TestValues.NULL, msg.getImageResolution());
+ assertNull(TestValues.NULL, msg.getTouchEventAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(ScreenParams.KEY_RESOLUTION, Test.JSON_IMAGERESOLUTION);
- reference.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, Test.JSON_TOUCHEVENTCAPABILITIES);
+ reference.put(ScreenParams.KEY_RESOLUTION, TestValues.JSON_IMAGERESOLUTION);
+ reference.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, TestValues.JSON_TOUCHEVENTCAPABILITIES);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -69,22 +69,22 @@ public class ScreenParamsTest extends TestCase {
JSONObject touchEventObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject touchEventObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateTouchEventCapabilities(
+ assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(
new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjReference)),
new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjTest))));
} else if (key.equals(ScreenParams.KEY_RESOLUTION)) {
JSONObject resolutionObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject resolutionObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateImageResolution(
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(
new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjReference)),
new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjTest))));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
index a047cf01c..499db5c13 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class SdlMsgVersionTest extends TestCase {
public void setUp() {
msg = new SdlMsgVersion();
- msg.setMajorVersion(Test.GENERAL_INT);
- msg.setMinorVersion(Test.GENERAL_INT);
- msg.setPatchVersion(Test.GENERAL_INT);
+ msg.setMajorVersion(TestValues.GENERAL_INT);
+ msg.setMinorVersion(TestValues.GENERAL_INT);
+ msg.setPatchVersion(TestValues.GENERAL_INT);
}
/**
@@ -38,37 +38,37 @@ public class SdlMsgVersionTest extends TestCase {
Integer patch = msg.getPatchVersion();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, major);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, minor);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, patch);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, major);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minor);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, patch);
// Invalid/Null Tests
SdlMsgVersion msg = new SdlMsgVersion();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getMajorVersion());
- assertNull(Test.NULL, msg.getMinorVersion());
- assertNull(Test.NULL, msg.getPatchVersion());
+ assertNull(TestValues.NULL, msg.getMajorVersion());
+ assertNull(TestValues.NULL, msg.getMinorVersion());
+ assertNull(TestValues.NULL, msg.getPatchVersion());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SdlMsgVersion.KEY_MAJOR_VERSION, Test.GENERAL_INT);
- reference.put(SdlMsgVersion.KEY_MINOR_VERSION, Test.GENERAL_INT);
- reference.put(SdlMsgVersion.KEY_PATCH_VERSION, Test.GENERAL_INT);
+ reference.put(SdlMsgVersion.KEY_MAJOR_VERSION, TestValues.GENERAL_INT);
+ reference.put(SdlMsgVersion.KEY_MINOR_VERSION, TestValues.GENERAL_INT);
+ reference.put(SdlMsgVersion.KEY_PATCH_VERSION, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
index d988fa991..38b0c3fff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -22,22 +22,22 @@ public class SeatControlCapabilitiesTest extends TestCase {
@Override
public void setUp() {
msg = new SeatControlCapabilities();
- msg.setModuleName(Test.GENERAL_STRING);
- msg.setHeatingEnabledAvailable(Test.GENERAL_BOOLEAN);
- msg.setCoolingEnabledAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeatingLevelAvailable(Test.GENERAL_BOOLEAN);
- msg.setCoolingLevelAvailable(Test.GENERAL_BOOLEAN);
- msg.setHorizontalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setVerticalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setFrontVerticalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setBackVerticalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setBackTiltAngleAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeadSupportVerticalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setHeadSupportHorizontalPositionAvailable(Test.GENERAL_BOOLEAN);
- msg.setMassageEnabledAvailable(Test.GENERAL_BOOLEAN);
- msg.setMassageModeAvailable(Test.GENERAL_BOOLEAN);
- msg.setMassageCushionFirmnessAvailable(Test.GENERAL_BOOLEAN);
- msg.setMemoryAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setHeatingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatingLevelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingLevelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setFrontVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setBackVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setBackTiltAngleAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadSupportVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadSupportHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageModeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageCushionFirmnessAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMemoryAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -64,78 +64,78 @@ public class SeatControlCapabilitiesTest extends TestCase {
Boolean memoryAvailable = msg.getMemoryAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, heatingEnabledAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, coolingEnabledAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, heatingLevelAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, coolingLevelAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, horizontalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, verticalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, frontVerticalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, backVerticalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, backTiltAngleAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, headSupportHorizontalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, headSupportVerticalPositionAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, massageEnabledAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, massageModeAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, massageCushionFirmnessAvailable);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, memoryAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingLevelAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingLevelAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, horizontalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, verticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, frontVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backTiltAngleAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportHorizontalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageModeAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageCushionFirmnessAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, memoryAvailable);
// Invalid/Null Tests
SeatControlCapabilities msg = new SeatControlCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getModuleName());
- assertNull(Test.NULL, msg.getHeatingEnabledAvailable());
- assertNull(Test.NULL, msg.getCoolingEnabledAvailable());
- assertNull(Test.NULL, msg.getHeatingLevelAvailable());
- assertNull(Test.NULL, msg.getCoolingLevelAvailable());
- assertNull(Test.NULL, msg.getHorizontalPositionAvailable());
- assertNull(Test.NULL, msg.getVerticalPositionAvailable());
- assertNull(Test.NULL, msg.getFrontVerticalPositionAvailable());
- assertNull(Test.NULL, msg.getBackVerticalPositionAvailable());
- assertNull(Test.NULL, msg.getBackTiltAngleAvailable());
- assertNull(Test.NULL, msg.getHeadSupportHorizontalPositionAvailable());
- assertNull(Test.NULL, msg.getHeadSupportVerticalPositionAvailable());
- assertNull(Test.NULL, msg.getMassageEnabledAvailable());
- assertNull(Test.NULL, msg.getMassageModeAvailable());
- assertNull(Test.NULL, msg.getMassageCushionFirmnessAvailable());
- assertNull(Test.NULL, msg.getMemoryAvailable());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getHeatingEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getCoolingEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getHeatingLevelAvailable());
+ assertNull(TestValues.NULL, msg.getCoolingLevelAvailable());
+ assertNull(TestValues.NULL, msg.getHorizontalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getFrontVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getBackVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getBackTiltAngleAvailable());
+ assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getHeadSupportVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getMassageEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getMassageModeAvailable());
+ assertNull(TestValues.NULL, msg.getMassageCushionFirmnessAvailable());
+ assertNull(TestValues.NULL, msg.getMemoryAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SeatControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
- reference.put(SeatControlCapabilities.KEY_HEATING_ENABLED_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_COOLING_ENABLED_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEATING_LEVEL_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_COOLING_LEVEL_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HORIZONTAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_VERTICAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_FRONT_VERTICAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_BACK_VERTICAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_BACK_TILT_ANGLE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_MASSAGE_ENABLED_AVAILABLE, Test.GENERAL_BOOLEAN);
-
- reference.put(SeatControlCapabilities.KEY_MASSAGE_MODE_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE, Test.GENERAL_BOOLEAN);
-
- reference.put(SeatControlCapabilities.KEY_MEMORY_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(SeatControlCapabilities.KEY_HEATING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_COOLING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEATING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_COOLING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_FRONT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_BACK_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_BACK_TILT_ANGLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_MODE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlCapabilities.KEY_MEMORY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
index 535e7cf3e..6ee549a4c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.SeatControlData;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.enums.SupportedSeat;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -31,22 +31,22 @@ public class SeatControlDataTest extends TestCase {
@Override
public void setUp() {
msg = new SeatControlData();
- msg.setId(Test.GENERAL_SUPPORTEDSEAT);
- msg.setHeatingEnabled(Test.GENERAL_BOOLEAN);
- msg.setCoolingEnabled(Test.GENERAL_BOOLEAN);
- msg.setHeatingLevel(Test.GENERAL_INT);
- msg.setCoolingLevel(Test.GENERAL_INT);
- msg.setHorizontalPosition(Test.GENERAL_INT);
- msg.setVerticalPosition(Test.GENERAL_INT);
- msg.setFrontVerticalPosition(Test.GENERAL_INT);
- msg.setBackVerticalPosition(Test.GENERAL_INT);
- msg.setBackTiltAngle(Test.GENERAL_INT);
- msg.setHeadSupportVerticalPosition(Test.GENERAL_INT);
- msg.setHeadSupportHorizontalPosition(Test.GENERAL_INT);
- msg.setMassageEnabled(Test.GENERAL_BOOLEAN);
- msg.setMassageMode(Test.GENERAL_MASSAGEMODEDATA_LIST);
- msg.setMassageCushionFirmness(Test.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
- msg.setMemory(Test.GENERAL_SEATMEMORYACTION);
+ msg.setId(TestValues.GENERAL_SUPPORTEDSEAT);
+ msg.setHeatingEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatingLevel(TestValues.GENERAL_INT);
+ msg.setCoolingLevel(TestValues.GENERAL_INT);
+ msg.setHorizontalPosition(TestValues.GENERAL_INT);
+ msg.setVerticalPosition(TestValues.GENERAL_INT);
+ msg.setFrontVerticalPosition(TestValues.GENERAL_INT);
+ msg.setBackVerticalPosition(TestValues.GENERAL_INT);
+ msg.setBackTiltAngle(TestValues.GENERAL_INT);
+ msg.setHeadSupportVerticalPosition(TestValues.GENERAL_INT);
+ msg.setHeadSupportHorizontalPosition(TestValues.GENERAL_INT);
+ msg.setMassageEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageMode(TestValues.GENERAL_MASSAGEMODEDATA_LIST);
+ msg.setMassageCushionFirmness(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
+ msg.setMemory(TestValues.GENERAL_SEATMEMORYACTION);
}
/**
@@ -73,72 +73,72 @@ public class SeatControlDataTest extends TestCase {
SeatMemoryAction memory = msg.getMemory();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SUPPORTEDSEAT, id);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, heatingEnabled);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, coolingEnabled);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, heatingLevel);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, coolingLevel);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, horizontalPosition);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, verticalPosition);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, frontVerticalPosition);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, backVerticalPosition);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, backTiltAngle);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, headSupportHorizontalPosition);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, headSupportVerticalPosition);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, massageEnabled);
-
- assertTrue(Test.TRUE, Validator.validateMassageModeDataList(Test.GENERAL_MASSAGEMODEDATA_LIST, massageMode));
- assertTrue(Test.TRUE, Validator.validateMassageCushionFirmnessList(Test.GENERAL_MASSAGECUSHIONFIRMNESS_LIST, massageCushionFirmness));
-
- assertTrue(Test.TRUE, Validator.validateSeatMemoryAction(Test.GENERAL_SEATMEMORYACTION, memory));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SUPPORTEDSEAT, id);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabled);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabled);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, heatingLevel);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, coolingLevel);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, horizontalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, verticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, frontVerticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backVerticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backTiltAngle);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportHorizontalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportVerticalPosition);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabled);
+
+ assertTrue(TestValues.TRUE, Validator.validateMassageModeDataList(TestValues.GENERAL_MASSAGEMODEDATA_LIST, massageMode));
+ assertTrue(TestValues.TRUE, Validator.validateMassageCushionFirmnessList(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST, massageCushionFirmness));
+
+ assertTrue(TestValues.TRUE, Validator.validateSeatMemoryAction(TestValues.GENERAL_SEATMEMORYACTION, memory));
// Invalid/Null Tests
SeatControlData msg = new SeatControlData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getId());
- assertNull(Test.NULL, msg.getHeatingEnabled());
- assertNull(Test.NULL, msg.getCoolingEnabled());
- assertNull(Test.NULL, msg.getHeatingLevel());
- assertNull(Test.NULL, msg.getCoolingLevel());
- assertNull(Test.NULL, msg.getHorizontalPosition());
- assertNull(Test.NULL, msg.getVerticalPosition());
- assertNull(Test.NULL, msg.getFrontVerticalPosition());
- assertNull(Test.NULL, msg.getBackVerticalPosition());
- assertNull(Test.NULL, msg.getBackTiltAngle());
- assertNull(Test.NULL, msg.getHeadSupportHorizontalPosition());
- assertNull(Test.NULL, msg.getHeadSupportVerticalPosition());
- assertNull(Test.NULL, msg.getMassageEnabled());
- assertNull(Test.NULL, msg.getMassageMode());
- assertNull(Test.NULL, msg.getMassageCushionFirmness());
- assertNull(Test.NULL, msg.getMemory());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getHeatingEnabled());
+ assertNull(TestValues.NULL, msg.getCoolingEnabled());
+ assertNull(TestValues.NULL, msg.getHeatingLevel());
+ assertNull(TestValues.NULL, msg.getCoolingLevel());
+ assertNull(TestValues.NULL, msg.getHorizontalPosition());
+ assertNull(TestValues.NULL, msg.getVerticalPosition());
+ assertNull(TestValues.NULL, msg.getFrontVerticalPosition());
+ assertNull(TestValues.NULL, msg.getBackVerticalPosition());
+ assertNull(TestValues.NULL, msg.getBackTiltAngle());
+ assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPosition());
+ assertNull(TestValues.NULL, msg.getHeadSupportVerticalPosition());
+ assertNull(TestValues.NULL, msg.getMassageEnabled());
+ assertNull(TestValues.NULL, msg.getMassageMode());
+ assertNull(TestValues.NULL, msg.getMassageCushionFirmness());
+ assertNull(TestValues.NULL, msg.getMemory());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SeatControlData.KEY_ID, Test.GENERAL_SUPPORTEDSEAT);
- reference.put(SeatControlData.KEY_HEATING_ENABLED, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlData.KEY_COOLING_ENABLED, Test.GENERAL_BOOLEAN);
- reference.put(SeatControlData.KEY_HEATING_LEVEL, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_COOLING_LEVEL, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_HORIZONTAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_VERTICAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_FRONT_VERTICAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_BACK_VERTICAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_BACK_TILT_ANGLE, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_HEAD_SUPPORT_VERTICAL_POSITION, Test.GENERAL_INT);
- reference.put(SeatControlData.KEY_MASSAGE_ENABLED, Test.GENERAL_BOOLEAN);
-
- reference.put(SeatControlData.KEY_MASSAGE_MODE, Test.GENERAL_MASSAGEMODEDATA_LIST);
- reference.put(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS, Test.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
-
- reference.put(SeatControlData.KEY_MEMORY, Test.GENERAL_SEATMEMORYACTION);
+ reference.put(SeatControlData.KEY_ID, TestValues.GENERAL_SUPPORTEDSEAT);
+ reference.put(SeatControlData.KEY_HEATING_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlData.KEY_COOLING_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlData.KEY_HEATING_LEVEL, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_COOLING_LEVEL, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_FRONT_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_BACK_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_BACK_TILT_ANGLE, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HEAD_SUPPORT_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_MASSAGE_ENABLED, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODEDATA_LIST);
+ reference.put(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS, TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
+
+ reference.put(SeatControlData.KEY_MEMORY, TestValues.GENERAL_SEATMEMORYACTION);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -163,11 +163,11 @@ public class SeatControlDataTest extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
assertTrue(Validator.validateSeatMemoryAction(mReference, new SeatMemoryAction(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
index 847564adb..df99fd9cc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatLocationCapability;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -25,10 +25,10 @@ public class SeatLocationCapabilityTests extends TestCase {
@Override
public void setUp() {
msg = new SeatLocationCapability();
- msg.setCols(Test.GENERAL_INT);
- msg.setRows(Test.GENERAL_INT);
- msg.setLevels(Test.GENERAL_INT);
- msg.setSeats(Test.GENERAL_SEAT_LIST);
+ msg.setCols(TestValues.GENERAL_INT);
+ msg.setRows(TestValues.GENERAL_INT);
+ msg.setLevels(TestValues.GENERAL_INT);
+ msg.setSeats(TestValues.GENERAL_SEAT_LIST);
}
public void testRpcValues() {
@@ -38,29 +38,29 @@ public class SeatLocationCapabilityTests extends TestCase {
List<SeatLocation> seats = msg.getSeatLocations();
//valid tests
- assertEquals(Test.MATCH, row, Test.GENERAL_INT);
- assertEquals(Test.MATCH, col, Test.GENERAL_INT);
- assertEquals(Test.MATCH, level, Test.GENERAL_INT);
- assertEquals(Test.MATCH, seats.size(), Test.GENERAL_SEAT_LIST.size());
- for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
- assertTrue(Test.TRUE, Validator.validateGrid(Test.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
+ assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, seats.size(), TestValues.GENERAL_SEAT_LIST.size());
+ for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateGrid(TestValues.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
}
//null tests
SeatLocationCapability msg = new SeatLocationCapability();
- assertNull(Test.NULL, msg.getCols());
- assertNull(Test.NULL, msg.getRows());
- assertNull(Test.NULL, msg.getLevels());
- assertNull(Test.NULL, msg.getSeatLocations());
+ assertNull(TestValues.NULL, msg.getCols());
+ assertNull(TestValues.NULL, msg.getRows());
+ assertNull(TestValues.NULL, msg.getLevels());
+ assertNull(TestValues.NULL, msg.getSeatLocations());
}
public void testJson() {
JSONObject original = new JSONObject();
try {
- original.put(SeatLocationCapability.KEY_COLS, Test.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_ROWS, Test.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_LEVELS, Test.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_SEATS, Test.JSON_SEAT_LOCATIONS);
+ original.put(SeatLocationCapability.KEY_COLS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_ROWS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_LEVELS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_SEATS, TestValues.JSON_SEAT_LOCATIONS);
JSONObject serialized = msg.serializeJSON();
assertEquals(serialized.length(), original.length());
@@ -72,28 +72,28 @@ public class SeatLocationCapabilityTests extends TestCase {
if (key.equals(SeatLocationCapability.KEY_COLS)) {
int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getCols();
int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getCols();
- assertEquals(Test.MATCH, i1, i2);
+ assertEquals(TestValues.MATCH, i1, i2);
} else if (key.equals(SeatLocationCapability.KEY_ROWS)) {
int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getRows();
int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getRows();
- assertEquals(Test.MATCH, i1, i2);
+ assertEquals(TestValues.MATCH, i1, i2);
} else if (key.equals(SeatLocationCapability.KEY_LEVELS)) {
int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getLevels();
int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getLevels();
- assertEquals(Test.MATCH, i1, i2);
+ assertEquals(TestValues.MATCH, i1, i2);
} else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
- assertEquals(Test.MATCH, arr1.length(), arr2.length());
- for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, arr1.length(), arr2.length());
+ for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
- assertTrue(Test.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
+ assertTrue(TestValues.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
}
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
index 6a102fc66..cf954b702 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.SeatLocation;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -18,31 +18,31 @@ public class SeatLocationTests extends TestCase {
@Override
public void setUp() {
msg = new SeatLocation();
- msg.setGrid(Test.GENERAL_GRID);
+ msg.setGrid(TestValues.GENERAL_GRID);
}
public void testRpcValues() {
Grid grid = msg.getGrid();
//valid test
- assertTrue(Validator.validateGrid(Test.GENERAL_GRID, grid));
+ assertTrue(Validator.validateGrid(TestValues.GENERAL_GRID, grid));
//null test
SeatLocation msg = new SeatLocation();
- assertNull(Test.NULL, msg.getGrid());
+ assertNull(TestValues.NULL, msg.getGrid());
}
public void testJson() {
JSONObject original = new JSONObject();
try {
- original.put(SeatLocation.KEY_GRID, Test.GENERAL_GRID);
+ original.put(SeatLocation.KEY_GRID, TestValues.GENERAL_GRID);
JSONObject serialized = msg.serializeJSON();
assertEquals(serialized.length(), original.length());
- assertTrue(Test.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
+ assertTrue(TestValues.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
index a8c17cee3..c6ca217f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.enums.SeatMemoryActionType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,9 +24,9 @@ public class SeatMemoryActionTest extends TestCase {
public void setUp() {
msg = new SeatMemoryAction();
- msg.setId(Test.GENERAL_INT);
- msg.setLabel(Test.GENERAL_STRING);
- msg.setAction(Test.GENERAL_SEATMEMORYACTIONTYPE);
+ msg.setId(TestValues.GENERAL_INT);
+ msg.setLabel(TestValues.GENERAL_STRING);
+ msg.setAction(TestValues.GENERAL_SEATMEMORYACTIONTYPE);
}
/**
@@ -39,37 +39,37 @@ public class SeatMemoryActionTest extends TestCase {
SeatMemoryActionType action = msg.getAction();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, id);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, label);
- assertEquals(Test.MATCH, Test.GENERAL_SEATMEMORYACTIONTYPE, action);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, label);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATMEMORYACTIONTYPE, action);
// Invalid/Null Tests
SeatMemoryAction msg = new SeatMemoryAction();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getId());
- assertNull(Test.NULL, msg.getLabel());
- assertNull(Test.NULL, msg.getAction());
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getLabel());
+ assertNull(TestValues.NULL, msg.getAction());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SeatMemoryAction.KEY_ID, Test.GENERAL_INT);
- reference.put(SeatMemoryAction.KEY_LABEL, Test.GENERAL_STRING);
- reference.put(SeatMemoryAction.KEY_ACTION, Test.GENERAL_SEATMEMORYACTIONTYPE);
+ reference.put(SeatMemoryAction.KEY_ID, TestValues.GENERAL_INT);
+ reference.put(SeatMemoryAction.KEY_LABEL, TestValues.GENERAL_STRING);
+ reference.put(SeatMemoryAction.KEY_ACTION, TestValues.GENERAL_SEATMEMORYACTIONTYPE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
index 15e83ad11..14f9890f2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.TPMS;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,9 +25,9 @@ public class SingleTireStatusTest extends TestCase {
public void setUp() {
msg = new SingleTireStatus();
- msg.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setTPMS(Test.GENERAL_TPMS);
- msg.setPressure(Test.GENERAL_FLOAT);
+ msg.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setTPMS(TestValues.GENERAL_TPMS);
+ msg.setPressure(TestValues.GENERAL_FLOAT);
}
/**
@@ -40,37 +40,37 @@ public class SingleTireStatusTest extends TestCase {
Float pressure = msg.getPressure();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, status);
- assertEquals(Test.MATCH, Test.GENERAL_TPMS, tpms);
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, pressure);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TPMS, tpms);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, pressure);
// Invalid/Null Tests
SingleTireStatus msg = new SingleTireStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getStatus());
- assertNull(Test.NULL, msg.getTPMS());
- assertNull(Test.NULL, msg.getPressure());
+ assertNull(TestValues.NULL, msg.getStatus());
+ assertNull(TestValues.NULL, msg.getTPMS());
+ assertNull(TestValues.NULL, msg.getPressure());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(SingleTireStatus.KEY_TPMS, Test.GENERAL_TPMS);
- reference.put(SingleTireStatus.KEY_PRESSURE, Test.GENERAL_FLOAT);
+ reference.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(SingleTireStatus.KEY_TPMS, TestValues.GENERAL_TPMS);
+ reference.put(SingleTireStatus.KEY_PRESSURE, TestValues.GENERAL_FLOAT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
index 51e38f8d1..e3bd7c92e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.GPSData;
import com.smartdevicelink.proxy.rpc.SisData;
import com.smartdevicelink.proxy.rpc.StationIDNumber;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.VehicleDataHelper;
@@ -29,11 +29,11 @@ public class SisDataTests extends TestCase {
public void setUp() {
msg = new SisData();
- msg.setStationShortName(Test.GENERAL_STRING);
- msg.setStationIDNumber(Test.GENERAL_STATIONIDNUMBER);
- msg.setStationLongName(Test.GENERAL_STRING);
+ msg.setStationShortName(TestValues.GENERAL_STRING);
+ msg.setStationIDNumber(TestValues.GENERAL_STATIONIDNUMBER);
+ msg.setStationLongName(TestValues.GENERAL_STRING);
msg.setStationLocation(VehicleDataHelper.GPS);
- msg.setStationMessage(Test.GENERAL_STRING);
+ msg.setStationMessage(TestValues.GENERAL_STRING);
}
/**
@@ -48,35 +48,35 @@ public class SisDataTests extends TestCase {
String stationMessage = msg.getStationMessage();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, stationShortName);
- assertEquals(Test.MATCH, Test.GENERAL_STATIONIDNUMBER, stationIDNumber);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, stationLongName);
- assertEquals(Test.MATCH, VehicleDataHelper.GPS, stationLocation);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, stationMessage);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationShortName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STATIONIDNUMBER, stationIDNumber);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationLongName);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, stationLocation);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationMessage);
// Invalid/Null Tests
SisData msg = new SisData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getStationShortName());
- assertNull(Test.NULL, msg.getStationIDNumber());
- assertNull(Test.NULL, msg.getStationLongName());
- assertNull(Test.NULL, msg.getStationLocation());
- assertNull(Test.NULL, msg.getStationMessage());
+ assertNull(TestValues.NULL, msg.getStationShortName());
+ assertNull(TestValues.NULL, msg.getStationIDNumber());
+ assertNull(TestValues.NULL, msg.getStationLongName());
+ assertNull(TestValues.NULL, msg.getStationLocation());
+ assertNull(TestValues.NULL, msg.getStationMessage());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SisData.KEY_STATION_SHORT_NAME, Test.GENERAL_STRING);
- reference.put(SisData.KEY_STATION_ID_NUMBER, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_STATIONIDNUMBER.getStore()));
- reference.put(SisData.KEY_STATION_LONG_NAME, Test.GENERAL_STRING);
+ reference.put(SisData.KEY_STATION_SHORT_NAME, TestValues.GENERAL_STRING);
+ reference.put(SisData.KEY_STATION_ID_NUMBER, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_STATIONIDNUMBER.getStore()));
+ reference.put(SisData.KEY_STATION_LONG_NAME, TestValues.GENERAL_STRING);
reference.put(SisData.KEY_STATION_LOCATION, JsonRPCMarshaller.serializeHashtable(VehicleDataHelper.GPS.getStore()));
- reference.put(SisData.KEY_STATION_MESSAGE, Test.GENERAL_STRING);
+ reference.put(SisData.KEY_STATION_MESSAGE, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -87,19 +87,19 @@ public class SisDataTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateStationIDNumber(new StationIDNumber(hashReference), new StationIDNumber(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateStationIDNumber(new StationIDNumber(hashReference), new StationIDNumber(hashTest)));
} else if (key.equals(SisData.KEY_STATION_LOCATION)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateGpsData(new GPSData(hashReference), new GPSData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateGpsData(new GPSData(hashReference), new GPSData(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
index b422ce627..1846d1022 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,11 +23,11 @@ public class SoftButtonCapabilitiesTest extends TestCase {
public void setUp() {
msg = new SoftButtonCapabilities();
- msg.setImageSupported(Test.GENERAL_BOOLEAN);
- msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
- msg.setLongPressAvailable(Test.GENERAL_BOOLEAN);
- msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
- msg.setTextSupported(Test.GENERAL_BOOLEAN);
+ msg.setImageSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setShortPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setLongPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setUpDownAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setTextSupported(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -42,43 +42,43 @@ public class SoftButtonCapabilitiesTest extends TestCase {
Boolean textSupported = msg.getTextSupported();
// Valid Tests
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, imageSupp);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, updown);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, longPress);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, shortPress);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, textSupported);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, imageSupp);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, updown);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, longPress);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, shortPress);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, textSupported);
// Invalid/Null Tests
SoftButtonCapabilities msg = new SoftButtonCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getImageSupported());
- assertNull(Test.NULL, msg.getLongPressAvailable());
- assertNull(Test.NULL, msg.getShortPressAvailable());
- assertNull(Test.NULL, msg.getUpDownAvailable());
- assertNull(Test.NULL, msg.getTextSupported());
+ assertNull(TestValues.NULL, msg.getImageSupported());
+ assertNull(TestValues.NULL, msg.getLongPressAvailable());
+ assertNull(TestValues.NULL, msg.getShortPressAvailable());
+ assertNull(TestValues.NULL, msg.getUpDownAvailable());
+ assertNull(TestValues.NULL, msg.getTextSupported());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, Test.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
index 5d12e1286..5d3d09d73 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,12 +29,12 @@ public class SoftButtonTest extends TestCase {
public void setUp() {
msg = new SoftButton();
- msg.setType(Test.GENERAL_SOFTBUTTONTYPE);
- msg.setText(Test.GENERAL_STRING);
- msg.setSystemAction(Test.GENERAL_SYSTEMACTION);
- msg.setImage(Test.GENERAL_IMAGE);
- msg.setIsHighlighted(Test.GENERAL_BOOLEAN);
- msg.setSoftButtonID(Test.GENERAL_INT);
+ msg.setType(TestValues.GENERAL_SOFTBUTTONTYPE);
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setSystemAction(TestValues.GENERAL_SYSTEMACTION);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ msg.setIsHighlighted(TestValues.GENERAL_BOOLEAN);
+ msg.setSoftButtonID(TestValues.GENERAL_INT);
}
/**
@@ -50,38 +50,38 @@ public class SoftButtonTest extends TestCase {
Integer id = msg.getSoftButtonID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONTYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text);
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMACTION, sysAction);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, image));
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHighlighted);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONTYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMACTION, sysAction);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHighlighted);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
// Invalid/Null Tests
SoftButton msg = new SoftButton();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getSoftButtonID());
- assertNull(Test.NULL, msg.getImage());
- assertNull(Test.NULL, msg.getIsHighlighted());
- assertNull(Test.NULL, msg.getSystemAction());
- assertNull(Test.NULL, msg.getText());
- assertNull(Test.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getSoftButtonID());
+ assertNull(TestValues.NULL, msg.getImage());
+ assertNull(TestValues.NULL, msg.getIsHighlighted());
+ assertNull(TestValues.NULL, msg.getSystemAction());
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getType());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SoftButton.KEY_SOFT_BUTTON_ID, Test.GENERAL_INT);
- reference.put(SoftButton.KEY_TYPE, Test.GENERAL_SOFTBUTTONTYPE);
- reference.put(SoftButton.KEY_TEXT, Test.GENERAL_STRING);
- reference.put(SoftButton.KEY_IMAGE, Test.JSON_IMAGE);
- reference.put(SoftButton.KEY_SYSTEM_ACTION, Test.GENERAL_SYSTEMACTION);
- reference.put(SoftButton.KEY_IS_HIGHLIGHTED, Test.GENERAL_BOOLEAN);
+ reference.put(SoftButton.KEY_SOFT_BUTTON_ID, TestValues.GENERAL_INT);
+ reference.put(SoftButton.KEY_TYPE, TestValues.GENERAL_SOFTBUTTONTYPE);
+ reference.put(SoftButton.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(SoftButton.KEY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(SoftButton.KEY_SYSTEM_ACTION, TestValues.GENERAL_SYSTEMACTION);
+ reference.put(SoftButton.KEY_IS_HIGHLIGHTED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -92,13 +92,13 @@ public class SoftButtonTest extends TestCase {
JSONObject underTestArray = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray);
- assertTrue(Test.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
index 5d698398f..54752d5ef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.StartTime;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class StartTimeTest extends TestCase {
public void setUp() {
msg = new StartTime();
- msg.setHours(Test.GENERAL_INT);
- msg.setMinutes(Test.GENERAL_INT);
- msg.setSeconds(Test.GENERAL_INT);
+ msg.setHours(TestValues.GENERAL_INT);
+ msg.setMinutes(TestValues.GENERAL_INT);
+ msg.setSeconds(TestValues.GENERAL_INT);
}
/**
@@ -38,42 +38,42 @@ public class StartTimeTest extends TestCase {
Integer seconds = msg.getSeconds();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, hours);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, minutes);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, seconds);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, hours);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minutes);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, seconds);
// TimeInterval constructor test
StartTime startTime = new StartTime(7000);
- assertEquals(Test.MATCH, (Integer) 1, startTime.getHours());
- assertEquals(Test.MATCH, (Integer) 56, startTime.getMinutes());
- assertEquals(Test.MATCH, (Integer) 40, startTime.getSeconds());
+ assertEquals(TestValues.MATCH, (Integer) 1, startTime.getHours());
+ assertEquals(TestValues.MATCH, (Integer) 56, startTime.getMinutes());
+ assertEquals(TestValues.MATCH, (Integer) 40, startTime.getSeconds());
// Invalid/Null Tests
StartTime msg = new StartTime();
- assertNotNull(Test.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getHours());
- assertNull(Test.NULL, msg.getMinutes());
- assertNull(Test.NULL, msg.getSeconds());
+ assertNotNull(TestValues.NOT_NULL, msg);
+ assertNull(TestValues.NULL, msg.getHours());
+ assertNull(TestValues.NULL, msg.getMinutes());
+ assertNull(TestValues.NULL, msg.getSeconds());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(StartTime.KEY_HOURS, Test.GENERAL_INT);
- reference.put(StartTime.KEY_MINUTES, Test.GENERAL_INT);
- reference.put(StartTime.KEY_SECONDS, Test.GENERAL_INT);
+ reference.put(StartTime.KEY_HOURS, TestValues.GENERAL_INT);
+ reference.put(StartTime.KEY_MINUTES, TestValues.GENERAL_INT);
+ reference.put(StartTime.KEY_SECONDS, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
index e7e61f8fd..0e3ee88cb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.StationIDNumber;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,8 +23,8 @@ public class StationIDNumberTests extends TestCase {
public void setUp() {
msg = new StationIDNumber();
- msg.setCountryCode(Test.GENERAL_INT);
- msg.setFccFacilityId(Test.GENERAL_INT);
+ msg.setCountryCode(TestValues.GENERAL_INT);
+ msg.setFccFacilityId(TestValues.GENERAL_INT);
}
/**
@@ -37,15 +37,15 @@ public class StationIDNumberTests extends TestCase {
int fccFacilityId = msg.getFccFacilityId();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, countryCode);
- assertEquals(Test.MATCH, Test.GENERAL_INT, fccFacilityId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, countryCode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, fccFacilityId);
// Invalid/Null Tests
StationIDNumber msg = new StationIDNumber();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getCountryCode());
- assertNull(Test.NULL, msg.getFccFacilityId());
+ assertNull(TestValues.NULL, msg.getCountryCode());
+ assertNull(TestValues.NULL, msg.getFccFacilityId());
}
public void testJson() {
@@ -53,21 +53,21 @@ public class StationIDNumberTests extends TestCase {
try {
- reference.put(StationIDNumber.KEY_COUNTRY_CODE, Test.GENERAL_INT);
- reference.put(StationIDNumber.KEY_FCC_FACILITY_ID, Test.GENERAL_INT);
+ reference.put(StationIDNumber.KEY_COUNTRY_CODE, TestValues.GENERAL_INT);
+ reference.put(StationIDNumber.KEY_FCC_FACILITY_ID, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
index 203f72060..0a02b6543 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -11,7 +11,7 @@ import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -36,12 +36,12 @@ public class SystemCapabilityTests extends TestCase {
public void setUp() {
msg = new SystemCapability();
- msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
- msg.setCapabilityForType(SystemCapabilityType.NAVIGATION, Test.GENERAL_NAVIGATIONCAPABILITY);
- msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
- msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES);
- msg.setCapabilityForType(SystemCapabilityType.APP_SERVICES, Test.GENERAL_APP_SERVICE_CAPABILITIES);
- msg.setCapabilityForType(SystemCapabilityType.DISPLAYS, Test.GENERAL_DISPLAYCAPABILITY_LIST);
+ msg.setSystemCapabilityType(TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
+ msg.setCapabilityForType(SystemCapabilityType.NAVIGATION, TestValues.GENERAL_NAVIGATIONCAPABILITY);
+ msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, TestValues.GENERAL_PHONECAPABILITY);
+ msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, TestValues.GENERAL_REMOTECONTROLCAPABILITIES);
+ msg.setCapabilityForType(SystemCapabilityType.APP_SERVICES, TestValues.GENERAL_APP_SERVICE_CAPABILITIES);
+ msg.setCapabilityForType(SystemCapabilityType.DISPLAYS, TestValues.GENERAL_DISPLAYCAPABILITY_LIST);
}
/**
@@ -57,41 +57,41 @@ public class SystemCapabilityTests extends TestCase {
List<DisplayCapability> displayCapabilities = (List<DisplayCapability>) msg.getCapabilityForType(SystemCapabilityType.DISPLAYS);
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
- assertTrue(Test.TRUE, Validator.validateNavigationCapability(Test.GENERAL_NAVIGATIONCAPABILITY, testNavigationCapability));
- assertTrue(Test.TRUE, Validator.validatePhoneCapability(Test.GENERAL_PHONECAPABILITY, testPhoneCapability));
- assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities(Test.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
- assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities(Test.GENERAL_APP_SERVICE_CAPABILITIES, testAppServicesCapabilities));
-
- for(int i = 0; i < Test.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++){
- assertTrue(Test.TRUE, Validator.validateDisplayCapability(Test.GENERAL_DISPLAYCAPABILITY_LIST.get(i), displayCapabilities.get(i)));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITYTYPE, testType);
+ assertTrue(TestValues.TRUE, Validator.validateNavigationCapability(TestValues.GENERAL_NAVIGATIONCAPABILITY, testNavigationCapability));
+ assertTrue(TestValues.TRUE, Validator.validatePhoneCapability(TestValues.GENERAL_PHONECAPABILITY, testPhoneCapability));
+ assertTrue(TestValues.TRUE, Validator.validateRemoteControlCapabilities(TestValues.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilities(TestValues.GENERAL_APP_SERVICE_CAPABILITIES, testAppServicesCapabilities));
+
+ for(int i = 0; i < TestValues.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++){
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapability(TestValues.GENERAL_DISPLAYCAPABILITY_LIST.get(i), displayCapabilities.get(i)));
}
// Invalid/Null Tests
SystemCapability msg = new SystemCapability();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getSystemCapabilityType());
- assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.NAVIGATION));
- assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
- assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
- assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES));
- assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.DISPLAYS));
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getSystemCapabilityType());
+ assertNull(TestValues.NULL, msg.getCapabilityForType(SystemCapabilityType.NAVIGATION));
+ assertNull(TestValues.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
+ assertNull(TestValues.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
+ assertNull(TestValues.NULL, msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES));
+ assertNull(TestValues.NULL, msg.getCapabilityForType(SystemCapabilityType.DISPLAYS));
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(SystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
- reference.put(SystemCapability.KEY_NAVIGATION_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NAVIGATIONCAPABILITY.getStore()));
- reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_PHONECAPABILITY.getStore()));
- reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
- reference.put(SystemCapability.KEY_APP_SERVICES_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_CAPABILITIES.getStore()));
- reference.put(SystemCapability.KEY_DISPLAY_CAPABILITIES, Test.JSON_DISPLAYCAPABILITY_LIST);
+ reference.put(SystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
+ reference.put(SystemCapability.KEY_NAVIGATION_CAPABILITY, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_NAVIGATIONCAPABILITY.getStore()));
+ reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_PHONECAPABILITY.getStore()));
+ reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
+ reference.put(SystemCapability.KEY_APP_SERVICES_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APP_SERVICE_CAPABILITIES.getStore()));
+ reference.put(SystemCapability.KEY_DISPLAY_CAPABILITIES, TestValues.JSON_DISPLAYCAPABILITY_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -102,19 +102,19 @@ public class SystemCapabilityTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateNavigationCapability( new NavigationCapability(hashReference), new NavigationCapability(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateNavigationCapability( new NavigationCapability(hashReference), new NavigationCapability(hashTest)));
} else if(key.equals(SystemCapability.KEY_PHONE_CAPABILITY)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validatePhoneCapability( new PhoneCapability(hashReference), new PhoneCapability(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validatePhoneCapability( new PhoneCapability(hashReference), new PhoneCapability(hashTest)));
} else if(key.equals(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
} else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
@@ -122,23 +122,23 @@ public class SystemCapabilityTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
Log.i("TEST REF", hashReference.toString());
Log.i("TEST TEST", hashTest.toString());
- assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
} else if(key.equals(SystemCapability.KEY_DISPLAY_CAPABILITIES)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for(int i = 0; i < referenceArray.length(); i++){
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateDisplayCapability(new DisplayCapability(hashReference), new DisplayCapability(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapability(new DisplayCapability(hashReference), new DisplayCapability(hashTest)));
}
} else{
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
index 4a34d297a..8a30b1c21 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -20,8 +20,8 @@ public class TTSChunkTest extends TestCase {
public void setUp() {
msg = new TTSChunk();
- msg.setText(Test.GENERAL_STRING);
- msg.setType(Test.GENERAL_SPEECHCAPABILITIES);
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setType(TestValues.GENERAL_SPEECHCAPABILITIES);
}
/**
@@ -33,34 +33,34 @@ public class TTSChunkTest extends TestCase {
SpeechCapabilities speechType = msg.getType();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text);
- assertEquals(Test.MATCH, Test.GENERAL_SPEECHCAPABILITIES, speechType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES, speechType);
// Invalid/Null Tests
TTSChunk msg = new TTSChunk();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getText());
- assertNull(Test.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getType());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TTSChunk.KEY_TEXT, Test.GENERAL_STRING);
- reference.put(TTSChunk.KEY_TYPE, Test.GENERAL_SPEECHCAPABILITIES);
+ reference.put(TTSChunk.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(TTSChunk.KEY_TYPE, TestValues.GENERAL_SPEECHCAPABILITIES);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
index 090f5a235..353862a18 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -24,8 +24,8 @@ public class TemperatureTests extends TestCase{
public void setUp(){
msg = new Temperature();
- msg.setUnit(Test.GENERAL_TEMPERATUREUNIT);
- msg.setValue(Test.GENERAL_FLOAT);
+ msg.setUnit(TestValues.GENERAL_TEMPERATUREUNIT);
+ msg.setValue(TestValues.GENERAL_FLOAT);
}
/**
@@ -37,36 +37,36 @@ public class TemperatureTests extends TestCase{
float value = msg.getValue();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FLOAT, value);
- assertEquals(Test.MATCH, Test.GENERAL_TEMPERATUREUNIT, unit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, value);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEMPERATUREUNIT, unit);
// Invalid/Null Tests
Temperature msg = new Temperature();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getUnit());
- assertNull(Test.NULL, msg.getValue());
+ assertNull(TestValues.NULL, msg.getUnit());
+ assertNull(TestValues.NULL, msg.getValue());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Temperature.KEY_VALUE, (Float) Test.GENERAL_FLOAT);
- reference.put(Temperature.KEY_UNIT, Test.GENERAL_TEMPERATUREUNIT);
+ reference.put(Temperature.KEY_VALUE, (Float) TestValues.GENERAL_FLOAT);
+ reference.put(Temperature.KEY_UNIT, TestValues.GENERAL_TEMPERATUREUNIT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
index 85666a8b6..22ef586d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.RGBColor;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -25,9 +25,9 @@ public class TemplateColorSchemeTest extends TestCase {
@Override
public void setUp() {
msg = new TemplateColorScheme();
- msg.setPrimaryColor(Test.GENERAL_RGBCOLOR);
- msg.setSecondaryColor(Test.GENERAL_RGBCOLOR);
- msg.setBackgroundColor(Test.GENERAL_RGBCOLOR);
+ msg.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
+ msg.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
+ msg.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
}
/**
@@ -40,29 +40,29 @@ public class TemplateColorSchemeTest extends TestCase {
RGBColor backgroundColor = msg.getBackgroundColor();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateRGBColor(Test.GENERAL_RGBCOLOR, primaryColor));
- assertTrue(Test.TRUE, Validator.validateRGBColor(Test.GENERAL_RGBCOLOR, secondaryColor));
- assertTrue(Test.TRUE, Validator.validateRGBColor(Test.GENERAL_RGBCOLOR, backgroundColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, primaryColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, secondaryColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, backgroundColor));
// Invalid/Null Tests
TemplateColorScheme msg = new TemplateColorScheme();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getPrimaryColor());
- assertNull(Test.NULL, msg.getSecondaryColor());
- assertNull(Test.NULL, msg.getBackgroundColor());
+ assertNull(TestValues.NULL, msg.getPrimaryColor());
+ assertNull(TestValues.NULL, msg.getSecondaryColor());
+ assertNull(TestValues.NULL, msg.getBackgroundColor());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TemplateColorScheme.KEY_PRIMARY_COLOR, Test.JSON_RGBCOLOR);
- reference.put(TemplateColorScheme.KEY_SECONDARY_COLOR, Test.JSON_RGBCOLOR);
- reference.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, Test.JSON_RGBCOLOR);
+ reference.put(TemplateColorScheme.KEY_PRIMARY_COLOR, TestValues.JSON_RGBCOLOR);
+ reference.put(TemplateColorScheme.KEY_SECONDARY_COLOR, TestValues.JSON_RGBCOLOR);
+ reference.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, TestValues.JSON_RGBCOLOR);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -71,10 +71,10 @@ public class TemplateColorSchemeTest extends TestCase {
RGBColor referenceColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(referenceColorObj));
JSONObject underTestColorObj = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
RGBColor underTestColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(underTestColorObj));
- assertTrue(Test.TRUE, Validator.validateRGBColor(referenceColor, underTestColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(referenceColor, underTestColor));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
index 4fc3744be..d01bb92fd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -27,9 +27,9 @@ public class TemplateConfigurationTests extends TestCase {
public void setUp(){
msg = new TemplateConfiguration();
- msg.setTemplate(Test.GENERAL_STRING);
- msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
- msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+ msg.setTemplate(TestValues.GENERAL_STRING);
+ msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
}
@@ -43,29 +43,29 @@ public class TemplateConfigurationTests extends TestCase {
TemplateColorScheme testNightColorScheme = msg.getNightColorScheme();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testTemplate);
- assertEquals(Test.MATCH, Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme);
- assertEquals(Test.MATCH, Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTemplate);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme);
// Invalid/Null Tests
TemplateConfiguration msg = new TemplateConfiguration();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getTemplate());
- assertNull(Test.NULL, msg.getDayColorScheme());
- assertNull(Test.NULL, msg.getNightColorScheme());
+ assertNull(TestValues.NULL, msg.getTemplate());
+ assertNull(TestValues.NULL, msg.getDayColorScheme());
+ assertNull(TestValues.NULL, msg.getNightColorScheme());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(TemplateConfiguration.KEY_TEMPLATE, Test.GENERAL_STRING);
- reference.put(TemplateConfiguration.KEY_DAY_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_DAYCOLORSCHEME.getStore()));
- reference.put(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NIGHTCOLORSCHEME.getStore()));
+ reference.put(TemplateConfiguration.KEY_TEMPLATE, TestValues.GENERAL_STRING);
+ reference.put(TemplateConfiguration.KEY_DAY_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_DAYCOLORSCHEME.getStore()));
+ reference.put(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_NIGHTCOLORSCHEME.getStore()));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -76,19 +76,19 @@ public class TemplateConfigurationTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
} else if (key.equals(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME)) {
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
index 8a06abd5d..9db332b77 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.enums.CharacterSet;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -25,10 +25,10 @@ public class TextFieldTest extends TestCase {
public void setUp() {
msg = new TextField();
- msg.setName(Test.GENERAL_TEXTFIELDNAME);
- msg.setCharacterSet(Test.GENERAL_CHARACTERSET);
- msg.setWidth(Test.GENERAL_INT);
- msg.setRows(Test.GENERAL_INT);
+ msg.setName(TestValues.GENERAL_TEXTFIELDNAME);
+ msg.setCharacterSet(TestValues.GENERAL_CHARACTERSET);
+ msg.setWidth(TestValues.GENERAL_INT);
+ msg.setRows(TestValues.GENERAL_INT);
}
/**
@@ -42,40 +42,40 @@ public class TextFieldTest extends TestCase {
Integer rows = msg.getRows();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELDNAME, name);
- assertEquals(Test.MATCH, Test.GENERAL_CHARACTERSET, charSet);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, width);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, rows);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELDNAME, name);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CHARACTERSET, charSet);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, width);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, rows);
// Invalid/Null Tests
TextField msg = new TextField();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getName());
- assertNull(Test.NULL, msg.getWidth());
- assertNull(Test.NULL, msg.getRows());
- assertNull(Test.NULL, msg.getCharacterSet());
+ assertNull(TestValues.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getWidth());
+ assertNull(TestValues.NULL, msg.getRows());
+ assertNull(TestValues.NULL, msg.getCharacterSet());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TextField.KEY_CHARACTER_SET, Test.GENERAL_CHARACTERSET);
- reference.put(TextField.KEY_WIDTH, Test.GENERAL_INT);
- reference.put(TextField.KEY_ROWS, Test.GENERAL_INT);
- reference.put(TextField.KEY_NAME, Test.GENERAL_TEXTFIELDNAME);
+ reference.put(TextField.KEY_CHARACTER_SET, TestValues.GENERAL_CHARACTERSET);
+ reference.put(TextField.KEY_WIDTH, TestValues.GENERAL_INT);
+ reference.put(TextField.KEY_ROWS, TestValues.GENERAL_INT);
+ reference.put(TextField.KEY_NAME, TestValues.GENERAL_TEXTFIELDNAME);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
index 3def0a8eb..59d289546 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -23,24 +23,24 @@ public class TireStatusTest extends TestCase {
@Override
public void setUp() {
msg = new TireStatus();
- msg.setPressureTellTale(Test.GENERAL_WARNINGLIGHTSTATUS);
+ msg.setPressureTellTale(TestValues.GENERAL_WARNINGLIGHTSTATUS);
SingleTireStatus tireLeftFront = new SingleTireStatus();
- tireLeftFront.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireLeftFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setLeftFront(tireLeftFront);
SingleTireStatus tireRightFront = new SingleTireStatus();
- tireRightFront.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireRightFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setRightFront(tireRightFront);
SingleTireStatus tireLeftRear = new SingleTireStatus();
- tireLeftRear.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setLeftRear(tireLeftRear);
SingleTireStatus tireRightRear = new SingleTireStatus();
- tireRightRear.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setRightRear(tireRightRear);
SingleTireStatus tireInnerLeftRear = new SingleTireStatus();
- tireInnerLeftRear.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireInnerLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setInnerLeftRear(tireInnerLeftRear);
SingleTireStatus tireInnerRightRear = new SingleTireStatus();
- tireInnerRightRear.setStatus(Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireInnerRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
msg.setInnerRightRear(tireInnerRightRear);
}
@@ -58,51 +58,51 @@ public class TireStatusTest extends TestCase {
SingleTireStatus innerRightRear = msg.getInnerRightRear();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_WARNINGLIGHTSTATUS, pressure);
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, leftFront.getStatus());
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, rightFront.getStatus());
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, leftRear.getStatus());
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, rightRear.getStatus());
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, innerLeftRear.getStatus());
- assertEquals(Test.MATCH, Test.GENERAL_COMPONENTVOLUMESTATUS, innerRightRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WARNINGLIGHTSTATUS, pressure);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftFront.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightFront.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerLeftRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerRightRear.getStatus());
// Invalid/Null Tests
TireStatus msg = new TireStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TireStatus.KEY_PRESSURE_TELL_TALE, Test.GENERAL_WARNINGLIGHTSTATUS);
+ reference.put(TireStatus.KEY_PRESSURE_TELL_TALE, TestValues.GENERAL_WARNINGLIGHTSTATUS);
JSONObject tireLeftFront = new JSONObject();
- tireLeftFront.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireLeftFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
JSONObject tireRightFront = new JSONObject();
- tireRightFront.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireRightFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
JSONObject tireLeftRear = new JSONObject();
- tireLeftRear.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
JSONObject tireRightRear = new JSONObject();
- tireRightRear.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
JSONObject tireInnerLeftRear = new JSONObject();
- tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
JSONObject tireInnerRightRear = new JSONObject();
- tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, Test.GENERAL_COMPONENTVOLUMESTATUS);
+ tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
reference.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- assertTrue(Test.TRUE, Validator.validateTireStatus(
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(
new TireStatus(JsonRPCMarshaller.deserializeJSONObject(reference)),
new TireStatus(JsonRPCMarshaller.deserializeJSONObject(underTest))));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
index 7ce2f176f..cc7c0f40a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,8 +23,8 @@ public class TouchCoordTest extends TestCase {
public void setUp() {
msg = new TouchCoord();
- msg.setX(Test.GENERAL_INT);
- msg.setY(Test.GENERAL_INT);
+ msg.setX(TestValues.GENERAL_INT);
+ msg.setY(TestValues.GENERAL_INT);
}
/**
@@ -36,34 +36,34 @@ public class TouchCoordTest extends TestCase {
Integer y = msg.getY();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, x);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, y);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, x);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, y);
// Invalid/Null Tests
TouchCoord msg = new TouchCoord();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getX());
- assertNull(Test.NULL, msg.getY());
+ assertNull(TestValues.NULL, msg.getX());
+ assertNull(TestValues.NULL, msg.getY());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TouchCoord.KEY_X, Test.GENERAL_INT);
- reference.put(TouchCoord.KEY_Y, Test.GENERAL_INT);
+ reference.put(TouchCoord.KEY_X, TestValues.GENERAL_INT);
+ reference.put(TouchCoord.KEY_Y, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
index 27e90e337..6c07edae5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class TouchEventCapabilitiesTest extends TestCase {
public void setUp() {
msg = new TouchEventCapabilities();
- msg.setPressAvailable(Test.GENERAL_BOOLEAN);
- msg.setDoublePressAvailable(Test.GENERAL_BOOLEAN);
- msg.setMultiTouchAvailable(Test.GENERAL_BOOLEAN);
+ msg.setPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDoublePressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMultiTouchAvailable(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -38,37 +38,37 @@ public class TouchEventCapabilitiesTest extends TestCase {
Boolean doublePress = msg.getDoublePressAvailable();
// Valid Tests
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, press);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, multiTouch);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, doublePress);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, press);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, multiTouch);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, doublePress);
// Invalid/Null Tests
TouchEventCapabilities msg = new TouchEventCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getPressAvailable());
- assertNull(Test.NULL, msg.getMultiTouchAvailable());
- assertNull(Test.NULL, msg.getDoublePressAvailable());
+ assertNull(TestValues.NULL, msg.getPressAvailable());
+ assertNull(TestValues.NULL, msg.getMultiTouchAvailable());
+ assertNull(TestValues.NULL, msg.getDoublePressAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, Test.GENERAL_BOOLEAN);
- reference.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
index 24a10d68e..204fc4b4a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -25,9 +25,9 @@ public class TouchEventTest extends TestCase {
@Override
public void setUp() {
msg = new TouchEvent();
- msg.setId(Test.GENERAL_INT);
- msg.setTs(Test.GENERAL_LONG_LIST);
- msg.setC(Test.GENERAL_TOUCHCOORD_LIST);
+ msg.setId(TestValues.GENERAL_INT);
+ msg.setTs(TestValues.GENERAL_LONG_LIST);
+ msg.setC(TestValues.GENERAL_TOUCHCOORD_LIST);
}
/**
@@ -40,50 +40,50 @@ public class TouchEventTest extends TestCase {
List<TouchCoord> coordTest = msg.getC();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, id);
- assertTrue(Test.TRUE, Validator.validateLongList(Test.GENERAL_LONG_LIST, timestamp));
- assertEquals(Test.MATCH, Test.GENERAL_TOUCHCOORD_LIST.size(), coordTest.size());
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
+ assertTrue(TestValues.TRUE, Validator.validateLongList(TestValues.GENERAL_LONG_LIST, timestamp));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHCOORD_LIST.size(), coordTest.size());
- for (int index = 0; index < Test.GENERAL_TOUCHCOORD_LIST.size(); index++) {
- assertTrue(Test.TRUE, Validator.validateTouchCoord(Test.GENERAL_TOUCHCOORD_LIST.get(index), coordTest.get(index)));
+ for (int index = 0; index < TestValues.GENERAL_TOUCHCOORD_LIST.size(); index++) {
+ assertTrue(TestValues.TRUE, Validator.validateTouchCoord(TestValues.GENERAL_TOUCHCOORD_LIST.get(index), coordTest.get(index)));
}
// Invalid/Null Tests
TouchEvent msg = new TouchEvent();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getId());
- assertNull(Test.NULL, msg.getTs());
- assertNull(Test.NULL, msg.getC());
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getTs());
+ assertNull(TestValues.NULL, msg.getC());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(TouchEvent.KEY_ID, Test.GENERAL_INT);
- reference.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(Test.GENERAL_LONG_LIST));
- reference.put(TouchEvent.KEY_C, Test.JSON_TOUCHCOORDS);
+ reference.put(TouchEvent.KEY_ID, TestValues.GENERAL_INT);
+ reference.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(TestValues.GENERAL_LONG_LIST));
+ reference.put(TouchEvent.KEY_C, TestValues.JSON_TOUCHCOORDS);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(TouchEvent.KEY_C)) {
- assertTrue(Test.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
+ assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
} else if (key.equals(TouchEvent.KEY_TS)) {
List<Long> tsListReference = JsonUtils.readLongListFromJsonObject(reference, key);
List<Long> tsListTest = JsonUtils.readLongListFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, tsListReference.containsAll(tsListTest) && tsListTest.containsAll(tsListReference));
+ assertTrue(TestValues.TRUE, tsListReference.containsAll(tsListTest) && tsListTest.containsAll(tsListReference));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
index dba742b71..6b4b71988 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.Turn;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -17,10 +17,10 @@ public class TurnTests extends TestCase {
@Override
public void setUp(){
msg = new Turn();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- msg.setTurnIcon(Test.GENERAL_IMAGE);
- msg.setNavigationText(Test.GENERAL_STRING);
+ msg.setTurnIcon(TestValues.GENERAL_IMAGE);
+ msg.setNavigationText(TestValues.GENERAL_STRING);
}
/**
@@ -32,25 +32,25 @@ public class TurnTests extends TestCase {
String text = msg.getNavigationText();
// Valid Tests
- assertTrue(Test.MATCH, Validator.validateImage(Test.GENERAL_IMAGE, icon));
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text);
+ assertTrue(TestValues.MATCH, Validator.validateImage(TestValues.GENERAL_IMAGE, icon));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
// Invalid/Null Tests
Turn msg = new Turn();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getNavigationText());
- assertNull(Test.NULL, msg.getTurnIcon());
+ assertNull(TestValues.NULL, msg.getNavigationText());
+ assertNull(TestValues.NULL, msg.getTurnIcon());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(Turn.KEY_NAVIGATION_TEXT, Test.GENERAL_STRING);
- reference.put(Turn.KEY_TURN_IMAGE, Test.JSON_IMAGE);
+ reference.put(Turn.KEY_NAVIGATION_TEXT, TestValues.GENERAL_STRING);
+ reference.put(Turn.KEY_TURN_IMAGE, TestValues.JSON_IMAGE);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
index dd84c8181..c3b9034f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.VehicleDataResult;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -21,9 +21,9 @@ public class VehicleDataResultTest extends TestCase {
public void setUp() {
msg = new VehicleDataResult();
- msg.setDataType(Test.GENERAL_VEHICLEDATATYPE);
- msg.setResultCode(Test.GENERAL_VEHICLEDATARESULTCODE);
- msg.setOEMCustomVehicleDataType(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ msg.setDataType(TestValues.GENERAL_VEHICLEDATATYPE);
+ msg.setResultCode(TestValues.GENERAL_VEHICLEDATARESULTCODE);
+ msg.setOEMCustomVehicleDataType(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
}
/**
@@ -36,39 +36,39 @@ public class VehicleDataResultTest extends TestCase {
String oemCustomDataType = msg.getOEMCustomVehicleDataType();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATARESULTCODE, result);
- assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATATYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATARESULTCODE, result);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATATYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
// Invalid/Null Tests
VehicleDataResult msg = new VehicleDataResult();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getDataType());
- assertNull(Test.NULL, msg.getResultCode());
- assertNull(Test.NULL, msg.getOEMCustomVehicleDataType());
+ assertNull(TestValues.NULL, msg.getDataType());
+ assertNull(TestValues.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleDataType());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(VehicleDataResult.KEY_RESULT_CODE, Test.GENERAL_VEHICLEDATARESULTCODE);
- reference.put(VehicleDataResult.KEY_DATA_TYPE, Test.GENERAL_VEHICLEDATATYPE);
- reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ reference.put(VehicleDataResult.KEY_RESULT_CODE, TestValues.GENERAL_VEHICLEDATARESULTCODE);
+ reference.put(VehicleDataResult.KEY_DATA_TYPE, TestValues.GENERAL_VEHICLEDATATYPE);
+ reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH,
+ assertEquals(TestValues.MATCH,
JsonUtils.readObjectFromJsonObject(reference, key),
JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
index 24d85152a..1b0d5730e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -19,10 +19,10 @@ public class VehicleTypeTest extends TestCase {
public void setUp() {
msg = new VehicleType();
- msg.setModel(Test.GENERAL_STRING);
- msg.setMake(Test.GENERAL_STRING);
- msg.setTrim(Test.GENERAL_STRING);
- msg.setModelYear(Test.GENERAL_STRING);
+ msg.setModel(TestValues.GENERAL_STRING);
+ msg.setMake(TestValues.GENERAL_STRING);
+ msg.setTrim(TestValues.GENERAL_STRING);
+ msg.setModelYear(TestValues.GENERAL_STRING);
}
/**
@@ -36,40 +36,40 @@ public class VehicleTypeTest extends TestCase {
String model = msg.getModel();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, year);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, model);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, make);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, trim);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, year);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, model);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, make);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, trim);
// Invalid/Null Tests
VehicleType msg = new VehicleType();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getModel());
- assertNull(Test.NULL, msg.getMake());
- assertNull(Test.NULL, msg.getModelYear());
- assertNull(Test.NULL, msg.getTrim());
+ assertNull(TestValues.NULL, msg.getModel());
+ assertNull(TestValues.NULL, msg.getMake());
+ assertNull(TestValues.NULL, msg.getModelYear());
+ assertNull(TestValues.NULL, msg.getTrim());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(VehicleType.KEY_MODEL, Test.GENERAL_STRING);
- reference.put(VehicleType.KEY_MAKE, Test.GENERAL_STRING);
- reference.put(VehicleType.KEY_MODEL_YEAR, Test.GENERAL_STRING);
- reference.put(VehicleType.KEY_TRIM, Test.GENERAL_STRING);
+ reference.put(VehicleType.KEY_MODEL, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_MAKE, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_MODEL_YEAR, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_TRIM, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 808429d2f..0fb0288e2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -5,7 +5,7 @@ import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -26,13 +26,13 @@ public class VideoStreamingCapabilityTests extends TestCase {
@Override
public void setUp() {
msg = new VideoStreamingCapability();
- msg.setSupportedFormats(Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
- msg.setMaxBitrate(Test.GENERAL_INT);
- msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
- msg.setDiagonalScreenSize(Test.GENERAL_DOUBLE);
- msg.setPixelPerInch(Test.GENERAL_DOUBLE);
- msg.setScale(Test.GENERAL_DOUBLE);
+ msg.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ msg.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ msg.setMaxBitrate(TestValues.GENERAL_INT);
+ msg.setIsHapticSpatialDataSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setDiagonalScreenSize(TestValues.GENERAL_DOUBLE);
+ msg.setPixelPerInch(TestValues.GENERAL_DOUBLE);
+ msg.setScale(TestValues.GENERAL_DOUBLE);
}
/**
@@ -49,48 +49,48 @@ public class VideoStreamingCapabilityTests extends TestCase {
Double scale = msg.getScale();
// Valid Tests
- assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
- assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, diagonalScreenSize);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, pixelPerInch);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, scale);
+ assertEquals(TestValues.MATCH, (List<VideoStreamingFormat>) TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
+ assertEquals(TestValues.MATCH, (ImageResolution) TestValues.GENERAL_IMAGERESOLUTION, res);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, maxBitrate);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, diagonalScreenSize);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, pixelPerInch);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, scale);
// Invalid/Null Tests
VideoStreamingCapability msg = new VideoStreamingCapability();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getMaxBitrate());
- assertNull(Test.NULL, msg.getPreferredResolution());
- assertNull(Test.NULL, msg.getSupportedFormats());
- assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
- assertNull(Test.NULL, msg.getDiagonalScreenSize());
- assertNull(Test.NULL, msg.getPixelPerInch());
- assertNull(Test.NULL, msg.getScale());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMaxBitrate());
+ assertNull(TestValues.NULL, msg.getPreferredResolution());
+ assertNull(TestValues.NULL, msg.getSupportedFormats());
+ assertNull(TestValues.NULL, msg.getIsHapticSpatialDataSupported());
+ assertNull(TestValues.NULL, msg.getDiagonalScreenSize());
+ assertNull(TestValues.NULL, msg.getPixelPerInch());
+ assertNull(TestValues.NULL, msg.getScale());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, Test.GENERAL_INT);
- reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
- reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
- reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, Test.GENERAL_DOUBLE);
- reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, Test.GENERAL_DOUBLE);
- reference.put(VideoStreamingCapability.KEY_SCALE, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, TestValues.GENERAL_INT);
+ reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, TestValues.GENERAL_IMAGERESOLUTION);
+ reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, TestValues.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, TestValues.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_SCALE, TestValues.GENERAL_DOUBLE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
- assertTrue(Test.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
+ assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
} else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
@@ -108,7 +108,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
index 431b3bfc6..935751483 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -20,8 +20,8 @@ public class VideoStreamingFormatTests extends TestCase {
@Override
public void setUp() {
msg = new VideoStreamingFormat();
- msg.setProtocol(Test.GENERAL_VIDEOSTREAMINGPROTOCOL);
- msg.setCodec(Test.GENERAL_VIDEOSTREAMINGCODEC);
+ msg.setProtocol(TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ msg.setCodec(TestValues.GENERAL_VIDEOSTREAMINGCODEC);
}
/**
@@ -33,35 +33,35 @@ public class VideoStreamingFormatTests extends TestCase {
VideoStreamingCodec codec = msg.getCodec();
// Valid Tests
- assertEquals(Test.MATCH, (VideoStreamingProtocol) Test.GENERAL_VIDEOSTREAMINGPROTOCOL, protocol);
- assertEquals(Test.MATCH, (VideoStreamingCodec) Test.GENERAL_VIDEOSTREAMINGCODEC, codec);
+ assertEquals(TestValues.MATCH, (VideoStreamingProtocol) TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL, protocol);
+ assertEquals(TestValues.MATCH, (VideoStreamingCodec) TestValues.GENERAL_VIDEOSTREAMINGCODEC, codec);
// Invalid/Null Tests
VideoStreamingFormat msg = new VideoStreamingFormat();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getProtocol());
- assertNull(Test.NULL, msg.getCodec());
+ assertNull(TestValues.NULL, msg.getProtocol());
+ assertNull(TestValues.NULL, msg.getCodec());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(VideoStreamingFormat.KEY_PROTOCOL, Test.GENERAL_VIDEOSTREAMINGPROTOCOL);
- reference.put(VideoStreamingFormat.KEY_CODEC, Test.GENERAL_VIDEOSTREAMINGCODEC);
+ reference.put(VideoStreamingFormat.KEY_PROTOCOL, TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ reference.put(VideoStreamingFormat.KEY_CODEC, TestValues.GENERAL_VIDEOSTREAMINGCODEC);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
index 405e2bf84..a60615042 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -23,9 +23,9 @@ public class VrHelpItemTest extends TestCase {
public void setUp() {
msg = new VrHelpItem();
- msg.setText(Test.GENERAL_STRING);
- msg.setImage(Test.GENERAL_IMAGE);
- msg.setPosition(Test.GENERAL_INT);
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ msg.setPosition(TestValues.GENERAL_INT);
}
@@ -39,29 +39,29 @@ public class VrHelpItemTest extends TestCase {
Integer position = msg.getPosition();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, text);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, position);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, image));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, position);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
// Invalid/Null Tests
VrHelpItem msg = new VrHelpItem();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getImage());
- assertNull(Test.NULL, msg.getText());
- assertNull(Test.NULL, msg.getPosition());
+ assertNull(TestValues.NULL, msg.getImage());
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getPosition());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(VrHelpItem.KEY_IMAGE, Test.JSON_IMAGE);
- reference.put(VrHelpItem.KEY_TEXT, Test.GENERAL_STRING);
- reference.put(VrHelpItem.KEY_POSITION, Test.GENERAL_INT);
+ reference.put(VrHelpItem.KEY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(VrHelpItem.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(VrHelpItem.KEY_POSITION, TestValues.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -73,13 +73,13 @@ public class VrHelpItemTest extends TestCase {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
index 4a8ade572..f3537a29b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.WeatherAlert;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,12 +29,12 @@ public class WeatherAlertTests extends TestCase {
public void setUp(){
msg = new WeatherAlert();
- msg.setExpires(Test.GENERAL_DATETIME);
- msg.setTimeIssued(Test.GENERAL_DATETIME);
- msg.setRegions(Test.GENERAL_STRING_LIST);
- msg.setSeverity(Test.GENERAL_STRING);
- msg.setSummary(Test.GENERAL_STRING);
- msg.setTitle(Test.GENERAL_STRING);
+ msg.setExpires(TestValues.GENERAL_DATETIME);
+ msg.setTimeIssued(TestValues.GENERAL_DATETIME);
+ msg.setRegions(TestValues.GENERAL_STRING_LIST);
+ msg.setSeverity(TestValues.GENERAL_STRING);
+ msg.setSummary(TestValues.GENERAL_STRING);
+ msg.setTitle(TestValues.GENERAL_STRING);
}
/**
@@ -50,44 +50,44 @@ public class WeatherAlertTests extends TestCase {
String title = msg.getTitle();
// Valid Tests
- assertEquals(Test.MATCH, expires, Test.GENERAL_DATETIME);
- assertEquals(Test.MATCH, issued, Test.GENERAL_DATETIME);
- assertEquals(Test.MATCH, regions, Test.GENERAL_STRING_LIST);
- assertEquals(Test.MATCH, severity, Test.GENERAL_STRING);
- assertEquals(Test.MATCH, summary, Test.GENERAL_STRING);
- assertEquals(Test.MATCH, title, Test.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, expires, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, issued, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.MATCH, severity, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, summary, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, title, TestValues.GENERAL_STRING);
// Invalid/Null Tests
WeatherAlert msg = new WeatherAlert();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getExpires());
- assertNull(Test.NULL, msg.getTimeIssued());
- assertNull(Test.NULL, msg.getRegions());
- assertNull(Test.NULL, msg.getSeverity());
- assertNull(Test.NULL, msg.getSummary());
- assertNull(Test.NULL, msg.getTitle());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getExpires());
+ assertNull(TestValues.NULL, msg.getTimeIssued());
+ assertNull(TestValues.NULL, msg.getRegions());
+ assertNull(TestValues.NULL, msg.getSeverity());
+ assertNull(TestValues.NULL, msg.getSummary());
+ assertNull(TestValues.NULL, msg.getTitle());
}
public void testRequiredParamsConstructor(){
- msg = new WeatherAlert(Test.GENERAL_STRING_LIST);
+ msg = new WeatherAlert(TestValues.GENERAL_STRING_LIST);
List<String> regions = msg.getRegions();
- assertEquals(Test.MATCH, regions, Test.GENERAL_STRING_LIST);
+ assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(WeatherAlert.KEY_EXPIRES, Test.GENERAL_DATETIME);
- reference.put(WeatherAlert.KEY_TIME_ISSUED, Test.GENERAL_DATETIME);
- reference.put(WeatherAlert.KEY_REGIONS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(WeatherAlert.KEY_SEVERITY, Test.GENERAL_STRING);
- reference.put(WeatherAlert.KEY_SUMMARY, Test.GENERAL_STRING);
- reference.put(WeatherAlert.KEY_TITLE, Test.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_EXPIRES, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_TIME_ISSUED, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_REGIONS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(WeatherAlert.KEY_SEVERITY, TestValues.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_SUMMARY, TestValues.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_TITLE, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()) {
@@ -95,18 +95,18 @@ public class WeatherAlertTests extends TestCase {
if (key.equals(WeatherAlert.KEY_EXPIRES)||key.equals(WeatherAlert.KEY_TIME_ISSUED)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
} else if (key.equals(WeatherAlert.KEY_REGIONS)){
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
index 04522acfb..cbebce592 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.WeatherData;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -29,28 +29,28 @@ public class WeatherDataTests extends TestCase {
public void setUp(){
msg = new WeatherData();
- msg.setCurrentTemperature(Test.GENERAL_TEMPERATURE);
- msg.setTemperatureHigh(Test.GENERAL_TEMPERATURE);
- msg.setTemperatureLow(Test.GENERAL_TEMPERATURE);
- msg.setApparentTemperature(Test.GENERAL_TEMPERATURE);
- msg.setApparentTemperatureHigh(Test.GENERAL_TEMPERATURE);
- msg.setApparentTemperatureLow(Test.GENERAL_TEMPERATURE);
- msg.setWeatherSummary(Test.GENERAL_STRING);
- msg.setTime(Test.GENERAL_DATETIME);
- msg.setHumidity(Test.GENERAL_FLOAT);
- msg.setCloudCover(Test.GENERAL_FLOAT);
- msg.setMoonPhase(Test.GENERAL_FLOAT);
- msg.setWindBearing(Test.GENERAL_INTEGER);
- msg.setWindGust(Test.GENERAL_FLOAT);
- msg.setWindSpeed(Test.GENERAL_FLOAT);
- msg.setNearestStormBearing(Test.GENERAL_INTEGER);
- msg.setNearestStormDistance(Test.GENERAL_INTEGER);
- msg.setPrecipAccumulation(Test.GENERAL_FLOAT);
- msg.setPrecipIntensity(Test.GENERAL_FLOAT);
- msg.setPrecipProbability(Test.GENERAL_FLOAT);
- msg.setPrecipType(Test.GENERAL_STRING);
- msg.setVisibility(Test.GENERAL_FLOAT);
- msg.setWeatherIcon(Test.GENERAL_IMAGE);
+ msg.setCurrentTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
+ msg.setTemperatureLow(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureLow(TestValues.GENERAL_TEMPERATURE);
+ msg.setWeatherSummary(TestValues.GENERAL_STRING);
+ msg.setTime(TestValues.GENERAL_DATETIME);
+ msg.setHumidity(TestValues.GENERAL_FLOAT);
+ msg.setCloudCover(TestValues.GENERAL_FLOAT);
+ msg.setMoonPhase(TestValues.GENERAL_FLOAT);
+ msg.setWindBearing(TestValues.GENERAL_INTEGER);
+ msg.setWindGust(TestValues.GENERAL_FLOAT);
+ msg.setWindSpeed(TestValues.GENERAL_FLOAT);
+ msg.setNearestStormBearing(TestValues.GENERAL_INTEGER);
+ msg.setNearestStormDistance(TestValues.GENERAL_INTEGER);
+ msg.setPrecipAccumulation(TestValues.GENERAL_FLOAT);
+ msg.setPrecipIntensity(TestValues.GENERAL_FLOAT);
+ msg.setPrecipProbability(TestValues.GENERAL_FLOAT);
+ msg.setPrecipType(TestValues.GENERAL_STRING);
+ msg.setVisibility(TestValues.GENERAL_FLOAT);
+ msg.setWeatherIcon(TestValues.GENERAL_IMAGE);
}
/**
@@ -81,85 +81,85 @@ public class WeatherDataTests extends TestCase {
Image weatherIcon = msg.getWeatherIcon();
// Valid Tests
- assertEquals(Test.MATCH, currentTemperature, Test.GENERAL_TEMPERATURE);
- assertEquals(Test.MATCH, temperatureHigh, Test.GENERAL_TEMPERATURE);
- assertEquals(Test.MATCH, temperatureLow, Test.GENERAL_TEMPERATURE);
- assertEquals(Test.MATCH, apparentTemperature, Test.GENERAL_TEMPERATURE);
- assertEquals(Test.MATCH, apparentTemperatureHigh, Test.GENERAL_TEMPERATURE);
- assertEquals(Test.MATCH, weatherSummary, Test.GENERAL_STRING);
- assertEquals(Test.MATCH, time, Test.GENERAL_DATETIME);
- assertEquals(Test.MATCH, humidity, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, cloudCover, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, moonPhase, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, windBearing, Test.GENERAL_INTEGER);
- assertEquals(Test.MATCH, windGust, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, windSpeed, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, nearestStormBearing, Test.GENERAL_INTEGER);
- assertEquals(Test.MATCH, nearestStormDistance, Test.GENERAL_INTEGER);
- assertEquals(Test.MATCH, precipAccumulation, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, precipIntensity, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, precipProbability, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, precipType, Test.GENERAL_STRING);
- assertEquals(Test.MATCH, visibility, Test.GENERAL_FLOAT);
- assertEquals(Test.MATCH, weatherIcon, Test.GENERAL_IMAGE);
+ assertEquals(TestValues.MATCH, currentTemperature, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, temperatureHigh, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, temperatureLow, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, apparentTemperature, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, apparentTemperatureHigh, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, weatherSummary, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, time, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, humidity, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, cloudCover, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, moonPhase, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, windBearing, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, windGust, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, windSpeed, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, nearestStormBearing, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, nearestStormDistance, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, precipAccumulation, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipIntensity, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipProbability, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipType, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, visibility, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, weatherIcon, TestValues.GENERAL_IMAGE);
// Invalid/Null Tests
WeatherData msg = new WeatherData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getCurrentTemperature());
- assertNull(Test.NULL, msg.getTemperatureHigh());
- assertNull(Test.NULL, msg.getTemperatureLow());
- assertNull(Test.NULL, msg.getApparentTemperature());
- assertNull(Test.NULL, msg.getApparentTemperatureHigh());
- assertNull(Test.NULL, msg.getApparentTemperatureLow());
- assertNull(Test.NULL, msg.getWeatherSummary());
- assertNull(Test.NULL, msg.getTime());
- assertNull(Test.NULL, msg.getHumidity());
- assertNull(Test.NULL, msg.getCloudCover());
- assertNull(Test.NULL, msg.getMoonPhase());
- assertNull(Test.NULL, msg.getWindBearing());
- assertNull(Test.NULL, msg.getWindGust());
- assertNull(Test.NULL, msg.getWindSpeed());
- assertNull(Test.NULL, msg.getNearestStormBearing());
- assertNull(Test.NULL, msg.getNearestStormDistance());
- assertNull(Test.NULL, msg.getPrecipAccumulation());
- assertNull(Test.NULL, msg.getPrecipIntensity());
- assertNull(Test.NULL, msg.getPrecipProbability());
- assertNull(Test.NULL, msg.getPrecipType());
- assertNull(Test.NULL, msg.getVisibility());
- assertNull(Test.NULL, msg.getWeatherIcon());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getCurrentTemperature());
+ assertNull(TestValues.NULL, msg.getTemperatureHigh());
+ assertNull(TestValues.NULL, msg.getTemperatureLow());
+ assertNull(TestValues.NULL, msg.getApparentTemperature());
+ assertNull(TestValues.NULL, msg.getApparentTemperatureHigh());
+ assertNull(TestValues.NULL, msg.getApparentTemperatureLow());
+ assertNull(TestValues.NULL, msg.getWeatherSummary());
+ assertNull(TestValues.NULL, msg.getTime());
+ assertNull(TestValues.NULL, msg.getHumidity());
+ assertNull(TestValues.NULL, msg.getCloudCover());
+ assertNull(TestValues.NULL, msg.getMoonPhase());
+ assertNull(TestValues.NULL, msg.getWindBearing());
+ assertNull(TestValues.NULL, msg.getWindGust());
+ assertNull(TestValues.NULL, msg.getWindSpeed());
+ assertNull(TestValues.NULL, msg.getNearestStormBearing());
+ assertNull(TestValues.NULL, msg.getNearestStormDistance());
+ assertNull(TestValues.NULL, msg.getPrecipAccumulation());
+ assertNull(TestValues.NULL, msg.getPrecipIntensity());
+ assertNull(TestValues.NULL, msg.getPrecipProbability());
+ assertNull(TestValues.NULL, msg.getPrecipType());
+ assertNull(TestValues.NULL, msg.getVisibility());
+ assertNull(TestValues.NULL, msg.getWeatherIcon());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(WeatherData.KEY_CURRENT_TEMPERATURE, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_TEMPERATURE_HIGH, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_TEMPERATURE_LOW, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_LOW, Test.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_WEATHER_SUMMARY, Test.GENERAL_STRING);
- reference.put(WeatherData.KEY_TIME, Test.GENERAL_DATETIME);
- reference.put(WeatherData.KEY_HUMIDITY, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_CLOUD_COVER, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_MOON_PHASE, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WIND_BEARING, Test.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_WIND_GUST, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WIND_SPEED, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_NEAREST_STORM_BEARING, Test.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_NEAREST_STORM_DISTANCE, Test.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_PRECIP_ACCUMULATION, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_INTENSITY, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_PROBABILITY, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_TYPE, Test.GENERAL_STRING);
- reference.put(WeatherData.KEY_VISIBILITY, Test.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WEATHER_ICON, Test.GENERAL_STRING);
+ reference.put(WeatherData.KEY_CURRENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_WEATHER_SUMMARY, TestValues.GENERAL_STRING);
+ reference.put(WeatherData.KEY_TIME, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherData.KEY_HUMIDITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_CLOUD_COVER, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_MOON_PHASE, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_WIND_GUST, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_SPEED, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_NEAREST_STORM_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_NEAREST_STORM_DISTANCE, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_PRECIP_ACCUMULATION, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_INTENSITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_PROBABILITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_TYPE, TestValues.GENERAL_STRING);
+ reference.put(WeatherData.KEY_VISIBILITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WEATHER_ICON, TestValues.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()) {
@@ -169,21 +169,21 @@ public class WeatherDataTests extends TestCase {
key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_LOW)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, new Temperature(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(TestValues.GENERAL_TEMPERATURE, new Temperature(hashTest)));
} else if (key.equals(WeatherData.KEY_TIME)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateDateTime(Test.GENERAL_DATETIME, new DateTime(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
} else if (key.equals(WeatherData.KEY_WEATHER_ICON)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, new Image(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
index 09c976538..3e3e26d95 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.WeatherAlert;
import com.smartdevicelink.proxy.rpc.WeatherData;
import com.smartdevicelink.proxy.rpc.WeatherServiceData;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -33,12 +33,12 @@ public class WeatherServiceDataTests extends TestCase {
public void setUp(){
msg = new WeatherServiceData();
- msg.setLocation(Test.GENERAL_LOCATIONDETAILS);
- msg.setCurrentForecast(Test.GENERAL_WEATHERDATA);
- msg.setMinuteForecast(Test.GENERAL_WEATHERDATA_LIST);
- msg.setHourlyForecast(Test.GENERAL_WEATHERDATA_LIST);
- msg.setMultidayForecast(Test.GENERAL_WEATHERDATA_LIST);
- msg.setAlerts(Test.GENERAL_WEATHERALERT_LIST);
+ msg.setLocation(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setCurrentForecast(TestValues.GENERAL_WEATHERDATA);
+ msg.setMinuteForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setHourlyForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setMultidayForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setAlerts(TestValues.GENERAL_WEATHERALERT_LIST);
}
/**
@@ -54,44 +54,44 @@ public class WeatherServiceDataTests extends TestCase {
List<WeatherAlert> alerts = msg.getAlerts();
// Valid Tests
- assertEquals(Test.GENERAL_LOCATIONDETAILS, location);
- assertEquals(Test.GENERAL_WEATHERDATA, currentForecast);
- assertEquals(Test.GENERAL_WEATHERDATA_LIST, minuteForecast);
- assertEquals(Test.GENERAL_WEATHERDATA_LIST, hourlyForecast);
- assertEquals(Test.GENERAL_WEATHERDATA_LIST, multidayForecast);
- assertEquals(Test.GENERAL_WEATHERALERT_LIST, alerts);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
+ assertEquals(TestValues.GENERAL_WEATHERDATA, currentForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, minuteForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, hourlyForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, multidayForecast);
+ assertEquals(TestValues.GENERAL_WEATHERALERT_LIST, alerts);
// Invalid/Null Tests
WeatherServiceData msg = new WeatherServiceData();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getLocation());
- assertNull(Test.NULL, msg.getCurrentForecast());
- assertNull(Test.NULL, msg.getMinuteForecast());
- assertNull(Test.NULL, msg.getHourlyForecast());
- assertNull(Test.NULL, msg.getMultidayForecast());
- assertNull(Test.NULL, msg.getAlerts());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getLocation());
+ assertNull(TestValues.NULL, msg.getCurrentForecast());
+ assertNull(TestValues.NULL, msg.getMinuteForecast());
+ assertNull(TestValues.NULL, msg.getHourlyForecast());
+ assertNull(TestValues.NULL, msg.getMultidayForecast());
+ assertNull(TestValues.NULL, msg.getAlerts());
}
public void testRequiredParamsConstructor(){
- msg = new WeatherServiceData(Test.GENERAL_LOCATIONDETAILS);
+ msg = new WeatherServiceData(TestValues.GENERAL_LOCATIONDETAILS);
LocationDetails location = msg.getLocation();
- assertEquals(Test.GENERAL_LOCATIONDETAILS, location);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(WeatherServiceData.KEY_LOCATION, Test.GENERAL_LOCATIONDETAILS);
- reference.put(WeatherServiceData.KEY_CURRENT_FORECAST, Test.GENERAL_WEATHERDATA);
- reference.put(WeatherServiceData.KEY_MINUTE_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_HOURLY_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_MULTIDAY_FORECAST, Test.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_ALERTS, Test.GENERAL_WEATHERALERT_LIST);
+ reference.put(WeatherServiceData.KEY_LOCATION, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(WeatherServiceData.KEY_CURRENT_FORECAST, TestValues.GENERAL_WEATHERDATA);
+ reference.put(WeatherServiceData.KEY_MINUTE_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_HOURLY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_MULTIDAY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_ALERTS, TestValues.GENERAL_WEATHERALERT_LIST);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
@@ -101,13 +101,13 @@ public class WeatherServiceDataTests extends TestCase {
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateLocationDetails( Test.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
} else if(key.equals(WeatherServiceData.KEY_CURRENT_FORECAST)){
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(Test.TRUE, Validator.validateWeatherData( Test.GENERAL_WEATHERDATA, new WeatherData(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateWeatherData( TestValues.GENERAL_WEATHERDATA, new WeatherData(hashTest)));
} else if(key.equals(WeatherServiceData.KEY_MINUTE_FORECAST) || key.equals(WeatherServiceData.KEY_HOURLY_FORECAST)
|| key.equals(WeatherServiceData.KEY_MULTIDAY_FORECAST)){
@@ -120,7 +120,7 @@ public class WeatherServiceDataTests extends TestCase {
}
assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWeatherDataList(Test.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
+ Validator.validateWeatherDataList(TestValues.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
} else if(key.equals(WeatherServiceData.KEY_ALERTS)){
@@ -132,11 +132,11 @@ public class WeatherServiceDataTests extends TestCase {
}
assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWeatherAlertList(Test.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
+ Validator.validateWeatherAlertList(TestValues.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
}
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
index cbd65fae7..7a576569b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -23,11 +23,11 @@ public class WeatherServiceManifestTests extends TestCase {
public void setUp(){
msg = new WeatherServiceManifest();
- msg.setCurrentForecastSupported(Test.GENERAL_BOOLEAN);
- msg.setMaxHourlyForecastAmount(Test.GENERAL_INT);
- msg.setMaxMinutelyForecastAmount(Test.GENERAL_INT);
- msg.setMaxMultidayForecastAmount(Test.GENERAL_INT);
- msg.setWeatherForLocationSupported(Test.GENERAL_BOOLEAN);
+ msg.setCurrentForecastSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setMaxHourlyForecastAmount(TestValues.GENERAL_INT);
+ msg.setMaxMinutelyForecastAmount(TestValues.GENERAL_INT);
+ msg.setMaxMultidayForecastAmount(TestValues.GENERAL_INT);
+ msg.setWeatherForLocationSupported(TestValues.GENERAL_BOOLEAN);
}
/**
@@ -42,43 +42,43 @@ public class WeatherServiceManifestTests extends TestCase {
Integer getMaxMultidayForecastAmt = msg.getMaxMultidayForecastAmount();
// Valid Tests
- assertEquals(Test.GENERAL_BOOLEAN, currentForecastSupported);
- assertEquals(Test.GENERAL_BOOLEAN, weatherForLocationSupported);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxHourlyForecastAmt);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxMinutelyForecastAmt);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, getMaxMultidayForecastAmt);
+ assertEquals(TestValues.GENERAL_BOOLEAN, currentForecastSupported);
+ assertEquals(TestValues.GENERAL_BOOLEAN, weatherForLocationSupported);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxHourlyForecastAmt);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMinutelyForecastAmt);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMultidayForecastAmt);
// Invalid/Null Tests
WeatherServiceManifest msg = new WeatherServiceManifest();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getCurrentForecastSupported());
- assertNull(Test.NULL, msg.getWeatherForLocationSupported());
- assertNull(Test.NULL, msg.getMaxHourlyForecastAmount());
- assertNull(Test.NULL, msg.getMaxMinutelyForecastAmount());
- assertNull(Test.NULL, msg.getMaxMultidayForecastAmount());
+ assertNull(TestValues.NULL, msg.getCurrentForecastSupported());
+ assertNull(TestValues.NULL, msg.getWeatherForLocationSupported());
+ assertNull(TestValues.NULL, msg.getMaxHourlyForecastAmount());
+ assertNull(TestValues.NULL, msg.getMaxMinutelyForecastAmount());
+ assertNull(TestValues.NULL, msg.getMaxMultidayForecastAmount());
}
public void testJson(){
JSONObject reference = new JSONObject();
try{
- reference.put(WeatherServiceManifest.KEY_CURRENT_FORECAST_SUPPORTED, Test.GENERAL_BOOLEAN);
- reference.put(WeatherServiceManifest.KEY_WEATHER_FOR_LOCATION_SUPPORTED, Test.GENERAL_BOOLEAN);
- reference.put(WeatherServiceManifest.KEY_MAX_HOURLY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
- reference.put(WeatherServiceManifest.KEY_MAX_MINUTELY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
- reference.put(WeatherServiceManifest.KEY_MAX_MULTIDAY_FORECAST_AMOUNT, Test.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_CURRENT_FORECAST_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_WEATHER_FOR_LOCATION_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_MAX_HOURLY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MINUTELY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MULTIDAY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
index 550231452..62f2e4337 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
@@ -9,7 +9,7 @@ import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -34,15 +34,15 @@ public class WindowCapabilityTests extends TestCase {
@Override
public void setUp() {
msg = new WindowCapability();
- msg.setWindowID(Test.GENERAL_INT);
- msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST);
- msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST);
- msg.setImageTypeSupported(Test.GENERAL_IMAGE_TYPE_LIST);
- msg.setTemplatesAvailable(Test.GENERAL_STRING_LIST);
- msg.setNumCustomPresetsAvailable(Test.GENERAL_INT);
- msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- msg.setMenuLayoutsAvailable(Test.GENERAL_MENU_LAYOUT_LIST);
+ msg.setWindowID(TestValues.GENERAL_INT);
+ msg.setTextFields(TestValues.GENERAL_TEXTFIELD_LIST);
+ msg.setImageFields(TestValues.GENERAL_IMAGEFIELD_LIST);
+ msg.setImageTypeSupported(TestValues.GENERAL_IMAGE_TYPE_LIST);
+ msg.setTemplatesAvailable(TestValues.GENERAL_STRING_LIST);
+ msg.setNumCustomPresetsAvailable(TestValues.GENERAL_INT);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ msg.setMenuLayoutsAvailable(TestValues.GENERAL_MENU_LAYOUT_LIST);
}
/**
@@ -61,70 +61,70 @@ public class WindowCapabilityTests extends TestCase {
List<MenuLayout> menuLayouts = msg.getMenuLayoutsAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, windowID);
- assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
- assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
- assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.size(), imageTypeSupported.size());
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), templatesAvailable.size());
- assertEquals(Test.MATCH, Test.GENERAL_INT, numCustomPresetsAvailable);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), softButtonCapabilities.size());
- assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT_LIST.size(), menuLayouts.size());
-
- for (int i = 0; i < Test.GENERAL_TEXTFIELD_LIST.size(); i++) {
- assertTrue(Test.TRUE, Validator.validateTextFields(Test.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, windowID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGE_TYPE_LIST.size(), imageTypeSupported.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), templatesAvailable.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, numCustomPresetsAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), softButtonCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT_LIST.size(), menuLayouts.size());
+
+ for (int i = 0; i < TestValues.GENERAL_TEXTFIELD_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateTextFields(TestValues.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
}
- for (int i = 0; i < Test.GENERAL_IMAGEFIELD_LIST.size(); i++) {
- assertTrue(Test.TRUE, Validator.validateImageFields(Test.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
+ for (int i = 0; i < TestValues.GENERAL_IMAGEFIELD_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateImageFields(TestValues.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
}
- for (int i = 0; i < Test.GENERAL_IMAGE_TYPE_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.get(i), imageTypeSupported.get(i));
+ for (int i = 0; i < TestValues.GENERAL_IMAGE_TYPE_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGE_TYPE_LIST.get(i), imageTypeSupported.get(i));
}
- for (int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
+ for (int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
}
- for(int i = 0; i < Test.GENERAL_MENU_LAYOUT_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT_LIST.get(i), menuLayouts.get(i));
+ for(int i = 0; i < TestValues.GENERAL_MENU_LAYOUT_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT_LIST.get(i), menuLayouts.get(i));
}
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
- assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, softButtonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, softButtonCapabilities));
// Invalid/Null Tests
WindowCapability msg = new WindowCapability();
- assertNotNull(Test.NOT_NULL, msg);
-
- assertNull(Test.NULL, msg.getWindowID());
- assertNull(Test.NULL, msg.getTextFields());
- assertNull(Test.NULL, msg.getImageFields());
- assertNull(Test.NULL, msg.getImageTypeSupported());
- assertNull(Test.NULL, msg.getTemplatesAvailable());
- assertNull(Test.NULL, msg.getNumCustomPresetsAvailable());
- assertNull(Test.NULL, msg.getButtonCapabilities());
- assertNull(Test.NULL, msg.getSoftButtonCapabilities());
- assertNull(Test.NULL, msg.getMenuLayoutsAvailable());
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getWindowID());
+ assertNull(TestValues.NULL, msg.getTextFields());
+ assertNull(TestValues.NULL, msg.getImageFields());
+ assertNull(TestValues.NULL, msg.getImageTypeSupported());
+ assertNull(TestValues.NULL, msg.getTemplatesAvailable());
+ assertNull(TestValues.NULL, msg.getNumCustomPresetsAvailable());
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getMenuLayoutsAvailable());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(WindowCapability.KEY_WINDOW_ID, Test.GENERAL_INT);
- reference.put(WindowCapability.KEY_TEXT_FIELDS, Test.JSON_TEXTFIELDS);
- reference.put(WindowCapability.KEY_IMAGE_FIELDS, Test.JSON_IMAGEFIELDS);
- reference.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, Test.JSON_IMAGE_TYPE_SUPPORTED);
- reference.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- reference.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, Test.GENERAL_INT);
- reference.put(WindowCapability.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
- reference.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
- reference.put(WindowCapability.KEY_MENU_LAYOUTS_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_MENU_LAYOUT_LIST));
+ reference.put(WindowCapability.KEY_WINDOW_ID, TestValues.GENERAL_INT);
+ reference.put(WindowCapability.KEY_TEXT_FIELDS, TestValues.JSON_TEXTFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_FIELDS, TestValues.JSON_IMAGEFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, TestValues.JSON_IMAGE_TYPE_SUPPORTED);
+ reference.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, TestValues.GENERAL_INT);
+ reference.put(WindowCapability.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ reference.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
+ reference.put(WindowCapability.KEY_MENU_LAYOUTS_AVAILABLE, JsonUtils.createJsonArray(TestValues.GENERAL_MENU_LAYOUT_LIST));
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
@@ -133,32 +133,32 @@ public class WindowCapabilityTests extends TestCase {
if (key.equals(WindowCapability.KEY_IMAGE_FIELDS)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
}
} else if (key.equals(WindowCapability.KEY_TEXT_FIELDS)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- assertTrue(Test.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
+ assertTrue(TestValues.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
}
} else if (key.equals(WindowCapability.KEY_TEMPLATES_AVAILABLE)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
- assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if (key.equals(WindowCapability.KEY_BUTTON_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>();
List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>();
@@ -168,11 +168,11 @@ public class WindowCapabilityTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
testList.add(new ButtonCapabilities(hashTest));
}
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
} else if (key.equals(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
List<SoftButtonCapabilities> referenceList = new ArrayList<SoftButtonCapabilities>();
List<SoftButtonCapabilities> testList = new ArrayList<SoftButtonCapabilities>();
@@ -182,21 +182,21 @@ public class WindowCapabilityTests extends TestCase {
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
testList.add(new SoftButtonCapabilities(hashTest));
}
- assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(referenceList, testList));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(referenceList, testList));
} else if (key.equals(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED) || (key.equals(WindowCapability.KEY_MENU_LAYOUTS_AVAILABLE))) {
List<String> referenceList = JsonUtils.readStringListFromJsonObject(reference, key);
List<String> underTestList = JsonUtils.readStringListFromJsonObject(underTest, key);
- assertEquals(Test.MATCH, referenceList.size(), underTestList.size());
+ assertEquals(TestValues.MATCH, referenceList.size(), underTestList.size());
for (int i = 0; i < referenceList.size(); i++) {
- assertEquals(Test.MATCH, referenceList.get(i), underTestList.get(i));
+ assertEquals(TestValues.MATCH, referenceList.get(i), underTestList.get(i));
}
} else {
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
index 84d57ba52..cb91bb4c1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -20,8 +20,8 @@ public class WindowTypeCapabilitiesTest extends TestCase {
public void setUp() {
msg = new WindowTypeCapabilities();
- msg.setMaximumNumberOfWindows(Test.GENERAL_INT);
- msg.setType(Test.GENERAL_WINDOWTYPE);
+ msg.setMaximumNumberOfWindows(TestValues.GENERAL_INT);
+ msg.setType(TestValues.GENERAL_WINDOWTYPE);
}
/**
@@ -33,34 +33,34 @@ public class WindowTypeCapabilitiesTest extends TestCase {
WindowType type = msg.getType();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, maximumNumberOfWindows);
- assertEquals(Test.MATCH, Test.GENERAL_WINDOWTYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, maximumNumberOfWindows);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WINDOWTYPE, type);
// Invalid/Null Tests
WindowTypeCapabilities msg = new WindowTypeCapabilities();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(Test.NULL, msg.getMaximumNumberOfWindows());
- assertNull(Test.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getMaximumNumberOfWindows());
+ assertNull(TestValues.NULL, msg.getType());
}
public void testJson() {
JSONObject reference = new JSONObject();
try {
- reference.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, Test.GENERAL_INT);
- reference.put(WindowTypeCapabilities.KEY_TYPE, Test.GENERAL_WINDOWTYPE);
+ reference.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, TestValues.GENERAL_INT);
+ reference.put(WindowTypeCapabilities.KEY_TYPE, TestValues.GENERAL_WINDOWTYPE);
JSONObject underTest = msg.serializeJSON();
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
index d721e9b58..54c40d69f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -71,21 +71,21 @@ public class RequestTypeTests extends TestCase {
assertNotNull("PROPRIETARY returned null", enumProprietary);
assertNotNull("ICON_URL returned null", enumIconURL);
- assertNotNull(Test.NOT_NULL, enumQueryApps);
- assertNotNull(Test.NOT_NULL, enumLaunchApp);
- assertNotNull(Test.NOT_NULL, enumLockScreen);
- assertNotNull(Test.NOT_NULL, enumTrafficMessage);
- assertNotNull(Test.NOT_NULL, enumDriverProfile);
- assertNotNull(Test.NOT_NULL, enumVoiceSearch);
- assertNotNull(Test.NOT_NULL, enumNavigation);
- assertNotNull(Test.NOT_NULL, enumPhone);
- assertNotNull(Test.NOT_NULL, enumClimate);
- assertNotNull(Test.NOT_NULL, enumSettings);
- assertNotNull(Test.NOT_NULL, enumDiagnostics);
- assertNotNull(Test.NOT_NULL, enumEmergency);
- assertNotNull(Test.NOT_NULL, enumMedia);
- assertNotNull(Test.NOT_NULL, enumFota);
- assertNotNull(Test.NOT_NULL, enumIconURL);
+ assertNotNull(TestValues.NOT_NULL, enumQueryApps);
+ assertNotNull(TestValues.NOT_NULL, enumLaunchApp);
+ assertNotNull(TestValues.NOT_NULL, enumLockScreen);
+ assertNotNull(TestValues.NOT_NULL, enumTrafficMessage);
+ assertNotNull(TestValues.NOT_NULL, enumDriverProfile);
+ assertNotNull(TestValues.NOT_NULL, enumVoiceSearch);
+ assertNotNull(TestValues.NOT_NULL, enumNavigation);
+ assertNotNull(TestValues.NOT_NULL, enumPhone);
+ assertNotNull(TestValues.NOT_NULL, enumClimate);
+ assertNotNull(TestValues.NOT_NULL, enumSettings);
+ assertNotNull(TestValues.NOT_NULL, enumDiagnostics);
+ assertNotNull(TestValues.NOT_NULL, enumEmergency);
+ assertNotNull(TestValues.NOT_NULL, enumMedia);
+ assertNotNull(TestValues.NOT_NULL, enumFota);
+ assertNotNull(TestValues.NOT_NULL, enumIconURL);
}
/**
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
index 2b4fec652..243d61627 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -66,7 +66,7 @@ public class SdlDisconnectedReasonTests extends TestCase {
SdlDisconnectedReason enumRpcSessionEnded = SdlDisconnectedReason.valueForString(example);
example = "RESOURCE_CONSTRAINT";
SdlDisconnectedReason resourceConstraint = SdlDisconnectedReason.valueForString(example);
-
+
assertNotNull("USER_EXIT returned null", enumUserExit);
assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
@@ -163,19 +163,19 @@ public class SdlDisconnectedReasonTests extends TestCase {
* {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason#convertAppInterfaceunregisteredReason(AppInterfaceUnregisteredReason)}
*/
public void testConvertMethod () {
- assertEquals(Test.MATCH, SdlDisconnectedReason.DEFAULT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED));
- assertEquals(Test.MATCH, SdlDisconnectedReason.BLUETOOTH_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.BLUETOOTH_OFF));
- assertEquals(Test.MATCH, SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION));
- assertEquals(Test.MATCH, SdlDisconnectedReason.FACTORY_DEFAULTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS));
- assertEquals(Test.MATCH, SdlDisconnectedReason.IGNITION_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.IGNITION_OFF));
- assertEquals(Test.MATCH, SdlDisconnectedReason.LANGUAGE_CHANGE, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE));
- assertEquals(Test.MATCH, SdlDisconnectedReason.MASTER_RESET, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.MASTER_RESET));
- assertEquals(Test.MATCH, SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL));
- assertEquals(Test.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS));
- assertEquals(Test.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED));
- assertEquals(Test.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.DEFAULT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.BLUETOOTH_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.BLUETOOTH_OFF));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.FACTORY_DEFAULTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.IGNITION_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.IGNITION_OFF));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.LANGUAGE_CHANGE, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.MASTER_RESET, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.MASTER_RESET));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT));
assertEquals(Test.MATCH, SdlDisconnectedReason.RESOURCE_CONSTRAINT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT));
- assertNull(Test.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null));
+ assertNull(TestValues.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null));
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
index 33baa6835..cb55330eb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.rpc.enums;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
@@ -105,10 +105,10 @@ public class TextFieldNameTests extends TestCase {
assertNotNull("templateTitle returned null", templateTitle);
- assertNotNull(Test.NOT_NULL, enumLocName);
- assertNotNull(Test.NOT_NULL, enumLocDesc);
- assertNotNull(Test.NOT_NULL, enumAddLines);
- assertNotNull(Test.NOT_NULL, enumPhone);
+ assertNotNull(TestValues.NOT_NULL, enumLocName);
+ assertNotNull(TestValues.NOT_NULL, enumLocDesc);
+ assertNotNull(TestValues.NOT_NULL, enumAddLines);
+ assertNotNull(TestValues.NOT_NULL, enumPhone);
}
/**
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
index c5f9bebdb..4731de4fd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,7 +26,7 @@ public class OnAppInterfaceUnregisteredTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered();
- msg.setReason(Test.GENERAL_APPINTERFACEUNREGISTEREDREASON);
+ msg.setReason(TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON);
return msg;
}
@@ -40,9 +46,9 @@ public class OnAppInterfaceUnregisteredTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnAppInterfaceUnregistered.KEY_REASON, Test.GENERAL_APPINTERFACEUNREGISTEREDREASON);
+ result.put(OnAppInterfaceUnregistered.KEY_REASON, TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -51,18 +57,19 @@ public class OnAppInterfaceUnregisteredTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
AppInterfaceUnregisteredReason reason = ( (OnAppInterfaceUnregistered) msg ).getReason();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_APPINTERFACEUNREGISTEREDREASON, reason);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON, reason);
// Invalid/Null tests
OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getReason());
+ assertNull(TestValues.NULL, msg.getReason());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
index 8a04d4b6a..10affe5f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
@@ -5,10 +5,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.AppServiceData;
import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,7 +27,7 @@ public class OnAppServiceDataTests extends BaseRpcTests {
protected RPCMessage createMessage(){
OnAppServiceData msg = new OnAppServiceData();
- msg.setServiceData(Test.GENERAL_APPSERVICEDATA);
+ msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
return msg;
}
@@ -40,9 +47,9 @@ public class OnAppServiceDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(OnAppServiceData.KEY_SERVICE_DATA, Test.GENERAL_APPSERVICEDATA.serializeJSON());
+ result.put(OnAppServiceData.KEY_SERVICE_DATA, TestValues.GENERAL_APPSERVICEDATA.serializeJSON());
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -51,23 +58,24 @@ public class OnAppServiceDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
AppServiceData cmdId = ( (OnAppServiceData) msg ).getServiceData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_APPSERVICEDATA, cmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APPSERVICEDATA, cmdId);
// Invalid/Null Tests
OnAppServiceData msg = new OnAppServiceData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getServiceData());
+ assertNull(TestValues.NULL, msg.getServiceData());
// test constructor with param
- msg = new OnAppServiceData(Test.GENERAL_APPSERVICEDATA);
+ msg = new OnAppServiceData(TestValues.GENERAL_APPSERVICEDATA);
AppServiceData serviceData = msg.getServiceData();
- assertEquals(serviceData, Test.GENERAL_APPSERVICEDATA);
+ assertEquals(serviceData, TestValues.GENERAL_APPSERVICEDATA);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
index 1c6efbef5..dc50a7b58 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
@@ -4,9 +4,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONObject;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -37,10 +40,11 @@ public class OnAudioPassThruTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
OnAudioPassThru msg = new OnAudioPassThru();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
index 2bf73753e..2ed9edbf3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
@@ -6,10 +6,16 @@ import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.enums.ButtonEventMode;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -21,9 +27,9 @@ public class OnButtonEventTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnButtonEvent msg = new OnButtonEvent();
- msg.setButtonEventMode(Test.GENERAL_BUTTONEVENTMODE);
- msg.setButtonName(Test.GENERAL_BUTTONNAME);
- msg.setCustomButtonID(Test.GENERAL_INT);
+ msg.setButtonEventMode(TestValues.GENERAL_BUTTONEVENTMODE);
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
+ msg.setCustomButtonID(TestValues.GENERAL_INT);
return msg;
}
@@ -43,11 +49,11 @@ public class OnButtonEventTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnButtonEvent.KEY_BUTTON_EVENT_MODE, Test.GENERAL_BUTTONEVENTMODE);
- result.put(OnButtonEvent.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
- result.put(OnButtonEvent.KEY_CUSTOM_BUTTON_ID, Test.GENERAL_INT);
+ result.put(OnButtonEvent.KEY_BUTTON_EVENT_MODE, TestValues.GENERAL_BUTTONEVENTMODE);
+ result.put(OnButtonEvent.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
+ result.put(OnButtonEvent.KEY_CUSTOM_BUTTON_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,6 +62,7 @@ public class OnButtonEventTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int cmdId = ( (OnButtonEvent) msg ).getCustomButtonID();
@@ -63,17 +70,17 @@ public class OnButtonEventTests extends BaseRpcTests{
ButtonName name = ( (OnButtonEvent) msg ).getButtonName();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, cmdId);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONEVENTMODE, mode);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, name);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, cmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONEVENTMODE, mode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, name);
// Invalid/Null Tests
OnButtonEvent msg = new OnButtonEvent();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getButtonEventMode());
- assertNull(Test.NULL, msg.getButtonName());
- assertNull(Test.NULL, msg.getCustomButtonID());
+ assertNull(TestValues.NULL, msg.getButtonEventMode());
+ assertNull(TestValues.NULL, msg.getButtonName());
+ assertNull(TestValues.NULL, msg.getCustomButtonID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
index dcc300253..e44bf48bf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
@@ -6,10 +6,16 @@ import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -21,9 +27,9 @@ public class OnButtonPressTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnButtonPress msg = new OnButtonPress();
- msg.setButtonName(Test.GENERAL_BUTTONNAME);
- msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
- msg.setCustomButtonID(Test.GENERAL_INT);
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
+ msg.setButtonPressMode(TestValues.GENERAL_BUTTONPRESSMODE);
+ msg.setCustomButtonID(TestValues.GENERAL_INT);
return msg;
}
@@ -43,11 +49,11 @@ public class OnButtonPressTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnButtonPress.KEY_CUSTOM_BUTTON_ID, Test.GENERAL_INT);
- result.put(OnButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
- result.put(OnButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
+ result.put(OnButtonPress.KEY_CUSTOM_BUTTON_ID, TestValues.GENERAL_INT);
+ result.put(OnButtonPress.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
+ result.put(OnButtonPress.KEY_BUTTON_PRESS_MODE, TestValues.GENERAL_BUTTONPRESSMODE);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,6 +62,7 @@ public class OnButtonPressTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int customName = ( (OnButtonPress) msg ).getCustomButtonID();
@@ -63,17 +70,17 @@ public class OnButtonPressTests extends BaseRpcTests{
ButtonPressMode buttonPressMode = ( (OnButtonPress) msg ).getButtonPressMode();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, customName);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, buttonPressMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, customName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONPRESSMODE, buttonPressMode);
// Invalid/Null Tests
OnButtonPress msg = new OnButtonPress();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getCustomButtonID());
- assertNull(Test.NULL, msg.getButtonName());
- assertNull(Test.NULL, msg.getButtonPressMode());
+ assertNull(TestValues.NULL, msg.getCustomButtonID());
+ assertNull(TestValues.NULL, msg.getButtonName());
+ assertNull(TestValues.NULL, msg.getButtonPressMode());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
index 737435ec6..ade4ac3e2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,8 +26,8 @@ public class OnCommandTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnCommand msg = new OnCommand();
- msg.setCmdID(Test.GENERAL_INT);
- msg.setTriggerSource(Test.GENERAL_TRIGGERSOURCE);
+ msg.setCmdID(TestValues.GENERAL_INT);
+ msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE);
return msg;
}
@@ -41,10 +47,10 @@ public class OnCommandTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnCommand.KEY_CMD_ID, Test.GENERAL_INT);
- result.put(OnCommand.KEY_TRIGGER_SOURCE, Test.GENERAL_TRIGGERSOURCE);
+ result.put(OnCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
+ result.put(OnCommand.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -53,21 +59,22 @@ public class OnCommandTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int cmdId = ( (OnCommand) msg ).getCmdID();
TriggerSource triggerSource = ( (OnCommand) msg ).getTriggerSource();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, cmdId);
- assertEquals(Test.MATCH, Test.GENERAL_TRIGGERSOURCE, triggerSource);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, cmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, triggerSource);
// Invalid/Null Tests
OnCommand msg = new OnCommand();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTriggerSource());
- assertNull(Test.NULL, msg.getCmdID());
+ assertNull(TestValues.NULL, msg.getTriggerSource());
+ assertNull(TestValues.NULL, msg.getCmdID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
index c334c7e82..d554ff28e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -44,7 +50,7 @@ public class OnDriverDistractionTests extends BaseRpcTests{
try{
result.put(OnDriverDistraction.KEY_STATE, STATUS);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -53,18 +59,19 @@ public class OnDriverDistractionTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
DriverDistractionState cmdId = ( (OnDriverDistraction) msg ).getState();
// Valid Tests
- assertEquals(Test.MATCH, STATUS, cmdId);
+ assertEquals(TestValues.MATCH, STATUS, cmdId);
// Invalid/Null Tests
OnDriverDistraction msg = new OnDriverDistraction();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getState());
+ assertNull(TestValues.NULL, msg.getState());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnErrorTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnErrorTests.java
index a907c8942..f0c542894 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnErrorTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnErrorTests.java
@@ -2,10 +2,12 @@ package com.smartdevicelink.test.rpc.notifications;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
import com.smartdevicelink.proxy.callbacks.OnError;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.callbacks.OnError}
@@ -17,21 +19,22 @@ public class OnErrorTests extends TestCase {
* {@link com.smartdevicelink.proxy.callbacks.OnError#OnError()}
* {@link com.smartdevicelink.proxy.callbacks.OnError#OnError(String, Exception)}
*/
+ @Test
public void testValues () {
// Valid Tests
OnError testOnError = new OnError();
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
Exception testE = new Exception();
- testOnError = new OnError(Test.GENERAL_STRING, testE);
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testOnError.getInfo());
- assertEquals(Test.MATCH, testE, testOnError.getException());
+ testOnError = new OnError(TestValues.GENERAL_STRING, testE);
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testOnError.getInfo());
+ assertEquals(TestValues.MATCH, testE, testOnError.getException());
// Invalid/Null Tests
testOnError = new OnError(null, null);
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
- assertNull(Test.NULL, testOnError.getInfo());
- assertNull(Test.NULL, testOnError.getException());
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyError, testOnError.getFunctionName());
+ assertNull(TestValues.NULL, testOnError.getInfo());
+ assertNull(TestValues.NULL, testOnError.getException());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
index 56c41b213..c0206c960 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
@@ -8,11 +8,17 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.Version;
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 :
@@ -24,12 +30,12 @@ public class OnHMIStatusTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnHMIStatus msg = new OnHMIStatus();
- msg.setAudioStreamingState(Test.GENERAL_AUDIOSTREAMINGSTATE);
- msg.setVideoStreamingState(Test.GENERAL_VIDEOSTREAMINGSTATE);
- msg.setFirstRun(Test.GENERAL_BOOLEAN);
- msg.setHmiLevel(Test.GENERAL_HMILEVEL);
- msg.setSystemContext(Test.GENERAL_SYSTEMCONTEXT);
- msg.setWindowID(Test.GENERAL_INT);
+ msg.setAudioStreamingState(TestValues.GENERAL_AUDIOSTREAMINGSTATE);
+ msg.setVideoStreamingState(TestValues.GENERAL_VIDEOSTREAMINGSTATE);
+ msg.setFirstRun(TestValues.GENERAL_BOOLEAN);
+ msg.setHmiLevel(TestValues.GENERAL_HMILEVEL);
+ msg.setSystemContext(TestValues.GENERAL_SYSTEMCONTEXT);
+ msg.setWindowID(TestValues.GENERAL_INT);
return msg;
}
@@ -49,13 +55,13 @@ public class OnHMIStatusTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnHMIStatus.KEY_AUDIO_STREAMING_STATE, Test.GENERAL_AUDIOSTREAMINGSTATE);
- result.put(OnHMIStatus.KEY_VIDEO_STREAMING_STATE, Test.GENERAL_VIDEOSTREAMINGSTATE);
- result.put(OnHMIStatus.KEY_HMI_LEVEL, Test.GENERAL_HMILEVEL);
- result.put(OnHMIStatus.KEY_SYSTEM_CONTEXT, Test.GENERAL_SYSTEMCONTEXT);
- result.put(OnHMIStatus.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(OnHMIStatus.KEY_AUDIO_STREAMING_STATE, TestValues.GENERAL_AUDIOSTREAMINGSTATE);
+ result.put(OnHMIStatus.KEY_VIDEO_STREAMING_STATE, TestValues.GENERAL_VIDEOSTREAMINGSTATE);
+ result.put(OnHMIStatus.KEY_HMI_LEVEL, TestValues.GENERAL_HMILEVEL);
+ result.put(OnHMIStatus.KEY_SYSTEM_CONTEXT, TestValues.GENERAL_SYSTEMCONTEXT);
+ result.put(OnHMIStatus.KEY_WINDOW_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -64,6 +70,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
AudioStreamingState audioStreamingState = ( (OnHMIStatus) msg ).getAudioStreamingState();
@@ -73,24 +80,24 @@ public class OnHMIStatusTests extends BaseRpcTests{
int testWindowID = ( (OnHMIStatus) msg ).getWindowID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_AUDIOSTREAMINGSTATE, audioStreamingState);
- assertEquals(Test.MATCH, Test.GENERAL_VIDEOSTREAMINGSTATE, videoStreamingState);
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL, hmiLevel);
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCONTEXT, context);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOSTREAMINGSTATE, audioStreamingState);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VIDEOSTREAMINGSTATE, videoStreamingState);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL, hmiLevel);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCONTEXT, context);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testWindowID);
// Invalid/Null Tests
OnHMIStatus msg = new OnHMIStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAudioStreamingState());
+ assertNull(TestValues.NULL, msg.getAudioStreamingState());
- assertNull(Test.NULL, msg.getVideoStreamingState());
+ assertNull(TestValues.NULL, msg.getVideoStreamingState());
msg.format(new Version(4,5,0),true);
- assertEquals(Test.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
- assertNull(Test.NULL, msg.getHmiLevel());
- assertNull(Test.NULL, msg.getSystemContext());
- assertNull(Test.NULL, msg.getWindowID());
+ assertEquals(TestValues.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
+ assertNull(TestValues.NULL, msg.getHmiLevel());
+ assertNull(TestValues.NULL, msg.getSystemContext());
+ assertNull(TestValues.NULL, msg.getWindowID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
index cfc439a89..785acc62b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
@@ -4,10 +4,16 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnHashChange;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -43,7 +49,7 @@ public class OnHashChangeTests extends BaseRpcTests{
try{
result.put(OnHashChange.KEY_HASH_ID, HASH_ID);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -52,18 +58,19 @@ public class OnHashChangeTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String hashId = ( (OnHashChange) msg ).getHashID();
// Valid Tests
- assertEquals(Test.MATCH, HASH_ID, hashId);
+ assertEquals(TestValues.MATCH, HASH_ID, hashId);
// Invalid/Null Tests
OnHashChange msg = new OnHashChange();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getHashID());
+ assertNull(TestValues.NULL, msg.getHashID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
index 4fded53fe..9d3823499 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
@@ -6,11 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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.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 :
@@ -21,7 +27,7 @@ public class OnInteriorVehicleDataTests extends BaseRpcTests{
@Override
protected RPCMessage createMessage(){
OnInteriorVehicleData msg = new OnInteriorVehicleData();
- msg.setModuleData(Test.GENERAL_MODULEDATA);
+ msg.setModuleData(TestValues.GENERAL_MODULEDATA);
return msg;
}
@@ -41,9 +47,9 @@ public class OnInteriorVehicleDataTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ result.put(OnInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -52,18 +58,19 @@ public class OnInteriorVehicleDataTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ModuleData moduleData = ( (OnInteriorVehicleData) msg ).getModuleData();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, moduleData));
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, moduleData));
// Invalid/Null Tests
OnInteriorVehicleData msg = new OnInteriorVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getModuleData());
+ assertNull(TestValues.NULL, msg.getModuleData());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
index 4f541a84a..48d6d95af 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,8 +26,8 @@ public class OnKeyboardInputTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnKeyboardInput msg = new OnKeyboardInput();
- msg.setData(Test.GENERAL_STRING);
- msg.setEvent(Test.GENERAL_KEYBOARDEVENT);
+ msg.setData(TestValues.GENERAL_STRING);
+ msg.setEvent(TestValues.GENERAL_KEYBOARDEVENT);
return msg;
}
@@ -41,10 +47,10 @@ public class OnKeyboardInputTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnKeyboardInput.KEY_DATA, Test.GENERAL_STRING);
- result.put(OnKeyboardInput.KEY_EVENT, Test.GENERAL_KEYBOARDEVENT);
+ result.put(OnKeyboardInput.KEY_DATA, TestValues.GENERAL_STRING);
+ result.put(OnKeyboardInput.KEY_EVENT, TestValues.GENERAL_KEYBOARDEVENT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -53,21 +59,22 @@ public class OnKeyboardInputTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
KeyboardEvent event = ( (OnKeyboardInput) msg ).getEvent();
String data = ( (OnKeyboardInput) msg ).getData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_KEYBOARDEVENT, event);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, data);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_KEYBOARDEVENT, event);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, data);
// Invalid/Null Tests
OnKeyboardInput msg = new OnKeyboardInput();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getData());
- assertNull(Test.NULL, msg.getEvent());
+ assertNull(TestValues.NULL, msg.getData());
+ assertNull(TestValues.NULL, msg.getEvent());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
index 884851f4c..1030b2609 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnLanguageChange;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,8 +26,8 @@ public class OnLanguageChangeTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnLanguageChange msg = new OnLanguageChange();
- msg.setLanguage(Test.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguage(Test.GENERAL_LANGUAGE);
+ msg.setLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguage(TestValues.GENERAL_LANGUAGE);
return msg;
}
@@ -41,10 +47,10 @@ public class OnLanguageChangeTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnLanguageChange.KEY_LANGUAGE, Test.GENERAL_LANGUAGE);
- result.put(OnLanguageChange.KEY_HMI_DISPLAY_LANGUAGE, Test.GENERAL_LANGUAGE);
+ result.put(OnLanguageChange.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(OnLanguageChange.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -53,21 +59,22 @@ public class OnLanguageChangeTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Language lang = ( (OnLanguageChange) msg ).getLanguage();
Language hmiLang = ( (OnLanguageChange) msg ).getHmiDisplayLanguage();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, lang);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, hmiLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, lang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, hmiLang);
// Invalid/Null Tests
OnLanguageChange msg = new OnLanguageChange();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getLanguage());
- assertNull(Test.NULL, msg.getHmiDisplayLanguage());
+ assertNull(TestValues.NULL, msg.getLanguage());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
}
} \ 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
index 0326cda53..d73b39beb 100644
--- 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
@@ -7,10 +7,16 @@ 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.Test;
+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 :
@@ -22,10 +28,10 @@ public class OnLockScreenStatusTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnLockScreenStatus msg = new OnLockScreenStatus();
- msg.setDriverDistractionStatus(Test.GENERAL_BOOLEAN);
- msg.setHMILevel(Test.GENERAL_HMILEVEL);
- msg.setShowLockScreen(Test.GENERAL_LOCKSCREENSTATUS);
- msg.setUserSelected(Test.GENERAL_BOOLEAN);
+ msg.setDriverDistractionStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHMILevel(TestValues.GENERAL_HMILEVEL);
+ msg.setShowLockScreen(TestValues.GENERAL_LOCKSCREENSTATUS);
+ msg.setUserSelected(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -45,12 +51,12 @@ public class OnLockScreenStatusTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnLockScreenStatus.KEY_DRIVER_DISTRACTION, Test.GENERAL_BOOLEAN);
- result.put(OnHMIStatus.KEY_HMI_LEVEL, Test.GENERAL_HMILEVEL);
- result.put(OnLockScreenStatus.KEY_SHOW_LOCK_SCREEN, Test.GENERAL_LOCKSCREENSTATUS);
- result.put(OnLockScreenStatus.KEY_USER_SELECTED, Test.GENERAL_BOOLEAN);
+ 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(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -59,6 +65,7 @@ public class OnLockScreenStatusTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Boolean status = ( (OnLockScreenStatus) msg ).getDriverDistractionStatus();
@@ -67,19 +74,19 @@ public class OnLockScreenStatusTests extends BaseRpcTests{
boolean userSelected = ( (OnLockScreenStatus) msg ).getUserSelected();
// Valid Tests
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, status);
- assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL, hmiLevel);
- assertEquals(Test.MATCH, Test.GENERAL_LOCKSCREENSTATUS, lockScreen);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, userSelected);
+ 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(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getDriverDistractionStatus());
- assertNull(Test.NULL, msg.getHMILevel());
- assertNull(Test.NULL, msg.getShowLockScreen());
- assertNull(Test.NULL, msg.getUserSelected());
+ 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/OnPermissionsChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
index 5064753c6..e090afce8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
@@ -5,14 +5,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.List;
+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.rpc.OnPermissionsChange}
@@ -23,8 +30,8 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnPermissionsChange msg = new OnPermissionsChange();
- msg.setPermissionItem(Test.GENERAL_PERMISSIONITEM_LIST);
- msg.setRequireEncryption(Test.GENERAL_BOOLEAN);
+ msg.setPermissionItem(TestValues.GENERAL_PERMISSIONITEM_LIST);
+ msg.setRequireEncryption(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -44,10 +51,10 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnPermissionsChange.KEY_PERMISSION_ITEM, Test.JSON_PERMISSIONITEMS);
- result.put(OnPermissionsChange.KEY_REQUIRE_ENCRYPTION, Test.GENERAL_BOOLEAN);
+ result.put(OnPermissionsChange.KEY_PERMISSION_ITEM, TestValues.JSON_PERMISSIONITEMS);
+ result.put(OnPermissionsChange.KEY_REQUIRE_ENCRYPTION, TestValues.GENERAL_BOOLEAN);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,23 +63,24 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<PermissionItem> data = ( (OnPermissionsChange) msg ).getPermissionItem();
boolean isRequired = ((OnPermissionsChange)msg).getRequireEncryption();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_PERMISSIONITEM_LIST.size(), data.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PERMISSIONITEM_LIST.size(), data.size());
for(int i=0; i<data.size(); i++){
- assertTrue(Test.TRUE, Validator.validatePermissionItem(Test.GENERAL_PERMISSIONITEM_LIST.get(i), data.get(i)));
+ assertTrue(TestValues.TRUE, Validator.validatePermissionItem(TestValues.GENERAL_PERMISSIONITEM_LIST.get(i), data.get(i)));
}
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isRequired);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isRequired);
// Invalid/Null Tests
OnPermissionsChange msg = new OnPermissionsChange();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getRequireEncryption());
+ assertNull(TestValues.NULL, msg.getRequireEncryption());
- assertNull(Test.NULL, msg.getPermissionItem());
+ assertNull(TestValues.NULL, msg.getPermissionItem());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyClosedTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyClosedTests.java
index defede878..1ef639029 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyClosedTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyClosedTests.java
@@ -3,10 +3,12 @@ package com.smartdevicelink.test.rpc.notifications;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
import com.smartdevicelink.proxy.callbacks.OnProxyClosed;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.callbacks.OnProxyClosed}
@@ -18,24 +20,25 @@ public class OnProxyClosedTests extends TestCase {
* {@link com.smartdevicelink.proxy.callbacks.OnProxyClosed#OnProxyClosed()}
* {@link com.smartdevicelink.proxy.callbacks.OnProxyClosed#OnProxyClosed(String, Exception, SdlDisconnectedReason)}
*/
+ @Test
public void testValues () {
// Valid Tests
OnProxyClosed testOnProxyClosed = new OnProxyClosed();
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
Exception testE = new Exception();
SdlDisconnectedReason testReason = SdlDisconnectedReason.DEFAULT;
- testOnProxyClosed = new OnProxyClosed(Test.GENERAL_STRING, testE, testReason);
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testOnProxyClosed.getInfo());
- assertEquals(Test.MATCH, testE, testOnProxyClosed.getException());
- assertEquals(Test.MATCH, testReason, testOnProxyClosed.getReason());
+ testOnProxyClosed = new OnProxyClosed(TestValues.GENERAL_STRING, testE, testReason);
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testOnProxyClosed.getInfo());
+ assertEquals(TestValues.MATCH, testE, testOnProxyClosed.getException());
+ assertEquals(TestValues.MATCH, testReason, testOnProxyClosed.getReason());
// Invalid/Null Tests
testOnProxyClosed = new OnProxyClosed(null, null, null);
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
- assertNull(Test.NULL, testOnProxyClosed.getInfo());
- assertNull(Test.NULL, testOnProxyClosed.getException());
- assertNull(Test.NULL, testOnProxyClosed.getReason());
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyClosed, testOnProxyClosed.getFunctionName());
+ assertNull(TestValues.NULL, testOnProxyClosed.getInfo());
+ assertNull(TestValues.NULL, testOnProxyClosed.getException());
+ assertNull(TestValues.NULL, testOnProxyClosed.getReason());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyOpenedTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyOpenedTests.java
index 312d5abd1..3f76fd4cb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyOpenedTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnProxyOpenedTests.java
@@ -2,10 +2,12 @@ package com.smartdevicelink.test.rpc.notifications;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
import com.smartdevicelink.proxy.callbacks.OnProxyOpened;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import junit.framework.TestCase;
+import org.junit.Test;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.callbacks.OnProxyOpened}
@@ -18,9 +20,10 @@ public class OnProxyOpenedTests extends TestCase {
* {@link com.smartdevicelink.proxy.callbacks.OnProxyOpened#OnProxyOpened()}
* {@link com.smartdevicelink.proxy.callbacks.OnProxyOpened#getFunctionName()}
*/
+ @Test
public void testMethods () {
OnProxyOpened testOnProxyOpened = new OnProxyOpened();
- assertNotNull(Test.NOT_NULL, testOnProxyOpened);
- assertEquals(Test.MATCH, InternalProxyMessage.OnProxyOpened, testOnProxyOpened.getFunctionName());
+ assertNotNull(TestValues.NOT_NULL, testOnProxyOpened);
+ assertEquals(TestValues.MATCH, InternalProxyMessage.OnProxyOpened, testOnProxyOpened.getFunctionName());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
index a6d4d63fd..c292756e6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
@@ -6,29 +6,34 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.OnRCStatus;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+
public class OnRCStatusTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
OnRCStatus msg = new OnRCStatus();
- List<ModuleData> listAllocatedModules = Test.GENERAL_MODULEDATA_LIST;
+ List<ModuleData> listAllocatedModules = TestValues.GENERAL_MODULEDATA_LIST;
msg.setAllocatedModules(listAllocatedModules);
List<ModuleData> listFreeModules = new ArrayList<>();
- listFreeModules.add(Test.GENERAL_MODULEDATA);
+ listFreeModules.add(TestValues.GENERAL_MODULEDATA);
msg.setFreeModules(listFreeModules);
- msg.setAllowed(Test.GENERAL_BOOLEAN);
+ msg.setAllowed(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -49,8 +54,8 @@ public class OnRCStatusTests extends BaseRpcTests {
JSONArray jsonArrayAllocatedModules = new JSONArray();
JSONArray jsonArrayFreeModules = new JSONArray();
try {
- jsonArrayAllocatedModules.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
- jsonArrayFreeModules.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ jsonArrayAllocatedModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
+ jsonArrayFreeModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
} catch (JSONException e) {
e.printStackTrace();
}
@@ -58,7 +63,7 @@ public class OnRCStatusTests extends BaseRpcTests {
try {
result.put(OnRCStatus.KEY_ALLOCATED_MODULES, jsonArrayAllocatedModules);
result.put(OnRCStatus.KEY_FREE_MODULES, jsonArrayFreeModules);
- result.put(OnRCStatus.KEY_ALLOWED, Test.GENERAL_BOOLEAN);
+ result.put(OnRCStatus.KEY_ALLOWED, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
e.printStackTrace();
}
@@ -69,6 +74,7 @@ public class OnRCStatusTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues() {
// Test Values
List<ModuleData> listAllocatedModules = ((OnRCStatus) msg).getAllocatedModules();
@@ -76,17 +82,17 @@ public class OnRCStatusTests extends BaseRpcTests {
Boolean allowed = ((OnRCStatus) msg).getAllowed();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULEDATA, listAllocatedModules.get(0));
- assertEquals(Test.MATCH, Test.GENERAL_MODULEDATA, listFreeModules.get(0));
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, allowed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listAllocatedModules.get(0));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listFreeModules.get(0));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, allowed);
// Invalid/Null Tests
OnRCStatus msg = new OnRCStatus();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAllocatedModules());
- assertNull(Test.NULL, msg.getFreeModules());
- assertNull(Test.NULL, msg.getAllowed());
+ assertNull(TestValues.NULL, msg.getAllocatedModules());
+ assertNull(TestValues.NULL, msg.getFreeModules());
+ assertNull(TestValues.NULL, msg.getAllowed());
}
}
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
index 7146ca0cf..f3efebe84 100644
--- 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
@@ -6,11 +6,18 @@ 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.Test;
+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 :
@@ -23,9 +30,9 @@ public class OnSdlChoiceChosenTests extends BaseRpcTests{
@Override
protected RPCMessage createMessage(){
OnSdlChoiceChosen msg = new OnSdlChoiceChosen();
- sdlChoice = msg.new SdlChoice(Test.GENERAL_CHOICE);
+ sdlChoice = msg.new SdlChoice(TestValues.GENERAL_CHOICE);
- msg.setTriggerSource(Test.GENERAL_TRIGGERSOURCE);
+ msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE);
msg.setSdlChoice(sdlChoice);
return msg;
@@ -46,10 +53,10 @@ public class OnSdlChoiceChosenTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnSdlChoiceChosen.KEY_TRIGGER_SOURCE, Test.GENERAL_TRIGGERSOURCE);
+ result.put(OnSdlChoiceChosen.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
result.put(OnSdlChoiceChosen.KEY_SDL_CHOICE, sdlChoice);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,21 +65,22 @@ public class OnSdlChoiceChosenTests extends BaseRpcTests{
/**
* 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(Test.MATCH, Validator.validateChoice(Test.GENERAL_CHOICE, data.getChoice()));
- assertEquals(Test.MATCH, Test.GENERAL_TRIGGERSOURCE, source);
+ 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(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTriggerSource());
- assertNull(Test.NULL, msg.getSdlChoice());
+ 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
index 58db7d8eb..863abf4e0 100644
--- 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
@@ -4,10 +4,16 @@ 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.Test;
+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.
@@ -18,9 +24,9 @@ public class OnStreamRPCTests extends BaseRpcTests {
protected RPCMessage createMessage(){
OnStreamRPC msg = new OnStreamRPC();
- msg.setBytesComplete(Test.GENERAL_LONG);
- msg.setFileName(Test.GENERAL_STRING);
- msg.setFileSize(Test.GENERAL_LONG);
+ msg.setBytesComplete(TestValues.GENERAL_LONG);
+ msg.setFileName(TestValues.GENERAL_STRING);
+ msg.setFileSize(TestValues.GENERAL_LONG);
return msg;
}
@@ -40,11 +46,11 @@ public class OnStreamRPCTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(OnStreamRPC.KEY_BYTESCOMPLETE, Test.GENERAL_LONG);
- result.put(OnStreamRPC.KEY_FILENAME, Test.GENERAL_STRING);
- result.put(OnStreamRPC.KEY_FILESIZE, Test.GENERAL_LONG);
+ 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(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -53,6 +59,7 @@ public class OnStreamRPCTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Long bytes = ((OnStreamRPC) msg).getBytesComplete();
@@ -60,17 +67,17 @@ public class OnStreamRPCTests extends BaseRpcTests {
Long fileSize = ((OnStreamRPC) msg).getFileSize();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LONG, bytes);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, fileName);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, fileSize);
+ 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(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getBytesComplete());
- assertNull(Test.NULL, msg.getFileName());
- assertNull(Test.NULL, msg.getFileSize());
+ 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/notifications/OnSystemCapabilityUpdatedTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
index ca0fa5f02..37fa2e570 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,7 +26,7 @@ public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
protected RPCMessage createMessage(){
OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
- msg.setSystemCapability(Test.GENERAL_SYSTEMCAPABILITY);
+ msg.setSystemCapability(TestValues.GENERAL_SYSTEMCAPABILITY);
return msg;
}
@@ -40,9 +46,9 @@ public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, Test.GENERAL_SYSTEMCAPABILITY.serializeJSON());
+ result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, TestValues.GENERAL_SYSTEMCAPABILITY.serializeJSON());
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -51,23 +57,24 @@ public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
SystemCapability cmdId = ( (OnSystemCapabilityUpdated) msg ).getSystemCapability();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITY, cmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITY, cmdId);
// Invalid/Null Tests
OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSystemCapability());
+ assertNull(TestValues.NULL, msg.getSystemCapability());
// test constructor with param
- msg = new OnSystemCapabilityUpdated(Test.GENERAL_SYSTEMCAPABILITY);
+ msg = new OnSystemCapabilityUpdated(TestValues.GENERAL_SYSTEMCAPABILITY);
SystemCapability systemCapability = msg.getSystemCapability();
- assertEquals(systemCapability, Test.GENERAL_SYSTEMCAPABILITY);
+ assertEquals(systemCapability, TestValues.GENERAL_SYSTEMCAPABILITY);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
index d4490dd15..6ee431ea9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
@@ -7,11 +7,18 @@ import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -23,13 +30,13 @@ public class OnSystemRequestTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnSystemRequest msg = new OnSystemRequest();
- msg.setFileType(Test.GENERAL_FILETYPE);
- msg.setLength(Test.GENERAL_LONG);
- msg.setOffset(Test.GENERAL_LONG);
- msg.setRequestType(Test.GENERAL_REQUESTTYPE);
- msg.setRequestSubType(Test.GENERAL_STRING);
- msg.setTimeout(Test.GENERAL_INT);
- msg.setUrl(Test.GENERAL_STRING);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setLength(TestValues.GENERAL_LONG);
+ msg.setOffset(TestValues.GENERAL_LONG);
+ msg.setRequestType(TestValues.GENERAL_REQUESTTYPE);
+ msg.setRequestSubType(TestValues.GENERAL_STRING);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setUrl(TestValues.GENERAL_STRING);
return msg;
}
@@ -49,15 +56,15 @@ public class OnSystemRequestTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnSystemRequest.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
- result.put(OnSystemRequest.KEY_LENGTH, Test.GENERAL_LONG);
- result.put(OnSystemRequest.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(OnSystemRequest.KEY_OFFSET, Test.GENERAL_LONG);
- result.put(OnSystemRequest.KEY_URL, Test.GENERAL_STRING);
- result.put(OnSystemRequest.KEY_REQUEST_TYPE, Test.GENERAL_REQUESTTYPE);
- result.put(OnSystemRequest.KEY_REQUEST_SUB_TYPE, Test.GENERAL_STRING);
+ result.put(OnSystemRequest.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(OnSystemRequest.KEY_LENGTH, TestValues.GENERAL_LONG);
+ result.put(OnSystemRequest.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(OnSystemRequest.KEY_OFFSET, TestValues.GENERAL_LONG);
+ result.put(OnSystemRequest.KEY_URL, TestValues.GENERAL_STRING);
+ result.put(OnSystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
+ result.put(OnSystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
} catch(JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -66,6 +73,7 @@ public class OnSystemRequestTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
FileType fileType = ( (OnSystemRequest) msg ).getFileType();
@@ -78,28 +86,28 @@ public class OnSystemRequestTests extends BaseRpcTests{
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, fileType);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, length);
- assertEquals(Test.MATCH, Test.GENERAL_INT, timeout);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, offset);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, url);
- assertEquals(Test.MATCH, Test.GENERAL_REQUESTTYPE, requestType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, requestSubType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, length);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, timeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, offset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, url);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, requestType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, requestSubType);
// Test Body
OnSystemRequest osr = (OnSystemRequest) msg;
String body = osr.getBody();
- assertNull(Test.NULL, body);
+ assertNull(TestValues.NULL, body);
String testBody = "123ABC";
osr.setBody(testBody);
String readBody = osr.getBody();
- assertEquals(Test.MATCH, testBody, readBody);
+ assertEquals(TestValues.MATCH, testBody, readBody);
// Test Headers
Headers headers = osr.getHeader();
- assertNull(Test.NULL, headers);
+ assertNull(TestValues.NULL, headers);
Headers testHeaders = new Headers();
testHeaders.setCharset("ASCII");
@@ -115,19 +123,19 @@ public class OnSystemRequestTests extends BaseRpcTests{
osr.setHeaders(testHeaders);
Headers readHeaders = osr.getHeader();
- assertTrue(Test.TRUE, Validator.validateHeaders(testHeaders, readHeaders));
+ assertTrue(TestValues.TRUE, Validator.validateHeaders(testHeaders, readHeaders));
// Invalid/Null Tests
OnSystemRequest msg = new OnSystemRequest();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getFileType());
- assertNull(Test.NULL, msg.getLength());
- assertNull(Test.NULL, msg.getOffset());
- assertNull(Test.NULL, msg.getTimeout());
- assertNull(Test.NULL, msg.getUrl());
- assertNull(Test.NULL, msg.getRequestType());
- assertNull(Test.NULL, msg.getRequestSubType());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getLength());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getUrl());
+ assertNull(TestValues.NULL, msg.getRequestType());
+ assertNull(TestValues.NULL, msg.getRequestSubType());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
index 3b8b8fa3f..54cd86851 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
@@ -5,10 +5,16 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
import com.smartdevicelink.proxy.rpc.enums.TBTState;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+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 :
@@ -20,7 +26,7 @@ public class OnTBTClientStateTests extends BaseRpcTests{
protected RPCMessage createMessage(){
OnTBTClientState msg = new OnTBTClientState();
- msg.setState(Test.GENERAL_TBTSTATE);
+ msg.setState(TestValues.GENERAL_TBTSTATE);
return msg;
}
@@ -40,9 +46,9 @@ public class OnTBTClientStateTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnTBTClientState.KEY_STATE, Test.GENERAL_TBTSTATE);
+ result.put(OnTBTClientState.KEY_STATE, TestValues.GENERAL_TBTSTATE);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -51,18 +57,19 @@ public class OnTBTClientStateTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
TBTState data = ( (OnTBTClientState) msg ).getState();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_TBTSTATE, data);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TBTSTATE, data);
// Invalid/Null Tests
OnTBTClientState msg = new OnTBTClientState();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getState());
+ assertNull(TestValues.NULL, msg.getState());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
index a978d12e7..16f048aa3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.TouchEvent;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.List;
+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.rpc.OnTouchEvent}
@@ -23,8 +30,8 @@ public class OnTouchEventTests extends BaseRpcTests{
@Override
protected RPCMessage createMessage(){
OnTouchEvent msg = new OnTouchEvent();
- msg.setType(Test.GENERAL_TOUCHTYPE);
- msg.setEvent(Test.GENERAL_TOUCHEVENT_LIST);
+ msg.setType(TestValues.GENERAL_TOUCHTYPE);
+ msg.setEvent(TestValues.GENERAL_TOUCHEVENT_LIST);
return msg;
}
@@ -44,10 +51,10 @@ public class OnTouchEventTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(OnTouchEvent.KEY_TYPE,Test.GENERAL_TOUCHTYPE);
- result.put(OnTouchEvent.KEY_EVENT, Test.JSON_TOUCHEVENTS);
+ result.put(OnTouchEvent.KEY_TYPE, TestValues.GENERAL_TOUCHTYPE);
+ result.put(OnTouchEvent.KEY_EVENT, TestValues.JSON_TOUCHEVENTS);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,26 +63,27 @@ public class OnTouchEventTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
TouchType type = ( (OnTouchEvent) msg ).getType();
List<TouchEvent> event = ( (OnTouchEvent) msg ).getEvent();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_TOUCHTYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_TOUCHEVENT_LIST.size(), event.size());
- for(int i=0; i< Test.GENERAL_TOUCHEVENT_LIST.size(); i++){
- TouchEvent referenceEvent = Test.GENERAL_TOUCHEVENT_LIST.get(i);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHTYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHEVENT_LIST.size(), event.size());
+ for(int i = 0; i< TestValues.GENERAL_TOUCHEVENT_LIST.size(); i++){
+ TouchEvent referenceEvent = TestValues.GENERAL_TOUCHEVENT_LIST.get(i);
TouchEvent dataEvent = event.get(i);
- assertTrue(Test.TRUE, Validator.validateTouchEvent(referenceEvent, dataEvent));
+ assertTrue(TestValues.TRUE, Validator.validateTouchEvent(referenceEvent, dataEvent));
}
// Invalid/Null Tests
OnTouchEvent msg = new OnTouchEvent();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getType());
- assertNull(Test.NULL, msg.getEvent());
+ assertNull(TestValues.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getEvent());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
index e366e832f..76a7675a1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
@@ -25,18 +25,25 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.proxy.rpc.enums.WiperStatus;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.VehicleDataHelper;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+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.OnVehicleData}
@@ -92,9 +99,9 @@ public class OnVehicleDataTests extends BaseRpcTests{
result.put(OnVehicleData.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -103,6 +110,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Double speed = ( (OnVehicleData) msg).getSpeed();
@@ -134,77 +142,78 @@ public class OnVehicleDataTests extends BaseRpcTests{
List<FuelRange> fuelRangeList = ( (OnVehicleData) msg).getFuelRange();
TurnSignal turnSignal = ( (OnVehicleData) msg).getTurnSignal();
ElectronicParkBrakeStatus electronicParkBrakeStatus = ( (OnVehicleData) msg).getElectronicParkBrakeStatus();
- Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
- assertEquals(Test.MATCH, VehicleDataHelper.SPEED, speed);
- assertEquals(Test.MATCH, VehicleDataHelper.RPM, rpm);
- assertEquals(Test.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, external);
- assertEquals(Test.MATCH, VehicleDataHelper.FUEL_LEVEL, fuelLevel);
- assertEquals(Test.MATCH, VehicleDataHelper.VIN, vin);
- assertEquals(Test.MATCH, VehicleDataHelper.PRNDL_FINAL, prndl);
- assertTrue(Test.MATCH, Validator.validateTireStatus(VehicleDataHelper.TIRE_PRESSURE, pressure));
- assertEquals(Test.MATCH, VehicleDataHelper.ENGINE_TORQUE, torque);
- assertEquals(Test.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, engineOilLife);
- assertEquals(Test.MATCH, VehicleDataHelper.ODOMETER, odometer);
- assertTrue(Test.MATCH, Validator.validateGpsData(VehicleDataHelper.GPS, gps));
- assertEquals(Test.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, state);
- assertEquals(Test.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, consumption);
- assertTrue(Test.TRUE, Validator.validateBeltStatus(VehicleDataHelper.BELT_STATUS, belt));
- assertTrue(Test.TRUE, Validator.validateBodyInformation(VehicleDataHelper.BODY_INFORMATION, body));
- assertTrue(Test.TRUE, Validator.validateDeviceStatus(VehicleDataHelper.DEVICE_STATUS, device));
- assertEquals(Test.MATCH, VehicleDataHelper.DRIVER_BRAKING, brake);
- assertEquals(Test.MATCH, VehicleDataHelper.WIPER_STATUS, wiper);
- assertTrue(Test.TRUE, Validator.validateHeadLampStatus(VehicleDataHelper.HEAD_LAMP_STATUS, lamp));
- assertEquals(Test.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, pedal);
- assertEquals(Test.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, wheel);
- assertTrue(Test.TRUE, Validator.validateECallInfo(VehicleDataHelper.E_CALL_INFO, ecall));
- assertTrue(Test.TRUE, Validator.validateAirbagStatus(VehicleDataHelper.AIRBAG_STATUS, airbag));
- assertTrue(Test.TRUE, Validator.validateEmergencyEvent(VehicleDataHelper.EMERGENCY_EVENT, event));
- assertTrue(Test.TRUE, Validator.validateClusterModeStatus(VehicleDataHelper.CLUSTER_MODE_STATUS, cluster));
- assertTrue(Test.TRUE, Validator.validateMyKey(VehicleDataHelper.MY_KEY, key));
- assertTrue(Test.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
- assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
- assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
- assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, speed);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.RPM, rpm);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, external);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, fuelLevel);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.VIN, vin);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, prndl);
+ assertTrue(TestValues.MATCH, Validator.validateTireStatus(VehicleDataHelper.TIRE_PRESSURE, pressure));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, torque);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, engineOilLife);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ODOMETER, odometer);
+ assertTrue(TestValues.MATCH, Validator.validateGpsData(VehicleDataHelper.GPS, gps));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, state);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, consumption);
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(VehicleDataHelper.BELT_STATUS, belt));
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(VehicleDataHelper.BODY_INFORMATION, body));
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(VehicleDataHelper.DEVICE_STATUS, device));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, brake);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, wiper);
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(VehicleDataHelper.HEAD_LAMP_STATUS, lamp));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, pedal);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, wheel);
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(VehicleDataHelper.E_CALL_INFO, ecall));
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(VehicleDataHelper.AIRBAG_STATUS, airbag));
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(VehicleDataHelper.EMERGENCY_EVENT, event));
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(VehicleDataHelper.CLUSTER_MODE_STATUS, cluster));
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(VehicleDataHelper.MY_KEY, key));
+ assertTrue(TestValues.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
// Invalid/Null Tests
OnVehicleData msg = new OnVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getVin());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getVin());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
-
+
+ @Test
public void testJson() {
JSONObject reference = new JSONObject();
@@ -377,13 +386,13 @@ public class OnVehicleDataTests extends BaseRpcTests{
reference.put(OnVehicleData.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
reference.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ reference.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
//go inside underTest and only return the JSONObject inside the parameters key inside the notification key
underTest = underTest.getJSONObject("notification").getJSONObject("parameters");
- assertEquals(Test.MATCH, reference.length(), underTest.length());
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
@@ -394,7 +403,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject tirePressureReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject tirePressureTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateTireStatus(
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(
new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureReference)),
new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureTest))));
@@ -402,49 +411,49 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject GPSObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject GPSObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateGpsData(
+ assertTrue(TestValues.TRUE, Validator.validateGpsData(
new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjReference)),
new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjTest))));
} else if (key.equals(OnVehicleData.KEY_BELT_STATUS)) {
JSONObject beltObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject beltObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateBeltStatus(
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(
new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjReference)),
new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjTest))));
} else if (key.equals(OnVehicleData.KEY_BODY_INFORMATION)) {
JSONObject bodyInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject bodyInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateBodyInformation(
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(
new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjReference)),
new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjTest))));
} else if (key.equals(OnVehicleData.KEY_DEVICE_STATUS)) {
JSONObject deviceObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject deviceObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateDeviceStatus(
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(
new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjReference)),
new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjTest))));
} else if (key.equals(OnVehicleData.KEY_HEAD_LAMP_STATUS)) {
JSONObject headLampObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject headLampObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateHeadLampStatus(
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(
new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjReference)),
new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjTest))));
} else if (key.equals(OnVehicleData.KEY_E_CALL_INFO)) {
JSONObject callInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject callInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateECallInfo(
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(
new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjReference)),
new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjTest))));
} else if (key.equals(OnVehicleData.KEY_AIRBAG_STATUS)) {
JSONObject airbagObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject airbagObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateAirbagStatus(
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(
new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjReference)),
new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjTest))));
}
@@ -452,7 +461,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject emergencyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject emergencyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateEmergencyEvent(
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(
new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjReference)),
new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjTest))));
}
@@ -460,7 +469,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject clusterModeObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject clusterModeObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateClusterModeStatus(
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(
new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjReference)),
new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjTest))));
}
@@ -468,7 +477,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- assertTrue(Test.TRUE, Validator.validateMyKey(
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(
new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
}
@@ -490,16 +499,16 @@ public class OnVehicleDataTests extends BaseRpcTests{
fuelRangeUnderTestList.add(fuelRange);
}
- assertTrue(Test.TRUE, Validator.validateFuelRange(
+ assertTrue(TestValues.TRUE, Validator.validateFuelRange(
fuelRangeRefereceList,
fuelRangeUnderTestList));
}
else {
- assertEquals(Test.TRUE, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.TRUE, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
index dcc02dafd..efdd3eba0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
@@ -7,15 +7,20 @@ import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+
/**
* Created by austinkirk on 6/7/17.
*/
@@ -26,8 +31,8 @@ public class OnWayPointChangeTests extends BaseRpcTests {
OnWayPointChange msg = new OnWayPointChange();
List<LocationDetails> list = new ArrayList<>();
- list.add(Test.GENERAL_LOCATIONDETAILS);
- list.add(Test.GENERAL_LOCATIONDETAILS);
+ list.add(TestValues.GENERAL_LOCATIONDETAILS);
+ list.add(TestValues.GENERAL_LOCATIONDETAILS);
msg.setWayPoints(list);
@@ -50,8 +55,8 @@ public class OnWayPointChangeTests extends BaseRpcTests {
JSONArray jsonArray = new JSONArray();
try {
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LOCATIONDETAILS.getStore()));
} catch (JSONException e) {
e.printStackTrace();
}
@@ -68,19 +73,20 @@ public class OnWayPointChangeTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<LocationDetails> list = ((OnWayPointChange) msg).getWayPoints();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LOCATIONDETAILS, list.get(0));
- assertEquals(Test.MATCH, Test.GENERAL_LOCATIONDETAILS, list.get(1));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LOCATIONDETAILS, list.get(0));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LOCATIONDETAILS, list.get(1));
// Invalid/Null Tests
OnWayPointChange msg = new OnWayPointChange();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getWayPoints());
+ assertNull(TestValues.NULL, msg.getWayPoints());
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
index aa7967c2a..d31ff4464 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
@@ -8,15 +8,22 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -28,10 +35,10 @@ public class AddCommandTests extends BaseRpcTests{
protected RPCMessage createMessage(){
AddCommand msg = new AddCommand();
- msg.setCmdIcon(Test.GENERAL_IMAGE);
- msg.setMenuParams(Test.GENERAL_MENUPARAMS);
- msg.setVrCommands(Test.GENERAL_STRING_LIST);
- msg.setCmdID(Test.GENERAL_INT);
+ msg.setCmdIcon(TestValues.GENERAL_IMAGE);
+ msg.setMenuParams(TestValues.GENERAL_MENUPARAMS);
+ msg.setVrCommands(TestValues.GENERAL_STRING_LIST);
+ msg.setCmdID(TestValues.GENERAL_INT);
return msg;
}
@@ -51,12 +58,12 @@ public class AddCommandTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(AddCommand.KEY_CMD_ICON, Test.JSON_IMAGE);
- result.put(AddCommand.KEY_MENU_PARAMS, Test.JSON_MENUPARAMS);
- result.put(AddCommand.KEY_VR_COMMANDS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(AddCommand.KEY_CMD_ID, Test.GENERAL_INT);
+ result.put(AddCommand.KEY_CMD_ICON, TestValues.JSON_IMAGE);
+ result.put(AddCommand.KEY_MENU_PARAMS, TestValues.JSON_MENUPARAMS);
+ result.put(AddCommand.KEY_VR_COMMANDS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(AddCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -65,6 +72,7 @@ public class AddCommandTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testCmdId = ( (AddCommand) msg ).getCmdID();
@@ -73,62 +81,63 @@ public class AddCommandTests extends BaseRpcTests{
List<String> testVrCommands = ( (AddCommand) msg ).getVrCommands();
// Valid Tests
- assertNotNull(Test.NOT_NULL, testMenuParams);
- assertNotNull(Test.NOT_NULL, testImage);
- assertNotNull(Test.NOT_NULL, testVrCommands);
+ assertNotNull(TestValues.NOT_NULL, testMenuParams);
+ assertNotNull(TestValues.NOT_NULL, testImage);
+ assertNotNull(TestValues.NOT_NULL, testVrCommands);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testCmdId);
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), testVrCommands.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testCmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testVrCommands.size());
- assertTrue(Test.TRUE, Validator.validateMenuParams(Test.GENERAL_MENUPARAMS, testMenuParams));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testImage));
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testVrCommands));
+ assertTrue(TestValues.TRUE, Validator.validateMenuParams(TestValues.GENERAL_MENUPARAMS, testMenuParams));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testVrCommands));
// Invalid/Null Tests
AddCommand msg = new AddCommand();
- assertNotNull(Test.NULL, msg);
+ assertNotNull(TestValues.NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getCmdIcon());
- assertNull(Test.NULL, msg.getCmdID());
- assertNull(Test.NULL, msg.getMenuParams());
- assertNull(Test.NULL, msg.getVrCommands());
+ assertNull(TestValues.NULL, msg.getCmdIcon());
+ assertNull(TestValues.NULL, msg.getCmdID());
+ assertNull(TestValues.NULL, msg.getMenuParams());
+ assertNull(TestValues.NULL, msg.getVrCommands());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AddCommand cmd = new AddCommand(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
List<String> vrCommandsList = JsonUtils.readStringListFromJsonObject(parameters, AddCommand.KEY_VR_COMMANDS);
List<String> testCommandsList = cmd.getVrCommands();
- assertEquals(Test.MATCH, vrCommandsList.size(), testCommandsList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(vrCommandsList, testCommandsList));
+ assertEquals(TestValues.MATCH, vrCommandsList.size(), testCommandsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(vrCommandsList, testCommandsList));
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddCommand.KEY_CMD_ID), cmd.getCmdID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddCommand.KEY_CMD_ID), cmd.getCmdID());
JSONObject menuParams = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_MENU_PARAMS);
MenuParams referenceMenuParams = new MenuParams(JsonRPCMarshaller.deserializeJSONObject(menuParams));
- assertTrue(Test.TRUE, Validator.validateMenuParams(referenceMenuParams, cmd.getMenuParams()));
+ assertTrue(TestValues.TRUE, Validator.validateMenuParams(referenceMenuParams, cmd.getMenuParams()));
JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_CMD_ICON);
Image referenceCmdIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
- assertTrue(Test.TRUE, Validator.validateImage(referenceCmdIcon, cmd.getCmdIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceCmdIcon, cmd.getCmdIcon()));
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
index 2ea3d2079..da2bbfab8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
@@ -8,15 +8,23 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AddSubMenu}
@@ -27,11 +35,11 @@ public class AddSubmenuTests extends BaseRpcTests{
protected RPCMessage createMessage(){
AddSubMenu msg = new AddSubMenu();
- msg.setMenuID(Test.GENERAL_INT);
- msg.setMenuName(Test.GENERAL_STRING);
- msg.setPosition(Test.GENERAL_INT);
- msg.setMenuIcon(Test.GENERAL_IMAGE);
- msg.setMenuLayout(Test.GENERAL_MENU_LAYOUT);
+ msg.setMenuID(TestValues.GENERAL_INT);
+ msg.setMenuName(TestValues.GENERAL_STRING);
+ msg.setPosition(TestValues.GENERAL_INT);
+ msg.setMenuIcon(TestValues.GENERAL_IMAGE);
+ msg.setMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
return msg;
}
@@ -51,13 +59,13 @@ public class AddSubmenuTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(AddSubMenu.KEY_MENU_ID, Test.GENERAL_INT);
- result.put(AddSubMenu.KEY_MENU_NAME, Test.GENERAL_STRING);
- result.put(AddSubMenu.KEY_POSITION, Test.GENERAL_INT);
- result.put(AddSubMenu.KEY_MENU_ICON, Test.JSON_IMAGE);
- result.put(AddSubMenu.KEY_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
+ result.put(AddSubMenu.KEY_MENU_ID, TestValues.GENERAL_INT);
+ result.put(AddSubMenu.KEY_MENU_NAME, TestValues.GENERAL_STRING);
+ result.put(AddSubMenu.KEY_POSITION, TestValues.GENERAL_INT);
+ result.put(AddSubMenu.KEY_MENU_ICON, TestValues.JSON_IMAGE);
+ result.put(AddSubMenu.KEY_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -66,6 +74,7 @@ public class AddSubmenuTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testMenuId = ( (AddSubMenu) msg ).getMenuID();
@@ -75,11 +84,11 @@ public class AddSubmenuTests extends BaseRpcTests{
MenuLayout testMenuLayout = ( (AddSubMenu) msg ).getMenuLayout();
// Valid Tests
- assertEquals("Menu ID didn't match input menu ID.", Test.GENERAL_INT, testMenuId);
- assertEquals("Menu name didn't match input menu name.", Test.GENERAL_STRING, testMenuName);
- assertEquals("Position didn't match input position.", Test.GENERAL_INT, testPosition);
- assertTrue("Menu icon didn't match input icon.", Validator.validateImage(Test.GENERAL_IMAGE, testMenuIcon));
- assertEquals("Menu layout didn't match input menu layout.", Test.GENERAL_MENU_LAYOUT, testMenuLayout);
+ assertEquals("Menu ID didn't match input menu ID.", TestValues.GENERAL_INT, testMenuId);
+ assertEquals("Menu name didn't match input menu name.", TestValues.GENERAL_STRING, testMenuName);
+ assertEquals("Position didn't match input position.", TestValues.GENERAL_INT, testPosition);
+ assertTrue("Menu icon didn't match input icon.", Validator.validateImage(TestValues.GENERAL_IMAGE, testMenuIcon));
+ assertEquals("Menu layout didn't match input menu layout.", TestValues.GENERAL_MENU_LAYOUT, testMenuLayout);
// Invalid/Null Tests
@@ -87,43 +96,44 @@ public class AddSubmenuTests extends BaseRpcTests{
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getMenuID());
- assertNull(Test.NULL, msg.getMenuName());
- assertNull(Test.NULL, msg.getPosition());
- assertNull(Test.NULL, msg.getMenuIcon());
- assertNull(Test.NULL, msg.getMenuLayout());
+ assertNull(TestValues.NULL, msg.getMenuID());
+ assertNull(TestValues.NULL, msg.getMenuName());
+ assertNull(TestValues.NULL, msg.getPosition());
+ assertNull(TestValues.NULL, msg.getMenuIcon());
+ assertNull(TestValues.NULL, msg.getMenuLayout());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AddSubMenu cmd = new AddSubMenu(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_MENU_ID), cmd.getMenuID());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_POSITION), cmd.getPosition());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, AddSubMenu.KEY_MENU_NAME), cmd.getMenuName());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_LAYOUT), cmd.getMenuLayout());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_MENU_ID), cmd.getMenuID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_POSITION), cmd.getPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, AddSubMenu.KEY_MENU_NAME), cmd.getMenuName());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_LAYOUT), cmd.getMenuLayout());
JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_ICON);
Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
- assertTrue(Test.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
index 6cbe23fd1..f7c2c3218 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
@@ -8,18 +8,26 @@ import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.AlertManeuver}
@@ -30,8 +38,8 @@ public class AlertManeuverTests extends BaseRpcTests {
protected RPCMessage createMessage() {
AlertManeuver msg = new AlertManeuver();
- msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
return msg;
}
@@ -51,10 +59,10 @@ public class AlertManeuverTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(AlertManeuver.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
- result.put(AlertManeuver.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(AlertManeuver.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
+ result.put(AlertManeuver.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -63,41 +71,43 @@ public class AlertManeuverTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<TTSChunk> testTtsChunks = ( (AlertManeuver) msg ).getTtsChunks();
List<SoftButton> testSoftButtons = ( (AlertManeuver) msg ).getSoftButtons();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
// Invalid/Null Tests
AlertManeuver msg = new AlertManeuver();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTtsChunks());
- assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getTtsChunks());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AlertManeuver cmd = new AlertManeuver(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_TTS_CHUNKS);
@@ -107,7 +117,7 @@ public class AlertManeuverTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)));
ttsChunkList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
@@ -115,9 +125,9 @@ public class AlertManeuverTests extends BaseRpcTests {
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject)softButtonArray.get(index)));
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
index 8bd229d4d..e9a455ce5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
@@ -9,18 +9,26 @@ import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Alert}
@@ -31,16 +39,16 @@ public class AlertTests extends BaseRpcTests{
protected RPCMessage createMessage(){
Alert msg = new Alert();
- msg.setDuration(Test.GENERAL_INT);
- msg.setAlertText1(Test.GENERAL_STRING);
- msg.setAlertText2(Test.GENERAL_STRING);
- msg.setAlertText3(Test.GENERAL_STRING);
- msg.setPlayTone(Test.GENERAL_BOOLEAN);
- msg.setProgressIndicator(Test.GENERAL_BOOLEAN);
- msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
- msg.setCancelID(Test.GENERAL_INTEGER);
- msg.setAlertIcon(Test.GENERAL_IMAGE);
+ msg.setDuration(TestValues.GENERAL_INT);
+ msg.setAlertText1(TestValues.GENERAL_STRING);
+ msg.setAlertText2(TestValues.GENERAL_STRING);
+ msg.setAlertText3(TestValues.GENERAL_STRING);
+ msg.setPlayTone(TestValues.GENERAL_BOOLEAN);
+ msg.setProgressIndicator(TestValues.GENERAL_BOOLEAN);
+ msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
+ msg.setAlertIcon(TestValues.GENERAL_IMAGE);
return msg;
}
@@ -60,18 +68,18 @@ public class AlertTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(Alert.KEY_DURATION, Test.GENERAL_INT);
- result.put(Alert.KEY_ALERT_TEXT_1, Test.GENERAL_STRING);
- result.put(Alert.KEY_ALERT_TEXT_2, Test.GENERAL_STRING);
- result.put(Alert.KEY_ALERT_TEXT_3, Test.GENERAL_STRING);
- result.put(Alert.KEY_PLAY_TONE, Test.GENERAL_BOOLEAN);
- result.put(Alert.KEY_PROGRESS_INDICATOR, Test.GENERAL_BOOLEAN);
- result.put(Alert.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
- result.put(Alert.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
- result.put(Alert.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
- result.put(Alert.KEY_ALERT_ICON, Test.JSON_IMAGE);
+ result.put(Alert.KEY_DURATION, TestValues.GENERAL_INT);
+ result.put(Alert.KEY_ALERT_TEXT_1, TestValues.GENERAL_STRING);
+ result.put(Alert.KEY_ALERT_TEXT_2, TestValues.GENERAL_STRING);
+ result.put(Alert.KEY_ALERT_TEXT_3, TestValues.GENERAL_STRING);
+ result.put(Alert.KEY_PLAY_TONE, TestValues.GENERAL_BOOLEAN);
+ result.put(Alert.KEY_PROGRESS_INDICATOR, TestValues.GENERAL_BOOLEAN);
+ result.put(Alert.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
+ result.put(Alert.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(Alert.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
+ result.put(Alert.KEY_ALERT_ICON, TestValues.JSON_IMAGE);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -80,6 +88,7 @@ public class AlertTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testDuration = ( (Alert) msg ).getDuration();
@@ -94,59 +103,60 @@ public class AlertTests extends BaseRpcTests{
Image alertIcon = ( (Alert) msg ).getAlertIcon();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testDuration);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testAlertText1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testAlertText2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testAlertText3);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testPlayTone);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testProgressIndicator);
- assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTtsChunks));
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, alertIcon));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDuration);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPlayTone);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testProgressIndicator);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, alertIcon));
// Invalid/Null Tests
Alert msg = new Alert();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAlertText1());
- assertNull(Test.NULL, msg.getAlertText2());
- assertNull(Test.NULL, msg.getAlertText3());
- assertNull(Test.NULL, msg.getDuration());
- assertNull(Test.NULL, msg.getPlayTone());
- assertNull(Test.NULL, msg.getProgressIndicator());
- assertNull(Test.NULL, msg.getTtsChunks());
- assertNull(Test.NULL, msg.getSoftButtons());
- assertNull(Test.NULL, msg.getCancelID());
- assertNull(Test.NULL, msg.getAlertIcon());
+ assertNull(TestValues.NULL, msg.getAlertText1());
+ assertNull(TestValues.NULL, msg.getAlertText2());
+ assertNull(TestValues.NULL, msg.getAlertText3());
+ assertNull(TestValues.NULL, msg.getDuration());
+ assertNull(TestValues.NULL, msg.getPlayTone());
+ assertNull(TestValues.NULL, msg.getProgressIndicator());
+ assertNull(TestValues.NULL, msg.getTtsChunks());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getCancelID());
+ assertNull(TestValues.NULL, msg.getAlertIcon());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Alert cmd = new Alert(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PLAY_TONE), cmd.getPlayTone());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_DURATION), cmd.getDuration());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_1), cmd.getAlertText1());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_CANCEL_ID), cmd.getCancelID());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PLAY_TONE), cmd.getPlayTone());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_DURATION), cmd.getDuration());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_1), cmd.getAlertText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_TTS_CHUNKS);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
@@ -154,7 +164,7 @@ public class AlertTests extends BaseRpcTests{
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
ttsChunkList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
@@ -162,13 +172,13 @@ public class AlertTests extends BaseRpcTests{
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
JSONObject alertIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, Alert.KEY_ALERT_ICON);
Image referenceAlertIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(alertIcon));
- assertTrue(Test.TRUE, Validator.validateImage(referenceAlertIcon, cmd.getAlertIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceAlertIcon, cmd.getAlertIcon()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
index 6f90585d4..63a411fe6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
@@ -9,14 +9,21 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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.ButtonPress}
@@ -27,10 +34,10 @@ public class ButtonPressTests extends BaseRpcTests {
protected RPCMessage createMessage(){
ButtonPress msg = new ButtonPress();
- msg.setModuleType(Test.GENERAL_MODULETYPE);
- msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
- msg.setButtonName(Test.GENERAL_BUTTONNAME);
- msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setButtonPressMode(TestValues.GENERAL_BUTTONPRESSMODE);
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
+ msg.setModuleId(TestValues.GENERAL_STRING);
return msg;
}
@@ -50,12 +57,12 @@ public class ButtonPressTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
- result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
- result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
- result.put(ButtonPress.KEY_MODULE_ID, Test.GENERAL_STRING);
+ result.put(ButtonPress.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(ButtonPress.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
+ result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, TestValues.GENERAL_BUTTONPRESSMODE);
+ result.put(ButtonPress.KEY_MODULE_ID, TestValues.GENERAL_STRING);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -64,6 +71,7 @@ public class ButtonPressTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
@@ -72,48 +80,49 @@ public class ButtonPressTests extends BaseRpcTests {
String testButtonId = ((ButtonPress) msg).getModuleId();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testButtonId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, testModuleType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, testButtonName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testButtonId);
// Invalid/Null Tests
ButtonPress msg = new ButtonPress();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getModuleType());
- assertNull(Test.NULL, msg.getButtonName());
- assertNull(Test.NULL, msg.getButtonPressMode());
- assertNull(Test.NULL, msg.getModuleId());
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getButtonName());
+ assertNull(TestValues.NULL, msg.getButtonPressMode());
+ assertNull(TestValues.NULL, msg.getModuleId());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ButtonPress cmd = new ButtonPress(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
index 8735bea9c..bed52225c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
@@ -40,14 +40,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CancelInteraction}
@@ -57,8 +64,8 @@ public class CancelInteractionTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
CancelInteraction msg = new CancelInteraction();
- msg.setInteractionFunctionID(Test.GENERAL_INTEGER);
- msg.setCancelID(Test.GENERAL_INTEGER);
+ msg.setInteractionFunctionID(TestValues.GENERAL_INTEGER);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
return msg;
}
@@ -77,10 +84,10 @@ public class CancelInteractionTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(CancelInteraction.KEY_FUNCTION_ID, Test.GENERAL_INTEGER);
- result.put(CancelInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ result.put(CancelInteraction.KEY_FUNCTION_ID, TestValues.GENERAL_INTEGER);
+ result.put(CancelInteraction.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -89,47 +96,49 @@ public class CancelInteractionTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
Integer testCancelID = ((CancelInteraction) msg).getCancelID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testFunctionID);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testFunctionID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
CancelInteraction msg = new CancelInteraction();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getInteractionFunctionID());
- assertNull(Test.NULL, msg.getCancelID());
+ assertNull(TestValues.NULL, msg.getInteractionFunctionID());
+ assertNull(TestValues.NULL, msg.getCancelID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CancelInteraction cmd = new CancelInteraction(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
index 9eda2e182..05c8dddd5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.ChangeRegistration;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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.ChangeRegistration}
@@ -25,8 +32,8 @@ public class ChangeRegistrationTests extends BaseRpcTests{
protected RPCMessage createMessage(){
ChangeRegistration msg = new ChangeRegistration();
- msg.setLanguage(Test.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguage(Test.GENERAL_LANGUAGE);
+ msg.setLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguage(TestValues.GENERAL_LANGUAGE);
return msg;
}
@@ -46,10 +53,10 @@ public class ChangeRegistrationTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(ChangeRegistration.KEY_LANGUAGE, Test.GENERAL_LANGUAGE);
- result.put(ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE, Test.GENERAL_LANGUAGE);
+ result.put(ChangeRegistration.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,47 +65,49 @@ public class ChangeRegistrationTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Language testLanguage = ( (ChangeRegistration) msg ).getLanguage();
Language testHmiLanguage = ( (ChangeRegistration) msg ).getHmiDisplayLanguage();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testLanguage);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testHmiLanguage);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLanguage);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLanguage);
// Invalid/Null Tests
ChangeRegistration msg = new ChangeRegistration();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getLanguage());
- assertNull(Test.NULL, msg.getHmiDisplayLanguage());
+ assertNull(TestValues.NULL, msg.getLanguage());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ChangeRegistration cmd = new ChangeRegistration(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_LANGUAGE), cmd.getLanguage().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_LANGUAGE), cmd.getLanguage().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
index 9d8debf20..99428fae2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
@@ -40,14 +40,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CloseApplication;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CloseApplication}
@@ -77,33 +83,35 @@ public class CloseApplicationTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
CloseApplication msg = new CloseApplication();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CloseApplication cmd = new CloseApplication(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
index 5969c53fc..0d6ab0e2a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
@@ -7,17 +7,25 @@ import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.CreateInteractionChoiceSet}
@@ -28,8 +36,8 @@ public class CreateInteractionChoiceSetTests extends BaseRpcTests{
protected RPCMessage createMessage(){
CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet();
- msg.setInteractionChoiceSetID(Test.GENERAL_INT);
- msg.setChoiceSet(Test.GENERAL_CHOICE_LIST);
+ msg.setInteractionChoiceSetID(TestValues.GENERAL_INT);
+ msg.setChoiceSet(TestValues.GENERAL_CHOICE_LIST);
return msg;
}
@@ -49,10 +57,10 @@ public class CreateInteractionChoiceSetTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, Test.GENERAL_INT);
- result.put(CreateInteractionChoiceSet.KEY_CHOICE_SET, Test.JSON_CHOICES);
+ result.put(CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, TestValues.GENERAL_INT);
+ result.put(CreateInteractionChoiceSet.KEY_CHOICE_SET, TestValues.JSON_CHOICES);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -61,55 +69,57 @@ public class CreateInteractionChoiceSetTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testCmdId = ( (CreateInteractionChoiceSet) msg ).getInteractionChoiceSetID();
List<Choice> testChoices = ( (CreateInteractionChoiceSet) msg ).getChoiceSet();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testCmdId);
- assertEquals(Test.MATCH, Test.GENERAL_CHOICE_LIST.size(), testChoices.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testCmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CHOICE_LIST.size(), testChoices.size());
for(int i = 0; i < testChoices.size(); i++){
- assertTrue(Test.TRUE, Validator.validateChoice(Test.GENERAL_CHOICE_LIST.get(i), testChoices.get(i)));
+ assertTrue(TestValues.TRUE, Validator.validateChoice(TestValues.GENERAL_CHOICE_LIST.get(i), testChoices.get(i)));
}
// Invalid/Null Tests
CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getChoiceSet());
- assertNull(Test.NULL, msg.getInteractionChoiceSetID());
+ assertNull(TestValues.NULL, msg.getChoiceSet());
+ assertNull(TestValues.NULL, msg.getInteractionChoiceSetID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CreateInteractionChoiceSet cmd = new CreateInteractionChoiceSet(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
JSONArray choiceSetArray = JsonUtils.readJsonArrayFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_CHOICE_SET);
for (int index = 0; index < choiceSetArray.length(); index++) {
Choice chunk = new Choice(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)choiceSetArray.get(index)) );
- assertTrue(Test.TRUE, Validator.validateChoice(chunk, cmd.getChoiceSet().get(index)) );
+ assertTrue(TestValues.TRUE, Validator.validateChoice(chunk, cmd.getChoiceSet().get(index)) );
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
index cb039a7d3..3e2ddee64 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.CreateWindow;
import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CreateWindow}
@@ -25,11 +32,11 @@ public class CreateWindowTests extends BaseRpcTests {
protected RPCMessage createMessage() {
CreateWindow msg = new CreateWindow();
- msg.setWindowID(Test.GENERAL_INT);
- msg.setWindowName(Test.GENERAL_STRING);
- msg.setType(Test.GENERAL_WINDOWTYPE);
- msg.setAssociatedServiceType(Test.GENERAL_STRING);
- msg.setDuplicateUpdatesFromWindowID(Test.GENERAL_INT);
+ msg.setWindowID(TestValues.GENERAL_INT);
+ msg.setWindowName(TestValues.GENERAL_STRING);
+ msg.setType(TestValues.GENERAL_WINDOWTYPE);
+ msg.setAssociatedServiceType(TestValues.GENERAL_STRING);
+ msg.setDuplicateUpdatesFromWindowID(TestValues.GENERAL_INT);
return msg;
}
@@ -49,13 +56,13 @@ public class CreateWindowTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(CreateWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
- result.put(CreateWindow.KEY_WINDOW_NAME, Test.GENERAL_STRING);
- result.put(CreateWindow.KEY_TYPE, Test.GENERAL_WINDOWTYPE);
- result.put(CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE, Test.GENERAL_STRING);
- result.put(CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, Test.GENERAL_INT);
+ result.put(CreateWindow.KEY_WINDOW_ID, TestValues.GENERAL_INT);
+ result.put(CreateWindow.KEY_WINDOW_NAME, TestValues.GENERAL_STRING);
+ result.put(CreateWindow.KEY_TYPE, TestValues.GENERAL_WINDOWTYPE);
+ result.put(CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ result.put(CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, TestValues.GENERAL_INT);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -64,6 +71,7 @@ public class CreateWindowTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues() {
// Test Values
int testWindowID = ((CreateWindow) msg).getWindowID();
@@ -73,50 +81,51 @@ public class CreateWindowTests extends BaseRpcTests {
int testDuplicateUpdatesFromWindowID = ((CreateWindow) msg).getDuplicateUpdatesFromWindowID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testWindowName);
- assertEquals(Test.MATCH, Test.GENERAL_WINDOWTYPE, testType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testAssociatedServiceType);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testDuplicateUpdatesFromWindowID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testWindowID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testWindowName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WINDOWTYPE, testType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAssociatedServiceType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDuplicateUpdatesFromWindowID);
// Invalid/Null Tests
CreateWindow msg = new CreateWindow();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getWindowID());
- assertNull(Test.NULL, msg.getWindowName());
- assertNull(Test.NULL, msg.getType());
- assertNull(Test.NULL, msg.getAssociatedServiceType());
- assertNull(Test.NULL, msg.getDuplicateUpdatesFromWindowID());
+ assertNull(TestValues.NULL, msg.getWindowID());
+ assertNull(TestValues.NULL, msg.getWindowName());
+ assertNull(TestValues.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getAssociatedServiceType());
+ assertNull(TestValues.NULL, msg.getDuplicateUpdatesFromWindowID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CreateWindow cmd = new CreateWindow(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_WINDOW_ID), cmd.getWindowID());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_WINDOW_NAME).toString(), cmd.getWindowName().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_TYPE).toString(), cmd.getType().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE).toString(), cmd.getAssociatedServiceType().toString());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID), cmd.getDuplicateUpdatesFromWindowID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_WINDOW_NAME).toString(), cmd.getWindowName().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_TYPE).toString(), cmd.getType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE).toString(), cmd.getAssociatedServiceType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID), cmd.getDuplicateUpdatesFromWindowID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
index 8b3bff42c..4e485e8ff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.DeleteCommand}
@@ -24,7 +31,7 @@ public class DeleteCommandTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DeleteCommand msg = new DeleteCommand();
- msg.setCmdID(Test.GENERAL_INT);
+ msg.setCmdID(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +51,9 @@ public class DeleteCommandTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DeleteCommand.KEY_CMD_ID, Test.GENERAL_INT);
+ result.put(DeleteCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,44 +62,46 @@ public class DeleteCommandTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int cmdId = ( (DeleteCommand) msg ).getCmdID();
// Valid Tests
- assertEquals("Command ID didn't match input command ID.", Test.GENERAL_INT, cmdId);
+ assertEquals("Command ID didn't match input command ID.", TestValues.GENERAL_INT, cmdId);
// Invalid/Null Tests
DeleteCommand msg = new DeleteCommand();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.MATCH, msg.getCmdID());
+ assertNull(TestValues.MATCH, msg.getCmdID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteCommand cmd = new DeleteCommand(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteCommand.KEY_CMD_ID), cmd.getCmdID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteCommand.KEY_CMD_ID), cmd.getCmdID());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
index c86a1c134..c95b85536 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteFile;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.DeleteFile}
@@ -24,7 +31,7 @@ public class DeleteFileTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DeleteFile msg = new DeleteFile();
- msg.setSdlFileName(Test.GENERAL_STRING);
+ msg.setSdlFileName(TestValues.GENERAL_STRING);
return msg;
}
@@ -44,9 +51,9 @@ public class DeleteFileTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DeleteFile.KEY_SDL_FILE_NAME, Test.GENERAL_STRING);
+ result.put(DeleteFile.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,43 +62,45 @@ public class DeleteFileTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String testFilename = ( (DeleteFile) msg ).getSdlFileName();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testFilename);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFilename);
// Invalid/Null Tests
DeleteFile msg = new DeleteFile();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSdlFileName());
+ assertNull(TestValues.NULL, msg.getSdlFileName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteFile cmd = new DeleteFile(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, DeleteFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, DeleteFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
index b30aa1567..c4ac6db5d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.DeleteInteractionChoiceSet}
@@ -24,7 +31,7 @@ public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet();
- msg.setInteractionChoiceSetID(Test.GENERAL_INT);
+ msg.setInteractionChoiceSetID(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +51,9 @@ public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, Test.GENERAL_INT);
+ result.put(DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,43 +62,45 @@ public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testChoiceSetId = ( (DeleteInteractionChoiceSet) msg ).getInteractionChoiceSetID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testChoiceSetId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testChoiceSetId);
// Invalid/Null Tests
DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getInteractionChoiceSetID());
+ assertNull(TestValues.NULL, msg.getInteractionChoiceSetID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteInteractionChoiceSet cmd = new DeleteInteractionChoiceSet(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
index 4ed760099..12e982b94 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -24,7 +30,7 @@ public class DeleteSubMenuTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DeleteSubMenu msg = new DeleteSubMenu();
- msg.setMenuID(Test.GENERAL_INT);
+ msg.setMenuID(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +50,9 @@ public class DeleteSubMenuTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DeleteSubMenu.KEY_MENU_ID, Test.GENERAL_INT);
+ result.put(DeleteSubMenu.KEY_MENU_ID, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,43 +61,45 @@ public class DeleteSubMenuTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testMenuId = ( (DeleteSubMenu) msg ).getMenuID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testMenuId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMenuId);
// Invalid/Null Tests
DeleteSubMenu msg = new DeleteSubMenu();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getMenuID());
+ assertNull(TestValues.NULL, msg.getMenuID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteSubMenu cmd = new DeleteSubMenu(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteSubMenu.KEY_MENU_ID), cmd.getMenuID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteSubMenu.KEY_MENU_ID), cmd.getMenuID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
index 48080615f..1f1b2ab89 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteWindow;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -24,7 +30,7 @@ public class DeleteWindowTests extends BaseRpcTests {
protected RPCMessage createMessage() {
DeleteWindow msg = new DeleteWindow();
- msg.setWindowID(Test.GENERAL_INT);
+ msg.setWindowID(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +50,9 @@ public class DeleteWindowTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(DeleteWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(DeleteWindow.KEY_WINDOW_ID, TestValues.GENERAL_INT);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,43 +61,45 @@ public class DeleteWindowTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues() {
// Test Values
int testWindowID = ((DeleteWindow) msg).getWindowID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testWindowID);
// Invalid/Null Tests
DeleteWindow msg = new DeleteWindow();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getWindowID());
+ assertNull(TestValues.NULL, msg.getWindowID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteWindow cmd = new DeleteWindow(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteWindow.KEY_WINDOW_ID), cmd.getWindowID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
index 7b050347d..41accb797 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
@@ -6,16 +6,24 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DiagnosticMessage;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.DiagnosticMessage}
@@ -26,9 +34,9 @@ public class DiagnosticMessageTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DiagnosticMessage msg = new DiagnosticMessage();
- msg.setMessageLength(Test.GENERAL_INT);
- msg.setTargetID(Test.GENERAL_INT);
- msg.setMessageData(Test.GENERAL_INTEGER_LIST);
+ msg.setMessageLength(TestValues.GENERAL_INT);
+ msg.setTargetID(TestValues.GENERAL_INT);
+ msg.setMessageData(TestValues.GENERAL_INTEGER_LIST);
return msg;
}
@@ -48,11 +56,11 @@ public class DiagnosticMessageTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DiagnosticMessage.KEY_TARGET_ID, Test.GENERAL_INT);
- result.put(DiagnosticMessage.KEY_MESSAGE_LENGTH, Test.GENERAL_INT);
- result.put(DiagnosticMessage.KEY_MESSAGE_DATA, JsonUtils.createJsonArray(Test.GENERAL_INTEGER_LIST));
+ result.put(DiagnosticMessage.KEY_TARGET_ID, TestValues.GENERAL_INT);
+ result.put(DiagnosticMessage.KEY_MESSAGE_LENGTH, TestValues.GENERAL_INT);
+ result.put(DiagnosticMessage.KEY_MESSAGE_DATA, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -61,6 +69,7 @@ public class DiagnosticMessageTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testTargetId = ( (DiagnosticMessage) msg ).getTargetID();
@@ -68,52 +77,53 @@ public class DiagnosticMessageTests extends BaseRpcTests{
List<Integer> testMessageData = ( (DiagnosticMessage) msg ).getMessageData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testTargetId);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testMessageLength);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST.size(), testMessageData.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testTargetId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMessageLength);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.size(), testMessageData.size());
for(int i = 0; i < testMessageData.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST.get(i), testMessageData.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.get(i), testMessageData.get(i));
}
// Invalid/Null Tests
DiagnosticMessage msg = new DiagnosticMessage();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTargetID());
- assertNull(Test.NULL, msg.getMessageLength());
- assertNull(Test.NULL, msg.getMessageData());
+ assertNull(TestValues.NULL, msg.getTargetID());
+ assertNull(TestValues.NULL, msg.getMessageLength());
+ assertNull(TestValues.NULL, msg.getMessageData());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DiagnosticMessage cmd = new DiagnosticMessage(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_TARGET_ID), cmd.getTargetID());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_LENGTH), cmd.getMessageLength());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_TARGET_ID), cmd.getTargetID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_LENGTH), cmd.getMessageLength());
List<Integer> messageDataList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_DATA);
List<Integer> testDataList = cmd.getMessageData();
- assertEquals(Test.MATCH, messageDataList.size(), testDataList.size());
- assertTrue(Test.TRUE, Validator.validateIntegerList(messageDataList, testDataList));
+ assertEquals(TestValues.MATCH, messageDataList.size(), testDataList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(messageDataList, testDataList));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
index 40a8d432f..fc0db6117 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DialNumber;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
/**
* Created by austinkirk on 6/6/17.
@@ -48,7 +54,7 @@ public class DialNumberTests extends BaseRpcTests {
try{
result.put(DialNumber.KEY_NUMBER, TEST_NUMBER);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -57,41 +63,43 @@ public class DialNumberTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String testNumber = ((DialNumber) msg).getNumber();
// Valid Tests
- assertEquals(Test.MATCH, TEST_NUMBER, testNumber);
+ assertEquals(TestValues.MATCH, TEST_NUMBER, testNumber);
// Invalid/Null Tests
DialNumber msg = new DialNumber();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getNumber());
+ assertNull(TestValues.NULL, msg.getNumber());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DialNumber cmd = new DialNumber(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, DialNumber.KEY_NUMBER), cmd.getNumber());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, DialNumber.KEY_NUMBER), cmd.getNumber());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
index 0ab5ebe66..7694da1e6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.EndAudioPassThru;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.EndAudioPassThru}
@@ -43,32 +49,34 @@ public class EndAudioPassThruTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
EndAudioPassThru msg = new EndAudioPassThru();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
EndAudioPassThru cmd = new EndAudioPassThru(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
index abda43557..2a9ab6641 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
@@ -6,21 +6,28 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetAppServiceData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class GetAppServiceDataTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
GetAppServiceData msg = new GetAppServiceData();
- msg.setServiceType(Test.GENERAL_STRING);
- msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setSubscribe(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -39,10 +46,10 @@ public class GetAppServiceDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(GetAppServiceData.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
- result.put(GetAppServiceData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ result.put(GetAppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ result.put(GetAppServiceData.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
@@ -50,18 +57,19 @@ public class GetAppServiceDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String serviceType = ( (GetAppServiceData) msg ).getServiceType();
boolean subscribe = ( (GetAppServiceData) msg ).getSubscribe();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceType);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, subscribe);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, subscribe);
// Invalid/Null Tests
GetAppServiceData msg = new GetAppServiceData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
assertNull(msg.getServiceType());
@@ -71,35 +79,37 @@ public class GetAppServiceDataTests extends BaseRpcTests {
/**
* Tests constructor with required params
*/
+ @Test
public void testRequiredParamsConstructor () {
- GetAppServiceData msg = new GetAppServiceData(Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, msg);
+ GetAppServiceData msg = new GetAppServiceData(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getServiceType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceType());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetAppServiceData cmd = new GetAppServiceData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetAppServiceData.KEY_SUBSCRIBE), cmd.getSubscribe());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetAppServiceData.KEY_SERVICE_TYPE).toString(), cmd.getServiceType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetAppServiceData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetAppServiceData.KEY_SERVICE_TYPE).toString(), cmd.getServiceType().toString());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
index d31c33caa..ad8238056 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
@@ -4,18 +4,20 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetCloudAppProperties;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONException;
import org.json.JSONObject;
+import static junit.framework.TestCase.fail;
+
public class GetCloudAppPropertiesTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage(){
GetCloudAppProperties msg = new GetCloudAppProperties();
- msg.setAppID(Test.GENERAL_STRING);
+ msg.setAppID(TestValues.GENERAL_STRING);
return msg;
}
@@ -35,9 +37,9 @@ public class GetCloudAppPropertiesTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetCloudAppProperties.KEY_APP_ID, Test.GENERAL_STRING);
+ result.put(GetCloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
index 5b298a93b..930debec5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetDTCs;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.GetDTCs}
@@ -24,8 +31,8 @@ public class GetDTCsTests extends BaseRpcTests{
protected RPCMessage createMessage(){
GetDTCs msg = new GetDTCs();
- msg.setEcuName(Test.GENERAL_INT);
- msg.setDtcMask(Test.GENERAL_INT);
+ msg.setEcuName(TestValues.GENERAL_INT);
+ msg.setDtcMask(TestValues.GENERAL_INT);
return msg;
}
@@ -45,10 +52,10 @@ public class GetDTCsTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(GetDTCs.KEY_ECU_NAME, Test.GENERAL_INT);
- result.put(GetDTCs.KEY_DTC_MASK, Test.GENERAL_INT);
+ result.put(GetDTCs.KEY_ECU_NAME, TestValues.GENERAL_INT);
+ result.put(GetDTCs.KEY_DTC_MASK, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -57,49 +64,51 @@ public class GetDTCsTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int testDtcMask = ( (GetDTCs) msg ).getDtcMask();
int testEcuName = ( (GetDTCs) msg ).getEcuName();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, testDtcMask);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testEcuName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDtcMask);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testEcuName);
// Invalid/Null Tests
GetDTCs msg = new GetDTCs();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getEcuName());
- assertNull(Test.NULL, msg.getDtcMask());
+ assertNull(TestValues.NULL, msg.getEcuName());
+ assertNull(TestValues.NULL, msg.getDtcMask());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetDTCs cmd = new GetDTCs(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_DTC_MASK), cmd.getDtcMask());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_ECU_NAME), cmd.getEcuName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_DTC_MASK), cmd.getDtcMask());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_ECU_NAME), cmd.getEcuName());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
index 48214373d..df19fa3de 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.GetFile;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class GetFileTests extends BaseRpcTests {
@@ -22,11 +29,11 @@ public class GetFileTests extends BaseRpcTests {
protected RPCMessage createMessage() {
GetFile msg = new GetFile();
- msg.setFileName(Test.GENERAL_STRING);
- msg.setAppServiceId(Test.GENERAL_STRING);
- msg.setFileType(Test.GENERAL_FILETYPE);
- msg.setOffset(Test.GENERAL_INT);
- msg.setLength(Test.GENERAL_INT);
+ msg.setFileName(TestValues.GENERAL_STRING);
+ msg.setAppServiceId(TestValues.GENERAL_STRING);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setOffset(TestValues.GENERAL_INT);
+ msg.setLength(TestValues.GENERAL_INT);
return msg;
}
@@ -46,13 +53,13 @@ public class GetFileTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(GetFile.KEY_FILE_NAME, Test.GENERAL_STRING);
- result.put(GetFile.KEY_APP_SERVICE_ID, Test.GENERAL_STRING);
- result.put(GetFile.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
- result.put(GetFile.KEY_OFFSET, Test.GENERAL_INTEGER);
- result.put(GetFile.KEY_LENGTH, Test.GENERAL_INTEGER);
+ result.put(GetFile.KEY_FILE_NAME, TestValues.GENERAL_STRING);
+ result.put(GetFile.KEY_APP_SERVICE_ID, TestValues.GENERAL_STRING);
+ result.put(GetFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(GetFile.KEY_OFFSET, TestValues.GENERAL_INTEGER);
+ result.put(GetFile.KEY_LENGTH, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -61,6 +68,7 @@ public class GetFileTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String fileName = ( (GetFile) msg ).getFileName();
@@ -70,60 +78,62 @@ public class GetFileTests extends BaseRpcTests {
Integer length = ( (GetFile) msg ).getLength();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, fileName);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
- assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, fileType);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, offset);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, length);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, fileName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
// Invalid/Null Tests
GetFile msg = new GetFile();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getFileName());
- assertNull(Test.NULL, msg.getAppServiceId());
- assertNull(Test.NULL, msg.getFileType());
- assertNull(Test.NULL, msg.getOffset());
- assertNull(Test.NULL, msg.getLength());
+ assertNull(TestValues.NULL, msg.getFileName());
+ assertNull(TestValues.NULL, msg.getAppServiceId());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
}
/**
* Tests constructor with required params
*/
+ @Test
public void testRequiredParamsConstructor () {
- GetFile msg = new GetFile(Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, msg);
+ GetFile msg = new GetFile(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getFileName());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getFileName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetFile cmd = new GetFile(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_APP_SERVICE_ID), cmd.getAppServiceId());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_FILE_NAME), cmd.getFileName());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFile.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_LENGTH), cmd.getLength());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_OFFSET), cmd.getOffset());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_APP_SERVICE_ID), cmd.getAppServiceId());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_FILE_NAME), cmd.getFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFile.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_LENGTH), cmd.getLength());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_OFFSET), cmd.getOffset());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
index 15a902a84..a6def432b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
@@ -7,22 +7,28 @@ import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsent;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 java.util.List;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
- msg.setModuleType(Test.GENERAL_MODULETYPE);
- msg.setModuleIds(Test.GENERAL_STRING_LIST);
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setModuleIds(TestValues.GENERAL_STRING_LIST);
return msg;
}
@@ -30,10 +36,10 @@ public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
try {
- result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
- result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
@@ -48,45 +54,47 @@ public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
return RPCMessage.KEY_REQUEST;
}
+ @Test
public void testRpcValues() {
ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
//valid tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, ids);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, ids);
//null tests
GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
- assertNull(Test.NULL, msg.getModuleType());
- assertNull(Test.NULL, msg.getModuleIds());
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getModuleIds());
//test require param constructor
- GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(Test.GENERAL_MODULETYPE, Test.GENERAL_STRING_LIST);
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, msg2.getModuleIds());
+ GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(TestValues.GENERAL_MODULETYPE, TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, msg2.getModuleIds());
}
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
index dd175ae6f..4ab5f5e6a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.GetInteriorVehicleData;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.GetInteriorVehicleData}
@@ -25,9 +32,9 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
protected RPCMessage createMessage(){
GetInteriorVehicleData msg = new GetInteriorVehicleData();
- msg.setModuleType(Test.GENERAL_MODULETYPE);
- msg.setSubscribe(Test.GENERAL_BOOLEAN);
- msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setSubscribe(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleId(TestValues.GENERAL_STRING);
return msg;
}
@@ -47,11 +54,11 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
- result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
- result.put(GetInteriorVehicleData.KEY_MODULE_ID, Test.GENERAL_STRING);
+ result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleData.KEY_MODULE_ID, TestValues.GENERAL_STRING);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -60,6 +67,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
@@ -67,45 +75,46 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
String testModuleId = ((GetInteriorVehicleData) msg).getModuleId();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testModuleId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, testModuleType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testSubscribed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testModuleId);
// Invalid/Null Tests
GetInteriorVehicleData msg = new GetInteriorVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getModuleType());
- assertNull(Test.NULL, msg.getSubscribe());
- assertNull(Test.NULL, msg.getModuleId());
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getSubscribe());
+ assertNull(TestValues.NULL, msg.getModuleId());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetInteriorVehicleData cmd = new GetInteriorVehicleData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
index 290a291d1..f65473c3f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
@@ -7,22 +7,29 @@ import com.smartdevicelink.proxy.rpc.GetSystemCapability;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class GetSystemCapabilityTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage(){
GetSystemCapability msg = new GetSystemCapability();
- msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
- msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ msg.setSystemCapabilityType(TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
+ msg.setSubscribe(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -42,10 +49,10 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
- result.put(GetSystemCapability.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
+ result.put(GetSystemCapability.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -54,48 +61,50 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
SystemCapabilityType testType = ( (GetSystemCapability) msg ).getSystemCapabilityType();
boolean testSubscribe = ( (GetSystemCapability) msg ).getSubscribe();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribe);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITYTYPE, testType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testSubscribe);
// Invalid/Null Tests
GetSystemCapability msg = new GetSystemCapability();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSystemCapabilityType());
- assertNull(Test.NULL, msg.getSubscribe());
+ assertNull(TestValues.NULL, msg.getSystemCapabilityType());
+ assertNull(TestValues.NULL, msg.getSubscribe());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetSystemCapability cmd = new GetSystemCapability(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE).toString(), cmd.getSystemCapabilityType().toString());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE).toString(), cmd.getSystemCapabilityType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SUBSCRIBE), cmd.getSubscribe());
}catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
index 99577fb46..7ce293942 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
@@ -6,14 +6,22 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetVehicleData}
@@ -24,36 +32,36 @@ public class GetVehicleDataTests extends BaseRpcTests {
protected RPCMessage createMessage(){
GetVehicleData msg = new GetVehicleData();
- msg.setSpeed(Test.GENERAL_BOOLEAN);
- msg.setRpm(Test.GENERAL_BOOLEAN);
- msg.setExternalTemperature(Test.GENERAL_BOOLEAN);
- msg.setFuelLevel(Test.GENERAL_BOOLEAN);
- msg.setPrndl(Test.GENERAL_BOOLEAN);
- msg.setTirePressure(Test.GENERAL_BOOLEAN);
- msg.setEngineTorque(Test.GENERAL_BOOLEAN);
- msg.setEngineOilLife(Test.GENERAL_BOOLEAN);
- msg.setOdometer(Test.GENERAL_BOOLEAN);
- msg.setGps(Test.GENERAL_BOOLEAN);
- msg.setFuelLevelState(Test.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(Test.GENERAL_BOOLEAN);
- msg.setVin(Test.GENERAL_BOOLEAN);
- msg.setBeltStatus(Test.GENERAL_BOOLEAN);
- msg.setBodyInformation(Test.GENERAL_BOOLEAN);
- msg.setDeviceStatus(Test.GENERAL_BOOLEAN);
- msg.setDriverBraking(Test.GENERAL_BOOLEAN);
- msg.setWiperStatus(Test.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(Test.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(Test.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(Test.GENERAL_BOOLEAN);
- msg.setECallInfo(Test.GENERAL_BOOLEAN);
- msg.setAirbagStatus(Test.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(Test.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(Test.GENERAL_BOOLEAN);
- msg.setMyKey(Test.GENERAL_BOOLEAN);
- msg.setFuelRange(Test.GENERAL_BOOLEAN);
- msg.setTurnSignal(Test.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setVin(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -73,38 +81,38 @@ public class GetVehicleDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetVehicleData.KEY_SPEED, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_RPM, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_EXTERNAL_TEMPERATURE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_FUEL_LEVEL, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_PRNDL, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_TIRE_PRESSURE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_ENGINE_TORQUE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_ENGINE_OIL_LIFE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_ODOMETER, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_GPS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_FUEL_LEVEL_STATE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_VIN, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_BELT_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_BODY_INFORMATION, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_DEVICE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_DRIVER_BRAKING, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_WIPER_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_HEAD_LAMP_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_ACC_PEDAL_POSITION, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_STEERING_WHEEL_ANGLE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_E_CALL_INFO, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_AIRBAG_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_EMERGENCY_EVENT, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_CLUSTER_MODE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_MY_KEY, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
- result.put(GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_FUEL_LEVEL, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_PRNDL, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_TIRE_PRESSURE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_ENGINE_TORQUE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_ODOMETER, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_GPS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_VIN, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_BELT_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_BODY_INFORMATION, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_DEVICE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_DRIVER_BRAKING, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_WIPER_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_E_CALL_INFO, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_AIRBAG_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_EMERGENCY_EVENT, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_CLUSTER_MODE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_MY_KEY, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_FUEL_RANGE, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_TURN_SIGNAL, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -113,128 +121,130 @@ public class GetVehicleDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Valid Tests
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getSpeed());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getRpm());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getExternalTemperature());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getFuelLevel());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getPrndl());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getTirePressure());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getEngineTorque());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getEngineOilLife());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getOdometer());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getGps());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getFuelLevelState());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getVin());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getBeltStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getBodyInformation());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getVin());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getDeviceStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getDriverBraking());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getWiperStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getHeadLampStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getAccPedalPosition());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getECallInfo());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getAirbagStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getEmergencyEvent());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getClusterModeStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getMyKey());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getFuelRange());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getTurnSignal());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getSpeed());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getRpm());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getExternalTemperature());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelLevel());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getPrndl());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getTirePressure());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEngineTorque());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEngineOilLife());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getOdometer());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getGps());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelLevelState());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getVin());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getBeltStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getBodyInformation());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getVin());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getDeviceStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getDriverBraking());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getWiperStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getHeadLampStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getAccPedalPosition());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getSteeringWheelAngle());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getECallInfo());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getAirbagStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEmergencyEvent());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getClusterModeStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getMyKey());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelRange());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getTurnSignal());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleData msg = new GetVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getVin());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getVin());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetVehicleData cmd = new GetVehicleData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
assertEquals("Command name doesn't match input name", JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_VIN), cmd.getVin());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_VIN), cmd.getVin());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
index bf0531685..4037eb53d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.GetWayPoints;
import com.smartdevicelink.proxy.rpc.enums.WayPointType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* Created by austinkirk on 6/6/17.
*/
@@ -46,7 +53,7 @@ public class GetWayPointsTests extends BaseRpcTests {
try{
result.put(GetWayPoints.KEY_WAY_POINT_TYPE, WayPointType.DESTINATION);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,42 +62,44 @@ public class GetWayPointsTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
WayPointType testType = ( (GetWayPoints) msg ).getWayPointType();
// Valid Tests
- assertEquals(Test.MATCH, WayPointType.DESTINATION, testType);
+ assertEquals(TestValues.MATCH, WayPointType.DESTINATION, testType);
// Invalid/Null Tests
GetWayPoints msg = new GetWayPoints();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getWayPointType());
+ assertNull(TestValues.NULL, msg.getWayPointType());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetWayPoints cmd = new GetWayPoints(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, WayPointType.valueForString(JsonUtils.readStringFromJsonObject(parameters, GetWayPoints.KEY_WAY_POINT_TYPE)), cmd.getWayPointType());
+ assertEquals(TestValues.MATCH, WayPointType.valueForString(JsonUtils.readStringFromJsonObject(parameters, GetWayPoints.KEY_WAY_POINT_TYPE)), cmd.getWayPointType());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
index 2fd8db4ea..ac51ca8aa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ListFiles;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.ListFiles}
@@ -43,32 +49,34 @@ public class ListFilesTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ListFiles msg = new ListFiles();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ListFiles cmd = new ListFiles(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
index 5e5c4ffbd..0085f0f30 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.PerformAppServiceInteraction;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class PerformAppServiceInteractionTests extends BaseRpcTests {
@@ -21,10 +28,10 @@ public class PerformAppServiceInteractionTests extends BaseRpcTests {
protected RPCMessage createMessage() {
PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
- msg.setServiceUri(Test.GENERAL_STRING);
- msg.setServiceID(Test.GENERAL_STRING);
- msg.setOriginApp(Test.GENERAL_STRING);
- msg.setRequestServiceActive(Test.GENERAL_BOOLEAN);
+ msg.setServiceUri(TestValues.GENERAL_STRING);
+ msg.setServiceID(TestValues.GENERAL_STRING);
+ msg.setOriginApp(TestValues.GENERAL_STRING);
+ msg.setRequestServiceActive(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -44,12 +51,12 @@ public class PerformAppServiceInteractionTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PerformAppServiceInteraction.KEY_SERVICE_URI, Test.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_SERVICE_ID, Test.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_ORIGIN_APP, Test.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE, Test.GENERAL_BOOLEAN);
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_URI, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_ORIGIN_APP, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,6 +65,7 @@ public class PerformAppServiceInteractionTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String serviceUri = ( (PerformAppServiceInteraction) msg ).getServiceUri();
@@ -66,60 +74,62 @@ public class PerformAppServiceInteractionTests extends BaseRpcTests {
boolean requestServiceActive = ( (PerformAppServiceInteraction) msg ).getRequestServiceActive();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceUri);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, originApp);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, requestServiceActive);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, requestServiceActive);
// Invalid/Null Tests
PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getServiceUri());
- assertNull(Test.NULL, msg.getServiceID());
- assertNull(Test.NULL, msg.getOriginApp());
- assertNull(Test.NULL, msg.getRequestServiceActive());
+ assertNull(TestValues.NULL, msg.getServiceUri());
+ assertNull(TestValues.NULL, msg.getServiceID());
+ assertNull(TestValues.NULL, msg.getOriginApp());
+ assertNull(TestValues.NULL, msg.getRequestServiceActive());
}
/**
* Tests constructor with required params
*/
+ @Test
public void testRequiredParamsConstructor () {
// test with param in constructor
- PerformAppServiceInteraction msg = new PerformAppServiceInteraction(Test.GENERAL_STRING,Test.GENERAL_STRING,Test.GENERAL_STRING);
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
String serviceUri = msg.getServiceUri();
String appServiceId = msg.getServiceID();
String originApp = msg.getOriginApp();
- assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceUri);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, appServiceId);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, originApp);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformAppServiceInteraction cmd = new PerformAppServiceInteraction(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getServiceID());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_URI), cmd.getServiceUri());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_ORIGIN_APP), cmd.getOriginApp());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE), cmd.getRequestServiceActive());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getServiceID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_URI), cmd.getServiceUri());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_ORIGIN_APP), cmd.getOriginApp());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE), cmd.getRequestServiceActive());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
index f3ccf0a59..65c4b00dd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
@@ -10,18 +10,26 @@ import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.PerformAudioPassThru}
@@ -32,14 +40,14 @@ public class PerformAudioPassThruTests extends BaseRpcTests {
protected RPCMessage createMessage() {
PerformAudioPassThru msg = new PerformAudioPassThru();
- msg.setInitialPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setAudioPassThruDisplayText1(Test.GENERAL_STRING);
- msg.setAudioPassThruDisplayText2(Test.GENERAL_STRING);
- msg.setSamplingRate(Test.GENERAL_SAMPLINGRATE);
- msg.setAudioType(Test.GENERAL_AUDIOTYPE);
- msg.setBitsPerSample(Test.GENERAL_BITSPERSAMPLE);
- msg.setMaxDuration(Test.GENERAL_INT);
- msg.setMuteAudio(Test.GENERAL_BOOLEAN);
+ msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setAudioPassThruDisplayText1(TestValues.GENERAL_STRING);
+ msg.setAudioPassThruDisplayText2(TestValues.GENERAL_STRING);
+ msg.setSamplingRate(TestValues.GENERAL_SAMPLINGRATE);
+ msg.setAudioType(TestValues.GENERAL_AUDIOTYPE);
+ msg.setBitsPerSample(TestValues.GENERAL_BITSPERSAMPLE);
+ msg.setMaxDuration(TestValues.GENERAL_INT);
+ msg.setMuteAudio(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -58,16 +66,16 @@ public class PerformAudioPassThruTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1, Test.GENERAL_STRING);
- result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2, Test.GENERAL_STRING);
- result.put(PerformAudioPassThru.KEY_MUTE_AUDIO, Test.GENERAL_BOOLEAN);
- result.put(PerformAudioPassThru.KEY_MAX_DURATION, Test.GENERAL_INT);
- result.put(PerformAudioPassThru.KEY_AUDIO_TYPE, Test.GENERAL_AUDIOTYPE);
- result.put(PerformAudioPassThru.KEY_SAMPLING_RATE, Test.GENERAL_SAMPLINGRATE);
- result.put(PerformAudioPassThru.KEY_BITS_PER_SAMPLE, Test.GENERAL_BITSPERSAMPLE);
- result.put(PerformAudioPassThru.KEY_INITIAL_PROMPT, Test.JSON_TTSCHUNKS);
+ result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1, TestValues.GENERAL_STRING);
+ result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2, TestValues.GENERAL_STRING);
+ result.put(PerformAudioPassThru.KEY_MUTE_AUDIO, TestValues.GENERAL_BOOLEAN);
+ result.put(PerformAudioPassThru.KEY_MAX_DURATION, TestValues.GENERAL_INT);
+ result.put(PerformAudioPassThru.KEY_AUDIO_TYPE, TestValues.GENERAL_AUDIOTYPE);
+ result.put(PerformAudioPassThru.KEY_SAMPLING_RATE, TestValues.GENERAL_SAMPLINGRATE);
+ result.put(PerformAudioPassThru.KEY_BITS_PER_SAMPLE, TestValues.GENERAL_BITSPERSAMPLE);
+ result.put(PerformAudioPassThru.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -76,6 +84,7 @@ public class PerformAudioPassThruTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
boolean testMuteAudio = ( (PerformAudioPassThru) msg ).getMuteAudio();
@@ -88,58 +97,59 @@ public class PerformAudioPassThruTests extends BaseRpcTests {
List<TTSChunk> testInitialPrompt = ( (PerformAudioPassThru) msg ).getInitialPrompt();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_TTSCHUNK_LIST.size(), testInitialPrompt.size());
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText2);
- assertEquals(Test.MATCH, Test.GENERAL_SAMPLINGRATE, testSamplingRate);
- assertEquals(Test.MATCH, Test.GENERAL_BITSPERSAMPLE, testBitsPerSample);
- assertEquals(Test.MATCH, Test.GENERAL_AUDIOTYPE, testAudioType);
- assertEquals(Test.MATCH, Test.GENERAL_INT, testMaxDuration);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testMuteAudio);
- for (int i = 0; i < Test.GENERAL_TTSCHUNK_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_TTSCHUNK_LIST.get(i), testInitialPrompt.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.size(), testInitialPrompt.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SAMPLINGRATE, testSamplingRate);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BITSPERSAMPLE, testBitsPerSample);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOTYPE, testAudioType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMaxDuration);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testMuteAudio);
+ for (int i = 0; i < TestValues.GENERAL_TTSCHUNK_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.get(i), testInitialPrompt.get(i));
}
// Invalid/Null Tests
PerformAudioPassThru msg = new PerformAudioPassThru();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getInitialPrompt());
- assertNull(Test.NULL, msg.getAudioPassThruDisplayText1());
- assertNull(Test.NULL, msg.getAudioPassThruDisplayText2());
- assertNull(Test.NULL, msg.getSamplingRate());
- assertNull(Test.NULL, msg.getBitsPerSample());
- assertNull(Test.NULL, msg.getAudioType());
- assertNull(Test.NULL, msg.getMaxDuration());
- assertNull(Test.NULL, msg.getMuteAudio());
+ assertNull(TestValues.NULL, msg.getInitialPrompt());
+ assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText1());
+ assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText2());
+ assertNull(TestValues.NULL, msg.getSamplingRate());
+ assertNull(TestValues.NULL, msg.getBitsPerSample());
+ assertNull(TestValues.NULL, msg.getAudioType());
+ assertNull(TestValues.NULL, msg.getMaxDuration());
+ assertNull(TestValues.NULL, msg.getMuteAudio());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformAudioPassThru cmd = new PerformAudioPassThru(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformAudioPassThru.KEY_MAX_DURATION), (Integer)cmd.getMaxDuration());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1), cmd.getAudioPassThruDisplayText1());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2), cmd.getAudioPassThruDisplayText2());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAudioPassThru.KEY_MUTE_AUDIO), cmd.getMuteAudio());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_SAMPLING_RATE), cmd.getSamplingRate().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_TYPE), cmd.getAudioType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformAudioPassThru.KEY_MAX_DURATION), (Integer)cmd.getMaxDuration());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1), cmd.getAudioPassThruDisplayText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2), cmd.getAudioPassThruDisplayText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAudioPassThru.KEY_MUTE_AUDIO), cmd.getMuteAudio());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_SAMPLING_RATE), cmd.getSamplingRate().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_TYPE), cmd.getAudioType().toString());
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformAudioPassThru.KEY_INITIAL_PROMPT);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
@@ -147,11 +157,11 @@ public class PerformAudioPassThruTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
ttsChunkList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getInitialPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getInitialPrompt()));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_BITS_PER_SAMPLE), cmd.getBitsPerSample().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_BITS_PER_SAMPLE), cmd.getBitsPerSample().toString());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
index cd3ea00b4..f363e06a2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
@@ -10,18 +10,26 @@ import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PerformInteraction}
@@ -32,16 +40,16 @@ public class PerformInteractionTests extends BaseRpcTests {
protected RPCMessage createMessage() {
PerformInteraction msg = new PerformInteraction();
- msg.setInitialPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setHelpPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setTimeoutPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setVrHelp(Test.GENERAL_VRHELPITEM_LIST);
- msg.setInteractionChoiceSetIDList(Test.GENERAL_INTEGER_LIST);
- msg.setInteractionLayout(Test.GENERAL_LAYOUTMODE);
- msg.setInitialText(Test.GENERAL_STRING);
- msg.setInteractionMode(Test.GENERAL_INTERACTIONMODE);
- msg.setTimeout(Test.GENERAL_INT);
- msg.setCancelID(Test.GENERAL_INTEGER);
+ msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
+ msg.setInteractionChoiceSetIDList(TestValues.GENERAL_INTEGER_LIST);
+ msg.setInteractionLayout(TestValues.GENERAL_LAYOUTMODE);
+ msg.setInitialText(TestValues.GENERAL_STRING);
+ msg.setInteractionMode(TestValues.GENERAL_INTERACTIONMODE);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
return msg;
}
@@ -61,18 +69,18 @@ public class PerformInteractionTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PerformInteraction.KEY_INITIAL_PROMPT, Test.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_HELP_PROMPT, Test.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_TIMEOUT_PROMPT, Test.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_VR_HELP, Test.JSON_VRHELPITEMS);
- result.put(PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST, JsonUtils.createJsonArray(Test.GENERAL_INTEGER_LIST));
- result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, Test.GENERAL_LAYOUTMODE);
- result.put(PerformInteraction.KEY_INITIAL_TEXT, Test.GENERAL_STRING);
- result.put(PerformInteraction.KEY_INTERACTION_MODE, Test.GENERAL_INTERACTIONMODE);
- result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(PerformInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ result.put(PerformInteraction.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
+ result.put(PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
+ result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, TestValues.GENERAL_LAYOUTMODE);
+ result.put(PerformInteraction.KEY_INITIAL_TEXT, TestValues.GENERAL_STRING);
+ result.put(PerformInteraction.KEY_INTERACTION_MODE, TestValues.GENERAL_INTERACTIONMODE);
+ result.put(PerformInteraction.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(PerformInteraction.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -81,6 +89,7 @@ public class PerformInteractionTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<TTSChunk> testInitialPrompt = ( (PerformInteraction) msg).getInitialPrompt();
@@ -95,64 +104,65 @@ public class PerformInteractionTests extends BaseRpcTests {
Integer testCancelID = ( (PerformInteraction) msg ).getCancelID();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTimeoutPrompt));
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(Test.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST, testChoiceSetIds);
- assertEquals(Test.MATCH, Test.GENERAL_LAYOUTMODE, testLayout);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testInitialText);
- assertEquals(Test.MATCH, Test.GENERAL_INTERACTIONMODE, testMode);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeoutPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testChoiceSetIds);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LAYOUTMODE, testLayout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testInitialText);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTERACTIONMODE, testMode);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
// Invald/Null Tests
PerformInteraction msg = new PerformInteraction();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getInitialPrompt());
- assertNull(Test.NULL, msg.getHelpPrompt());
- assertNull(Test.NULL, msg.getTimeoutPrompt());
- assertNull(Test.NULL, msg.getVrHelp());
- assertNull(Test.NULL, msg.getInteractionChoiceSetIDList());
- assertNull(Test.NULL, msg.getInteractionLayout());
- assertNull(Test.NULL, msg.getInitialText());
- assertNull(Test.NULL, msg.getInteractionMode());
- assertNull(Test.NULL, msg.getTimeout());
- assertNull(Test.NULL, msg.getCancelID());
+ assertNull(TestValues.NULL, msg.getInitialPrompt());
+ assertNull(TestValues.NULL, msg.getHelpPrompt());
+ assertNull(TestValues.NULL, msg.getTimeoutPrompt());
+ assertNull(TestValues.NULL, msg.getVrHelp());
+ assertNull(TestValues.NULL, msg.getInteractionChoiceSetIDList());
+ assertNull(TestValues.NULL, msg.getInteractionLayout());
+ assertNull(TestValues.NULL, msg.getInitialText());
+ assertNull(TestValues.NULL, msg.getInteractionMode());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getCancelID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformInteraction cmd = new PerformInteraction(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_CANCEL_ID), cmd.getCancelID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_CANCEL_ID), cmd.getCancelID());
List<Integer> interactionIDList = JsonUtils.readIntegerListFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST);
List<Integer> testIDList = cmd.getInteractionChoiceSetIDList();
- assertEquals(Test.MATCH, interactionIDList.size(), testIDList.size());
- assertTrue(Test.TRUE, Validator.validateIntegerList(interactionIDList, testIDList));
+ assertEquals(TestValues.MATCH, interactionIDList.size(), testIDList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(interactionIDList, testIDList));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_LAYOUT), cmd.getInteractionLayout().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_LAYOUT), cmd.getInteractionLayout().toString());
JSONArray initalPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_PROMPT);
List<TTSChunk> initalPromptList = new ArrayList<TTSChunk>();
@@ -160,7 +170,7 @@ public class PerformInteractionTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)initalPromptArray.get(index)) );
initalPromptList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(initalPromptList, cmd.getInitialPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(initalPromptList, cmd.getInitialPrompt()));
JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_HELP_PROMPT);
List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
@@ -168,7 +178,7 @@ public class PerformInteractionTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)helpPromptArray.get(index)) );
helpPromptList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT_PROMPT);
List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
@@ -176,8 +186,8 @@ public class PerformInteractionTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)timeoutPromptArray.get(index)) );
timeoutPromptList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT), cmd.getTimeout());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT), cmd.getTimeout());
JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_VR_HELP);
List<VrHelpItem> vrHelpList= new ArrayList<VrHelpItem>();
@@ -185,9 +195,9 @@ public class PerformInteractionTests extends BaseRpcTests {
VrHelpItem vrHelpItem = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)vrHelpArray.get(index)) );
vrHelpList.add(vrHelpItem);
}
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()) );
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()) );
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
index ffe7a60b4..fecad8073 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
@@ -7,21 +7,29 @@ import com.smartdevicelink.proxy.rpc.AppServiceManifest;
import com.smartdevicelink.proxy.rpc.PublishAppService;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class PublishAppServiceTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
PublishAppService msg = new PublishAppService();
- msg.setAppServiceManifest(Test.GENERAL_APPSERVICEMANIFEST);
+ msg.setAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
return msg;
}
@@ -40,9 +48,9 @@ public class PublishAppServiceTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APPSERVICEMANIFEST.getStore()));
+ result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICEMANIFEST.getStore()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -51,55 +59,58 @@ public class PublishAppServiceTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
AppServiceManifest copy = ( (PublishAppService) msg ).getAppServiceManifest();
// Valid Tests
- assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APPSERVICEMANIFEST, copy));
+ assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, copy));
// Invalid/Null Tests
PublishAppService msg = new PublishAppService();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.MATCH, msg.getAppServiceManifest());
+ assertNull(TestValues.MATCH, msg.getAppServiceManifest());
}
/**
* Tests constructor with required params
*/
+ @Test
public void testRequiredParamsConstructor () {
- PublishAppService msg = new PublishAppService(Test.GENERAL_APPSERVICEMANIFEST);
- assertNotNull(Test.NOT_NULL, msg);
+ PublishAppService msg = new PublishAppService(TestValues.GENERAL_APPSERVICEMANIFEST);
+ assertNotNull(TestValues.NOT_NULL, msg);
// Valid Tests
- assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APPSERVICEMANIFEST, msg.getAppServiceManifest()));
+ assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, msg.getAppServiceManifest()));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PublishAppService cmd = new PublishAppService(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject appServiceManifestObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppService.KEY_APP_SERVICE_MANIFEST);
AppServiceManifest manifestTest = new AppServiceManifest(JsonRPCMarshaller.deserializeJSONObject(appServiceManifestObject));
- assertTrue(Test.TRUE, Validator.validateAppServiceManifest(manifestTest, cmd.getAppServiceManifest()));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest(manifestTest, cmd.getAppServiceManifest()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
index 2d55dde4b..d5834414d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
@@ -7,15 +7,22 @@ import com.smartdevicelink.proxy.rpc.PutFile;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 java.util.zip.CRC32;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PutFile}
@@ -26,13 +33,13 @@ public class PutFileTests extends BaseRpcTests {
protected RPCMessage createMessage() {
PutFile msg = new PutFile();
- msg.setFileType(Test.GENERAL_FILETYPE);
- msg.setPersistentFile(Test.GENERAL_BOOLEAN);
- msg.setSystemFile(Test.GENERAL_BOOLEAN);
- msg.setOffset(Test.GENERAL_LONG);
- msg.setLength(Test.GENERAL_LONG);
- msg.setCRC(Test.GENERAL_BYTE_ARRAY);
- msg.setCRC(Test.GENERAL_LONG);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setPersistentFile(TestValues.GENERAL_BOOLEAN);
+ msg.setSystemFile(TestValues.GENERAL_BOOLEAN);
+ msg.setOffset(TestValues.GENERAL_LONG);
+ msg.setLength(TestValues.GENERAL_LONG);
+ msg.setCRC(TestValues.GENERAL_BYTE_ARRAY);
+ msg.setCRC(TestValues.GENERAL_LONG);
return msg;
}
@@ -52,14 +59,14 @@ public class PutFileTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PutFile.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
- result.put(PutFile.KEY_PERSISTENT_FILE, Test.GENERAL_BOOLEAN);
- result.put(PutFile.KEY_SYSTEM_FILE, Test.GENERAL_BOOLEAN);
- result.put(PutFile.KEY_OFFSET, Test.GENERAL_LONG);
- result.put(PutFile.KEY_LENGTH, Test.GENERAL_LONG);
- result.put(PutFile.KEY_CRC, Test.GENERAL_LONG);
+ result.put(PutFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(PutFile.KEY_PERSISTENT_FILE, TestValues.GENERAL_BOOLEAN);
+ result.put(PutFile.KEY_SYSTEM_FILE, TestValues.GENERAL_BOOLEAN);
+ result.put(PutFile.KEY_OFFSET, TestValues.GENERAL_LONG);
+ result.put(PutFile.KEY_LENGTH, TestValues.GENERAL_LONG);
+ result.put(PutFile.KEY_CRC, TestValues.GENERAL_LONG);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -68,6 +75,7 @@ public class PutFileTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
FileType testFileType = ( (PutFile) msg ).getFileType();
@@ -78,40 +86,41 @@ public class PutFileTests extends BaseRpcTests {
Long testCRC = ( (PutFile) msg ).getCRC();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, testFileType);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testPersistentFile);
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSystemFile);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, testOffset);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, testLength);
- assertEquals(Test.MATCH, Test.GENERAL_LONG, testCRC);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, testFileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPersistentFile);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testSystemFile);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testOffset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testLength);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testCRC);
// Invalid/Null Tests
PutFile msg = new PutFile();
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getFileType());
- assertNull(Test.NULL, msg.getPersistentFile());
- assertNull(Test.NULL, msg.getSystemFile());
- assertNull(Test.NULL, msg.getOffset());
- assertNull(Test.NULL, msg.getLength());
- assertNull(Test.NULL, msg.getCRC());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getPersistentFile());
+ assertNull(TestValues.NULL, msg.getSystemFile());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
+ assertNull(TestValues.NULL, msg.getCRC());
}
/**
* Tests the expected values of the CRC checksum.
*/
+ @Test
public void testByteArrayCheckSum () {
// Test Values
PutFile msgCRC = new PutFile();
- msgCRC.setCRC(Test.GENERAL_BYTE_ARRAY);
+ msgCRC.setCRC(TestValues.GENERAL_BYTE_ARRAY);
Long testCRCByteArray = msgCRC.getCRC();
CRC32 crc = new CRC32();
- crc.update(Test.GENERAL_BYTE_ARRAY);
+ crc.update(TestValues.GENERAL_BYTE_ARRAY);
Long crcValue = crc.getValue();
- assertEquals(Test.MATCH, crcValue, testCRCByteArray);
+ assertEquals(TestValues.MATCH, crcValue, testCRCByteArray);
}
@@ -119,31 +128,32 @@ public class PutFileTests extends BaseRpcTests {
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PutFile cmd = new PutFile(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_PERSISTENT_FILE), cmd.getPersistentFile());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_SYSTEM_FILE), cmd.getSystemFile());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_FILE_TYPE), cmd.getFileType().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
- assertEquals(Test.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_OFFSET).longValue(), cmd.getOffset());
- assertEquals(Test.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_LENGTH).longValue(), cmd.getLength());
- assertEquals(Test.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_CRC).longValue(), cmd.getCRC());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_PERSISTENT_FILE), cmd.getPersistentFile());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_SYSTEM_FILE), cmd.getSystemFile());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_FILE_TYPE), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_OFFSET).longValue(), cmd.getOffset());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_LENGTH).longValue(), cmd.getLength());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_CRC).longValue(), cmd.getCRC());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
index 77889839f..f528e34ce 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
@@ -6,16 +6,24 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ReadDID;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.ReadDID}
@@ -26,8 +34,8 @@ public class ReadDidTests extends BaseRpcTests {
protected RPCMessage createMessage() {
ReadDID msg = new ReadDID();
- msg.setEcuName(Test.GENERAL_INT);
- msg.setDidLocation(Test.GENERAL_INTEGER_LIST);
+ msg.setEcuName(TestValues.GENERAL_INT);
+ msg.setDidLocation(TestValues.GENERAL_INTEGER_LIST);
return msg;
}
@@ -47,10 +55,10 @@ public class ReadDidTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ReadDID.KEY_ECU_NAME, Test.GENERAL_INT);
- result.put(ReadDID.KEY_DID_LOCATION, JsonUtils.createJsonArray(Test.GENERAL_INTEGER_LIST));
+ result.put(ReadDID.KEY_ECU_NAME, TestValues.GENERAL_INT);
+ result.put(ReadDID.KEY_DID_LOCATION, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -59,51 +67,53 @@ public class ReadDidTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer testEcuName = ( (ReadDID) msg ).getEcuName();
List<Integer> testDidLocation = ( (ReadDID) msg ).getDidLocation();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testEcuName);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST, testDidLocation);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testEcuName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testDidLocation);
// Invalid/Null Tests
ReadDID msg = new ReadDID();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getEcuName());
- assertNull(Test.NULL, msg.getDidLocation());
+ assertNull(TestValues.NULL, msg.getEcuName());
+ assertNull(TestValues.NULL, msg.getDidLocation());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ReadDID cmd = new ReadDID(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ReadDID.KEY_ECU_NAME), cmd.getEcuName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ReadDID.KEY_ECU_NAME), cmd.getEcuName());
List<Integer> didLocationList = JsonUtils.readIntegerListFromJsonObject(parameters, ReadDID.KEY_DID_LOCATION);
List<Integer> testLocationList = cmd.getDidLocation();
- assertEquals(Test.MATCH, didLocationList.size(), testLocationList.size());
- assertTrue(Test.TRUE, Validator.validateIntegerList(didLocationList, testLocationList));
+ assertEquals(TestValues.MATCH, didLocationList.size(), testLocationList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(didLocationList, testLocationList));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
index e8bd66219..74035cb7c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
@@ -13,18 +13,26 @@ import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RegisterAppInterface}
@@ -35,21 +43,21 @@ public class RegisterAppInterfaceTests extends BaseRpcTests {
protected RPCMessage createMessage() {
RegisterAppInterface msg = new RegisterAppInterface();
- msg.setSdlMsgVersion(Test.GENERAL_SDLMSGVERSION);
- msg.setAppName(Test.GENERAL_STRING);
- msg.setNgnMediaScreenAppName(Test.GENERAL_STRING);
- msg.setFullAppID(Test.GENERAL_FULL_APP_ID);
- msg.setLanguageDesired(Test.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguageDesired(Test.GENERAL_LANGUAGE);
- msg.setHashID(Test.GENERAL_STRING);
- msg.setTtsName(Test.GENERAL_TTSCHUNK_LIST);
- msg.setVrSynonyms(Test.GENERAL_STRING_LIST);
- msg.setAppHMIType(Test.GENERAL_APPHMITYPE_LIST);
- msg.setIsMediaApplication(Test.GENERAL_BOOLEAN);
- msg.setDeviceInfo(Test.GENERAL_DEVICEINFO);
- msg.setAppInfo(Test.GENERAL_APPINFO);
- msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
- msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+ msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setAppName(TestValues.GENERAL_STRING);
+ msg.setNgnMediaScreenAppName(TestValues.GENERAL_STRING);
+ msg.setFullAppID(TestValues.GENERAL_FULL_APP_ID);
+ msg.setLanguageDesired(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguageDesired(TestValues.GENERAL_LANGUAGE);
+ msg.setHashID(TestValues.GENERAL_STRING);
+ msg.setTtsName(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setVrSynonyms(TestValues.GENERAL_STRING_LIST);
+ msg.setAppHMIType(TestValues.GENERAL_APPHMITYPE_LIST);
+ msg.setIsMediaApplication(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceInfo(TestValues.GENERAL_DEVICEINFO);
+ msg.setAppInfo(TestValues.GENERAL_APPINFO);
+ msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
return msg;
}
@@ -69,24 +77,24 @@ public class RegisterAppInterfaceTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(RegisterAppInterface.KEY_SDL_MSG_VERSION, Test.JSON_SDLMSGVERSION);
- result.put(RegisterAppInterface.KEY_APP_NAME, Test.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME, Test.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_APP_ID, Test.GENERAL_APP_ID);
- result.put(RegisterAppInterface.KEY_FULL_APP_ID, Test.GENERAL_FULL_APP_ID);
- result.put(RegisterAppInterface.KEY_LANGUAGE_DESIRED, Test.GENERAL_LANGUAGE);
- result.put(RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED, Test.GENERAL_LANGUAGE);
- result.put(RegisterAppInterface.KEY_HASH_ID, Test.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_TTS_NAME, Test.JSON_TTSCHUNKS);
- result.put(RegisterAppInterface.KEY_VR_SYNONYMS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(RegisterAppInterface.KEY_APP_HMI_TYPE, JsonUtils.createJsonArrayOfJsonNames(Test.GENERAL_APPHMITYPE_LIST, SDL_VERSION_UNDER_TEST));
- result.put(RegisterAppInterface.KEY_IS_MEDIA_APPLICATION, Test.GENERAL_BOOLEAN);
- result.put(RegisterAppInterface.KEY_DEVICE_INFO, Test.JSON_DEVICEINFO);
- result.put(RegisterAppInterface.KEY_APP_INFO, Test.JSON_APPINFO);
- result.put(RegisterAppInterface.KEY_DAY_COLOR_SCHEME, Test.JSON_DAYCOLORSCHEME);
- result.put(RegisterAppInterface.KEY_NIGHT_COLOR_SCHEME, Test.JSON_NIGHTCOLORSCHEME);
+ result.put(RegisterAppInterface.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
+ result.put(RegisterAppInterface.KEY_APP_NAME, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_APP_ID, TestValues.GENERAL_APP_ID);
+ result.put(RegisterAppInterface.KEY_FULL_APP_ID, TestValues.GENERAL_FULL_APP_ID);
+ result.put(RegisterAppInterface.KEY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterface.KEY_HASH_ID, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_TTS_NAME, TestValues.JSON_TTSCHUNKS);
+ result.put(RegisterAppInterface.KEY_VR_SYNONYMS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(RegisterAppInterface.KEY_APP_HMI_TYPE, JsonUtils.createJsonArrayOfJsonNames(TestValues.GENERAL_APPHMITYPE_LIST, SDL_VERSION_UNDER_TEST));
+ result.put(RegisterAppInterface.KEY_IS_MEDIA_APPLICATION, TestValues.GENERAL_BOOLEAN);
+ result.put(RegisterAppInterface.KEY_DEVICE_INFO, TestValues.JSON_DEVICEINFO);
+ result.put(RegisterAppInterface.KEY_APP_INFO, TestValues.JSON_APPINFO);
+ result.put(RegisterAppInterface.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
+ result.put(RegisterAppInterface.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -95,6 +103,7 @@ public class RegisterAppInterfaceTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
SdlMsgVersion testVersion = ( (RegisterAppInterface) msg).getSdlMsgVersion();
@@ -115,63 +124,64 @@ public class RegisterAppInterfaceTests extends BaseRpcTests {
TemplateColorScheme testNightColorScheme = ( (RegisterAppInterface) msg).getNightColorScheme();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(Test.GENERAL_SDLMSGVERSION, testVersion));
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testName);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testNgnName);
- assertEquals(Test.MATCH, Test.GENERAL_APP_ID, testAppId);
- assertEquals(Test.MATCH, Test.GENERAL_FULL_APP_ID, testFullAppId);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testLang);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testHmiLang);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testHashId);
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTts));
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, testSynonyms);
- assertEquals(Test.MATCH, Test.GENERAL_APPHMITYPE_LIST, testApps);
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, testMedia);
- assertTrue(Test.TRUE, Validator.validateDeviceInfo(Test.GENERAL_DEVICEINFO, testDeviceInfo));
- assertTrue(Test.TRUE, Validator.validateAppInfo(Test.GENERAL_APPINFO, testAppInfo));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testVersion));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNgnName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APP_ID, testAppId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FULL_APP_ID, testFullAppId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testHashId);
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTts));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, testSynonyms);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APPHMITYPE_LIST, testApps);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testMedia);
+ assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(TestValues.GENERAL_DEVICEINFO, testDeviceInfo));
+ assertTrue(TestValues.TRUE, Validator.validateAppInfo(TestValues.GENERAL_APPINFO, testAppInfo));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
// Invalid/Null Tests
RegisterAppInterface msg = new RegisterAppInterface();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSdlMsgVersion());
- assertNull(Test.NULL, msg.getAppName());
- assertNull(Test.NULL, msg.getNgnMediaScreenAppName());
- assertNull(Test.NULL, msg.getAppID());
- assertNull(Test.NULL, msg.getFullAppID());
- assertNull(Test.NULL, msg.getLanguageDesired());
- assertNull(Test.NULL, msg.getHmiDisplayLanguageDesired());
- assertNull(Test.NULL, msg.getHashID());
- assertNull(Test.NULL, msg.getTtsName());
- assertNull(Test.NULL, msg.getVrSynonyms());
- assertNull(Test.NULL, msg.getAppHMIType());
- assertNull(Test.NULL, msg.getIsMediaApplication());
- assertNull(Test.NULL, msg.getDeviceInfo());
- assertNull(Test.NULL, msg.getAppInfo());
- assertNull(Test.NULL, msg.getDayColorScheme());
- assertNull(Test.NULL, msg.getNightColorScheme());
+ assertNull(TestValues.NULL, msg.getSdlMsgVersion());
+ assertNull(TestValues.NULL, msg.getAppName());
+ assertNull(TestValues.NULL, msg.getNgnMediaScreenAppName());
+ assertNull(TestValues.NULL, msg.getAppID());
+ assertNull(TestValues.NULL, msg.getFullAppID());
+ assertNull(TestValues.NULL, msg.getLanguageDesired());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguageDesired());
+ assertNull(TestValues.NULL, msg.getHashID());
+ assertNull(TestValues.NULL, msg.getTtsName());
+ assertNull(TestValues.NULL, msg.getVrSynonyms());
+ assertNull(TestValues.NULL, msg.getAppHMIType());
+ assertNull(TestValues.NULL, msg.getIsMediaApplication());
+ assertNull(TestValues.NULL, msg.getDeviceInfo());
+ assertNull(TestValues.NULL, msg.getAppInfo());
+ assertNull(TestValues.NULL, msg.getDayColorScheme());
+ assertNull(TestValues.NULL, msg.getNightColorScheme());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
RegisterAppInterface cmd = new RegisterAppInterface(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONArray ttsNameArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_TTS_NAME);
@@ -180,49 +190,49 @@ public class RegisterAppInterfaceTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsNameArray.get(index)) );
ttsNameList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(ttsNameList, cmd.getTtsName()));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED), cmd.getHmiDisplayLanguageDesired().toString());
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsNameList, cmd.getTtsName()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED), cmd.getHmiDisplayLanguageDesired().toString());
JSONArray appHmiTypeArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_APP_HMI_TYPE);
for (int index = 0; index < appHmiTypeArray.length(); index++) {
AppHMIType appHmiTypeItem = AppHMIType.valueForString( appHmiTypeArray.get(index).toString() );
- assertEquals(Test.MATCH, appHmiTypeItem, cmd.getAppHMIType().get(index) );
+ assertEquals(TestValues.MATCH, appHmiTypeItem, cmd.getAppHMIType().get(index) );
}
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_ID), cmd.getAppID());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_FULL_APP_ID), cmd.getFullAppID());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_LANGUAGE_DESIRED), cmd.getLanguageDesired().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_ID), cmd.getAppID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_FULL_APP_ID), cmd.getFullAppID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_LANGUAGE_DESIRED), cmd.getLanguageDesired().toString());
JSONObject deviceInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DEVICE_INFO);
DeviceInfo deviceInfo = new DeviceInfo(JsonRPCMarshaller.deserializeJSONObject(deviceInfoObj));
- assertTrue(Test.TRUE, Validator.validateDeviceInfo(deviceInfo, cmd.getDeviceInfo()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_NAME), cmd.getAppName());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());
+ assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(deviceInfo, cmd.getDeviceInfo()) );
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_NAME), cmd.getAppName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());
JSONObject appInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_APP_INFO);
AppInfo appInfo = new AppInfo(JsonRPCMarshaller.deserializeJSONObject(appInfoObj));
- assertTrue(Test.TRUE, Validator.validateAppInfo(appInfo, cmd.getAppInfo()));
+ assertTrue(TestValues.TRUE, Validator.validateAppInfo(appInfo, cmd.getAppInfo()));
List<String> vrSynonymsList = JsonUtils.readStringListFromJsonObject(parameters, RegisterAppInterface.KEY_VR_SYNONYMS);
List<String> testSynonymsList = cmd.getVrSynonyms();
- assertEquals(Test.MATCH, vrSynonymsList.size(), testSynonymsList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(vrSynonymsList, testSynonymsList));
+ assertEquals(TestValues.MATCH, vrSynonymsList.size(), testSynonymsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(vrSynonymsList, testSynonymsList));
JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_SDL_MSG_VERSION);
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HASH_ID), cmd.getHashID());
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HASH_ID), cmd.getHashID());
JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
index c2bd3b3d6..280e4f11b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
@@ -7,21 +7,28 @@ import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModule;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
- msg.setModuleType(Test.GENERAL_MODULETYPE);
- msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setModuleId(TestValues.GENERAL_STRING);
return msg;
}
@@ -29,10 +36,10 @@ public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
try {
- result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
- result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, Test.GENERAL_STRING);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, TestValues.GENERAL_STRING);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
@@ -47,43 +54,45 @@ public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
return RPCMessage.KEY_REQUEST;
}
+ @Test
public void testRpcValues() {
ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
//valid tests
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
//null tests
ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
- assertNull(Test.NULL, msg.getModuleType());
- assertNull(Test.NULL, msg.getModuleId());
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getModuleId());
// required param tests
- ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(Test.GENERAL_MODULETYPE);
- assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
+ ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(TestValues.GENERAL_MODULETYPE);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
}
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
index 408c809be..89cef762e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
@@ -7,16 +7,23 @@ import com.smartdevicelink.proxy.rpc.ResetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.ResetGlobalProperties}
@@ -27,7 +34,7 @@ public class ResetGlobalPropertiesTests extends BaseRpcTests {
protected RPCMessage createMessage() {
ResetGlobalProperties msg = new ResetGlobalProperties();
- msg.setProperties(Test.GENERAL_GLOBALPROPERTY_LIST);
+ msg.setProperties(TestValues.GENERAL_GLOBALPROPERTY_LIST);
return msg;
}
@@ -47,9 +54,9 @@ public class ResetGlobalPropertiesTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ResetGlobalProperties.KEY_PROPERTIES, JsonUtils.createJsonArray(Test.GENERAL_GLOBALPROPERTY_LIST));
+ result.put(ResetGlobalProperties.KEY_PROPERTIES, JsonUtils.createJsonArray(TestValues.GENERAL_GLOBALPROPERTY_LIST));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,51 +65,53 @@ public class ResetGlobalPropertiesTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<GlobalProperty> copy = ( (ResetGlobalProperties) msg ).getProperties();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_GLOBALPROPERTY_LIST.size(), copy.size());
- for(int i = 0; i < Test.GENERAL_GLOBALPROPERTY_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_GLOBALPROPERTY_LIST.get(i), copy.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GLOBALPROPERTY_LIST.size(), copy.size());
+ for(int i = 0; i < TestValues.GENERAL_GLOBALPROPERTY_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GLOBALPROPERTY_LIST.get(i), copy.get(i));
}
// Invalid/Null Tests
ResetGlobalProperties msg = new ResetGlobalProperties();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getProperties());
+ assertNull(TestValues.NULL, msg.getProperties());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ResetGlobalProperties cmd = new ResetGlobalProperties(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONArray propertiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ResetGlobalProperties.KEY_PROPERTIES);
for (int index = 0; index < propertiesArray.length(); index++) {
GlobalProperty property = GlobalProperty.valueOf(propertiesArray.get(index).toString());
- assertEquals(Test.MATCH, property, cmd.getProperties().get(index));
+ assertEquals(TestValues.MATCH, property, cmd.getProperties().get(index));
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
index 195cb7973..632769924 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
@@ -7,18 +7,26 @@ import com.smartdevicelink.proxy.rpc.ScrollableMessage;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ScrollableMessage}
@@ -29,10 +37,10 @@ public class ScrollableMessageTests extends BaseRpcTests {
protected RPCMessage createMessage() {
ScrollableMessage msg = new ScrollableMessage();
- msg.setTimeout(Test.GENERAL_INT);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
- msg.setScrollableMessageBody(Test.GENERAL_STRING);
- msg.setCancelID(Test.GENERAL_INTEGER);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setScrollableMessageBody(TestValues.GENERAL_STRING);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
return msg;
}
@@ -52,12 +60,12 @@ public class ScrollableMessageTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, Test.GENERAL_STRING);
- result.put(ScrollableMessage.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
- result.put(ScrollableMessage.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, TestValues.GENERAL_STRING);
+ result.put(ScrollableMessage.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(ScrollableMessage.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -66,6 +74,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String testBody = ( (ScrollableMessage) msg ).getScrollableMessageBody();
@@ -74,48 +83,49 @@ public class ScrollableMessageTests extends BaseRpcTests {
Integer testCancelID = ( (ScrollableMessage) msg ).getCancelID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testBody);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTON_LIST.size(), testSoftButtons.size());
- for (int i = 0; i < Test.GENERAL_SOFTBUTTON_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testBody);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.size(), testSoftButtons.size());
+ for (int i = 0; i < TestValues.GENERAL_SOFTBUTTON_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
}
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
ScrollableMessage msg = new ScrollableMessage();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getScrollableMessageBody());
- assertNull(Test.NULL, msg.getTimeout());
- assertNull(Test.NULL, msg.getSoftButtons());
- assertNull(Test.NULL, msg.getCancelID());
+ assertNull(TestValues.NULL, msg.getScrollableMessageBody());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getCancelID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ScrollableMessage cmd = new ScrollableMessage(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_CANCEL_ID), cmd.getCancelID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ScrollableMessage.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
@@ -123,9 +133,9 @@ public class ScrollableMessageTests extends BaseRpcTests {
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
index 7c3b0ed90..090818308 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
@@ -6,15 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.SendHapticData;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+
/**
* Created by brettywhite on 8/9/17.
*/
@@ -28,7 +33,7 @@ public class SendHapticDataTests extends BaseRpcTests {
msg = new SendHapticData();
List<HapticRect> list = new ArrayList<>();
- list.add(Test.GENERAL_HAPTIC_RECT);
+ list.add(TestValues.GENERAL_HAPTIC_RECT);
msg.setHapticRectData(list);
@@ -51,7 +56,7 @@ public class SendHapticDataTests extends BaseRpcTests {
JSONArray jsonArray = new JSONArray();
try {
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HAPTIC_RECT.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HAPTIC_RECT.getStore()));
} catch (JSONException e) {
e.printStackTrace();
}
@@ -68,19 +73,20 @@ public class SendHapticDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<HapticRect> list = msg.getHapticRectData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_HAPTIC_RECT, list.get(0));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HAPTIC_RECT, list.get(0));
// Invalid/Null Tests
SendHapticData msg = new SendHapticData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getHapticRectData());
+ assertNull(TestValues.NULL, msg.getHapticRectData());
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
index 9849caee5..c92eac6ec 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
@@ -7,16 +7,24 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.SendLocation;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SendLocation}
@@ -27,13 +35,13 @@ public class SendLocationTests extends BaseRpcTests {
protected RPCMessage createMessage(){
SendLocation msg = new SendLocation();
- msg.setLatitudeDegrees(Test.GENERAL_DOUBLE);
- msg.setLongitudeDegrees(Test.GENERAL_DOUBLE);
- msg.setLocationName(Test.GENERAL_STRING);
- msg.setLocationDescription(Test.GENERAL_STRING);
- msg.setPhoneNumber(Test.GENERAL_STRING);
- msg.setAddressLines(Test.GENERAL_STRING_LIST);
- msg.setLocationImage(Test.GENERAL_IMAGE);
+ msg.setLatitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setLongitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setLocationName(TestValues.GENERAL_STRING);
+ msg.setLocationDescription(TestValues.GENERAL_STRING);
+ msg.setPhoneNumber(TestValues.GENERAL_STRING);
+ msg.setAddressLines(TestValues.GENERAL_STRING_LIST);
+ msg.setLocationImage(TestValues.GENERAL_IMAGE);
return msg;
}
@@ -53,15 +61,15 @@ public class SendLocationTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SendLocation.KEY_LAT_DEGREES, Test.GENERAL_DOUBLE);
- result.put(SendLocation.KEY_LON_DEGREES, Test.GENERAL_DOUBLE);
- result.put(SendLocation.KEY_LOCATION_NAME, Test.GENERAL_STRING);
- result.put(SendLocation.KEY_LOCATION_DESCRIPTION, Test.GENERAL_STRING);
- result.put(SendLocation.KEY_PHONE_NUMBER, Test.GENERAL_STRING);
- result.put(SendLocation.KEY_LOCATION_IMAGE, Test.GENERAL_IMAGE.serializeJSON());
- result.put(SendLocation.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ result.put(SendLocation.KEY_LAT_DEGREES, TestValues.GENERAL_DOUBLE);
+ result.put(SendLocation.KEY_LON_DEGREES, TestValues.GENERAL_DOUBLE);
+ result.put(SendLocation.KEY_LOCATION_NAME, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_LOCATION_DESCRIPTION, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_PHONE_NUMBER, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_LOCATION_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
+ result.put(SendLocation.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -70,6 +78,7 @@ public class SendLocationTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Double latitude = ((SendLocation) msg).getLatitudeDegrees();
@@ -81,65 +90,66 @@ public class SendLocationTests extends BaseRpcTests {
Image locationImage = ((SendLocation) msg).getLocationImage();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, longitude);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, latitude);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, locationDesc);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, locationName);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, phoneNumber);
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, addressLines));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, locationImage));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, longitude);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, latitude);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationDesc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, phoneNumber);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, addressLines));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, locationImage));
// Invalid/Null Tests
SendLocation msg = new SendLocation();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getLatitudeDegrees());
- assertNull(Test.NULL, msg.getLongitudeDegrees());
- assertNull(Test.NULL, msg.getLocationName());
- assertNull(Test.NULL, msg.getLocationDescription());
- assertNull(Test.NULL, msg.getPhoneNumber());
- assertNull(Test.NULL, msg.getAddressLines());
- assertNull(Test.NULL, msg.getLocationImage());
+ assertNull(TestValues.NULL, msg.getLatitudeDegrees());
+ assertNull(TestValues.NULL, msg.getLongitudeDegrees());
+ assertNull(TestValues.NULL, msg.getLocationName());
+ assertNull(TestValues.NULL, msg.getLocationDescription());
+ assertNull(TestValues.NULL, msg.getPhoneNumber());
+ assertNull(TestValues.NULL, msg.getAddressLines());
+ assertNull(TestValues.NULL, msg.getLocationImage());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
assertNotNull("Command object is null", commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SendLocation cmd = new SendLocation(hash);
- assertNotNull(Test.NOT_NULL, cmd);
+ assertNotNull(TestValues.NOT_NULL, cmd);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LAT_DEGREES), cmd.getLatitudeDegrees());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LON_DEGREES), cmd.getLongitudeDegrees());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_NAME), cmd.getLocationName());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_DESCRIPTION), cmd.getLocationDescription());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_PHONE_NUMBER), cmd.getPhoneNumber());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LAT_DEGREES), cmd.getLatitudeDegrees());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LON_DEGREES), cmd.getLongitudeDegrees());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_NAME), cmd.getLocationName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_DESCRIPTION), cmd.getLocationDescription());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_PHONE_NUMBER), cmd.getPhoneNumber());
List<String> addressList = JsonUtils.readStringListFromJsonObject(parameters, SendLocation.KEY_ADDRESS_LINES);
List<String> testList = cmd.getAddressLines();
- assertEquals(Test.MATCH, addressList.size(), testList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(addressList, testList));
+ assertEquals(TestValues.MATCH, addressList.size(), testList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(addressList, testList));
JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SendLocation.KEY_LOCATION_IMAGE);
Image reference = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
- assertTrue(Test.TRUE, Validator.validateImage(reference, cmd.getLocationImage()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(reference, cmd.getLocationImage()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
index 1be5366f6..e4df0a44b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetAppIcon;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SetAppIcon}
@@ -24,7 +31,7 @@ public class SetAppIconTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SetAppIcon msg = new SetAppIcon();
- msg.setSdlFileName(Test.GENERAL_STRING);
+ msg.setSdlFileName(TestValues.GENERAL_STRING);
return msg;
}
@@ -44,9 +51,9 @@ public class SetAppIconTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SetAppIcon.KEY_SDL_FILE_NAME, Test.GENERAL_STRING);
+ result.put(SetAppIcon.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,44 +62,46 @@ public class SetAppIconTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String copy = ( (SetAppIcon) msg ).getSdlFileName();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, copy);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
// Invalid/Null Tests
SetAppIcon msg = new SetAppIcon();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSdlFileName());
+ assertNull(TestValues.NULL, msg.getSdlFileName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetAppIcon cmd = new SetAppIcon(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetAppIcon.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetAppIcon.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
index 1a5751701..2db06fa01 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
@@ -4,18 +4,20 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetCloudAppProperties;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONException;
import org.json.JSONObject;
+import static junit.framework.TestCase.fail;
+
public class SetCloudAppPropertiesTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage(){
SetCloudAppProperties msg = new SetCloudAppProperties();
- msg.setProperties(Test.GENERAL_CLOUDAPPPROPERTIES);
+ msg.setProperties(TestValues.GENERAL_CLOUDAPPPROPERTIES);
return msg;
}
@@ -35,9 +37,9 @@ public class SetCloudAppPropertiesTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(SetCloudAppProperties.KEY_PROPERTIES, Test.GENERAL_CLOUDAPPPROPERTIES.serializeJSON());
+ result.put(SetCloudAppProperties.KEY_PROPERTIES, TestValues.GENERAL_CLOUDAPPPROPERTIES.serializeJSON());
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
index f56cab807..56f0dc0bc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
@@ -7,15 +7,23 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayout;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -27,9 +35,9 @@ public class SetDisplayLayoutTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SetDisplayLayout msg = new SetDisplayLayout();
- msg.setDisplayLayout(Test.GENERAL_STRING);
- msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
- msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+ msg.setDisplayLayout(TestValues.GENERAL_STRING);
+ msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
return msg;
}
@@ -49,11 +57,11 @@ public class SetDisplayLayoutTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SetDisplayLayout.KEY_DISPLAY_LAYOUT, Test.GENERAL_STRING);
- result.put(SetDisplayLayout.KEY_DAY_COLOR_SCHEME, Test.JSON_DAYCOLORSCHEME);
- result.put(SetDisplayLayout.KEY_NIGHT_COLOR_SCHEME, Test.JSON_NIGHTCOLORSCHEME);
+ result.put(SetDisplayLayout.KEY_DISPLAY_LAYOUT, TestValues.GENERAL_STRING);
+ result.put(SetDisplayLayout.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
+ result.put(SetDisplayLayout.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -62,6 +70,7 @@ public class SetDisplayLayoutTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String testDisplayLayout = ( (SetDisplayLayout) msg ).getDisplayLayout();
@@ -69,53 +78,54 @@ public class SetDisplayLayoutTests extends BaseRpcTests {
TemplateColorScheme testNightColorScheme = ( (SetDisplayLayout) msg).getNightColorScheme();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testDisplayLayout);
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testDisplayLayout);
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
// Invalid/Null Tests
SetDisplayLayout msg = new SetDisplayLayout();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getDisplayLayout());
- assertNull(Test.NULL, msg.getDayColorScheme());
- assertNull(Test.NULL, msg.getNightColorScheme());
+ assertNull(TestValues.NULL, msg.getDisplayLayout());
+ assertNull(TestValues.NULL, msg.getDayColorScheme());
+ assertNull(TestValues.NULL, msg.getNightColorScheme());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetDisplayLayout cmd = new SetDisplayLayout(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.MATCH, body);
+ assertNotNull(TestValues.MATCH, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetDisplayLayout.KEY_DISPLAY_LAYOUT), cmd.getDisplayLayout());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetDisplayLayout.KEY_DISPLAY_LAYOUT), cmd.getDisplayLayout());
JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
- assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
index 1ca333e73..51adf5c7c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
@@ -11,18 +11,26 @@ import com.smartdevicelink.proxy.rpc.VrHelpItem;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetGlobalProperties}
@@ -33,14 +41,14 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SetGlobalProperties msg = new SetGlobalProperties();
- msg.setVrHelpTitle(Test.GENERAL_STRING);
- msg.setMenuTitle(Test.GENERAL_STRING);
- msg.setMenuIcon(Test.GENERAL_IMAGE);
- msg.setVrHelp(Test.GENERAL_VRHELPITEM_LIST);
- msg.setHelpPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setTimeoutPrompt(Test.GENERAL_TTSCHUNK_LIST);
- msg.setKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES);
- msg.setMenuLayout(Test.GENERAL_MENU_LAYOUT);
+ msg.setVrHelpTitle(TestValues.GENERAL_STRING);
+ msg.setMenuTitle(TestValues.GENERAL_STRING);
+ msg.setMenuIcon(TestValues.GENERAL_IMAGE);
+ msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
+ msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES);
+ msg.setMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
return msg;
}
@@ -60,16 +68,16 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SetGlobalProperties.KEY_MENU_ICON, Test.JSON_IMAGE);
- result.put(SetGlobalProperties.KEY_VR_HELP, Test.JSON_VRHELPITEMS);
- result.put(SetGlobalProperties.KEY_HELP_PROMPT, Test.JSON_TTSCHUNKS);
- result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, Test.JSON_TTSCHUNKS);
- result.put(SetGlobalProperties.KEY_MENU_TITLE, Test.GENERAL_STRING);
- result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, Test.GENERAL_STRING);
- result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, Test.JSON_KEYBOARDPROPERTIES);
- result.put(SetGlobalProperties.KEY_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
+ result.put(SetGlobalProperties.KEY_MENU_ICON, TestValues.JSON_IMAGE);
+ result.put(SetGlobalProperties.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
+ result.put(SetGlobalProperties.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(SetGlobalProperties.KEY_MENU_TITLE, TestValues.GENERAL_STRING);
+ result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, TestValues.GENERAL_STRING);
+ result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, TestValues.JSON_KEYBOARDPROPERTIES);
+ result.put(SetGlobalProperties.KEY_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -78,6 +86,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Image testImage = ( (SetGlobalProperties) msg ).getMenuIcon();
@@ -90,61 +99,62 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
MenuLayout testMenuLayout = ( (SetGlobalProperties) msg ).getMenuLayout();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testMenuTitle);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testVrHelpTitle);
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testImage));
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(Test.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTimeout));
- assertTrue(Test.TRUE, Validator.validateKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties));
- assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT, testMenuLayout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testMenuTitle);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testVrHelpTitle);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeout));
+ assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT, testMenuLayout);
// Invalid/Null Tests
SetGlobalProperties msg = new SetGlobalProperties();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getMenuIcon());
- assertNull(Test.NULL, msg.getMenuTitle());
- assertNull(Test.NULL, msg.getVrHelp());
- assertNull(Test.NULL, msg.getHelpPrompt());
- assertNull(Test.NULL, msg.getTimeoutPrompt());
- assertNull(Test.NULL, msg.getKeyboardProperties());
- assertNull(Test.NULL, msg.getVrHelpTitle());
- assertNull(Test.NULL, msg.getMenuLayout());
+ assertNull(TestValues.NULL, msg.getMenuIcon());
+ assertNull(TestValues.NULL, msg.getMenuTitle());
+ assertNull(TestValues.NULL, msg.getVrHelp());
+ assertNull(TestValues.NULL, msg.getHelpPrompt());
+ assertNull(TestValues.NULL, msg.getTimeoutPrompt());
+ assertNull(TestValues.NULL, msg.getKeyboardProperties());
+ assertNull(TestValues.NULL, msg.getVrHelpTitle());
+ assertNull(TestValues.NULL, msg.getMenuLayout());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetGlobalProperties cmd = new SetGlobalProperties(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout());
JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_ICON);
Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
- assertTrue(Test.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
JSONObject keyboardProperties = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_KEYBOARD_PROPERTIES);
KeyboardProperties referenceKeyboardProperties = new KeyboardProperties(JsonRPCMarshaller.deserializeJSONObject(keyboardProperties));
- assertTrue(Test.TRUE, Validator.validateKeyboardProperties(referenceKeyboardProperties, cmd.getKeyboardProperties()));
+ assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(referenceKeyboardProperties, cmd.getKeyboardProperties()));
JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_HELP_PROMPT);
List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
@@ -152,7 +162,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)helpPromptArray.get(index)) );
helpPromptList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_TIMEOUT_PROMPT);
List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
@@ -160,7 +170,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)timeoutPromptArray.get(index)) );
timeoutPromptList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP);
List<VrHelpItem> vrHelpList = new ArrayList<VrHelpItem>();
@@ -168,9 +178,9 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
VrHelpItem chunk = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)vrHelpArray.get(index)) );
vrHelpList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()));
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
index f5ecb0d06..ecffe1b21 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
@@ -7,15 +7,23 @@ import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SetInteriorVehicleData}
@@ -26,7 +34,7 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
protected RPCMessage createMessage(){
SetInteriorVehicleData msg = new SetInteriorVehicleData();
- msg.setModuleData(Test.GENERAL_MODULEDATA);
+ msg.setModuleData(TestValues.GENERAL_MODULEDATA);
return msg;
}
@@ -46,9 +54,9 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(SetInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ result.put(SetInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -57,46 +65,48 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ModuleData testModuleData = ( (SetInteriorVehicleData) msg ).getModuleData();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, testModuleData));
// Invalid/Null Tests
SetInteriorVehicleData msg = new SetInteriorVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getModuleData());
+ assertNull(TestValues.NULL, msg.getModuleData());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetInteriorVehicleData cmd = new SetInteriorVehicleData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
ModuleData referenceModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleData.KEY_MODULE_DATA)));
- assertTrue(Test.TRUE, Validator.validateModuleData(referenceModuleData, cmd.getModuleData()));
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(referenceModuleData, cmd.getModuleData()));
}catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
index b422937a8..5e97d8633 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
@@ -9,15 +9,23 @@ import com.smartdevicelink.proxy.rpc.enums.AudioStreamingIndicator;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetMediaClockTimer}
@@ -28,10 +36,10 @@ public class SetMediaClockTimerTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SetMediaClockTimer msg = new SetMediaClockTimer();
- msg.setStartTime(Test.GENERAL_STARTTIME);
- msg.setEndTime(Test.GENERAL_STARTTIME);
- msg.setUpdateMode(Test.GENERAL_UPDATEMODE);
- msg.setAudioStreamingIndicator(Test.GENERAL_AUDIO_STREAMING_INDICATOR);
+ msg.setStartTime(TestValues.GENERAL_STARTTIME);
+ msg.setEndTime(TestValues.GENERAL_STARTTIME);
+ msg.setUpdateMode(TestValues.GENERAL_UPDATEMODE);
+ msg.setAudioStreamingIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
return msg;
}
@@ -51,12 +59,12 @@ public class SetMediaClockTimerTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SetMediaClockTimer.KEY_START_TIME, Test.JSON_STARTTIME);
- result.put(SetMediaClockTimer.KEY_END_TIME, Test.JSON_STARTTIME);
- result.put(SetMediaClockTimer.KEY_UPDATE_MODE, Test.GENERAL_UPDATEMODE);
- result.put(SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
+ result.put(SetMediaClockTimer.KEY_START_TIME, TestValues.JSON_STARTTIME);
+ result.put(SetMediaClockTimer.KEY_END_TIME, TestValues.JSON_STARTTIME);
+ result.put(SetMediaClockTimer.KEY_UPDATE_MODE, TestValues.GENERAL_UPDATEMODE);
+ result.put(SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -65,6 +73,7 @@ public class SetMediaClockTimerTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
StartTime testStartTime = ( (SetMediaClockTimer) msg ).getStartTime();
@@ -73,25 +82,26 @@ public class SetMediaClockTimerTests extends BaseRpcTests {
AudioStreamingIndicator testAudioStreamingIndicator = ( (SetMediaClockTimer) msg ).getAudioStreamingIndicator();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_UPDATEMODE, testUpdateMode);
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, testAudioStreamingIndicator);
- assertTrue(Test.TRUE, Validator.validateStartTime(Test.GENERAL_STARTTIME, testStartTime));
- assertTrue(Test.TRUE, Validator.validateStartTime(Test.GENERAL_STARTTIME, testEndTime));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_UPDATEMODE, testUpdateMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, testAudioStreamingIndicator);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testStartTime));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testEndTime));
// Invalid/Null Tests
SetMediaClockTimer msg = new SetMediaClockTimer();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getStartTime());
- assertNull(Test.NULL, msg.getEndTime());
- assertNull(Test.NULL, msg.getUpdateMode());
- assertNull(Test.NULL, msg.getAudioStreamingIndicator());
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertNull(TestValues.NULL, msg.getUpdateMode());
+ assertNull(TestValues.NULL, msg.getAudioStreamingIndicator());
}
/**
* Test static initializers
*/
+ @Test
public void testInitializers(){
Integer timeInterval1 = 5000;
StartTime startTime1 = new StartTime(timeInterval1);
@@ -99,91 +109,92 @@ public class SetMediaClockTimerTests extends BaseRpcTests {
StartTime startTime2 = new StartTime(timeInterval2);
SetMediaClockTimer msg;
- msg = SetMediaClockTimer.countUpFromStartTimeInterval(timeInterval1, timeInterval2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countUpFromStartTime(startTime1, startTime2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countDownFromStartTimeInterval(timeInterval1, timeInterval2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countDownFromStartTime(startTime1, startTime2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.pauseWithPlayPauseIndicator(Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertNull(Test.NULL, msg.getStartTime());
- assertNull(Test.NULL, msg.getEndTime());
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.updatePauseWithNewStartTimeInterval(timeInterval1, timeInterval2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.updatePauseWithNewStartTime(startTime1, startTime2, Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(Test.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.resumeWithPlayPauseIndicator(Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.RESUME);
- assertNull(Test.NULL, msg.getStartTime());
- assertNull(Test.NULL, msg.getEndTime());
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.clearWithPlayPauseIndicator(Test.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(Test.MATCH, msg.getUpdateMode(), UpdateMode.CLEAR);
- assertNull(Test.NULL, msg.getStartTime());
- assertNull(Test.NULL, msg.getEndTime());
- assertEquals(Test.MATCH, Test.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+ msg = SetMediaClockTimer.countUpFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countUpFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countDownFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countDownFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.pauseWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.updatePauseWithNewStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.updatePauseWithNewStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.resumeWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.RESUME);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.clearWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.CLEAR);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetMediaClockTimer cmd = new SetMediaClockTimer(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject startTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_START_TIME);
StartTime referenceStartTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(startTime));
- assertTrue(Test.TRUE, Validator.validateStartTime(referenceStartTime, cmd.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceStartTime, cmd.getStartTime()));
JSONObject endTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_END_TIME);
StartTime referenceEndTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(endTime));
- assertTrue(Test.TRUE, Validator.validateStartTime(referenceEndTime, cmd.getEndTime()));
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_UPDATE_MODE), cmd.getUpdateMode().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR), cmd.getAudioStreamingIndicator().toString());
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceEndTime, cmd.getEndTime()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_UPDATE_MODE), cmd.getUpdateMode().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR), cmd.getAudioStreamingIndicator().toString());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
index 07ff2fbfc..eb2526e54 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
@@ -41,14 +41,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ShowAppMenu;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowAppMenu}
@@ -58,7 +65,7 @@ public class ShowAppMenuTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
ShowAppMenu msg = new ShowAppMenu();
- msg.setMenuID(Test.GENERAL_INTEGER);
+ msg.setMenuID(TestValues.GENERAL_INTEGER);
return msg;
}
@@ -77,9 +84,9 @@ public class ShowAppMenuTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ShowAppMenu.KEY_MENU_ID, Test.GENERAL_INTEGER);
+ result.put(ShowAppMenu.KEY_MENU_ID, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -88,43 +95,45 @@ public class ShowAppMenuTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer copy = ( (ShowAppMenu) msg ).getMenuID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, copy);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, copy);
// Invalid/Null Tests
ShowAppMenu msg = new ShowAppMenu();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.MATCH, msg.getMenuID());
+ assertNull(TestValues.MATCH, msg.getMenuID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ShowAppMenu cmd = new ShowAppMenu(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
Integer serviceID = JsonUtils.readIntegerFromJsonObject(parameters, ShowAppMenu.KEY_MENU_ID);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, serviceID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, serviceID);
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
index 0fd7f0d19..4a3034eee 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
@@ -8,18 +8,26 @@ import com.smartdevicelink.proxy.rpc.ShowConstantTbt;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.ShowConstantTbt}
@@ -30,17 +38,17 @@ public class ShowConstantTbtTests extends BaseRpcTests {
protected RPCMessage createMessage() {
ShowConstantTbt msg = new ShowConstantTbt();
- msg.setDistanceToManeuver(Test.GENERAL_DOUBLE);
- msg.setDistanceToManeuverScale(Test.GENERAL_DOUBLE);
- msg.setEta(Test.GENERAL_STRING);
+ msg.setDistanceToManeuver(TestValues.GENERAL_DOUBLE);
+ msg.setDistanceToManeuverScale(TestValues.GENERAL_DOUBLE);
+ msg.setEta(TestValues.GENERAL_STRING);
msg.setManeuverComplete(true);
- msg.setNavigationText1(Test.GENERAL_STRING);
- msg.setNavigationText2(Test.GENERAL_STRING);
- msg.setNextTurnIcon(Test.GENERAL_IMAGE);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
- msg.setTimeToDestination(Test.GENERAL_STRING);
- msg.setTotalDistance(Test.GENERAL_STRING);
- msg.setTurnIcon(Test.GENERAL_IMAGE);
+ msg.setNavigationText1(TestValues.GENERAL_STRING);
+ msg.setNavigationText2(TestValues.GENERAL_STRING);
+ msg.setNextTurnIcon(TestValues.GENERAL_IMAGE);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setTimeToDestination(TestValues.GENERAL_STRING);
+ msg.setTotalDistance(TestValues.GENERAL_STRING);
+ msg.setTurnIcon(TestValues.GENERAL_IMAGE);
return msg;
}
@@ -60,19 +68,19 @@ public class ShowConstantTbtTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
- result.put(ShowConstantTbt.KEY_ETA, Test.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(ShowConstantTbt.KEY_ETA, TestValues.GENERAL_STRING);
result.put(ShowConstantTbt.KEY_MANEUVER_COMPLETE, true);
- result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, Test.GENERAL_DOUBLE);
- result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, Test.GENERAL_DOUBLE);
- result.put(ShowConstantTbt.KEY_TEXT1, Test.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TEXT2, Test.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, Test.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TOTAL_DISTANCE, Test.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_MANEUVER_IMAGE, Test.GENERAL_IMAGE.serializeJSON());
- result.put(ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE, Test.GENERAL_IMAGE.serializeJSON());
+ result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, TestValues.GENERAL_DOUBLE);
+ result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, TestValues.GENERAL_DOUBLE);
+ result.put(ShowConstantTbt.KEY_TEXT1, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TEXT2, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TOTAL_DISTANCE, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
+ result.put(ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -81,6 +89,7 @@ public class ShowConstantTbtTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Double testScale = ((ShowConstantTbt) msg).getDistanceToManeuverScale();
@@ -96,70 +105,71 @@ public class ShowConstantTbtTests extends BaseRpcTests {
List<SoftButton> testSoftButtons = ((ShowConstantTbt) msg).getSoftButtons();
// Valid Test
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testTimeToDestination);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, testScale);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testNavText1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testNavText2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testEta);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testTotalDistance);
- assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, testDistance);
- assertTrue(Test.TRUE, testManeuverComplete);
- assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testTurnIcon));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testNextTurnIcon));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTimeToDestination);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testScale);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testEta);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTotalDistance);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testDistance);
+ assertTrue(TestValues.TRUE, testManeuverComplete);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testTurnIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testNextTurnIcon));
// Invalid/Null Tests
ShowConstantTbt msg = new ShowConstantTbt();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSoftButtons());
- assertNull(Test.NULL, msg.getNavigationText1());
- assertNull(Test.NULL, msg.getNavigationText2());
- assertNull(Test.NULL, msg.getDistanceToManeuver());
- assertNull(Test.NULL, msg.getDistanceToManeuverScale());
- assertNull(Test.NULL, msg.getEta());
- assertNull(Test.NULL, msg.getManeuverComplete());
- assertNull(Test.NULL, msg.getNextTurnIcon());
- assertNull(Test.NULL, msg.getTimeToDestination());
- assertNull(Test.NULL, msg.getTotalDistance());
- assertNull(Test.NULL, msg.getTurnIcon());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getNavigationText1());
+ assertNull(TestValues.NULL, msg.getNavigationText2());
+ assertNull(TestValues.NULL, msg.getDistanceToManeuver());
+ assertNull(TestValues.NULL, msg.getDistanceToManeuverScale());
+ assertNull(TestValues.NULL, msg.getEta());
+ assertNull(TestValues.NULL, msg.getManeuverComplete());
+ assertNull(TestValues.NULL, msg.getNextTurnIcon());
+ assertNull(TestValues.NULL, msg.getTimeToDestination());
+ assertNull(TestValues.NULL, msg.getTotalDistance());
+ assertNull(TestValues.NULL, msg.getTurnIcon());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ShowConstantTbt cmd = new ShowConstantTbt(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TOTAL_DISTANCE), cmd.getTotalDistance());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TOTAL_DISTANCE), cmd.getTotalDistance());
JSONObject icon1 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_IMAGE);
Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon1));
- assertTrue(Test.TRUE, Validator.validateImage(refIcon1, cmd.getTurnIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, cmd.getTurnIcon()));
JSONObject icon2 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE);
Image refIcon2 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon2));
- assertTrue(Test.TRUE, Validator.validateImage(refIcon2, cmd.getNextTurnIcon()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon2, cmd.getNextTurnIcon()));
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ShowConstantTbt.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
@@ -167,9 +177,9 @@ public class ShowConstantTbtTests extends BaseRpcTests {
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
index 77f6e65e7..de39d2733 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
@@ -11,18 +11,26 @@ import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Show}
@@ -33,21 +41,21 @@ public class ShowTests extends BaseRpcTests {
protected RPCMessage createMessage() {
Show msg = new Show();
- msg.setMainField1(Test.GENERAL_STRING);
- msg.setMainField2(Test.GENERAL_STRING);
- msg.setMainField3(Test.GENERAL_STRING);
- msg.setMainField4(Test.GENERAL_STRING);
- msg.setStatusBar(Test.GENERAL_STRING);
- msg.setMediaTrack(Test.GENERAL_STRING);
- msg.setTemplateTitle(Test.GENERAL_STRING);
- msg.setAlignment(Test.GENERAL_TEXTALIGNMENT);
- msg.setGraphic(Test.GENERAL_IMAGE);
- msg.setSecondaryGraphic(Test.GENERAL_IMAGE);
- msg.setCustomPresets(Test.GENERAL_STRING_LIST);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
- msg.setMetadataTags(Test.GENERAL_METADATASTRUCT);
- msg.setWindowID(Test.GENERAL_INT);
- msg.setTemplateConfiguration(Test.GENERAL_TEMPLATE_CONFIGURATION);
+ msg.setMainField1(TestValues.GENERAL_STRING);
+ msg.setMainField2(TestValues.GENERAL_STRING);
+ msg.setMainField3(TestValues.GENERAL_STRING);
+ msg.setMainField4(TestValues.GENERAL_STRING);
+ msg.setStatusBar(TestValues.GENERAL_STRING);
+ msg.setMediaTrack(TestValues.GENERAL_STRING);
+ msg.setTemplateTitle(TestValues.GENERAL_STRING);
+ msg.setAlignment(TestValues.GENERAL_TEXTALIGNMENT);
+ msg.setGraphic(TestValues.GENERAL_IMAGE);
+ msg.setSecondaryGraphic(TestValues.GENERAL_IMAGE);
+ msg.setCustomPresets(TestValues.GENERAL_STRING_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setMetadataTags(TestValues.GENERAL_METADATASTRUCT);
+ msg.setWindowID(TestValues.GENERAL_INT);
+ msg.setTemplateConfiguration(TestValues.GENERAL_TEMPLATE_CONFIGURATION);
return msg;
}
@@ -67,28 +75,29 @@ public class ShowTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(Show.KEY_MAIN_FIELD_1, Test.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_2, Test.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_3, Test.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_4, Test.GENERAL_STRING);
- result.put(Show.KEY_STATUS_BAR, Test.GENERAL_STRING);
- result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
- result.put(Show.KEY_TEMPLATE_TITLE, Test.GENERAL_STRING);
- result.put(Show.KEY_GRAPHIC, Test.JSON_IMAGE);
- result.put(Show.KEY_SECONDARY_GRAPHIC, Test.JSON_IMAGE);
- result.put(Show.KEY_ALIGNMENT, Test.GENERAL_TEXTALIGNMENT);
- result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(Show.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
- result.put(Show.KEY_METADATA_TAGS, Test.GENERAL_METADATASTRUCT.serializeJSON());
- result.put(Show.KEY_WINDOW_ID, Test.GENERAL_INT);
- result.put(Show.KEY_TEMPLATE_CONFIGURATION, Test.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
+ result.put(Show.KEY_MAIN_FIELD_1, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_2, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_3, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_4, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_STATUS_BAR, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MEDIA_TRACK, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_TEMPLATE_TITLE, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_GRAPHIC, TestValues.JSON_IMAGE);
+ result.put(Show.KEY_SECONDARY_GRAPHIC, TestValues.JSON_IMAGE);
+ result.put(Show.KEY_ALIGNMENT, TestValues.GENERAL_TEXTALIGNMENT);
+ result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(Show.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(Show.KEY_METADATA_TAGS, TestValues.GENERAL_METADATASTRUCT.serializeJSON());
+ result.put(Show.KEY_WINDOW_ID, TestValues.GENERAL_INT);
+ result.put(Show.KEY_TEMPLATE_CONFIGURATION, TestValues.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
+ @Test
public void testSoftButtons () {
// TestValues
String testTrack = ( (Show) msg ).getMediaTrack();
@@ -106,89 +115,90 @@ public class ShowTests extends BaseRpcTests {
MetadataTags testMetadata = ( (Show) msg ).getMetadataTags();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testTrack);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, templateTitle);
- assertEquals(Test.MATCH, Test.GENERAL_TEXTALIGNMENT, testAlignment);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testStatusBar);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText1);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText2);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText3);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText4);
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), testCustomPresets.size());
- assertEquals(Test.MATCH, Test.GENERAL_METADATASTRUCT, testMetadata);
- assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic2));
- assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic1));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTrack);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, templateTitle);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTALIGNMENT, testAlignment);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testStatusBar);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText4);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testCustomPresets.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_METADATASTRUCT, testMetadata);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic2));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic1));
// Invalid/Null Tests
Show msg = new Show();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getMainField1());
- assertNull(Test.NULL, msg.getMainField2());
- assertNull(Test.NULL, msg.getMainField3());
- assertNull(Test.NULL, msg.getMainField4());
- assertNull(Test.NULL, msg.getStatusBar());
- assertNull(Test.NULL, msg.getAlignment());
- assertNull(Test.NULL, msg.getGraphic());
- assertNull(Test.NULL, msg.getSecondaryGraphic());
- assertNull(Test.NULL, msg.getCustomPresets());
- assertNull(Test.NULL, msg.getMediaTrack());
- assertNull(Test.NULL, msg.getTemplateTitle());
- assertNull(Test.NULL, msg.getSoftButtons());
- assertNull(Test.NULL, msg.getMetadataTags());
- assertNull(Test.NULL, msg.getWindowID());
- assertNull(Test.NULL, msg.getTemplateConfiguration());
+ assertNull(TestValues.NULL, msg.getMainField1());
+ assertNull(TestValues.NULL, msg.getMainField2());
+ assertNull(TestValues.NULL, msg.getMainField3());
+ assertNull(TestValues.NULL, msg.getMainField4());
+ assertNull(TestValues.NULL, msg.getStatusBar());
+ assertNull(TestValues.NULL, msg.getAlignment());
+ assertNull(TestValues.NULL, msg.getGraphic());
+ assertNull(TestValues.NULL, msg.getSecondaryGraphic());
+ assertNull(TestValues.NULL, msg.getCustomPresets());
+ assertNull(TestValues.NULL, msg.getMediaTrack());
+ assertNull(TestValues.NULL, msg.getTemplateTitle());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getMetadataTags());
+ assertNull(TestValues.NULL, msg.getWindowID());
+ assertNull(TestValues.NULL, msg.getTemplateConfiguration());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext,getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(),getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Show cmd = new Show(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject graphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_GRAPHIC);
Image referenceGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(graphic));
- assertTrue(Test.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
List<String> customPresetsList = JsonUtils.readStringListFromJsonObject(parameters, Show.KEY_CUSTOM_PRESETS);
List<String> testPresetsList = cmd.getCustomPresets();
- assertEquals(Test.MATCH, customPresetsList.size(), testPresetsList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(customPresetsList, testPresetsList));
-
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_1), cmd.getMainField1());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_2), cmd.getMainField2());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_3), cmd.getMainField3());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_4), cmd.getMainField4());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Show.KEY_WINDOW_ID), cmd.getWindowID());
+ assertEquals(TestValues.MATCH, customPresetsList.size(), testPresetsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(customPresetsList, testPresetsList));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_1), cmd.getMainField1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_2), cmd.getMainField2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_3), cmd.getMainField3());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_4), cmd.getMainField4());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Show.KEY_WINDOW_ID), cmd.getWindowID());
JSONObject templateConfiguration = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_TEMPLATE_CONFIGURATION);
TemplateConfiguration refTemplateConfiguration = new TemplateConfiguration(JsonRPCMarshaller.deserializeJSONObject(templateConfiguration));
- assertTrue(Test.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
- assertTrue(Test.TRUE, Validator.validateImage(referenceSecondaryGraphic, cmd.getSecondaryGraphic()));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceSecondaryGraphic, cmd.getSecondaryGraphic()));
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Show.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
@@ -196,10 +206,10 @@ public class ShowTests extends BaseRpcTests {
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
index cce913632..c375d2d4d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
@@ -6,16 +6,24 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Slider;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Slider}
@@ -26,12 +34,12 @@ public class SliderTests extends BaseRpcTests {
protected RPCMessage createMessage() {
Slider msg = new Slider();
- msg.setNumTicks(Test.GENERAL_INT);
- msg.setPosition(Test.GENERAL_INT);
- msg.setTimeout(Test.GENERAL_INT);
- msg.setSliderHeader(Test.GENERAL_STRING);
- msg.setSliderFooter(Test.GENERAL_STRING_LIST);
- msg.setCancelID(Test.GENERAL_INTEGER);
+ msg.setNumTicks(TestValues.GENERAL_INT);
+ msg.setPosition(TestValues.GENERAL_INT);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setSliderHeader(TestValues.GENERAL_STRING);
+ msg.setSliderFooter(TestValues.GENERAL_STRING_LIST);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
return msg;
}
@@ -51,14 +59,14 @@ public class SliderTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(Slider.KEY_SLIDER_HEADER, Test.GENERAL_STRING);
- result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(Slider.KEY_POSITION, Test.GENERAL_INT);
- result.put(Slider.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
- result.put(Slider.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ result.put(Slider.KEY_SLIDER_HEADER, TestValues.GENERAL_STRING);
+ result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(Slider.KEY_POSITION, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_NUM_TICKS, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -67,6 +75,7 @@ public class SliderTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer testNumTicks = ( (Slider) msg ).getNumTicks();
@@ -77,59 +86,60 @@ public class SliderTests extends BaseRpcTests {
Integer testCancelID = ( (Slider) msg ).getCancelID();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testNumTicks);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testPosition);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testSlider);
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testFooter));
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testNumTicks);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testPosition);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testSlider);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testFooter));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
Slider msg = new Slider();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSliderHeader());
- assertNull(Test.NULL, msg.getSliderFooter());
- assertNull(Test.NULL, msg.getPosition());
- assertNull(Test.NULL, msg.getTimeout());
- assertNull(Test.NULL, msg.getNumTicks());
- assertNull(Test.NULL, msg.getCancelID());
+ assertNull(TestValues.NULL, msg.getSliderHeader());
+ assertNull(TestValues.NULL, msg.getSliderFooter());
+ assertNull(TestValues.NULL, msg.getPosition());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getNumTicks());
+ assertNull(TestValues.NULL, msg.getCancelID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Slider cmd = new Slider(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_NUM_TICKS), cmd.getNumTicks());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Slider.KEY_SLIDER_HEADER), cmd.getSliderHeader());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_NUM_TICKS), cmd.getNumTicks());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Slider.KEY_SLIDER_HEADER), cmd.getSliderHeader());
List<String> sliderFooterList = JsonUtils.readStringListFromJsonObject(parameters, Slider.KEY_SLIDER_FOOTER);
List<String> testFooterList = cmd.getSliderFooter();
- assertEquals(Test.MATCH, sliderFooterList.size(), testFooterList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(sliderFooterList, testFooterList));
+ assertEquals(TestValues.MATCH, sliderFooterList.size(), testFooterList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(sliderFooterList, testFooterList));
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
index e926c9b78..4681975fe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
@@ -7,25 +7,33 @@ import com.smartdevicelink.proxy.rpc.Speak;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class SpeakTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
Speak msg = new Speak();
- msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
+ msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
return msg;
}
@@ -45,9 +53,9 @@ public class SpeakTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(Speak.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
+ result.put(Speak.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,38 +64,40 @@ public class SpeakTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<TTSChunk> copy = ( (Speak) msg ).getTtsChunks();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, copy));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, copy));
// Invalid/Null Tests
Speak msg = new Speak();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.MATCH, msg.getTtsChunks());
+ assertNull(TestValues.MATCH, msg.getTtsChunks());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Speak cmd = new Speak(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
@@ -97,7 +107,7 @@ public class SpeakTests extends BaseRpcTests {
TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
ttsChunkList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
index 6860122bb..534e65576 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
@@ -7,13 +7,19 @@ import com.smartdevicelink.proxy.rpc.SubscribeButton;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -25,7 +31,7 @@ public class SubscribeButtonTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SubscribeButton msg = new SubscribeButton();
- msg.setButtonName(Test.GENERAL_BUTTONNAME);
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
return msg;
}
@@ -45,9 +51,9 @@ public class SubscribeButtonTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SubscribeButton.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
+ result.put(SubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,43 +62,45 @@ public class SubscribeButtonTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ButtonName testButtonName = ( (SubscribeButton) msg ).getButtonName();
// Valid Tests
- assertEquals("Data didn't match input data.", Test.GENERAL_BUTTONNAME, testButtonName);
+ assertEquals("Data didn't match input data.", TestValues.GENERAL_BUTTONNAME, testButtonName);
// Invalid/Null Tests
SubscribeButton msg = new SubscribeButton();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getButtonName());
+ assertNull(TestValues.NULL, msg.getButtonName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeButton cmd = new SubscribeButton(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
index 6cfeb8816..d319d1b11 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
@@ -6,14 +6,22 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeVehicleData}
@@ -24,35 +32,35 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SubscribeVehicleData msg = new SubscribeVehicleData();
- msg.setSpeed(Test.GENERAL_BOOLEAN);
- msg.setRpm(Test.GENERAL_BOOLEAN);
- msg.setExternalTemperature(Test.GENERAL_BOOLEAN);
- msg.setFuelLevel(Test.GENERAL_BOOLEAN);
- msg.setPrndl(Test.GENERAL_BOOLEAN);
- msg.setTirePressure(Test.GENERAL_BOOLEAN);
- msg.setEngineTorque(Test.GENERAL_BOOLEAN);
- msg.setEngineOilLife(Test.GENERAL_BOOLEAN);
- msg.setOdometer(Test.GENERAL_BOOLEAN);
- msg.setGps(Test.GENERAL_BOOLEAN);
- msg.setFuelLevelState(Test.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(Test.GENERAL_BOOLEAN);
- msg.setBeltStatus(Test.GENERAL_BOOLEAN);
- msg.setBodyInformation(Test.GENERAL_BOOLEAN);
- msg.setDeviceStatus(Test.GENERAL_BOOLEAN);
- msg.setDriverBraking(Test.GENERAL_BOOLEAN);
- msg.setWiperStatus(Test.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(Test.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(Test.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(Test.GENERAL_BOOLEAN);
- msg.setECallInfo(Test.GENERAL_BOOLEAN);
- msg.setAirbagStatus(Test.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(Test.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(Test.GENERAL_BOOLEAN);
- msg.setMyKey(Test.GENERAL_BOOLEAN);
- msg.setFuelRange(Test.GENERAL_BOOLEAN);
- msg.setTurnSignal(Test.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -72,37 +80,37 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SubscribeVehicleData.KEY_SPEED, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_RPM, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_FUEL_LEVEL, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_PRNDL, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_TIRE_PRESSURE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_ENGINE_TORQUE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_ENGINE_OIL_LIFE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_ODOMETER, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_GPS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_FUEL_LEVEL_STATE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_BELT_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_BODY_INFORMATION, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_DEVICE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_DRIVER_BRAKING, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_WIPER_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_HEAD_LAMP_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_ACC_PEDAL_POSITION, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_E_CALL_INFO, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_AIRBAG_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_EMERGENCY_EVENT, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_MY_KEY, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
- result.put(SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_FUEL_LEVEL, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_PRNDL, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_TIRE_PRESSURE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_ENGINE_TORQUE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_ODOMETER, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_GPS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_BELT_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_BODY_INFORMATION, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_DEVICE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_DRIVER_BRAKING, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_WIPER_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_E_CALL_INFO, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_AIRBAG_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_EMERGENCY_EVENT, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_MY_KEY, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_FUEL_RANGE, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_TURN_SIGNAL, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -111,125 +119,127 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Valid Tests
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getSpeed());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getRpm());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getExternalTemperature());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getFuelLevel());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getPrndl());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getTirePressure());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getEngineTorque());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getEngineOilLife());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getOdometer());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getGps());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getFuelLevelState());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getBeltStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getBodyInformation());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getDeviceStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getDriverBraking());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getWiperStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getHeadLampStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getAccPedalPosition());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getECallInfo());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getAirbagStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getEmergencyEvent());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getClusterModeStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getMyKey());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getFuelRange());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getTurnSignal());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getSpeed());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getRpm());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getExternalTemperature());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelLevel());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getPrndl());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getTirePressure());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEngineTorque());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEngineOilLife());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getOdometer());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getGps());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelLevelState());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getInstantFuelConsumption());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getBeltStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getBodyInformation());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getDeviceStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getDriverBraking());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getWiperStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getHeadLampStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getAccPedalPosition());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getSteeringWheelAngle());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getECallInfo());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getAirbagStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEmergencyEvent());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getClusterModeStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getMyKey());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelRange());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getTurnSignal());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleData msg = new SubscribeVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeVehicleData cmd = new SubscribeVehicleData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
index 06b6ee330..894ef026e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeWayPoints;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* Created by austinkirk on 6/7/17.
*/
@@ -42,32 +48,34 @@ public class SubscribeWayPointsTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SubscribeWayPoints msg = new SubscribeWayPoints();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeWayPoints cmd = new SubscribeWayPoints(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
index e6c7d72ee..217e4da58 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
@@ -7,16 +7,25 @@ import com.smartdevicelink.proxy.rpc.SystemRequest;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SystemRequest}
@@ -27,10 +36,10 @@ public class SystemRequestTests extends BaseRpcTests {
protected RPCMessage createMessage() {
SystemRequest msg = new SystemRequest();
- msg.setLegacyData(Test.GENERAL_STRING_LIST);
- msg.setFileName(Test.GENERAL_STRING);
- msg.setRequestType(Test.GENERAL_REQUESTTYPE);
- msg.setRequestSubType(Test.GENERAL_STRING);
+ msg.setLegacyData(TestValues.GENERAL_STRING_LIST);
+ msg.setFileName(TestValues.GENERAL_STRING);
+ msg.setRequestType(TestValues.GENERAL_REQUESTTYPE);
+ msg.setRequestSubType(TestValues.GENERAL_STRING);
return msg;
}
@@ -50,12 +59,12 @@ public class SystemRequestTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SystemRequest.KEY_DATA, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(SystemRequest.KEY_FILE_NAME, Test.GENERAL_STRING);
- result.put(SystemRequest.KEY_REQUEST_TYPE, Test.GENERAL_REQUESTTYPE);
- result.put(SystemRequest.KEY_REQUEST_SUB_TYPE, Test.GENERAL_STRING);
+ result.put(SystemRequest.KEY_DATA, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(SystemRequest.KEY_FILE_NAME, TestValues.GENERAL_STRING);
+ result.put(SystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
+ result.put(SystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -64,6 +73,7 @@ public class SystemRequestTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
RequestType testRequestType = ( (SystemRequest) msg ).getRequestType();
@@ -72,52 +82,53 @@ public class SystemRequestTests extends BaseRpcTests {
List<String> testLegacyData = ( (SystemRequest) msg ).getLegacyData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_REQUESTTYPE, testRequestType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testRequestSubType);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testFileName);
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testLegacyData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, testRequestType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testRequestSubType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFileName);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testLegacyData));
// Invalid/Null Tests
SystemRequest msg = new SystemRequest();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getLegacyData());
- assertNull(Test.NULL, msg.getFileName());
- assertNull(Test.NULL, msg.getRequestType());
- assertNull(Test.NULL, msg.getRequestSubType());
- assertNull(Test.NULL, msg.getBulkData());
+ assertNull(TestValues.NULL, msg.getLegacyData());
+ assertNull(TestValues.NULL, msg.getFileName());
+ assertNull(TestValues.NULL, msg.getRequestType());
+ assertNull(TestValues.NULL, msg.getRequestSubType());
+ assertNull(TestValues.NULL, msg.getBulkData());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SystemRequest cmd = new SystemRequest(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_FILE_NAME), cmd.getFileName());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_TYPE), cmd.getRequestType().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_SUB_TYPE), cmd.getRequestSubType());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_FILE_NAME), cmd.getFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_TYPE), cmd.getRequestType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_SUB_TYPE), cmd.getRequestSubType());
List<String> dataList = JsonUtils.readStringListFromJsonObject(parameters, SystemRequest.KEY_DATA);
List<String> testDataList = cmd.getLegacyData();
- assertEquals(Test.MATCH, dataList.size(), testDataList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(dataList, testDataList));
+ assertEquals(TestValues.MATCH, dataList.size(), testDataList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(dataList, testDataList));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
index 1bc0532f8..f038121a7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
@@ -41,14 +41,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnpublishAppService;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnpublishAppService}
@@ -58,7 +65,7 @@ public class UnpublishAppServiceTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
UnpublishAppService msg = new UnpublishAppService();
- msg.setServiceID(Test.GENERAL_STRING);
+ msg.setServiceID(TestValues.GENERAL_STRING);
return msg;
}
@@ -77,9 +84,9 @@ public class UnpublishAppServiceTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(UnpublishAppService.KEY_SERVICE_ID, Test.GENERAL_STRING);
+ result.put(UnpublishAppService.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -88,54 +95,57 @@ public class UnpublishAppServiceTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String copy = ( (UnpublishAppService) msg ).getServiceID();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, copy);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
// Invalid/Null Tests
UnpublishAppService msg = new UnpublishAppService();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.MATCH, msg.getServiceID());
+ assertNull(TestValues.MATCH, msg.getServiceID());
}
/**
* Tests constructor with required params
*/
+ @Test
public void testRequiredParamsConstructor () {
- UnpublishAppService msg = new UnpublishAppService(Test.GENERAL_STRING);
- assertNotNull(Test.NOT_NULL, msg);
+ UnpublishAppService msg = new UnpublishAppService(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getServiceID());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceID());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnpublishAppService cmd = new UnpublishAppService(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
String serviceID = JsonUtils.readStringFromJsonObject(parameters, UnpublishAppService.KEY_SERVICE_ID);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceID);
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
index a49cc12fb..e400ff73b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.UnregisterAppInterface}
@@ -43,33 +49,35 @@ public class UnregisterAppInterfaceTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnregisterAppInterface msg = new UnregisterAppInterface();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnregisterAppInterface cmd = new UnregisterAppInterface(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
index c587b2358..9b786cb7d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.UnsubscribeButton}
@@ -25,7 +32,7 @@ public class UnsubscribeButtonTests extends BaseRpcTests {
protected RPCMessage createMessage() {
UnsubscribeButton msg = new UnsubscribeButton();
- msg.setButtonName(Test.GENERAL_BUTTONNAME);
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
return msg;
}
@@ -45,10 +52,10 @@ public class UnsubscribeButtonTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(UnsubscribeButton.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
+ result.put(UnsubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -57,41 +64,43 @@ public class UnsubscribeButtonTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ButtonName testButtonName = ( (UnsubscribeButton) msg ).getButtonName();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, testButtonName);
// Invalid/Null Tests
UnsubscribeButton msg = new UnsubscribeButton();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getButtonName());
+ assertNull(TestValues.NULL, msg.getButtonName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeButton cmd = new UnsubscribeButton(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, UnsubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, UnsubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
}
catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
index 634bb8ee6..0f2098c54 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
@@ -7,14 +7,23 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeVehicleData}
@@ -25,36 +34,36 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
protected RPCMessage createMessage() {
UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- msg.setSpeed(Test.GENERAL_BOOLEAN);
- msg.setRpm(Test.GENERAL_BOOLEAN);
- msg.setExternalTemperature(Test.GENERAL_BOOLEAN);
- msg.setFuelLevel(Test.GENERAL_BOOLEAN);
- msg.setPrndl(Test.GENERAL_BOOLEAN);
- msg.setTirePressure(Test.GENERAL_BOOLEAN);
- msg.setEngineTorque(Test.GENERAL_BOOLEAN);
- msg.setEngineOilLife(Test.GENERAL_BOOLEAN);
- msg.setOdometer(Test.GENERAL_BOOLEAN);
- msg.setGps(Test.GENERAL_BOOLEAN);
- msg.setFuelLevelState(Test.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(Test.GENERAL_BOOLEAN);
- msg.setBeltStatus(Test.GENERAL_BOOLEAN);
- msg.setBodyInformation(Test.GENERAL_BOOLEAN);
- msg.setDeviceStatus(Test.GENERAL_BOOLEAN);
- msg.setDriverBraking(Test.GENERAL_BOOLEAN);
- msg.setWiperStatus(Test.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(Test.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(Test.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(Test.GENERAL_BOOLEAN);
- msg.setECallInfo(Test.GENERAL_BOOLEAN);
- msg.setAirbagStatus(Test.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(Test.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(Test.GENERAL_BOOLEAN);
- msg.setMyKey(Test.GENERAL_BOOLEAN);
- msg.setFuelRange(Test.GENERAL_BOOLEAN);
- msg.setTurnSignal(Test.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
- msg.setCloudAppVehicleID(Test.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setCloudAppVehicleID(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -74,38 +83,38 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(UnsubscribeVehicleData.KEY_SPEED, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_RPM, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_FUEL_LEVEL, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_PRNDL, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_TIRE_PRESSURE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ENGINE_TORQUE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ODOMETER, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_GPS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_BELT_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_BODY_INFORMATION, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_DEVICE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_DRIVER_BRAKING, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_WIPER_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_E_CALL_INFO, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_AIRBAG_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_EMERGENCY_EVENT, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_MY_KEY, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, Test.GENERAL_BOOLEAN);
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_FUEL_LEVEL, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_PRNDL, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_TIRE_PRESSURE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_ENGINE_TORQUE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_ODOMETER, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_GPS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_BELT_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_BODY_INFORMATION, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_DEVICE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_DRIVER_BRAKING, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_WIPER_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_E_CALL_INFO, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_AIRBAG_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_EMERGENCY_EVENT, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_MY_KEY, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_FUEL_RANGE, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_TURN_SIGNAL, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, TestValues.GENERAL_BOOLEAN);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -114,129 +123,131 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues(){
// Valid Tests
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getSpeed());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getRpm());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getExternalTemperature());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevel());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getPrndl());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getTirePressure());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getEngineTorque());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getEngineOilLife());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getOdometer());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getGps());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevelState());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getBeltStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getBodyInformation());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getDeviceStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getDriverBraking());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getWiperStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getHeadLampStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getAccPedalPosition());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getECallInfo());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getAirbagStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getEmergencyEvent());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getClusterModeStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getMyKey());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getFuelRange());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getTurnSignal());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getCloudAppVehicleID());
- assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getSpeed());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getRpm());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getExternalTemperature());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevel());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getPrndl());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getTirePressure());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEngineTorque());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEngineOilLife());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getOdometer());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getGps());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevelState());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getBeltStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getBodyInformation());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getDeviceStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getDriverBraking());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getWiperStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getHeadLampStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getAccPedalPosition());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getSteeringWheelAngle());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getECallInfo());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getAirbagStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEmergencyEvent());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getClusterModeStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getMyKey());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelRange());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getTurnSignal());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getCloudAppVehicleID());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getCloudAppVehicleID());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getCloudAppVehicleID());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeVehicleData cmd = new UnsubscribeVehicleData(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
- assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
index ac4afbbea..d595b8ec9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
@@ -6,13 +6,18 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnsubscribeWayPoints;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
/**
* Created by austinkirk on 6/7/17.
@@ -42,32 +47,34 @@ public class UnsubscribeWayPointsTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnsubscribeWayPoints msg = new UnsubscribeWayPoints();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeWayPoints cmd = new UnsubscribeWayPoints(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
index a8e88aee8..3f2e37a03 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
@@ -8,18 +8,26 @@ import com.smartdevicelink.proxy.rpc.Turn;
import com.smartdevicelink.proxy.rpc.UpdateTurnList;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.UpdateTurnList}
@@ -30,8 +38,8 @@ public class UpdateTurnListTests extends BaseRpcTests {
protected RPCMessage createMessage() {
UpdateTurnList msg = new UpdateTurnList();
- msg.setTurnList(Test.GENERAL_TURN_LIST);
- msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setTurnList(TestValues.GENERAL_TURN_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
return msg;
}
@@ -51,10 +59,10 @@ public class UpdateTurnListTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(UpdateTurnList.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
- result.put(UpdateTurnList.KEY_TURN_LIST, Test.JSON_TURNS);
+ result.put(UpdateTurnList.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(UpdateTurnList.KEY_TURN_LIST, TestValues.JSON_TURNS);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -63,43 +71,45 @@ public class UpdateTurnListTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<SoftButton> testSoftButtonList = ( (UpdateTurnList) msg ).getSoftButtons();
List<Turn> testTurnList = ( (UpdateTurnList) msg ).getTurnList();
// Valid Tests
- assertNotNull(Test.NOT_NULL, testSoftButtonList);
- assertNotNull(Test.NOT_NULL, testTurnList);
+ assertNotNull(TestValues.NOT_NULL, testSoftButtonList);
+ assertNotNull(TestValues.NOT_NULL, testTurnList);
- assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtonList));
- assertTrue(Test.TRUE, Validator.validateTurnList(Test.GENERAL_TURN_LIST, testTurnList));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtonList));
+ assertTrue(TestValues.TRUE, Validator.validateTurnList(TestValues.GENERAL_TURN_LIST, testTurnList));
// Invalid/Null Tests
UpdateTurnList msg = new UpdateTurnList();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTurnList());
- assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getTurnList());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UpdateTurnList cmd = new UpdateTurnList(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_SOFT_BUTTONS);
@@ -108,7 +118,7 @@ public class UpdateTurnListTests extends BaseRpcTests {
SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
softButtonList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
JSONArray turnArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_TURN_LIST);
List<Turn> turnList = new ArrayList<Turn>();
@@ -117,9 +127,9 @@ public class UpdateTurnListTests extends BaseRpcTests {
if (chunk != null)
turnList.add(chunk);
}
- assertTrue(Test.TRUE, Validator.validateTurnList(turnList, cmd.getTurnList()));
+ assertTrue(TestValues.TRUE, Validator.validateTurnList(turnList, cmd.getTurnList()));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
index 3536809ec..94346fdb2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
@@ -7,13 +7,17 @@ import com.smartdevicelink.proxy.rpc.AddCommand;
import com.smartdevicelink.proxy.rpc.AddCommandResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -44,30 +48,32 @@ public class AddCommandResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
AddCommandResponse msg = new AddCommandResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AddCommand cmd = new AddCommand(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
index d49f91443..ec355539d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class AddSubmenuResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
AddSubMenuResponse msg = new AddSubMenuResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AddSubMenuResponse cmd = new AddSubMenuResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
index b296cccf0..f26a09f4a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class AlertManeuverResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
AlertManeuverResponse msg = new AlertManeuverResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AlertManeuverResponse cmd = new AlertManeuverResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
index b46a83c62..ff260f23f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
@@ -6,14 +6,21 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.AlertResponse}
@@ -46,7 +53,7 @@ public class AlertResponseTests extends BaseRpcTests{
try{
result.put(AlertResponse.KEY_TRY_AGAIN_TIME, TRY_AGAIN_TIME);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,40 +62,42 @@ public class AlertResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int tryAgainTime = ( (AlertResponse) msg ).getTryAgainTime();
// Valid Tests
- assertEquals(Test.MATCH, TRY_AGAIN_TIME, tryAgainTime);
+ assertEquals(TestValues.MATCH, TRY_AGAIN_TIME, tryAgainTime);
// Invalid/Null Tests
AlertResponse msg = new AlertResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getTryAgainTime());
+ assertNull(TestValues.NULL, msg.getTryAgainTime());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
AlertResponse cmd = new AlertResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AlertResponse.KEY_TRY_AGAIN_TIME), cmd.getTryAgainTime());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AlertResponse.KEY_TRY_AGAIN_TIME), cmd.getTryAgainTime());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
index 64f5b0c75..25b8140c4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class ButtonPressResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ButtonPressResponse msg = new ButtonPressResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ButtonPressResponse cmd = new ButtonPressResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
index e983327f2..e1fb2746a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
@@ -40,13 +40,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -77,30 +81,32 @@ public class CancelInteractionResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
CancelInteractionResponse msg = new CancelInteractionResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CancelInteractionResponse cmd = new CancelInteractionResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
index dc0ebd285..60996445c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
@@ -6,14 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.ChangeRegistrationResponse}
@@ -43,30 +48,32 @@ public class ChangeRegistrationResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ChangeRegistrationResponse msg = new ChangeRegistrationResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ChangeRegistrationResponse cmd = new ChangeRegistrationResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
index eb56a5293..9bf867391 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
@@ -40,13 +40,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -77,30 +81,32 @@ public class CloseApplicationResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
CloseApplicationResponse msg = new CloseApplicationResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CloseApplicationResponse cmd = new CloseApplicationResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
index 5acf53c08..a64d12236 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
@@ -4,9 +4,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONObject;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -37,10 +40,11 @@ public class CreateInteractionChoiceSetResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
CreateInteractionChoiceSetResponse msg = new CreateInteractionChoiceSetResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
index 8099a9ce7..56e8fc257 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class CreateWindowResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues() {
// Invalid/Null Tests
CreateWindowResponse msg = new CreateWindowResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
CreateWindowResponse cmd = new CreateWindowResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
index cde460a81..2318a4e46 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class DeleteCommandResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
DeleteCommandResponse msg = new DeleteCommandResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteCommandResponse cmd = new DeleteCommandResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
index 7d0c293c5..d5ca5d0c1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -24,7 +30,7 @@ public class DeleteFileResponseTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DeleteFileResponse msg = new DeleteFileResponse();
- msg.setSpaceAvailable(Test.GENERAL_INT);
+ msg.setSpaceAvailable(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +50,9 @@ public class DeleteFileResponseTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(DeleteFileResponse.KEY_SPACE_AVAILABLE, Test.GENERAL_INT);
+ result.put(DeleteFileResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,41 +61,43 @@ public class DeleteFileResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
int spaceAvailable = ( (DeleteFileResponse) msg ).getSpaceAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INT, spaceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, spaceAvailable);
// Invalid/Null Tests
DeleteFileResponse msg = new DeleteFileResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSpaceAvailable());
+ assertNull(TestValues.NULL, msg.getSpaceAvailable());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteFileResponse cmd = new DeleteFileResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
index f57b0277f..7a313531c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class DeleteInteractionChoiceSetResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
DeleteInteractionChoiceSetResponse msg = new DeleteInteractionChoiceSetResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteInteractionChoiceSetResponse cmd = new DeleteInteractionChoiceSetResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
index 5a405b78c..e70402ecd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class DeleteSubMenuResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
DeleteSubMenuResponse msg = new DeleteSubMenuResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteSubMenuResponse cmd = new DeleteSubMenuResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
index 01bcd1491..bfa2df5aa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class DeleteWindowResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues() {
// Invalid/Null Tests
DeleteWindowResponse msg = new DeleteWindowResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DeleteWindowResponse cmd = new DeleteWindowResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
index c55cc5098..d42a1e53e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
@@ -6,15 +6,22 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -26,7 +33,7 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
protected RPCMessage createMessage(){
DiagnosticMessageResponse msg = new DiagnosticMessageResponse();
- msg.setMessageDataResult(Test.GENERAL_INTEGER_LIST);
+ msg.setMessageDataResult(TestValues.GENERAL_INTEGER_LIST);
return msg;
}
@@ -47,9 +54,9 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
try{
result.put(DiagnosticMessageResponse.KEY_MESSAGE_DATA_RESULT,
- JsonUtils.createJsonArray(Test.GENERAL_INTEGER_LIST));
+ JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -59,50 +66,52 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<Integer> cmdId = ( (DiagnosticMessageResponse) msg ).getMessageDataResult();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST.size(), cmdId.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.size(), cmdId.size());
- for(int i = 0; i < Test.GENERAL_INTEGER_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST.get(i), cmdId.get(i));
+ for(int i = 0; i < TestValues.GENERAL_INTEGER_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.get(i), cmdId.get(i));
}
// Invalid/Null Tests
DiagnosticMessageResponse msg = new DiagnosticMessageResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getMessageDataResult());
+ assertNull(TestValues.NULL, msg.getMessageDataResult());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DiagnosticMessageResponse cmd = new DiagnosticMessageResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
List<Integer> dataResultList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessageResponse.KEY_MESSAGE_DATA_RESULT);
List<Integer> testResultList = cmd.getMessageDataResult();
- assertEquals(Test.MATCH, dataResultList.size(), testResultList.size());
- assertTrue(Test.TRUE, Validator.validateIntegerList(dataResultList, testResultList));
+ assertEquals(TestValues.MATCH, dataResultList.size(), testResultList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(dataResultList, testResultList));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
index bf625f19a..9625cf3d5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* Created by austinkirk on 6/6/17.
@@ -43,30 +47,32 @@ public class DialNumberResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
DialNumberResponse msg = new DialNumberResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
DialNumberResponse cmd = new DialNumberResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
index 5bf4c33da..9d999e1b7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class EndAudioPassThruResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
EndAudioPassThruResponse msg = new EndAudioPassThruResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
EndAudioPassThruResponse cmd = new EndAudioPassThruResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
index fafb7c22a..1c9681e2e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
@@ -4,9 +4,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONObject;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -37,10 +40,11 @@ public class GenericResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
GenericResponse msg = new GenericResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
index ef3e53424..243c9ab3b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
@@ -7,13 +7,17 @@ import com.smartdevicelink.proxy.rpc.AppServiceData;
import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -44,34 +48,36 @@ public class GetAppServiceDataResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
GetAppServiceDataResponse msg = new GetAppServiceDataResponse();
- msg.setServiceData(Test.GENERAL_APPSERVICEDATA);
- assertNotNull(Test.NOT_NULL, msg);
+ msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
// test getter
AppServiceData serviceData = msg.getServiceData();
- assertEquals(Test.GENERAL_APPSERVICEDATA, serviceData);
+ assertEquals(TestValues.GENERAL_APPSERVICEDATA, serviceData);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetAppServiceDataResponse cmd = new GetAppServiceDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
index e082c82f9..b9d40f907 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
@@ -4,9 +4,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONObject;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertNotNull;
public class GetCloudAppPropertiesResponseTests extends BaseRpcTests {
@Override
@@ -32,10 +35,11 @@ public class GetCloudAppPropertiesResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
index 5df87b425..464efa60c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
@@ -6,16 +6,24 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.GetDTCsResponse}
@@ -26,7 +34,7 @@ public class GetDTCsResponseTests extends BaseRpcTests{
protected RPCMessage createMessage(){
GetDTCsResponse msg = new GetDTCsResponse();
- msg.setDtc(Test.GENERAL_STRING_LIST);
+ msg.setDtc(TestValues.GENERAL_STRING_LIST);
return msg;
}
@@ -46,9 +54,9 @@ public class GetDTCsResponseTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(GetDTCsResponse.KEY_DTC, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ result.put(GetDTCsResponse.KEY_DTC, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -57,49 +65,51 @@ public class GetDTCsResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<String> cmdId = ( (GetDTCsResponse) msg ).getDtc();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), cmdId.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), cmdId.size());
- for(int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++){
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), cmdId.get(i));
+ for(int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++){
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), cmdId.get(i));
}
// Invalid/Null Tests
GetDTCsResponse msg = new GetDTCsResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getDtc());
+ assertNull(TestValues.NULL, msg.getDtc());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetDTCsResponse cmd = new GetDTCsResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
List<String> dtcList = JsonUtils.readStringListFromJsonObject(parameters, GetDTCsResponse.KEY_DTC);
List<String> testDtcList = cmd.getDtc();
- assertEquals(Test.MATCH, dtcList.size(), testDtcList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(dtcList, testDtcList));
+ assertEquals(TestValues.MATCH, dtcList.size(), testDtcList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(dtcList, testDtcList));
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
index 25ba20949..6b62d3200 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
@@ -7,14 +7,22 @@ import com.smartdevicelink.proxy.rpc.GetFileResponse;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetFileResponse}
@@ -26,10 +34,10 @@ public class GetFileResponseTests extends BaseRpcTests {
GetFileResponse msg = new GetFileResponse();
- msg.setCRC(Test.GENERAL_INT);
- msg.setFileType(Test.GENERAL_FILETYPE);
- msg.setOffset(Test.GENERAL_INT);
- msg.setLength(Test.GENERAL_INT);
+ msg.setCRC(TestValues.GENERAL_INT);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setOffset(TestValues.GENERAL_INT);
+ msg.setLength(TestValues.GENERAL_INT);
return msg;
}
@@ -49,12 +57,12 @@ public class GetFileResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetFileResponse.KEY_CRC, Test.GENERAL_INTEGER);
- result.put(GetFileResponse.KEY_FILE_TYPE, Test.GENERAL_FILETYPE);
- result.put(GetFileResponse.KEY_OFFSET, Test.GENERAL_INTEGER);
- result.put(GetFileResponse.KEY_LENGTH, Test.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_CRC, TestValues.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(GetFileResponse.KEY_OFFSET, TestValues.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_LENGTH, TestValues.GENERAL_INTEGER);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -63,6 +71,7 @@ public class GetFileResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer crc = ( (GetFileResponse) msg ).getCRC();
@@ -71,46 +80,47 @@ public class GetFileResponseTests extends BaseRpcTests {
Integer length = ( (GetFileResponse) msg ).getLength();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, crc);
- assertEquals(Test.MATCH, Test.GENERAL_FILETYPE, fileType);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, offset);
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER, length);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, crc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
// Invalid/Null Tests
GetFileResponse msg = new GetFileResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getCRC());
- assertNull(Test.NULL, msg.getFileType());
- assertNull(Test.NULL, msg.getOffset());
- assertNull(Test.NULL, msg.getLength());
+ assertNull(TestValues.NULL, msg.getCRC());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetFileResponse cmd = new GetFileResponse (hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_CRC), cmd.getCRC());
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFileResponse.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_LENGTH), cmd.getLength());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_OFFSET), cmd.getOffset());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_CRC), cmd.getCRC());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFileResponse.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_LENGTH), cmd.getLength());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_OFFSET), cmd.getOffset());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
index e100f4b86..48cea8f69 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
@@ -7,21 +7,27 @@ import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 java.util.List;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
- msg.setAllowances(Test.GENERAL_BOOLEAN_LIST);
+ msg.setAllowances(TestValues.GENERAL_BOOLEAN_LIST);
return msg;
}
@@ -40,43 +46,46 @@ public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_BOOLEAN_LIST));
+ result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(TestValues.GENERAL_BOOLEAN_LIST));
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
+ @Test
public void testRpcValues() {
List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
- assertEquals(Test.MATCH, list, Test.GENERAL_BOOLEAN_LIST);
+ assertEquals(TestValues.MATCH, list, TestValues.GENERAL_BOOLEAN_LIST);
}
+ @Test
public void testRequiredParams(){
GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(true, Result.SUCCESS);
assertTrue(msg.getSuccess());
- assertEquals(Test.MATCH, msg.getResultCode(), Result.SUCCESS);
+ assertEquals(TestValues.MATCH, msg.getResultCode(), Result.SUCCESS);
}
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
index c76388c69..fd3e793f5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
@@ -7,14 +7,21 @@ import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -27,8 +34,8 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse();
- msg.setIsSubscribed(Test.GENERAL_BOOLEAN);
- msg.setModuleData(Test.GENERAL_MODULEDATA);
+ msg.setIsSubscribed(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleData(TestValues.GENERAL_MODULEDATA);
return msg;
}
@@ -48,10 +55,10 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED, Test.GENERAL_BOOLEAN);
- result.put(GetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ result.put(GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED, TestValues.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -60,49 +67,51 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
boolean testIsSubscribed = ( (GetInteriorVehicleDataResponse) msg ).getIsSubscribed();
ModuleData testModuleData = ( (GetInteriorVehicleDataResponse) msg ).getModuleData();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testIsSubscribed);
- assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testIsSubscribed);
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, testModuleData));
// Invalid/Null Tests
GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getIsSubscribed());
- assertNull(Test.NULL, msg.getModuleData());
+ assertNull(TestValues.NULL, msg.getIsSubscribed());
+ assertNull(TestValues.NULL, msg.getModuleData());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetInteriorVehicleDataResponse cmd = new GetInteriorVehicleDataResponse (hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
ModuleData cmdModuleData = cmd.getModuleData();
- assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED), cmd.getIsSubscribed());
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED), cmd.getIsSubscribed());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
index b9fd85a8e..80a0a8b8d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
@@ -7,21 +7,28 @@ import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.fail;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
public class GetSystemCapabilityResponseTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage(){
GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse();
- msg.setSystemCapability(Test.GENERAL_SYSTEMCAPABILITY);
+ msg.setSystemCapability(TestValues.GENERAL_SYSTEMCAPABILITY);
return msg;
}
@@ -41,9 +48,9 @@ public class GetSystemCapabilityResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_SYSTEMCAPABILITY.getStore()));
+ result.put(GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SYSTEMCAPABILITY.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -52,44 +59,46 @@ public class GetSystemCapabilityResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
SystemCapability testCapability = ( (GetSystemCapabilityResponse) msg ).getSystemCapability();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITY.getSystemCapabilityType(), testCapability.getSystemCapabilityType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITY.getSystemCapabilityType(), testCapability.getSystemCapabilityType());
// Invalid/Null Tests
GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSystemCapability());
+ assertNull(TestValues.NULL, msg.getSystemCapability());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetSystemCapabilityResponse cmd = new GetSystemCapabilityResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
SystemCapability testCapability = new SystemCapability(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY)));
SystemCapability cmdCapability = cmd.getSystemCapability();
- assertEquals(Test.MATCH, testCapability.getSystemCapabilityType(), cmdCapability.getSystemCapabilityType());
+ assertEquals(TestValues.MATCH, testCapability.getSystemCapabilityType(), cmdCapability.getSystemCapabilityType());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
index fbba38025..d09494913 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
@@ -20,7 +20,7 @@ import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.enums.TurnSignal;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.VehicleDataHelper;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
@@ -28,12 +28,20 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -90,14 +98,15 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
result.put(GetVehicleDataResponse.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
+ @Test
public void testJson() {
JSONObject reference = new JSONObject();
@@ -269,7 +278,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
reference.put(GetVehicleDataResponse.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, TurnSignal.OFF);
reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ reference.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
@@ -416,166 +425,168 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
}
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
-
+
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues(){
// Valid Tests
- assertEquals(Test.MATCH, VehicleDataHelper.SPEED, ( (GetVehicleDataResponse) msg ).getSpeed());
- assertEquals(Test.MATCH, (Integer) VehicleDataHelper.RPM, ( (GetVehicleDataResponse) msg ).getRpm());
- assertEquals(Test.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, ( (GetVehicleDataResponse) msg ).getExternalTemperature());
- assertEquals(Test.MATCH, VehicleDataHelper.FUEL_LEVEL, ( (GetVehicleDataResponse) msg ).getFuelLevel());
- assertEquals(Test.MATCH, VehicleDataHelper.PRNDL_FINAL, ( (GetVehicleDataResponse) msg ).getPrndl());
- assertEquals(Test.MATCH, VehicleDataHelper.TIRE_PRESSURE, ( (GetVehicleDataResponse) msg ).getTirePressure());
- assertEquals(Test.MATCH, VehicleDataHelper.ENGINE_TORQUE, ( (GetVehicleDataResponse) msg ).getEngineTorque());
- assertEquals(Test.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, ( (GetVehicleDataResponse) msg ).getEngineOilLife());
- assertEquals(Test.MATCH, (Integer) VehicleDataHelper.ODOMETER, ( (GetVehicleDataResponse) msg ).getOdometer());
- assertEquals(Test.MATCH, VehicleDataHelper.GPS, ( (GetVehicleDataResponse) msg ).getGps());
- assertEquals(Test.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, ( (GetVehicleDataResponse) msg ).getFuelLevelState());
- assertEquals(Test.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, ( (GetVehicleDataResponse) msg ).getInstantFuelConsumption());
- assertEquals(Test.MATCH, VehicleDataHelper.BELT_STATUS, ( (GetVehicleDataResponse) msg ).getBeltStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.BODY_INFORMATION, ( (GetVehicleDataResponse) msg ).getBodyInformation());
- assertEquals(Test.MATCH, VehicleDataHelper.DEVICE_STATUS, ( (GetVehicleDataResponse) msg ).getDeviceStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.DRIVER_BRAKING, ( (GetVehicleDataResponse) msg ).getDriverBraking());
- assertEquals(Test.MATCH, VehicleDataHelper.WIPER_STATUS, ( (GetVehicleDataResponse) msg ).getWiperStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.HEAD_LAMP_STATUS, ( (GetVehicleDataResponse) msg ).getHeadLampStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, ( (GetVehicleDataResponse) msg ).getAccPedalPosition());
- assertEquals(Test.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, ( (GetVehicleDataResponse) msg ).getSteeringWheelAngle());
- assertEquals(Test.MATCH, VehicleDataHelper.E_CALL_INFO, ( (GetVehicleDataResponse) msg ).getECallInfo());
- assertEquals(Test.MATCH, VehicleDataHelper.AIRBAG_STATUS, ( (GetVehicleDataResponse) msg ).getAirbagStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.EMERGENCY_EVENT, ( (GetVehicleDataResponse) msg ).getEmergencyEvent());
- assertEquals(Test.MATCH, VehicleDataHelper.CLUSTER_MODE_STATUS, ( (GetVehicleDataResponse) msg ).getClusterModeStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.MY_KEY, ( (GetVehicleDataResponse) msg ).getMyKey());
- assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, ( (GetVehicleDataResponse) msg ).getTurnSignal());
- assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ( (GetVehicleDataResponse) msg ).getElectronicParkBrakeStatus());
- assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, ( (GetVehicleDataResponse) msg ).getSpeed());
+ assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.RPM, ( (GetVehicleDataResponse) msg ).getRpm());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, ( (GetVehicleDataResponse) msg ).getExternalTemperature());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, ( (GetVehicleDataResponse) msg ).getFuelLevel());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, ( (GetVehicleDataResponse) msg ).getPrndl());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TIRE_PRESSURE, ( (GetVehicleDataResponse) msg ).getTirePressure());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, ( (GetVehicleDataResponse) msg ).getEngineTorque());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, ( (GetVehicleDataResponse) msg ).getEngineOilLife());
+ assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.ODOMETER, ( (GetVehicleDataResponse) msg ).getOdometer());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, ( (GetVehicleDataResponse) msg ).getGps());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, ( (GetVehicleDataResponse) msg ).getFuelLevelState());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, ( (GetVehicleDataResponse) msg ).getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.BELT_STATUS, ( (GetVehicleDataResponse) msg ).getBeltStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.BODY_INFORMATION, ( (GetVehicleDataResponse) msg ).getBodyInformation());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DEVICE_STATUS, ( (GetVehicleDataResponse) msg ).getDeviceStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, ( (GetVehicleDataResponse) msg ).getDriverBraking());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, ( (GetVehicleDataResponse) msg ).getWiperStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.HEAD_LAMP_STATUS, ( (GetVehicleDataResponse) msg ).getHeadLampStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, ( (GetVehicleDataResponse) msg ).getAccPedalPosition());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, ( (GetVehicleDataResponse) msg ).getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.E_CALL_INFO, ( (GetVehicleDataResponse) msg ).getECallInfo());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.AIRBAG_STATUS, ( (GetVehicleDataResponse) msg ).getAirbagStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EMERGENCY_EVENT, ( (GetVehicleDataResponse) msg ).getEmergencyEvent());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.CLUSTER_MODE_STATUS, ( (GetVehicleDataResponse) msg ).getClusterModeStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.MY_KEY, ( (GetVehicleDataResponse) msg ).getMyKey());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, ( (GetVehicleDataResponse) msg ).getTurnSignal());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ( (GetVehicleDataResponse) msg ).getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleDataResponse msg = new GetVehicleDataResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetVehicleDataResponse cmd = new GetVehicleDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_SPEED), cmd.getSpeed());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_RPM), cmd.getRpm());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_VIN), cmd.getVin());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_PRNDL), cmd.getPrndl().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_VIN), cmd.getVin());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_PRNDL), cmd.getPrndl().toString());
JSONObject tireStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_TIRE_PRESSURE);
TireStatus tireStatus = new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tireStatusObj));
- assertTrue(Test.TRUE, Validator.validateTireStatus(tireStatus, cmd.getTirePressure()) );
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(tireStatus, cmd.getTirePressure()) );
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife(), 0.0002);
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife(), 0.0002);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_ODOMETER), cmd.getOdometer());
JSONObject gpsDataObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_GPS);
GPSData gpsData = new GPSData(JsonRPCMarshaller.deserializeJSONObject(gpsDataObj));
- assertTrue(Test.TRUE, Validator.validateGpsData(gpsData, cmd.getGps()) );
+ assertTrue(TestValues.TRUE, Validator.validateGpsData(gpsData, cmd.getGps()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState().toString());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
JSONObject beltStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BELT_STATUS);
BeltStatus beltStatus = new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltStatusObj));
- assertTrue(Test.TRUE, Validator.validateBeltStatus(beltStatus, cmd.getBeltStatus()) );
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(beltStatus, cmd.getBeltStatus()) );
JSONObject bodyInformationObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BODY_INFORMATION);
BodyInformation bodyInformation = new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInformationObj));
- assertTrue(Test.TRUE, Validator.validateBodyInformation(bodyInformation, cmd.getBodyInformation()) );
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(bodyInformation, cmd.getBodyInformation()) );
JSONObject deviceStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_DEVICE_STATUS);
DeviceStatus deviceStatus = new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceStatusObj));
- assertTrue(Test.TRUE, Validator.validateDeviceStatus(deviceStatus, cmd.getDeviceStatus()) );
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(deviceStatus, cmd.getDeviceStatus()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_DRIVER_BRAKING), cmd.getDriverBraking().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_WIPER_STATUS), cmd.getWiperStatus().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_DRIVER_BRAKING), cmd.getDriverBraking().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_WIPER_STATUS), cmd.getWiperStatus().toString());
JSONObject headLampStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
HeadLampStatus headLampStatus = new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampStatusObj));
- assertTrue(Test.TRUE, Validator.validateHeadLampStatus(headLampStatus, cmd.getHeadLampStatus()) );
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(headLampStatus, cmd.getHeadLampStatus()) );
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
JSONObject eCallInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_E_CALL_INFO);
ECallInfo eCallInfo = new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(eCallInfoObj));
- assertTrue(Test.TRUE, Validator.validateECallInfo(eCallInfo, cmd.getECallInfo()) );
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(eCallInfo, cmd.getECallInfo()) );
JSONObject airbagStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_AIRBAG_STATUS);
AirbagStatus airbagStatus = new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagStatusObj));
- assertTrue(Test.TRUE, Validator.validateAirbagStatus(airbagStatus, cmd.getAirbagStatus()) );
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(airbagStatus, cmd.getAirbagStatus()) );
JSONObject emergencyEventObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_EMERGENCY_EVENT);
EmergencyEvent emergencyEvent = new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyEventObj));
- assertTrue(Test.TRUE, Validator.validateEmergencyEvent(emergencyEvent, cmd.getEmergencyEvent()) );
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(emergencyEvent, cmd.getEmergencyEvent()) );
JSONObject clusterModeStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS);
ClusterModeStatus clusterModeStatus = new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeStatusObj));
- assertTrue(Test.TRUE, Validator.validateClusterModeStatus(clusterModeStatus, cmd.getClusterModeStatus()) );
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(clusterModeStatus, cmd.getClusterModeStatus()) );
JSONObject myKeyObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_MY_KEY);
MyKey myKey = new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObj));
- assertTrue(Test.TRUE, Validator.validateMyKey(myKey, cmd.getMyKey()) );
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(myKey, cmd.getMyKey()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
index 57d8499df..f133e2bed 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
@@ -7,16 +7,21 @@ import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
/**
* Created by austinkirk on 6/6/17.
@@ -28,8 +33,8 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
- waypoints.add(Test.GENERAL_LOCATIONDETAILS);
- waypoints.add(Test.GENERAL_LOCATIONDETAILS);
+ waypoints.add(TestValues.GENERAL_LOCATIONDETAILS);
+ waypoints.add(TestValues.GENERAL_LOCATIONDETAILS);
GetWayPointsResponse getWayPointsResponse = new GetWayPointsResponse();
getWayPointsResponse.setWayPoints(waypoints);
@@ -53,8 +58,8 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
JSONArray jsonArray = new JSONArray();
try {
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LOCATIONDETAILS.getStore()));
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LOCATIONDETAILS.getStore()));
} catch (JSONException e) {
e.printStackTrace();
}
@@ -71,39 +76,41 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<LocationDetails> testWPs = ( (GetWayPointsResponse) msg ).getWayPoints();
// Valid Tests
- assertEquals(Test.MATCH, waypoints, testWPs);
+ assertEquals(TestValues.MATCH, waypoints, testWPs);
// Invalid/Null Tests
GetWayPointsResponse msg = new GetWayPointsResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getWayPoints());
+ assertNull(TestValues.NULL, msg.getWayPoints());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
GetWayPointsResponse cmd = new GetWayPointsResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
@@ -114,7 +121,7 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
locationList.add(det);
}
List<LocationDetails> dets = cmd.getWayPoints();
- assertEquals(Test.MATCH, locationList.size(), dets.size());
+ assertEquals(TestValues.MATCH, locationList.size(), dets.size());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
index 466961bcc..432562631 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
@@ -6,16 +6,25 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ListFilesResponse}
@@ -26,8 +35,8 @@ public class ListFilesResponseTests extends BaseRpcTests{
protected RPCMessage createMessage(){
ListFilesResponse msg = new ListFilesResponse();
- msg.setFilenames(Test.GENERAL_STRING_LIST);
- msg.setSpaceAvailable(Test.GENERAL_INT);
+ msg.setFilenames(TestValues.GENERAL_STRING_LIST);
+ msg.setSpaceAvailable(TestValues.GENERAL_INT);
return msg;
}
@@ -47,10 +56,10 @@ public class ListFilesResponseTests extends BaseRpcTests{
JSONObject result = new JSONObject();
try{
- result.put(ListFilesResponse.KEY_FILENAMES, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
- result.put(ListFilesResponse.KEY_SPACE_AVAILABLE, Test.GENERAL_INT);
+ result.put(ListFilesResponse.KEY_FILENAMES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(ListFilesResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -59,50 +68,52 @@ public class ListFilesResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<String> filenames = ( (ListFilesResponse) msg ).getFilenames();
int spaceAvailable = ( (ListFilesResponse) msg ).getSpaceAvailable();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), filenames.size());
- assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, filenames));
- assertEquals(Test.MATCH, Test.GENERAL_INT, spaceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), filenames.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, filenames));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, spaceAvailable);
// Invalid/Null Tests
ListFilesResponse msg = new ListFilesResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getFilenames());
- assertNull(Test.NULL, msg.getSpaceAvailable());
+ assertNull(TestValues.NULL, msg.getFilenames());
+ assertNull(TestValues.NULL, msg.getSpaceAvailable());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ListFilesResponse cmd = new ListFilesResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
List<String> fileNamesList = JsonUtils.readStringListFromJsonObject(parameters, ListFilesResponse.KEY_FILENAMES);
List<String> testNamesList = cmd.getFilenames();
- assertEquals(Test.MATCH, fileNamesList.size(), testNamesList.size());
- assertTrue(Test.TRUE, Validator.validateStringList(fileNamesList, testNamesList));
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ListFilesResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ assertEquals(TestValues.MATCH, fileNamesList.size(), testNamesList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(fileNamesList, testNamesList));
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ListFilesResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
index a6ba3c96c..58663a888 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
@@ -6,13 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+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 :
@@ -25,7 +32,7 @@ public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
- msg.setServiceSpecificResult(Test.GENERAL_STRING);
+ msg.setServiceSpecificResult(TestValues.GENERAL_STRING);
return msg;
}
@@ -45,9 +52,9 @@ public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, Test.GENERAL_STRING);
+ result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, TestValues.GENERAL_STRING);
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -56,42 +63,44 @@ public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
String serviceSpecificResult = ( (PerformAppServiceInteractionResponse) msg ).getServiceSpecificResult();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceSpecificResult);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceSpecificResult);
// Invalid/Null Tests
PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getServiceSpecificResult());
+ assertNull(TestValues.NULL, msg.getServiceSpecificResult());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformAppServiceInteractionResponse cmd = new PerformAppServiceInteractionResponse (hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
index 19e62bd28..3fb489fca 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class PerformAudioPassThruResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformAudioPassThruResponse cmd = new PerformAudioPassThruResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
index 8e9145b27..dd81627b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
@@ -7,13 +7,19 @@ import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+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 :
@@ -25,9 +31,9 @@ public class PerformInteractionResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
PerformInteractionResponse msg = new PerformInteractionResponse();
- msg.setChoiceID(Test.GENERAL_INT);
- msg.setTriggerSource(Test.GENERAL_TRIGGERSOURCE);
- msg.setManualTextEntry(Test.GENERAL_STRING);
+ msg.setChoiceID(TestValues.GENERAL_INT);
+ msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE);
+ msg.setManualTextEntry(TestValues.GENERAL_STRING);
return msg;
}
@@ -47,11 +53,11 @@ public class PerformInteractionResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PerformInteractionResponse.KEY_CHOICE_ID, Test.GENERAL_INT);
- result.put(PerformInteractionResponse.KEY_TRIGGER_SOURCE, Test.GENERAL_TRIGGERSOURCE);
- result.put(PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY, Test.GENERAL_STRING);
+ result.put(PerformInteractionResponse.KEY_CHOICE_ID, TestValues.GENERAL_INT);
+ result.put(PerformInteractionResponse.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
+ result.put(PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY, TestValues.GENERAL_STRING);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -60,6 +66,7 @@ public class PerformInteractionResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer testId = ( (PerformInteractionResponse) msg).getChoiceID();
@@ -67,42 +74,43 @@ public class PerformInteractionResponseTest extends BaseRpcTests {
String testText = ( (PerformInteractionResponse) msg).getManualTextEntry();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testId);
- assertEquals(Test.MATCH, Test.GENERAL_TRIGGERSOURCE, testSource);
- assertEquals(Test.MATCH, Test.GENERAL_STRING, testText);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, testSource);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText);
// Invalid/Null Tests
PerformInteractionResponse msg = new PerformInteractionResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getChoiceID());
- assertNull(Test.NULL, msg.getTriggerSource());
- assertNull(Test.NULL, msg.getManualTextEntry());
+ assertNull(TestValues.NULL, msg.getChoiceID());
+ assertNull(TestValues.NULL, msg.getTriggerSource());
+ assertNull(TestValues.NULL, msg.getManualTextEntry());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PerformInteractionResponse cmd = new PerformInteractionResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY), cmd.getManualTextEntry());
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_TRIGGER_SOURCE), cmd.getTriggerSource().toString());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteractionResponse.KEY_CHOICE_ID), cmd.getChoiceID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY), cmd.getManualTextEntry());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_TRIGGER_SOURCE), cmd.getTriggerSource().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteractionResponse.KEY_CHOICE_ID), cmd.getChoiceID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
index 97ded7f67..9659c992b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
@@ -7,15 +7,23 @@ import com.smartdevicelink.proxy.rpc.AppServiceRecord;
import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PublishAppServiceResponse}
@@ -27,7 +35,7 @@ public class PublishAppServiceResponseTests extends BaseRpcTests {
PublishAppServiceResponse msg = new PublishAppServiceResponse();
- msg.setServiceRecord(Test.GENERAL_APPSERVICERECORD);
+ msg.setServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
return msg;
}
@@ -47,9 +55,9 @@ public class PublishAppServiceResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APPSERVICERECORD.getStore()));
+ result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICERECORD.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,44 +66,46 @@ public class PublishAppServiceResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
AppServiceRecord testRecord = ( (PublishAppServiceResponse) msg ).getServiceRecord();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateAppServiceRecord(Test.GENERAL_APPSERVICERECORD, testRecord));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, testRecord));
// Invalid/Null Tests
PublishAppServiceResponse msg = new PublishAppServiceResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getServiceRecord());
+ assertNull(TestValues.NULL, msg.getServiceRecord());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PublishAppServiceResponse cmd = new PublishAppServiceResponse (hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject appServiceRecordObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppServiceResponse.KEY_APP_SERVICE_RECORD);
AppServiceRecord recordTest = new AppServiceRecord(JsonRPCMarshaller.deserializeJSONObject(appServiceRecordObject));
- assertTrue(Test.TRUE, Validator.validateAppServiceRecord(recordTest, cmd.getServiceRecord()));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(recordTest, cmd.getServiceRecord()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
index a3fc1a2fd..90faa7291 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+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 :
@@ -24,7 +30,7 @@ public class PutFileResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
PutFileResponse msg = new PutFileResponse();
- msg.setSpaceAvailable(Test.GENERAL_INT);
+ msg.setSpaceAvailable(TestValues.GENERAL_INT);
return msg;
}
@@ -44,9 +50,9 @@ public class PutFileResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(PutFileResponse.KEY_SPACE_AVAILABLE, Test.GENERAL_INT);
+ result.put(PutFileResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -55,41 +61,43 @@ public class PutFileResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
Integer testSpace = ( (PutFileResponse) msg ).getSpaceAvailable();
// Valid Tests
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testSpace);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testSpace);
// Invalid/Null Tests
PutFileResponse msg = new PutFileResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSpaceAvailable());
+ assertNull(TestValues.NULL, msg.getSpaceAvailable());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
PutFileResponse cmd = new PutFileResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PutFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PutFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
index 2e383b8da..5948eb3f5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
@@ -7,17 +7,25 @@ import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getContext;
+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 :
@@ -29,7 +37,7 @@ public class ReadDIDResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
ReadDIDResponse msg = new ReadDIDResponse();
- msg.setDidResult(Test.GENERAL_DIDRESULT_LIST);
+ msg.setDidResult(TestValues.GENERAL_DIDRESULT_LIST);
return msg;
}
@@ -49,9 +57,9 @@ public class ReadDIDResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(ReadDIDResponse.KEY_DID_RESULT, Test.JSON_DIDRESULTS);
+ result.put(ReadDIDResponse.KEY_DID_RESULT, TestValues.JSON_DIDRESULTS);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -60,38 +68,40 @@ public class ReadDIDResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<DIDResult> testResults = ( (ReadDIDResponse) msg ).getDidResult();
// Valid Tests
- assertTrue("Did results didn't match input data.", Validator.validateDIDResults(Test.GENERAL_DIDRESULT_LIST, testResults));
+ assertTrue("Did results didn't match input data.", Validator.validateDIDResults(TestValues.GENERAL_DIDRESULT_LIST, testResults));
// Invalid/Null Tests
ReadDIDResponse msg = new ReadDIDResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getDidResult());
+ assertNull(TestValues.NULL, msg.getDidResult());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ReadDIDResponse cmd = new ReadDIDResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
@@ -101,7 +111,7 @@ public class ReadDIDResponseTest extends BaseRpcTests {
DIDResult chunk = new DIDResult(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)didResultArray.get(index)) );
didResultList.add(chunk);
}
- assertTrue(Test.MATCH, Validator.validateDIDResults(didResultList, cmd.getDidResult()));
+ assertTrue(TestValues.MATCH, Validator.validateDIDResults(didResultList, cmd.getDidResult()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
index 73528e577..4a12bc5b3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
@@ -18,18 +18,26 @@ import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse}
@@ -40,22 +48,22 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
- msg.setSdlMsgVersion(Test.GENERAL_SDLMSGVERSION);
- msg.setLanguage(Test.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguage(Test.GENERAL_LANGUAGE);
- msg.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
- msg.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
- msg.setVehicleType(Test.GENERAL_VEHICLETYPE);
- msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- msg.setAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
- msg.setPcmStreamingCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES);
- msg.setHmiZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST);
- msg.setSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST);
- msg.setVrCapabilities(Test.GENERAL_VRCAPABILITIES_LIST);
- msg.setPrerecordedSpeech(Test.GENERAL_PRERECORDEDSPEECH_LIST);
- msg.setSupportedDiagModes(Test.GENERAL_INTEGER_LIST);
- msg.setIconResumed(Test.GENERAL_BOOLEAN);
+ msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ msg.setVehicleType(TestValues.GENERAL_VEHICLETYPE);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ msg.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ msg.setPcmStreamingCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES);
+ msg.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
+ msg.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
+ msg.setVrCapabilities(TestValues.GENERAL_VRCAPABILITIES_LIST);
+ msg.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
+ msg.setSupportedDiagModes(TestValues.GENERAL_INTEGER_LIST);
+ msg.setIconResumed(TestValues.GENERAL_BOOLEAN);
return msg;
}
@@ -76,24 +84,24 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(RegisterAppInterfaceResponse.KEY_LANGUAGE, Test.GENERAL_LANGUAGE);
- result.put(RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE, Test.GENERAL_LANGUAGE);
- result.put(RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES, JsonUtils.createJsonArray(Test.GENERAL_INTEGER_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION, Test.JSON_SDLMSGVERSION);
- result.put(RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE, Test.GENERAL_VEHICLETYPE.serializeJSON());
- result.put(RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES, Test.JSON_PRESETBANKCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES, Test.JSON_DISPLAYCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES, Test.JSON_AUDIOPASSTHRUCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES, Test.JSON_PCMSTREAMCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_SPEECHCAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_VRCAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_HMIZONECAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH, JsonUtils.createJsonArray(Test.GENERAL_PRERECORDEDSPEECH_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_ICON_RESUMED, Test.GENERAL_BOOLEAN);
+ result.put(RegisterAppInterfaceResponse.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
+ result.put(RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE, TestValues.GENERAL_VEHICLETYPE.serializeJSON());
+ result.put(RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES, TestValues.JSON_DISPLAYCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES, TestValues.JSON_AUDIOPASSTHRUCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES, TestValues.JSON_PCMSTREAMCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_SPEECHCAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_VRCAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_HMIZONECAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH, JsonUtils.createJsonArray(TestValues.GENERAL_PRERECORDEDSPEECH_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_ICON_RESUMED, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -102,6 +110,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
List<Integer> testSupportedDiagModes = ( (RegisterAppInterfaceResponse) msg ).getSupportedDiagModes();
@@ -122,84 +131,85 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
Boolean testIconResumed = ( (RegisterAppInterfaceResponse) msg ).getIconResumed();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST, testSupportedDiagModes);
- assertEquals(Test.MATCH, Test.GENERAL_PRERECORDEDSPEECH_LIST, testPrerecordedSpeech);
- assertEquals(Test.MATCH, Test.GENERAL_VRCAPABILITIES_LIST, testVrCapabilities);
- assertEquals(Test.MATCH, Test.GENERAL_SPEECHCAPABILITIES_LIST, testSpeechCapabilities);
- assertEquals(Test.MATCH, Test.GENERAL_HMIZONECAPABILITIES_LIST, testHmiZoneCapabilities);
- assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, testSoftButtonCapabilities));
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, testButtonCapabilities));
- assertTrue(Test.TRUE, Validator.validateVehicleType(Test.GENERAL_VEHICLETYPE, testVehicleType));
- assertTrue(Test.TRUE, Validator.validatePresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES, testPbc));
- assertTrue(Test.TRUE, Validator.validateDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES, testDc));
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testHmiLang);
- assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testLang);
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(Test.GENERAL_SDLMSGVERSION, testMsgVersion));
- assertTrue(Test.TRUE, Validator.validateAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, testAptc));
- assertTrue(Test.TRUE, Validator.validatePcmStreamCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES, testPcmStream));
- assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, testIconResumed);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testSupportedDiagModes);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PRERECORDEDSPEECH_LIST, testPrerecordedSpeech);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VRCAPABILITIES_LIST, testVrCapabilities);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES_LIST, testSpeechCapabilities);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMIZONECAPABILITIES_LIST, testHmiZoneCapabilities);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, testSoftButtonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, testButtonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleType(TestValues.GENERAL_VEHICLETYPE, testVehicleType));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDc));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testMsgVersion));
+ assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, testAptc));
+ assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES, testPcmStream));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testIconResumed);
// Invalid/Null Tests
RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSdlMsgVersion());
- assertNull(Test.NULL, msg.getLanguage());
- assertNull(Test.NULL, msg.getHmiDisplayLanguage());
- assertNull(Test.NULL, msg.getDisplayCapabilities());
- assertNull(Test.NULL, msg.getPresetBankCapabilities());
- assertNull(Test.NULL, msg.getVehicleType());
- assertNull(Test.NULL, msg.getButtonCapabilities());
- assertNull(Test.NULL, msg.getSoftButtonCapabilities());
- assertNull(Test.NULL, msg.getAudioPassThruCapabilities());
- assertNull(Test.NULL, msg.getPcmStreamingCapabilities());
- assertNull(Test.NULL, msg.getHmiZoneCapabilities());
- assertNull(Test.NULL, msg.getSpeechCapabilities());
- assertNull(Test.NULL, msg.getVrCapabilities());
- assertNull(Test.NULL, msg.getPrerecordedSpeech());
- assertNull(Test.NULL, msg.getSupportedDiagModes());
- assertNull(Test.NULL, msg.getIconResumed());
+ assertNull(TestValues.NULL, msg.getSdlMsgVersion());
+ assertNull(TestValues.NULL, msg.getLanguage());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
+ assertNull(TestValues.NULL, msg.getDisplayCapabilities());
+ assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
+ assertNull(TestValues.NULL, msg.getVehicleType());
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getAudioPassThruCapabilities());
+ assertNull(TestValues.NULL, msg.getPcmStreamingCapabilities());
+ assertNull(TestValues.NULL, msg.getHmiZoneCapabilities());
+ assertNull(TestValues.NULL, msg.getSpeechCapabilities());
+ assertNull(TestValues.NULL, msg.getVrCapabilities());
+ assertNull(TestValues.NULL, msg.getPrerecordedSpeech());
+ assertNull(TestValues.NULL, msg.getSupportedDiagModes());
+ assertNull(TestValues.NULL, msg.getIconResumed());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
RegisterAppInterfaceResponse cmd = new RegisterAppInterfaceResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject vehicleTypeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE);
VehicleType vehicleType = new VehicleType(JsonRPCMarshaller.deserializeJSONObject(vehicleTypeObj));
- assertTrue(Test.TRUE, Validator.validateVehicleType(vehicleType, cmd.getVehicleType()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleType(vehicleType, cmd.getVehicleType()));
JSONObject pcmStreamObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES);
AudioPassThruCapabilities pcmStreamCap = new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject(pcmStreamObj));
- assertTrue(Test.TRUE, Validator.validatePcmStreamCapabilities(pcmStreamCap, cmd.getPcmStreamingCapabilities()));
+ assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(pcmStreamCap, cmd.getPcmStreamingCapabilities()));
JSONArray speechCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES);
for (int index = 0; index < speechCapabilitiesArray.length(); index++) {
SpeechCapabilities speechCapability = SpeechCapabilities.valueForString( speechCapabilitiesArray.get(index).toString() );
- assertEquals(Test.MATCH, speechCapability, cmd.getSpeechCapabilities().get(index));
+ assertEquals(TestValues.MATCH, speechCapability, cmd.getSpeechCapabilities().get(index));
}
JSONArray vrCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES);
for (int index = 0; index < vrCapabilitiesArray.length(); index++) {
VrCapabilities vrCapability = VrCapabilities.valueForString( vrCapabilitiesArray.get(index).toString() );
- assertEquals(Test.MATCH, vrCapability, cmd.getVrCapabilities().get(index));
+ assertEquals(TestValues.MATCH, vrCapability, cmd.getVrCapabilities().get(index));
}
JSONArray audioPassThruCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES);
@@ -209,29 +219,29 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)audioPassThruCapabilitiesArray.get(index) ));
audioPassThruCapabilitiesList.add(audioPassThruCapability);
}
- assertTrue(Test.TRUE, Validator.validateAudioPassThruCapabilities(audioPassThruCapabilitiesList, cmd.getAudioPassThruCapabilities() ));
+ assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(audioPassThruCapabilitiesList, cmd.getAudioPassThruCapabilities() ));
JSONArray hmiZoneCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES);
for (int index = 0; index < hmiZoneCapabilitiesArray.length(); index++) {
HmiZoneCapabilities hmiZoneCapability = HmiZoneCapabilities.valueForString( hmiZoneCapabilitiesArray.get(index).toString() );
- assertEquals(Test.MATCH, hmiZoneCapability, cmd.getHmiZoneCapabilities().get(index));
+ assertEquals(TestValues.MATCH, hmiZoneCapability, cmd.getHmiZoneCapabilities().get(index));
}
JSONArray prerecordedSpeechArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH);
for (int index = 0; index < prerecordedSpeechArray.length(); index++) {
PrerecordedSpeech prerecordedSpeech = PrerecordedSpeech.valueForString( prerecordedSpeechArray.get(index).toString() );
- assertEquals(Test.MATCH, prerecordedSpeech, cmd.getPrerecordedSpeech().get(index));
+ assertEquals(TestValues.MATCH, prerecordedSpeech, cmd.getPrerecordedSpeech().get(index));
}
List<Integer> supportedDiagnosticModesList = JsonUtils.readIntegerListFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES);
List<Integer> testDiagnosticModesList = cmd.getSupportedDiagModes();
- assertEquals(Test.MATCH, supportedDiagnosticModesList.size(), testDiagnosticModesList.size());
- assertTrue(Test.TRUE, Validator.validateIntegerList(supportedDiagnosticModesList, testDiagnosticModesList));
+ assertEquals(TestValues.MATCH, supportedDiagnosticModesList.size(), testDiagnosticModesList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(supportedDiagnosticModesList, testDiagnosticModesList));
JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION);
SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
- assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_LANGUAGE), cmd.getLanguage().toString());
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_LANGUAGE), cmd.getLanguage().toString());
JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES);
List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
@@ -239,12 +249,12 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)buttonCapabilitiesArray.get(index) ));
buttonCapabilitiesList.add(buttonCapability);
}
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES);
DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
- assertTrue(Test.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES);
List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
@@ -253,14 +263,14 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonCapabilitiesArray.get(index) ));
softButtonCapabilitiesList.add(softButtonCapability);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES);
PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
- assertTrue(Test.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
Boolean iconResumed = JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_ICON_RESUMED);
- assertEquals(Test.MATCH, iconResumed, cmd.getIconResumed());
+ assertEquals(TestValues.MATCH, iconResumed, cmd.getIconResumed());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
index f1d2b6e5a..760623916 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
@@ -6,13 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.fail;
+
public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests {
@Override
@@ -36,21 +42,22 @@ public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests
return new JSONObject();
}
+ @Test
public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
index fa3c870fb..eb8ab1ae2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class ResetGlobalPropertiesResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse();
- assertNotNull(Test.NULL, msg);
+ assertNotNull(TestValues.NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ResetGlobalPropertiesResponse cmd = new ResetGlobalPropertiesResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
index 2795b6621..e7ec116d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class ScrollableMessageResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ScrollableMessageResponse msg = new ScrollableMessageResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ScrollableMessageResponse cmd = new ScrollableMessageResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
index 43163608e..bf9461328 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -44,29 +48,31 @@ public class SendLocationResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SendLocationResponse msg = new SendLocationResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SendLocationResponse cmd = new SendLocationResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
index 8efb6f006..dd850f46b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class SetAppIconResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SetAppIconResponse msg = new SetAppIconResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetAppIconResponse cmd = new SetAppIconResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
index 894c7ee78..f6558ab5a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
@@ -4,9 +4,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
import com.smartdevicelink.test.BaseRpcTests;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import org.json.JSONObject;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertNotNull;
public class SetCloudAppPropertiesResponseTests extends BaseRpcTests {
@Override
@@ -32,10 +35,11 @@ public class SetCloudAppPropertiesResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SetCloudAppPropertiesResponse msg = new SetCloudAppPropertiesResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
index f6ea2e691..b6e7be537 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
@@ -10,18 +10,26 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+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;
+import static android.support.test.InstrumentationRegistry.getContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse}
@@ -32,10 +40,10 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
- msg.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
- msg.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
- msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
return msg;
}
@@ -55,12 +63,12 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES, Test.GENERAL_DISPLAYCAPABILITIES.serializeJSON());
- result.put(SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES, Test.JSON_PRESETBANKCAPABILITIES);
- result.put(SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
- result.put(SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
+ result.put(SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES, TestValues.GENERAL_DISPLAYCAPABILITIES.serializeJSON());
+ result.put(SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
+ result.put(SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ result.put(SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -69,6 +77,7 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
DisplayCapabilities testDisplay = ( (SetDisplayLayoutResponse) msg ).getDisplayCapabilities();
@@ -77,45 +86,46 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
List<SoftButtonCapabilities> testSbc = ( (SetDisplayLayoutResponse) msg ).getSoftButtonCapabilities();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES, testDisplay));
- assertTrue(Test.TRUE, Validator.validatePresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES, testPbc));
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), testBc.size());
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), testSbc.size());
- for (int i = 0; i < Test.GENERAL_BUTTONCAPABILITIES_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.get(i), testBc.get(i));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDisplay));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), testBc.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), testSbc.size());
+ for (int i = 0; i < TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.get(i), testBc.get(i));
}
- for (int i = 0; i < Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(); i++) {
- assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.get(i), testSbc.get(i));
+ for (int i = 0; i < TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.get(i), testSbc.get(i));
}
// Invalid/Null Tests
SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getDisplayCapabilities());
- assertNull(Test.NULL, msg.getPresetBankCapabilities());
- assertNull(Test.NULL, msg.getButtonCapabilities());
- assertNull(Test.NULL, msg.getSoftButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getDisplayCapabilities());
+ assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetDisplayLayoutResponse cmd = new SetDisplayLayoutResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
@@ -125,11 +135,11 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)buttonCapabilitiesArray.get(index) ));
buttonCapabilitiesList.add(buttonCapability);
}
- assertTrue(Test.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES);
DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
- assertTrue(Test.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES);
List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
@@ -138,11 +148,11 @@ public class SetDisplayLayoutResponseTest extends BaseRpcTests {
new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonCapabilitiesArray.get(index) ));
softButtonCapabilitiesList.add(softButtonCapability);
}
- assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES);
PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
- assertTrue(Test.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
index 249294228..04e099304 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
@@ -6,13 +6,18 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +48,32 @@ public class SetGlobalPropertiesResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetGlobalPropertiesResponse cmd = new SetGlobalPropertiesResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
index c25685157..cdb59146c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
@@ -7,15 +7,23 @@ import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SetInteriorVehicleDataResponse}
@@ -27,7 +35,7 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse();
- msg.setModuleData(Test.GENERAL_MODULEDATA);
+ msg.setModuleData(TestValues.GENERAL_MODULEDATA);
return msg;
}
@@ -47,9 +55,9 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try{
- result.put(SetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ result.put(SetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
}catch(JSONException e){
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -58,45 +66,47 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
ModuleData testModuleData = ( (SetInteriorVehicleDataResponse) msg ).getModuleData();
// Valid Tests
- assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, testModuleData));
// Invalid/Null Tests
SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getModuleData());
+ assertNull(TestValues.NULL, msg.getModuleData());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetInteriorVehicleDataResponse cmd = new SetInteriorVehicleDataResponse (hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
ModuleData cmdModuleData = cmd.getModuleData();
- assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
index 9bcc7f841..981f4e3f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
@@ -6,14 +6,19 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static android.support.test.InstrumentationRegistry.getContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SetMediaClockTimerResponse}
@@ -43,30 +48,32 @@ public class SetMediaClockTimerResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetMediaClockTimerResponse cmd = new SetMediaClockTimerResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
index 397bf43cc..a4b1dda0b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
@@ -41,13 +41,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
public class ShowAppMenuResponseTests extends BaseRpcTests {
@@ -74,30 +78,32 @@ public class ShowAppMenuResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ShowAppMenuResponse msg = new ShowAppMenuResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
index dd41d1ea2..06bb43dba 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -44,29 +48,31 @@ public class ShowConstantTbtResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ShowConstantTbtResponse msg = new ShowConstantTbtResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ShowConstantTbtResponse cmd = new ShowConstantTbtResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
index ba9b2dfb0..6e6140068 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static android.support.test.InstrumentationRegistry.getContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowResponse}
@@ -43,30 +49,32 @@ public class ShowResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
ShowResponse msg = new ShowResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ShowResponse cmd = new ShowResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
index 2985b9207..8d288c73b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
@@ -6,13 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SliderResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+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 :
@@ -24,7 +31,7 @@ public class SliderResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
SliderResponse msg = new SliderResponse();
- msg.setSliderPosition(Test.GENERAL_INT);
+ msg.setSliderPosition(TestValues.GENERAL_INT);
return msg;
}
@@ -44,49 +51,52 @@ public class SliderResponseTest extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(SliderResponse.KEY_SLIDER_POSITION, Test.GENERAL_INT);
+ result.put(SliderResponse.KEY_SLIDER_POSITION, TestValues.GENERAL_INT);
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
}
+ @Test
public void testPosition() {
Integer copy = ( (SliderResponse) msg ).getSliderPosition();
- assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, copy);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, copy);
}
+ @Test
public void testNull() {
SliderResponse msg = new SliderResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getSliderPosition());
+ assertNull(TestValues.NULL, msg.getSliderPosition());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SliderResponse cmd = new SliderResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SliderResponse.KEY_SLIDER_POSITION), cmd.getSliderPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SliderResponse.KEY_SLIDER_POSITION), cmd.getSliderPosition());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
index 6606b3df5..196c06f21 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SpeakResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class SpeakResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SpeakResponse msg = new SpeakResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SpeakResponse cmd = new SpeakResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
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
index 47801ea90..252a34aab 100644
--- 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
@@ -6,13 +6,18 @@ 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.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+
/**
* Created by austinkirk on 6/7/17.
@@ -22,8 +27,8 @@ public class StreamRPCResponseTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage(){
StreamRPCResponse response = new StreamRPCResponse();
- response.setFileSize((Long) Test.GENERAL_LONG);
- response.setFileName(Test.GENERAL_STRING);
+ response.setFileSize((Long) TestValues.GENERAL_LONG);
+ response.setFileName(TestValues.GENERAL_STRING);
return response;
}
@@ -42,8 +47,8 @@ public class StreamRPCResponseTests extends BaseRpcTests {
JSONObject result = new JSONObject();
try {
- result.put(StreamRPCResponse.KEY_FILESIZE, (Long) Test.GENERAL_LONG);
- result.put(StreamRPCResponse.KEY_FILENAME, Test.GENERAL_STRING);
+ result.put(StreamRPCResponse.KEY_FILESIZE, (Long) TestValues.GENERAL_LONG);
+ result.put(StreamRPCResponse.KEY_FILENAME, TestValues.GENERAL_STRING);
} catch (JSONException e) {
e.printStackTrace();
}
@@ -54,34 +59,36 @@ public class StreamRPCResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
StreamRPCResponse msg = new StreamRPCResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(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(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, StreamRPCResponse.KEY_FILENAME), cmd.getFileName());
- assertEquals(Test.MATCH, JsonUtils.readLongFromJsonObject(parameters, StreamRPCResponse.KEY_FILESIZE), cmd.getFileSize());
+ 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();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
index b835354e3..023fd8869 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static android.support.test.InstrumentationRegistry.getContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.SubscribeButtonResponse}
@@ -43,29 +49,31 @@ public class SubscribeButtonResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SubscribeButtonResponse msg = new SubscribeButtonResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeButtonResponse cmd = new SubscribeButtonResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
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 88eb20221..6694886d9 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
@@ -8,15 +8,23 @@ import com.smartdevicelink.proxy.rpc.VehicleDataResult;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.fail;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse}
@@ -29,35 +37,35 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
- msg.setSpeed(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
- msg.setRpm(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
- msg.setExternalTemperature(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
- msg.setFuelLevel(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
- msg.setPrndl(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
- msg.setTirePressure(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
- msg.setEngineTorque(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
- msg.setEngineOilLife(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
- msg.setOdometer(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
- msg.setGps(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
- msg.setFuelLevelState(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
- msg.setInstantFuelConsumption(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
- msg.setBeltStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
- msg.setBodyInformation(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
- msg.setDeviceStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
- msg.setDriverBraking(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
- msg.setWiperStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
- msg.setHeadLampStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
- msg.setAccPedalPosition(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
- msg.setSteeringWheelAngle(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
- msg.setECallInfo(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
- msg.setAirbagStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
- msg.setEmergencyEvent(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
- msg.setClusterModeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
- msg.setMyKey(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
- msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
- msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
- msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
- msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
+ 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()));
+ msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
+ msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
+ msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
+ msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
+ msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
+ msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
+ msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
+ msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
+ msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
+ msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
+ msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
+ msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
+ msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
+ msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
+ msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
+ msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
+ msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
+ msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
+ msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
+ msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
+ msg.setClusterModeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
+ msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
+ msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
+ msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -82,37 +90,37 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
// were to be in a list then this could be easily looped through
// instead of individually set.
- result.put(SubscribeVehicleDataResponse.KEY_SPEED, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_RPM, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_PRNDL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GPS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
+ 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());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -121,6 +129,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
VehicleDataResult testGps = ( (SubscribeVehicleDataResponse) msg ).getGps();
@@ -151,210 +160,211 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (SubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (SubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (SubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
- VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
- assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
- assertTrue(Test.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
- assertTrue(Test.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
- assertTrue(Test.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
- assertTrue(Test.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
- assertTrue(Test.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
- assertTrue(Test.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
- assertTrue(Test.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
- assertTrue(Test.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
- assertTrue(Test.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
- assertTrue(Test.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
- assertTrue(Test.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
- assertTrue(Test.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
- assertTrue(Test.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
- assertTrue(Test.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
- assertTrue(Test.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
- assertTrue(Test.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
- assertTrue(Test.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
- assertTrue(Test.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
- assertTrue(Test.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
- assertTrue(Test.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
- assertTrue(Test.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
- assertTrue(Test.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
- assertTrue(Test.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
- assertTrue(Test.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
- assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
- assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
- assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
- assertTrue(Test.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ 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));
+ assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
+ assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
+ assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
+ assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
+ assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
+ assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
+ assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
+ assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
+ assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
+ assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
+ assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
+ assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
+ assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
+ assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
+ assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
+ assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
+ assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
+ assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
+ assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
+ assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
+ assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
+ assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
+ assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
+ assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
+ assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(TestValues.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeVehicleDataResponse cmd = new SubscribeVehicleDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_SPEED);
VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_RPM);
VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_PRNDL);
VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ODOMETER);
VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_GPS);
VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BELT_STATUS);
VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_WIPER_STATUS);
VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_E_CALL_INFO);
VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
JSONObject clusterModeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS);
VehicleDataResult referenceClusterModeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModeStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceClusterModeStatus, cmd.getClusterModeStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModeStatus, cmd.getClusterModeStatus()));
JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_MY_KEY);
VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_RANGE);
VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
JSONObject electronicParkBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(electronicParkBrakeStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
- JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
index a43220dce..817414ae1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* Created by austinkirk on 6/7/17.
@@ -42,29 +46,31 @@ public class SubscribeWaypointsResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SubscribeWayPointsResponse msg = new SubscribeWayPointsResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SubscribeWayPointsResponse cmd = new SubscribeWayPointsResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
index 70a4f6279..3ccae2288 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class SystemRequestResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
SystemRequestResponse msg = new SystemRequestResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SystemRequestResponse cmd = new SystemRequestResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
index ce99a1a4a..62264a884 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
@@ -41,13 +41,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -78,30 +82,32 @@ public class UnpublishAppServiceResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnpublishAppServiceResponse cmd = new UnpublishAppServiceResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
index a0d33a15d..cb461a563 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnregisterAppInterfaceResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,30 +47,32 @@ public class UnregisterAppInterfaceResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnregisterAppInterfaceResponse cmd = new UnregisterAppInterfaceResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
index 015b0e255..afdedbdd0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
@@ -6,14 +6,20 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static android.support.test.InstrumentationRegistry.getContext;
+
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.rpc.UnsubscribeButtonResponse}
@@ -43,30 +49,32 @@ public class UnsubscribeButtonResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeButtonResponse cmd = new UnsubscribeButtonResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
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 c2ba6e019..f79b18b30 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
@@ -10,15 +10,23 @@ import com.smartdevicelink.proxy.rpc.VehicleDataResult;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
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 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;
+import static android.support.test.InstrumentationRegistry.getContext;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse}
@@ -31,35 +39,35 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
protected RPCMessage createMessage() {
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
- msg.setSpeed(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
- msg.setRpm(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
- msg.setExternalTemperature(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
- msg.setFuelLevel(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
- msg.setPrndl(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
- msg.setTirePressure(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
- msg.setEngineTorque(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
- msg.setEngineOilLife(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
- msg.setOdometer(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
- msg.setGps(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
- msg.setFuelLevelState(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
- msg.setInstantFuelConsumption(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
- msg.setBeltStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
- msg.setBodyInformation(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
- msg.setDeviceStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
- msg.setDriverBraking(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
- msg.setWiperStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
- msg.setHeadLampStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
- msg.setAccPedalPosition(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
- msg.setSteeringWheelAngle(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
- msg.setECallInfo(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
- msg.setAirbagStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
- msg.setEmergencyEvent(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
- msg.setClusterModeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
- msg.setMyKey(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
- msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
- msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
- msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
- msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
+ 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()));
+ msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
+ msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
+ msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
+ msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
+ msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
+ msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
+ msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
+ msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
+ msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
+ msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
+ msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
+ msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
+ msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
+ msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
+ msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
+ msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
+ msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
+ msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
+ msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
+ msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
+ msg.setClusterModeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
+ msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
+ msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
+ msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -84,37 +92,37 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
// were to be in a list then this could be easily looped through
// instead of individually set.
- result.put(SubscribeVehicleDataResponse.KEY_SPEED, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_RPM, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_PRNDL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GPS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
- result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
+ 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());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
- fail(Test.JSON_FAIL);
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -123,6 +131,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Test Values
VehicleDataResult testGps = ( (UnsubscribeVehicleDataResponse) msg ).getGps();
@@ -153,210 +162,211 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (UnsubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (UnsubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (UnsubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
- VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
- assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
- assertTrue(Test.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
- assertTrue(Test.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
- assertTrue(Test.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
- assertTrue(Test.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
- assertTrue(Test.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
- assertTrue(Test.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
- assertTrue(Test.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
- assertTrue(Test.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
- assertTrue(Test.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
- assertTrue(Test.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
- assertTrue(Test.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
- assertTrue(Test.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
- assertTrue(Test.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
- assertTrue(Test.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
- assertTrue(Test.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
- assertTrue(Test.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
- assertTrue(Test.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
- assertTrue(Test.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
- assertTrue(Test.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
- assertTrue(Test.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
- assertTrue(Test.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
- assertTrue(Test.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
- assertTrue(Test.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
- assertTrue(Test.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
- assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
- assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
- assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
- assertTrue(Test.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ 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));
+ assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
+ assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
+ assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
+ assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
+ assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
+ assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
+ assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
+ assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
+ assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
+ assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
+ assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
+ assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
+ assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
+ assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
+ assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
+ assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
+ assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
+ assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
+ assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
+ assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
+ assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
+ assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
+ assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
+ assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
+ assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(TestValues.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(Test.NULL, msg.getAccPedalPosition());
- assertNull(Test.NULL, msg.getAirbagStatus());
- assertNull(Test.NULL, msg.getBeltStatus());
- assertNull(Test.NULL, msg.getDriverBraking());
- assertNull(Test.NULL, msg.getFuelLevel());
- assertNull(Test.NULL, msg.getTirePressure());
- assertNull(Test.NULL, msg.getWiperStatus());
- assertNull(Test.NULL, msg.getGps());
- assertNull(Test.NULL, msg.getSpeed());
- assertNull(Test.NULL, msg.getRpm());
- assertNull(Test.NULL, msg.getFuelLevelState());
- assertNull(Test.NULL, msg.getInstantFuelConsumption());
- assertNull(Test.NULL, msg.getExternalTemperature());
- assertNull(Test.NULL, msg.getPrndl());
- assertNull(Test.NULL, msg.getOdometer());
- assertNull(Test.NULL, msg.getBodyInformation());
- assertNull(Test.NULL, msg.getDeviceStatus());
- assertNull(Test.NULL, msg.getHeadLampStatus());
- assertNull(Test.NULL, msg.getEngineTorque());
- assertNull(Test.NULL, msg.getEngineOilLife());
- assertNull(Test.NULL, msg.getSteeringWheelAngle());
- assertNull(Test.NULL, msg.getECallInfo());
- assertNull(Test.NULL, msg.getEmergencyEvent());
- assertNull(Test.NULL, msg.getClusterModeStatus());
- assertNull(Test.NULL, msg.getMyKey());
- assertNull(Test.NULL, msg.getFuelRange());
- assertNull(Test.NULL, msg.getTurnSignal());
- assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getAirbagStatus());
+ assertNull(TestValues.NULL, msg.getBeltStatus());
+ assertNull(TestValues.NULL, msg.getDriverBraking());
+ assertNull(TestValues.NULL, msg.getFuelLevel());
+ assertNull(TestValues.NULL, msg.getTirePressure());
+ assertNull(TestValues.NULL, msg.getWiperStatus());
+ assertNull(TestValues.NULL, msg.getGps());
+ assertNull(TestValues.NULL, msg.getSpeed());
+ assertNull(TestValues.NULL, msg.getRpm());
+ assertNull(TestValues.NULL, msg.getFuelLevelState());
+ assertNull(TestValues.NULL, msg.getInstantFuelConsumption());
+ assertNull(TestValues.NULL, msg.getExternalTemperature());
+ assertNull(TestValues.NULL, msg.getPrndl());
+ assertNull(TestValues.NULL, msg.getOdometer());
+ assertNull(TestValues.NULL, msg.getBodyInformation());
+ assertNull(TestValues.NULL, msg.getDeviceStatus());
+ assertNull(TestValues.NULL, msg.getHeadLampStatus());
+ assertNull(TestValues.NULL, msg.getEngineTorque());
+ assertNull(TestValues.NULL, msg.getEngineOilLife());
+ assertNull(TestValues.NULL, msg.getSteeringWheelAngle());
+ assertNull(TestValues.NULL, msg.getECallInfo());
+ assertNull(TestValues.NULL, msg.getEmergencyEvent());
+ assertNull(TestValues.NULL, msg.getClusterModeStatus());
+ assertNull(TestValues.NULL, msg.getMyKey());
+ assertNull(TestValues.NULL, msg.getFuelRange());
+ assertNull(TestValues.NULL, msg.getTurnSignal());
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeVehicleDataResponse cmd = new UnsubscribeVehicleDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ 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);
JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_SPEED);
VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_RPM);
VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_PRNDL);
VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ODOMETER);
VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_GPS);
VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BELT_STATUS);
VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_WIPER_STATUS);
VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_E_CALL_INFO);
VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
JSONObject clusterModeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_CLUSTER_MODE_STATUS);
VehicleDataResult referenceClusterModeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModeStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceClusterModeStatus, cmd.getClusterModeStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModeStatus, cmd.getClusterModeStatus()));
JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_MY_KEY);
VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_RANGE);
VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
JSONObject eBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eBrakeStatus));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
- JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
- assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
index b8b69be60..49017109a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* Created by austinkirk on 6/7/17.
@@ -42,29 +46,31 @@ public class UnsubscribeWayPointsResponseTests extends BaseRpcTests{
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UnsubscribeWayPointsResponse msg = new UnsubscribeWayPointsResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests a valid JSON construction of this RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UnsubscribeWayPointsResponse cmd = new UnsubscribeWayPointsResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
index 84ecc8b64..603565803 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
@@ -6,13 +6,17 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
-import com.smartdevicelink.test.Test;
+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 android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -43,29 +47,31 @@ public class UpdateTurnListResponseTests extends BaseRpcTests {
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testRpcValues () {
// Invalid/Null Tests
UpdateTurnListResponse msg = new UpdateTurnListResponse();
- assertNotNull(Test.NOT_NULL, msg);
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
/**
* Tests the expected values of the RPC message.
*/
+ @Test
public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
- assertNotNull(Test.NOT_NULL, commandJson);
+ JSONObject commandJson = JsonFileReader.readId(getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
UpdateTurnListResponse cmd = new UpdateTurnListResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(Test.NOT_NULL, body);
+ assertNotNull(TestValues.NOT_NULL, body);
// Test everything in the json body.
- assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
index e3aca14a4..1a089daa0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
@@ -1,26 +1,28 @@
package com.smartdevicelink.test.security;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.BaseTransportConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.List;
-public class SdlSecurityBaseTest extends AndroidTestCase2 {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- }
-
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+
+@RunWith(AndroidJUnit4.class)
+public class SdlSecurityBaseTest {
+
private class MockSdlSecurityBase extends SdlSecurityBase {
@Override
@@ -115,7 +117,8 @@ public class SdlSecurityBaseTest extends AndroidTestCase2 {
public void onAuthTokenReceived(String token, byte bytes){}
}
-
+
+ @Test
public void testMakeListSetAndGet(){
List<String> makeList = new ArrayList<String>();
MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
@@ -127,10 +130,11 @@ public class SdlSecurityBaseTest extends AndroidTestCase2 {
mockSdlSecurityBase.setMakeList(makeList);
- assertNotNull(Test.NOT_NULL, makeList);
- assertEquals(Test.MATCH, makeList, mockSdlSecurityBase.getMakeList());
+ assertNotNull(TestValues.NOT_NULL, makeList);
+ assertEquals(TestValues.MATCH, makeList, mockSdlSecurityBase.getMakeList());
}
-
+
+ @Test
public void testHandleInitResult() {
byte testWiproVersion = (byte) 0x0B;
boolean testInitResult = true;
@@ -140,21 +144,22 @@ public class SdlSecurityBaseTest extends AndroidTestCase2 {
SdlSession testSdlSession = SdlSession.createSession(testWiproVersion,interfaceBroker, transportConfig);
- assertNotNull(Test.NOT_NULL, mockSdlSecurityBase);
- assertNotNull(Test.NOT_NULL, testSdlSession);
+ assertNotNull(TestValues.NOT_NULL, mockSdlSecurityBase);
+ assertNotNull(TestValues.NOT_NULL, testSdlSession);
testSdlSession.setSdlSecurity(mockSdlSecurityBase);
mockSdlSecurityBase.handleSdlSession(testSdlSession);
- assertEquals(Test.MATCH, mockSdlSecurityBase.getSdlSession(), testSdlSession);
- assertEquals(Test.MATCH, mockSdlSecurityBase.getSdlSession().getSessionId(), testSdlSession.getSessionId());
+ assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession(), testSdlSession);
+ assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession().getSessionId(), testSdlSession.getSessionId());
mockSdlSecurityBase.handleInitResult(testInitResult);
- assertEquals(Test.MATCH, testInitResult, mockSdlSecurityBase.getInitSuccess());
+ assertEquals(TestValues.MATCH, testInitResult, mockSdlSecurityBase.getInitSuccess());
}
-
+
+ @Test
public void testStartServiceListSetAndGet() {
List<SessionType> startServiceList = new ArrayList<SessionType>();
MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
@@ -164,11 +169,11 @@ public class SdlSecurityBaseTest extends AndroidTestCase2 {
startServiceList.add(SessionType.PCM);
startServiceList.add(SessionType.CONTROL);
- assertNotNull(Test.NOT_NULL, startServiceList);
+ assertNotNull(TestValues.NOT_NULL, startServiceList);
mockSdlSecurityBase.setStartServiceList(startServiceList);
- assertEquals(Test.MATCH, startServiceList, mockSdlSecurityBase.getServiceList());
+ assertEquals(TestValues.MATCH, startServiceList, mockSdlSecurityBase.getServiceList());
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
index aa2c6f073..b4167bef5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
@@ -4,7 +4,7 @@ import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.streaming.IStreamListener;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -56,26 +56,26 @@ public class AbstractPacketizerTests extends TestCase {
// Valid Tests
- assertNotNull(Test.NOT_NULL, testPacketizer1);
- assertNotNull(Test.NOT_NULL, testPacketizer2);
- assertNotNull(Test.NOT_NULL, testPacketizer3);
+ assertNotNull(TestValues.NOT_NULL, testPacketizer1);
+ assertNotNull(TestValues.NOT_NULL, testPacketizer2);
+ assertNotNull(TestValues.NOT_NULL, testPacketizer3);
- assertEquals(Test.MATCH, testListener, testPacketizer1.getListener());
- assertEquals(Test.MATCH, testInputStream, testPacketizer1.getInputStream());
- assertEquals(Test.MATCH, testSessionType, testPacketizer1.getSessionType());
- assertEquals(Test.MATCH, testSessionId, testPacketizer1.getSessionId());
- assertEquals(Test.MATCH, testListener, testPacketizer3.getListener());
- assertEquals(Test.MATCH, testInputStream, testPacketizer3.getInputStream());
- assertEquals(Test.MATCH, testSessionType, testPacketizer3.getSessionType());
- assertEquals(Test.MATCH, testSessionId, testPacketizer3.getSessionId());
- assertEquals(Test.MATCH, testWiproVersion, testPacketizer3.getWiproVersion());
- assertEquals(Test.MATCH, testRpcRequest.getFunctionName(), testPacketizer3.getRPCRequest().getFunctionName());
- assertEquals(Test.MATCH, testSdlSession, testPacketizer3.getSdlSession());
+ assertEquals(TestValues.MATCH, testListener, testPacketizer1.getListener());
+ assertEquals(TestValues.MATCH, testInputStream, testPacketizer1.getInputStream());
+ assertEquals(TestValues.MATCH, testSessionType, testPacketizer1.getSessionType());
+ assertEquals(TestValues.MATCH, testSessionId, testPacketizer1.getSessionId());
+ assertEquals(TestValues.MATCH, testListener, testPacketizer3.getListener());
+ assertEquals(TestValues.MATCH, testInputStream, testPacketizer3.getInputStream());
+ assertEquals(TestValues.MATCH, testSessionType, testPacketizer3.getSessionType());
+ assertEquals(TestValues.MATCH, testSessionId, testPacketizer3.getSessionId());
+ assertEquals(TestValues.MATCH, testWiproVersion, testPacketizer3.getWiproVersion());
+ assertEquals(TestValues.MATCH, testRpcRequest.getFunctionName(), testPacketizer3.getRPCRequest().getFunctionName());
+ assertEquals(TestValues.MATCH, testSdlSession, testPacketizer3.getSdlSession());
// Invalid/Null Tests
- assertNull(Test.NULL, testPacketizer2.getListener());
- assertNull(Test.NULL, testPacketizer2.getInputStream());
- assertNull(Test.NULL, testPacketizer2.getSessionType());
+ assertNull(TestValues.NULL, testPacketizer2.getListener());
+ assertNull(TestValues.NULL, testPacketizer2.getInputStream());
+ assertNull(TestValues.NULL, testPacketizer2.getSessionType());
} catch (IOException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
index 143e8efec..e7a367d0e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -133,7 +133,7 @@ public class StreamPacketizerTests extends TestCase {
try {
testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
StreamPacketizer testStreamPacketizer = new StreamPacketizer(testListener, testInputStream, testSessionType, testSessionId, testSdlSession);
- assertNotNull(Test.NOT_NULL, testStreamPacketizer);
+ assertNotNull(TestValues.NOT_NULL, testStreamPacketizer);
// NOTE: Cannot test thread handling methods currently.
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
index b35877ac3..30a97a09a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -44,7 +44,7 @@ public class StreamRPCPacketizerTests extends TestCase {
try {
testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
StreamRPCPacketizer testStreamRpcPacketizer = new StreamRPCPacketizer(null, testListener, testInputStream, testRequest, testSessionType, testSessionId, testWV, testWV, testSdlSession);
- assertNotNull(Test.NOT_NULL, testStreamRpcPacketizer);
+ assertNotNull(TestValues.NOT_NULL, testStreamRpcPacketizer);
// NOTE: Cannot test thread handling methods currently.
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
index b894eca12..8aa8ac5e8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
@@ -1,26 +1,38 @@
package com.smartdevicelink.test.streaming.video;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Collections;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNull;
-public class VideoStreamingParametersTest extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class VideoStreamingParametersTest {
private VideoStreamingParameters params;
private VideoStreamingCapability capability;
private ImageResolution preferredResolution;
+ @Before
public void setUp() {
params = new VideoStreamingParameters();
capability = new VideoStreamingCapability();
}
+ @Test
public void testUpdateNullScale() {
preferredResolution = new ImageResolution(800, 354);
@@ -36,6 +48,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(354, height);
}
+ @Test
public void testUpdateScale_1_Resolution_800_354() {
preferredResolution = new ImageResolution(800, 354);
@@ -51,6 +64,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(354, height);
}
+ @Test
public void testUpdateScale_1_25_Resolution_1280_569() {
preferredResolution = new ImageResolution(1280, 569);
@@ -66,6 +80,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(456, height);
}
+ @Test
public void testUpdateScale_1_5_Resolution_1280_569() {
preferredResolution = new ImageResolution(1280, 569);
@@ -81,6 +96,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(380, height);
}
+ @Test
public void testUpdateScale_1_0_Ford_Resolution_800_354() {
preferredResolution = new ImageResolution(800, 354);
@@ -96,6 +112,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(354, height);
}
+ @Test
public void testUpdateScale_1_3_Lincoln_Resolution_600_900() {
preferredResolution = new ImageResolution(600, 900);
@@ -111,6 +128,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(676, height);
}
+ @Test
public void testUpdateScale_1_3_Ford_Resolution_900_600() {
preferredResolution = new ImageResolution(900, 600);
@@ -126,6 +144,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(450, height);
}
+ @Test
public void testUpdateScale_1_0_Toyota_Resolution_900_600() {
preferredResolution = new ImageResolution(900, 600);
@@ -141,6 +160,7 @@ public class VideoStreamingParametersTest extends AndroidTestCase2 {
assertEquals(600, height);
}
+ @Test
public void testUpdateCapabilityFormat(){
VideoStreamingCapability capability = new VideoStreamingCapability();
capability.setMaxBitrate(10000);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
index ce24ce4e8..34685897f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.DiagLevel;
import com.smartdevicelink.trace.enums.DetailLevel;
import com.smartdevicelink.trace.enums.Mod;
@@ -42,86 +42,86 @@ public class DiagLevelTests extends TestCase {
// Valid Tests
DiagLevel.setAllLevels(testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testProto));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testTran));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testApp));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
DiagLevel.setAllLevels(testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testProto));
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testProxy));
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testTran));
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testApp));
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testRpc));
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
DiagLevel.setAllLevels(testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testProto));
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testProxy));
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testTran));
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testApp));
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testRpc));
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
DiagLevel.setLevel(testMar, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
DiagLevel.setLevel(testMar, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
DiagLevel.setLevel(testMar, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testMar));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
DiagLevel.setLevel(testRpc, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
DiagLevel.setLevel(testRpc, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
DiagLevel.setLevel(testRpc, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
DiagLevel.setLevel(testApp, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
DiagLevel.setLevel(testApp, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
DiagLevel.setLevel(testApp, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
DiagLevel.setLevel(testTran, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
DiagLevel.setLevel(testTran, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
DiagLevel.setLevel(testTran, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
DiagLevel.setLevel(testProxy, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
DiagLevel.setLevel(testProxy, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
DiagLevel.setLevel(testProxy, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
DiagLevel.setLevel(testProto, testVerbose);
- assertEquals(Test.MATCH, testVerbose, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
DiagLevel.setLevel(testProto, testTerse);
- assertEquals(Test.MATCH, testTerse, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
DiagLevel.setLevel(testProto, testOff);
- assertEquals(Test.MATCH, testOff, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
- assertTrue(Test.TRUE, DiagLevel.isValidDetailLevel(testVerboseS));
- assertTrue(Test.TRUE, DiagLevel.isValidDetailLevel(testTerseS));
- assertTrue(Test.TRUE, DiagLevel.isValidDetailLevel(testOffS));
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testVerboseS));
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testTerseS));
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testOffS));
- assertEquals(Test.MATCH, testVerbose, DiagLevel.toDetailLevel(testVerboseS));
- assertEquals(Test.MATCH, testTerse, DiagLevel.toDetailLevel(testTerseS));
- assertEquals(Test.MATCH, testOff, DiagLevel.toDetailLevel(testOffS));
- assertEquals(Test.MATCH, testOff, DiagLevel.toDetailLevel(testInvalidS));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.toDetailLevel(testVerboseS));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.toDetailLevel(testTerseS));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testOffS));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testInvalidS));
try {
// Invalid/Null Tests
- assertFalse(Test.FALSE, DiagLevel.isValidDetailLevel(testInvalidS));
- assertFalse(Test.FALSE, DiagLevel.isValidDetailLevel(null));
- assertNull(Test.NULL, DiagLevel.getLevel(null));
+ assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(testInvalidS));
+ assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(null));
+ assertNull(TestValues.NULL, DiagLevel.getLevel(null));
DiagLevel.setLevel(null, null);
DiagLevel.setAllLevels(null);
} catch (NullPointerException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
index 34c5c1936..c28d4af87 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.Mime;
import junit.framework.TestCase;
@@ -37,15 +37,15 @@ public class MimeTests extends TestCase {
String actualEncodedString3 = Mime.base64Encode(testBytes, 0, testBytes.length);
// Valid Tests
- assertEquals(Test.MATCH, expectedEncodedString, actualEncodedString1);
- assertEquals(Test.MATCH, expectedEncodedString, actualEncodedString2);
- assertEquals(Test.MATCH, expectedEncodedString, actualEncodedString3);
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString1);
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString2);
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString3);
// Invalid/Null Tests
- assertNull(Test.NULL, actualNullResult1);
- assertNull(Test.NULL, actualNullResult2);
- assertNull(Test.NULL, actualNullResult3);
- assertNull(Test.NULL, actualInvalidResult);
+ assertNull(TestValues.NULL, actualNullResult1);
+ assertNull(TestValues.NULL, actualNullResult2);
+ assertNull(TestValues.NULL, actualNullResult3);
+ assertNull(TestValues.NULL, actualInvalidResult);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
index a46e35542..1a770f609 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.DiagLevel;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.enums.DetailLevel;
@@ -22,14 +22,14 @@ public class SdlTraceTests extends TestCase {
public void testAdjustmentFlags () {
SdlTrace.setAcceptAPITraceAdjustments(true);
- assertTrue(Test.TRUE, SdlTrace.getAcceptAPITraceAdjustments());
+ assertTrue(TestValues.TRUE, SdlTrace.getAcceptAPITraceAdjustments());
SdlTrace.setAcceptAPITraceAdjustments(false);
- assertFalse(Test.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
+ assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
// This should not change the value from the previous setting.
SdlTrace.setAcceptAPITraceAdjustments(null);
- assertFalse(Test.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
+ assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
}
/**
@@ -47,75 +47,75 @@ public class SdlTraceTests extends TestCase {
// App Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setAppTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.app));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.app));
SdlTrace.setAppTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.app));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.app));
SdlTrace.setAppTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
// This should not change the value from the previous setting.
SdlTrace.setAppTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
// Proxy Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setProxyTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proxy));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proxy));
SdlTrace.setProxyTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proxy));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proxy));
SdlTrace.setProxyTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
// This should not change the value from the previous setting.
SdlTrace.setProxyTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
// Rpc Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setRpcTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.rpc));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.rpc));
SdlTrace.setRpcTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.rpc));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.rpc));
SdlTrace.setRpcTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
// This should not change the value from the previous setting.
SdlTrace.setRpcTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
// Marshalling Trace Level - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setMarshallingTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.mar));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.mar));
SdlTrace.setMarshallingTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.mar));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.mar));
SdlTrace.setMarshallingTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
// This should not change the value from the previous setting.
SdlTrace.setMarshallingTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
// Protocol Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setProtocolTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proto));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proto));
SdlTrace.setProtocolTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proto));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proto));
SdlTrace.setProtocolTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
// This should not change the value from the previous setting.
SdlTrace.setProtocolTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
// Transport Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
SdlTrace.setTransportTraceLevel(DetailLevel.VERBOSE);
- assertEquals(Test.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.tran));
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.tran));
SdlTrace.setTransportTraceLevel(DetailLevel.TERSE);
- assertEquals(Test.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.tran));
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.tran));
SdlTrace.setTransportTraceLevel(DetailLevel.OFF);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
// This should not change the value from the previous setting.
SdlTrace.setTransportTraceLevel(null);
- assertEquals(Test.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
}
// NOTE : No testing can currently be done for the logging methods.
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
index 5f4301b0d..07cd3e56e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace.enums;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.enums.DetailLevel;
import junit.framework.TestCase;
@@ -45,14 +45,14 @@ public class DetailLevelTests extends TestCase {
List<DetailLevel> actualEnumList = Arrays.asList(DetailLevel.values());
// Valid Tests
- assertEquals(Test.MATCH, expectedOffEnum, actualOffEnum);
- assertEquals(Test.MATCH, expectedTerseEnum, actualTerseEnum);
- assertEquals(Test.MATCH, expectedVerboseEnum, actualVerboseEnum);
- assertTrue(Test.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+ assertEquals(TestValues.MATCH, expectedOffEnum, actualOffEnum);
+ assertEquals(TestValues.MATCH, expectedTerseEnum, actualTerseEnum);
+ assertEquals(TestValues.MATCH, expectedVerboseEnum, actualVerboseEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
// Invalid/Null Tests
- assertNull(Test.NULL, actualInvalidEnum);
- assertNull(Test.NULL, actualNullEnum);
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
}catch (NullPointerException e) {
fail("Could not retrieve value for null string, should return null.");
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
index 9ee0fff13..32aae24b1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace.enums;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import junit.framework.TestCase;
@@ -45,14 +45,14 @@ public class InterfaceActivityDirectionTests extends TestCase {
List<InterfaceActivityDirection> actualEnumList = Arrays.asList(InterfaceActivityDirection.values());
// Valid Tests
- assertEquals(Test.MATCH, expectedNoneEnum, actualNoneEnum);
- assertEquals(Test.MATCH, expectedReceiveEnum, actualReceiveEnum);
- assertEquals(Test.MATCH, expectedTransmitEnum, actualTransmitEnum);
- assertTrue(Test.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+ assertEquals(TestValues.MATCH, expectedNoneEnum, actualNoneEnum);
+ assertEquals(TestValues.MATCH, expectedReceiveEnum, actualReceiveEnum);
+ assertEquals(TestValues.MATCH, expectedTransmitEnum, actualTransmitEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
// Invalid/Null
- assertNull(Test.NULL, actualInvalidEnum);
- assertNull(Test.NULL, actualNullEnum);
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
} catch (NullPointerException e) {
fail("Could not retrieve value for null string, should return null.");
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
index f1f856ef9..c2621d789 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.trace.enums;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.trace.enums.Mod;
import junit.framework.TestCase;
@@ -57,17 +57,17 @@ public class ModTests extends TestCase {
List<Mod> actualEnumList = Arrays.asList(Mod.values());
// Valid Tests
- assertEquals(Test.MATCH, expectedAppEnum, actualAppEnum);
- assertEquals(Test.MATCH, expectedRpcEnum, actualRpcEnum);
- assertEquals(Test.MATCH, expectedMarEnum, actualMarEnum);
- assertEquals(Test.MATCH, expectedTranEnum, actualTranEnum);
- assertEquals(Test.MATCH, expectedProtoEnum, actualProtoEnum);
- assertEquals(Test.MATCH, expectedProxyEnum, actualProxyEnum);
- assertTrue(Test.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+ assertEquals(TestValues.MATCH, expectedAppEnum, actualAppEnum);
+ assertEquals(TestValues.MATCH, expectedRpcEnum, actualRpcEnum);
+ assertEquals(TestValues.MATCH, expectedMarEnum, actualMarEnum);
+ assertEquals(TestValues.MATCH, expectedTranEnum, actualTranEnum);
+ assertEquals(TestValues.MATCH, expectedProtoEnum, actualProtoEnum);
+ assertEquals(TestValues.MATCH, expectedProxyEnum, actualProxyEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
// Invalid/Null Tests
- assertNull(Test.NULL, actualInvalidEnum);
- assertNull(Test.NULL, actualNullEnum);
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
} catch (NullPointerException e) {
fail("Could not retrieve value for null string, should return null.");
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java
index 973cdaa16..edb932f62 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.transport;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
@@ -31,13 +31,13 @@ public class BTTransportConfigTests extends TestCase {
TransportType actualTransportType = testConfig1.getTransportType();
// Valid Tests
- assertEquals(Test.MATCH, expectedTransportType, actualTransportType);
- assertTrue(Test.TRUE, actualShareConnection);
+ assertEquals(TestValues.MATCH, expectedTransportType, actualTransportType);
+ assertTrue(TestValues.TRUE, actualShareConnection);
testConfig1.setKeepSocketActive(true);
- assertTrue(Test.TRUE, testConfig1.getKeepSocketActive());
+ assertTrue(TestValues.TRUE, testConfig1.getKeepSocketActive());
testConfig1.setKeepSocketActive(false);
- assertFalse(Test.FALSE, testConfig1.getKeepSocketActive());
+ assertFalse(TestValues.FALSE, testConfig1.getKeepSocketActive());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
index 6336851fe..d5f6629bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.transport;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
@@ -31,12 +31,12 @@ public class BaseTransportConfigTests extends TestCase {
int actualMaxValue = testBaseTransportConfig.getHeartBeatTimeout();
// Valid Tests
- assertNotNull(Test.NOT_NULL, testBaseTransportConfig);
- assertEquals(Test.MATCH, expectedMaxValue, actualMaxValue);
- assertTrue(Test.TRUE, actualShareConnection);
+ assertNotNull(TestValues.NOT_NULL, testBaseTransportConfig);
+ assertEquals(TestValues.MATCH, expectedMaxValue, actualMaxValue);
+ assertTrue(TestValues.TRUE, actualShareConnection);
testBaseTransportConfig.setHeartBeatTimeout(testInt);
- assertEquals(Test.MATCH, testInt, testBaseTransportConfig.getHeartBeatTimeout());
+ assertEquals(TestValues.MATCH, testInt, testBaseTransportConfig.getHeartBeatTimeout());
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
index cb3de5670..8fae50a8b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
@@ -1,22 +1,30 @@
package com.smartdevicelink.test.transport;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class MultiplexTransportConfigTests extends AndroidTestCase2 {
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
-
+@RunWith(AndroidJUnit4.class)
+public class MultiplexTransportConfigTests {
+
+ @Test
public void testDefaultSecurity(){
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext, "2341");
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(), "2341");
assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
}
-
+
+ @Test
public void testSettingSecurity(){
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext, "2341", MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(), "2341", MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- config = new MultiplexTransportConfig(this.mContext, "2341");
+ config = new MultiplexTransportConfig(getTargetContext(), "2341");
config.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
index e6398853a..cca9171c8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
@@ -4,7 +4,7 @@ import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.WiProProtocol;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.SdlPsm;
import junit.framework.TestCase;
@@ -55,7 +55,7 @@ public class SdlPsmTests extends TestCase {
dataLength.set(sdlPsm, MAX_DATA_LENGTH + 1);
int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
- assertEquals(Test.MATCH, SdlPsm.ERROR_STATE, STATE);
+ assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
}catch (Exception e){
Log.e(TAG, e.toString());
}
@@ -71,7 +71,7 @@ public class SdlPsmTests extends TestCase {
dataLength.set(sdlPsm, MAX_DATA_LENGTH);
int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
- assertEquals(Test.MATCH, SdlPsm.DATA_PUMP_STATE, STATE);
+ assertEquals(TestValues.MATCH, SdlPsm.DATA_PUMP_STATE, STATE);
}catch (Exception e){
Log.e(TAG, e.toString());
}
@@ -86,7 +86,7 @@ public class SdlPsmTests extends TestCase {
dataLength.set(sdlPsm, 2147483647);
int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
- assertEquals(Test.MATCH, SdlPsm.ERROR_STATE, STATE);
+ assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
}catch (Exception e){
Log.e(TAG, e.toString());
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
index f08deea5a..fded19fd5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.transport;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
@@ -41,14 +41,14 @@ public class TCPTransportConfigTests extends TestCase {
TransportType actualTransportType = testConfig1.getTransportType();
// Valid Tests
- assertEquals(Test.MATCH, testInt, actualPort);
- assertEquals(Test.MATCH, testString, actualIpAddress);
- assertEquals(Test.MATCH, testBoolean, actualAutoReconnect);
- assertEquals(Test.MATCH, expectedTransportType, actualTransportType);
- assertEquals(Test.MATCH, expectedToString1, actualToString1);
- assertEquals(Test.MATCH, expectedToString2, actualToString2);
+ assertEquals(TestValues.MATCH, testInt, actualPort);
+ assertEquals(TestValues.MATCH, testString, actualIpAddress);
+ assertEquals(TestValues.MATCH, testBoolean, actualAutoReconnect);
+ assertEquals(TestValues.MATCH, expectedTransportType, actualTransportType);
+ assertEquals(TestValues.MATCH, expectedToString1, actualToString1);
+ assertEquals(TestValues.MATCH, expectedToString2, actualToString2);
// Invalid/Null Tests
- assertNull(Test.NULL, actualNullString);
+ assertNull(TestValues.NULL, actualNullString);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
index 62f5a322a..dc54b2197 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.transport;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.enums.TransportType;
import junit.framework.TestCase;
@@ -59,17 +59,17 @@ public class TransportTypeTests extends TestCase {
List<TransportType> actualEnumList = Arrays.asList(TransportType.values());
// Valid Tests
- assertEquals(Test.MATCH, expectedTcpEnum, actualTcpEnum);
- assertEquals(Test.MATCH, expectedUsbEnum, actualUsbEnum);
- assertEquals(Test.MATCH, expectedBluetoothEnum, actualBluetoothEnum);
- assertEquals(Test.MATCH, expectedMultiplexingEnum, actualMultiplexingEnum);
- assertEquals(Test.MATCH, expectedWebSocketServerEnum, actualWebSocketServerEnum);
- assertEquals(Test.MATCH, expectedCustomEnum, actualCustomEnum);
- assertTrue(Test.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+ assertEquals(TestValues.MATCH, expectedTcpEnum, actualTcpEnum);
+ assertEquals(TestValues.MATCH, expectedUsbEnum, actualUsbEnum);
+ assertEquals(TestValues.MATCH, expectedBluetoothEnum, actualBluetoothEnum);
+ assertEquals(TestValues.MATCH, expectedMultiplexingEnum, actualMultiplexingEnum);
+ assertEquals(TestValues.MATCH, expectedWebSocketServerEnum, actualWebSocketServerEnum);
+ assertEquals(TestValues.MATCH, expectedCustomEnum, actualCustomEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
// Invalid/Null Tests
- assertNull(Test.NULL, actualInvalidEnum);
- assertNull(Test.NULL, actualNullEnum);
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
} catch (NullPointerException e) {
fail("Could not retrieve value for null string, should return null.");
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
index fb6eed3f9..4fd0ca2cb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.BitConverter;
import junit.framework.TestCase;
@@ -36,9 +36,9 @@ public class BitConverterTests extends TestCase {
assertTrue("Arrays should match.", Arrays.equals(testBytes, actualBytes));
// Invalid/Null Tests
- assertNull(Test.NULL, BitConverter.bytesToHex(null));
- assertNull(Test.NULL, BitConverter.bytesToHex(null, 0, 0));
- assertNull(Test.NULL, BitConverter.hexToBytes(null));
+ assertNull(TestValues.NULL, BitConverter.bytesToHex(null));
+ assertNull(TestValues.NULL, BitConverter.bytesToHex(null, 0, 0));
+ assertNull(TestValues.NULL, BitConverter.hexToBytes(null));
}
/**
@@ -57,11 +57,11 @@ public class BitConverterTests extends TestCase {
int actualNullBytes = BitConverter.intFromByteArray(null, 0);
// Valid Tests
- assertEquals(Test.MATCH, expectedInt.intValue(), actualInt);
- assertTrue(Test.ARRAY, Arrays.equals(expectedBytes, actualBytes));
+ assertEquals(TestValues.MATCH, expectedInt.intValue(), actualInt);
+ assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
// Invalid/Null Tests
- assertEquals(Test.MATCH, (int) -1, actualNullBytes);
+ assertEquals(TestValues.MATCH, (int) -1, actualNullBytes);
}
/**
@@ -79,10 +79,10 @@ public class BitConverterTests extends TestCase {
short actualNullBytes = BitConverter.shortFromByteArray(null, 0);
// Valid Tests
- assertEquals(Test.MATCH, expectedShort, actualShort);
- assertTrue(Test.ARRAY, Arrays.equals(expectedBytes, actualBytes));
+ assertEquals(TestValues.MATCH, expectedShort, actualShort);
+ assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
// Invalid/Null Tests
- assertEquals(Test.MATCH, (short) -1, actualNullBytes);
+ assertEquals(TestValues.MATCH, (short) -1, actualNullBytes);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
index b056d4fdf..0cf0efc47 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.ByteEnumer;
import junit.framework.TestCase;
@@ -37,15 +37,15 @@ public class ByteEnumerTests extends TestCase {
String actualNullString = testObject.getName();
// Valid Tests
- assertNotNull(Test.NOT_NULL, expectedObject);
- assertEquals(Test.MATCH, testByte, actualByte1);
- assertEquals(Test.MATCH, testByte, actualByte2);
- assertEquals(Test.MATCH, testString, actualString);
- assertTrue(Test.TRUE, actualObject.equals(expectedObject));
- assertTrue(Test.TRUE, actualObject.eq(expectedObject));
+ assertNotNull(TestValues.NOT_NULL, expectedObject);
+ assertEquals(TestValues.MATCH, testByte, actualByte1);
+ assertEquals(TestValues.MATCH, testByte, actualByte2);
+ assertEquals(TestValues.MATCH, testString, actualString);
+ assertTrue(TestValues.TRUE, actualObject.equals(expectedObject));
+ assertTrue(TestValues.TRUE, actualObject.eq(expectedObject));
// Invalid/Null Tests
- assertNull(Test.NULL, actualNullString);
+ assertNull(TestValues.NULL, actualNullString);
}
/**
@@ -73,15 +73,15 @@ public class ByteEnumerTests extends TestCase {
testInvalidList.add(testString2);
// Valid Tests
- assertEquals(Test.MATCH, expectedObject1, ByteEnumer.get(testList, testByte1));
- assertEquals(Test.MATCH, expectedObject1, ByteEnumer.get(testList, testString1));
- assertEquals(Test.MATCH, expectedObject2, ByteEnumer.get(testList, testByte2));
- assertEquals(Test.MATCH, expectedObject2, ByteEnumer.get(testList, testString2));
+ assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testByte1));
+ assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testString1));
+ assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testByte2));
+ assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testString2));
// Invalid/Null Tests
- assertNull(Test.NULL, ByteEnumer.get(testList, null));
- assertNull(Test.NULL, ByteEnumer.get(testInvalidList, testByte1));
- assertNull(Test.NULL, ByteEnumer.get(testInvalidList, testString1));
+ assertNull(TestValues.NULL, ByteEnumer.get(testList, null));
+ assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testByte1));
+ assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testString1));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
index 5edd95ab5..17929e909 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
@@ -1,47 +1,56 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.test.Test;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.CompareUtils;
-public class CompareUtilsTest extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public class CompareUtilsTest {
+ @Test
public void testAreStringsEqual(){
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, true, true));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, false, true));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, true, false));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, false, false));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, true, true));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, false, true));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, true, false));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, false, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, true, true));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, false, true));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, true, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, false, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_APP_ID, true, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_APP_ID, false, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_APP_ID, true, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_APP_ID, false, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), false, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), false, true));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), true, false));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), true, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING.toUpperCase(), false, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING.toUpperCase(), false, true));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING.toUpperCase(), true, false));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING.toUpperCase(), true, true));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING, false, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING, false, true));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING.toUpperCase(), true, false));
- assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING.toUpperCase(), true, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING.toUpperCase(), TestValues.GENERAL_STRING, false, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING.toUpperCase(), TestValues.GENERAL_STRING, false, true));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING.toUpperCase(), TestValues.GENERAL_STRING.toUpperCase(), true, false));
+ assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING.toUpperCase(), TestValues.GENERAL_STRING.toUpperCase(), true, true));
assertTrue(CompareUtils.areStringsEqual(null, null, true, true));
assertFalse(CompareUtils.areStringsEqual(null, null, true, false));
assertTrue(CompareUtils.areStringsEqual(null, null, false, true));
assertFalse(CompareUtils.areStringsEqual(null, null, false, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, true, true));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, true, false));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, false, true));
- assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, false, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, null, true, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, null, true, false));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, null, false, true));
+ assertFalse(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, null, false, false));
- assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, false, true));
- assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, false, false));
- assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, true, true));
- assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, true, false));
+ assertFalse(CompareUtils.areStringsEqual(null, TestValues.GENERAL_STRING, false, true));
+ assertFalse(CompareUtils.areStringsEqual(null, TestValues.GENERAL_STRING, false, false));
+ assertFalse(CompareUtils.areStringsEqual(null, TestValues.GENERAL_STRING, true, true));
+ assertFalse(CompareUtils.areStringsEqual(null, TestValues.GENERAL_STRING, true, false));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
index d4fbacee0..62d159f26 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.DebugTool;
import junit.framework.TestCase;
@@ -19,9 +19,9 @@ public class DebugToolTests extends TestCase {
*/
public void testDebugEnableMethods () {
DebugTool.enableDebugTool();
- assertTrue(Test.TRUE, DebugTool.isDebugEnabled());
+ assertTrue(TestValues.TRUE, DebugTool.isDebugEnabled());
DebugTool.disableDebugTool();
- assertFalse(Test.FALSE, DebugTool.isDebugEnabled());
+ assertFalse(TestValues.FALSE, DebugTool.isDebugEnabled());
}
// NOTE : No testing can currently be done for the logging methods.
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
index 38ab8a67f..6071ee9d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.NativeLogTool;
import junit.framework.TestCase;
@@ -45,14 +45,14 @@ public class NativeLogToolTests extends TestCase {
List<NativeLogTool.LogTarget> actualEnumList = Arrays.asList(NativeLogTool.LogTarget.values());
// Valid Tests
- assertEquals(Test.MATCH, expectedInfoEnum, actualInfoEnum);
- assertEquals(Test.MATCH, expectedErrorEnum, actualErrorEnum);
- assertEquals(Test.MATCH, expectedWarningEnum, actualWarningEnum);
+ assertEquals(TestValues.MATCH, expectedInfoEnum, actualInfoEnum);
+ assertEquals(TestValues.MATCH, expectedErrorEnum, actualErrorEnum);
+ assertEquals(TestValues.MATCH, expectedWarningEnum, actualWarningEnum);
assertTrue("Contents should match.", expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
// Invalid/Null Tests
- assertNull(Test.NULL, actualInvalidEnum);
- assertNull(Test.NULL, actualNullEnum);
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
} catch (NullPointerException e) {
fail("Could not retrieve value for null string, should return null.");
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
index 027de8b2c..c1cf90e8c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
@@ -38,20 +38,29 @@ import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.os.Bundle;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.R;
import com.smartdevicelink.util.SdlAppInfo;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
/**
* Created by Joey Grover on 2/20/18.
*/
-public class SdlAppInfoTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlAppInfoTests {
Context context;
ResolveInfo defaultResolveInfo;
@@ -59,9 +68,8 @@ public class SdlAppInfoTests extends AndroidTestCase2 {
Bundle defaultBundle;
PackageInfo defaultPackageInfo;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
context = getContext();
defaultResolveInfo = createResolveInfo(context.getResources().getInteger(R.integer.sdl_router_service_version_value), "com.smartdevicelink.test", "com.smartdevicelink.test.SdlRouterService",false);
defaultServiceInfo = defaultResolveInfo.serviceInfo;
@@ -72,6 +80,7 @@ public class SdlAppInfoTests extends AndroidTestCase2 {
defaultPackageInfo.firstInstallTime = System.currentTimeMillis() - 1000000;
}
+ @Test
public void testConstructorWithDefaultData(){
SdlAppInfo info = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
@@ -92,6 +101,7 @@ public class SdlAppInfoTests extends AndroidTestCase2 {
/**
* If an app is found to have a newer service the compare should put it at the top of the list
*/
+ @Test
public void testCompareVersion(){
SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
@@ -112,6 +122,7 @@ public class SdlAppInfoTests extends AndroidTestCase2 {
/**
* Regardless of version, if the router service is custom it should be towards the end of the list
*/
+ @Test
public void testCompareVersionAndCustom(){
SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
@@ -132,6 +143,7 @@ public class SdlAppInfoTests extends AndroidTestCase2 {
/**
* If two services have the same version and are not custom, we need to check which app has been updated the most recently
*/
+ @Test
public void testCompareUpdatedTime(){
SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
index 2792608c6..0912354d7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.util.SdlDataTypeConverter;
import junit.framework.TestCase;
@@ -34,13 +34,13 @@ public class SdlDataTypeConverterTests extends TestCase {
Double actualIntegerValue = SdlDataTypeConverter.objectToDouble(testInteger);
// Valid Tests
- assertEquals(Test.MATCH, expectedValue, actualDoubleValue);
- assertEquals(Test.MATCH, expectedValue, actualIntegerValue);
- assertEquals(Test.MATCH, expectedValue, actualFloatValue);
+ assertEquals(TestValues.MATCH, expectedValue, actualDoubleValue);
+ assertEquals(TestValues.MATCH, expectedValue, actualIntegerValue);
+ assertEquals(TestValues.MATCH, expectedValue, actualFloatValue);
// Null Tests
- assertNull(Test.NULL, actualNullValue);
- assertNull(Test.NULL, actualLongValue);
- assertNull(Test.NULL, actualShortValue);
+ assertNull(TestValues.NULL, actualNullValue);
+ assertNull(TestValues.NULL, actualLongValue);
+ assertNull(TestValues.NULL, actualShortValue);
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
index f9d3b8e0a..9f462e3f4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
@@ -1,13 +1,21 @@
package com.smartdevicelink.test.util;
-import com.smartdevicelink.AndroidTestCase2;
+import android.support.test.runner.AndroidJUnit4;
+
import com.smartdevicelink.util.Version;
-public class VersionTest extends AndroidTestCase2 {
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class VersionTest {
private static final String TEST_VERSION_STRING = "1.2.3";
private static final Version TEST_VERSION = new Version(1,2,3);
+ @Test
public void testConstructorCorrect(){
Version version = new Version(TEST_VERSION_STRING);
assertEquals(1, version.getMajor());
@@ -15,6 +23,7 @@ public class VersionTest extends AndroidTestCase2 {
assertEquals(3, version.getPatch());
}
+ @Test
public void testConstructorIncorrect(){
try{
Version version = new Version("1.2");
@@ -24,11 +33,13 @@ public class VersionTest extends AndroidTestCase2 {
assert false;
}
+ @Test
public void testToString(){
Version version = new Version(TEST_VERSION_STRING);
assertEquals(version.toString(), TEST_VERSION_STRING);
}
+ @Test
public void testisNewerThan(){
Version version1 = new Version(5,0,0);
@@ -47,6 +58,7 @@ public class VersionTest extends AndroidTestCase2 {
}
+ @Test
public void testIsBetween(){
assertEquals(TEST_VERSION.isBetween(new Version(1,0,0), new Version (2,0,0)), 1);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
index 8b93b41b7..8b0389dbb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
@@ -1,28 +1,35 @@
package com.smartdevicelink.test.utl;
import android.content.ComponentName;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.util.AndroidTools;
import junit.framework.Assert;
-public class AndroidToolsTests extends AndroidTestCase2 {
-
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+@RunWith(AndroidJUnit4.class)
+public class AndroidToolsTests {
+ @Test
public void testIsServiceExportedNormal(){
try{
- AndroidTools.isServiceExported(mContext, new ComponentName(mContext, "test"));
+ AndroidTools.isServiceExported(getTargetContext(), new ComponentName(getTargetContext(), "test"));
}catch(Exception e){
Assert.fail("Exception during normal test: " + e.getMessage());
}
}
+ @Test
public void testIsServiceExportedNull(){
try{
- AndroidTools.isServiceExported(mContext, null);
+ AndroidTools.isServiceExported(getTargetContext(), null);
Assert.fail("Proccessed null data");
}catch(Exception e){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
index 108d6e457..aa37eda2d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import java.util.ArrayList;
import java.util.List;
@@ -22,7 +22,7 @@ public class AppServiceFactory {
AppServiceManifest manifest = new AppServiceManifest();
manifest.setServiceName(serviceName);
- manifest.setRpcSpecVersion(new SdlMsgVersion(Test.MAX_RPC_VERSION_SUPPORTED));
+ manifest.setRpcSpecVersion(new SdlMsgVersion(TestValues.MAX_RPC_VERSION_SUPPORTED));
manifest.setAllowAppConsumers(true);
List<FunctionID> handledRPCs = new ArrayList<>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
index 10aa25d75..e6b3d4341 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
@@ -3,22 +3,30 @@ package com.smartdevicelink.transport;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Parcel;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class LocalRouterServiceTests extends AndroidTestCase2 {
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+
+@RunWith(AndroidJUnit4.class)
+public class LocalRouterServiceTests {
private static final int TEST_WITH_CONSTRUCTOR = 0;
private static final int TEST_WITH_CREATOR = 1;
-
+ @Test
public void testLocalRouterServiceParcel(){
Parcel p = Parcel.obtain();
p.writeInt(4);
p.writeLong(System.currentTimeMillis());
p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(mContext, "test"), 0);
+ p.writeParcelable(new ComponentName(getContext(), "test"), 0);
p.setDataPosition(0);
SdlRouterService.LocalRouterService local = new SdlRouterService.LocalRouterService(p);
@@ -28,13 +36,14 @@ public class LocalRouterServiceTests extends AndroidTestCase2 {
p.recycle();
}
-
+
+ @Test
public void testLocalRouterServiceParcelCreator(){
Parcel p = Parcel.obtain();
p.writeInt(4);
p.writeLong(System.currentTimeMillis());
p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(mContext, "test"), 0);
+ p.writeParcelable(new ComponentName(getContext(), "test"), 0);
p.setDataPosition(0);
SdlRouterService.LocalRouterService local = SdlRouterService.LocalRouterService.CREATOR.createFromParcel(p);
@@ -57,7 +66,7 @@ public class LocalRouterServiceTests extends AndroidTestCase2 {
Parcel p = Parcel.obtain();
p.writeInt(4);
p.writeLong(System.currentTimeMillis());
- p.writeParcelable(new ComponentName(mContext, "test"), 0);
+ p.writeParcelable(new ComponentName(getContext(), "test"), 0);
p.writeParcelable(new Intent(), 0);
p.setDataPosition(0);
@@ -108,7 +117,7 @@ public class LocalRouterServiceTests extends AndroidTestCase2 {
p.writeLong(System.currentTimeMillis());
int space = p.dataSize();
p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(mContext, "test"), 0);
+ p.writeParcelable(new ComponentName(getContext(), "test"), 0);
p.setDataPosition(0);
byte[] raw = p.marshall();
@@ -130,11 +139,13 @@ public class LocalRouterServiceTests extends AndroidTestCase2 {
p.recycle();
}
-
+
+ @Test
public void testLocalRouterServiceCorruptParcel(){
corruptParcel(TEST_WITH_CONSTRUCTOR);
}
-
+
+ @Test
public void testLocalRouterServiceCorruptParcelCreator(){
corruptParcel(TEST_WITH_CREATOR);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
index b2da5ef08..192f3aa3c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
@@ -4,15 +4,26 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.transport.enums.TransportType;
import junit.framework.Assert;
-public class MultiplexTransportTest extends AndroidTestCase2 {
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public class MultiplexTransportTest {
private static final int TIMEOUT = 2000;
@@ -20,10 +31,9 @@ public class MultiplexTransportTest extends AndroidTestCase2 {
ITransportListener transportListener;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- rsvp = new RouterServiceValidator(this.mContext);
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
rsvp.validate();
@@ -49,9 +59,9 @@ public class MultiplexTransportTest extends AndroidTestCase2 {
}
-
+ @Test
public void testThreadRecoverability(){
- MultiplexTransportConfig config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID);
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(),SdlUnitTestContants.TEST_APP_ID);
// public MultiplexTransport(MultiplexTransportConfig transportConfig, final ITransportListener transportListener){
MultiplexTransport trans = new MultiplexTransport(config,transportListener);
@@ -87,6 +97,7 @@ public class MultiplexTransportTest extends AndroidTestCase2 {
}
// test for setting error state.
+ @Test
public void testSetState() {
final Bundle bundle = new Bundle();
MultiplexBluetoothTransport btTransport = new MultiplexBluetoothTransport(new Handler(Looper.getMainLooper()) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
index 538d5fed4..8302ec53c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
@@ -5,15 +5,20 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.ConditionVariable;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.transport.RouterServiceValidator.TrustedAppStore;
import com.smartdevicelink.util.HttpRequestTask.HttpRequestTaskCallback;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -21,7 +26,17 @@ import java.lang.reflect.Method;
import java.util.List;
import java.util.concurrent.Semaphore;
-public class RSVTestCase extends AndroidTestCase2 {
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+
+@RunWith(AndroidJUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)
+public class RSVTestCase {
private static final String TAG = "RSVTestCase";
private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
@@ -35,18 +50,12 @@ public class RSVTestCase extends AndroidTestCase2 {
*/
boolean liveTest = false;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- rsvp = new RouterServiceValidator(this.mContext);
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getTargetContext());
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
private static final Semaphore TRUSTED_LIST_LOCK = new Semaphore(1);
private void requestTListLock(){
@@ -72,45 +81,51 @@ public class RSVTestCase extends AndroidTestCase2 {
* These tests are a little strange because they don't test the logic behind the validation of each piece.
* However, they allow us to test
*/
-
+
+ @Test
public void testInstalledFrom(){
if(liveTest){
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
assertTrue(rsvp.validate());
}
}
-
+
+ @Test
public void testPackageCheck(){
if(liveTest){
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PACKAGE_CHECK);
assertTrue(rsvp.validate());
}
}
-
+
+ @Test
public void testVersionCheck(){
if(liveTest){
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
assertTrue(rsvp.validate());
}
}
-
+
+ @Test
public void testNoFlags(){
if(liveTest){
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
assertTrue(rsvp.validate());
}
}
-
+
+ @Test
public void testAllFlags(){
if(liveTest){
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
assertTrue(rsvp.validate());
}
}
-
+
+ @Test
public void testSecuritySetting(){
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext); //Use a locally scoped instance
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext()); //Use a locally scoped instance
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
try{
@@ -122,13 +137,14 @@ public class RSVTestCase extends AndroidTestCase2 {
}catch( IllegalAccessException e2){
fail(e2.getMessage());
}
- assertEquals(RouterServiceValidator.getSecurityLevel(mContext), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ assertEquals(RouterServiceValidator.getSecurityLevel(getTargetContext()), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
}
-
+
+ @Test
public void testHighSecurity(){
requestTListLock();
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext); //Use a locally scoped instance
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext()); //Use a locally scoped instance
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
@@ -136,14 +152,15 @@ public class RSVTestCase extends AndroidTestCase2 {
assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
- assertTrue(RouterServiceValidator.createTrustedListRequest(mContext, true, null, trustedListCallback));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getTargetContext(), true, null, trustedListCallback));
}
-
+
+ @Test
public void testMediumSecurity(){
requestTListLock();
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext); //Use a locally scoped instance
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext()); //Use a locally scoped instance
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
@@ -151,14 +168,15 @@ public class RSVTestCase extends AndroidTestCase2 {
assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
- assertTrue(RouterServiceValidator.createTrustedListRequest(mContext, true, null, trustedListCallback));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getTargetContext(), true, null, trustedListCallback));
}
-
+
+ @Test
public void testLowSecurity(){
requestTListLock();
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext); //Use a locally scoped instance
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext()); //Use a locally scoped instance
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW);
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
@@ -166,14 +184,15 @@ public class RSVTestCase extends AndroidTestCase2 {
assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_MONTH);
- assertTrue(RouterServiceValidator.createTrustedListRequest(mContext, true, null, trustedListCallback));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getTargetContext(), true, null, trustedListCallback));
}
-
+
+ @Test
public void testNoSecurity(){
requestTListLock();
- RouterServiceValidator rsvp = new RouterServiceValidator(this.mContext); //Use a locally scoped instance
+ RouterServiceValidator rsvp = new RouterServiceValidator(getTargetContext()); //Use a locally scoped instance
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
@@ -181,7 +200,7 @@ public class RSVTestCase extends AndroidTestCase2 {
assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
- assertFalse(RouterServiceValidator.createTrustedListRequest(mContext, true, null, trustedListCallback));
+ assertFalse(RouterServiceValidator.createTrustedListRequest(getTargetContext(), true, null, trustedListCallback));
//This should always return true
assertTrue(rsvp.validate());
@@ -205,54 +224,59 @@ public class RSVTestCase extends AndroidTestCase2 {
}
return false;
}
-
+
+ @Test
public void testJsonRecovery(){
assertNotNull(rsvp.stringToJson(null));
assertNotNull(rsvp.stringToJson("asdf235vq32{]]"));
}
-
+
+ @Test
public void testInvalidateList(){
requestTListLock();
assertFalse(RouterServiceValidator.invalidateList(null));
- assertTrue(RouterServiceValidator.invalidateList(mContext));
+ assertTrue(RouterServiceValidator.invalidateList(getTargetContext()));
releaseTListLock();
}
-
+
+ @Test
public void testGetTrustedList(){
requestTListLock();
assertNull(RouterServiceValidator.getTrustedList(null));
- assertNotNull(RouterServiceValidator.getTrustedList(mContext));
+ assertNotNull(RouterServiceValidator.getTrustedList(getTargetContext()));
releaseTListLock();
}
-
+
+ @Test
public void testSetTrustedList(){
requestTListLock();
assertFalse(RouterServiceValidator.setTrustedList(null,null));
- assertFalse(RouterServiceValidator.setTrustedList(mContext,null));
+ assertFalse(RouterServiceValidator.setTrustedList(getTargetContext(),null));
assertFalse(RouterServiceValidator.setTrustedList(null,"test"));
- assertTrue(RouterServiceValidator.setTrustedList(mContext,"test"));
- assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
- assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST+TEST+TEST+TEST+TEST));
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),"test"));
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),TEST));
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),TEST+TEST+TEST+TEST+TEST));
StringBuilder builder = new StringBuilder();
for(int i = 0; i<1000; i++){
builder.append(TEST);
}
- assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),builder.toString()));
releaseTListLock();
}
-
+
+ @Test
public void testTrustedListSetAndGet(){
requestTListLock();
- assertTrue(RouterServiceValidator.setTrustedList(mContext,TEST));
- String retVal = RouterServiceValidator.getTrustedList(mContext);
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),TEST));
+ String retVal = RouterServiceValidator.getTrustedList(getTargetContext());
assertNotNull(retVal);
assertTrue(TEST.equals(retVal));
@@ -260,32 +284,34 @@ public class RSVTestCase extends AndroidTestCase2 {
for(int i = 0; i<1000; i++){
builder.append(TEST);
}
- assertTrue(RouterServiceValidator.setTrustedList(mContext,builder.toString()));
- retVal = RouterServiceValidator.getTrustedList(mContext);
+ assertTrue(RouterServiceValidator.setTrustedList(getTargetContext(),builder.toString()));
+ retVal = RouterServiceValidator.getTrustedList(getTargetContext());
assertNotNull(retVal);
assertTrue(builder.toString().equals(retVal));
releaseTListLock();
}
-
+
+ @Test
public void testInvalidationSequence(){
requestTListLock();
- assertTrue(RouterServiceValidator.invalidateList(mContext));
- assertTrue(RouterServiceValidator.createTrustedListRequest(mContext, false, null, trustedListCallback));
+ assertTrue(RouterServiceValidator.invalidateList(getTargetContext()));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getTargetContext(), false, null, trustedListCallback));
}
-
+
+ @Test
public void testAppStorePackages(){
assertTrue(TrustedAppStore.isTrustedStore(TrustedAppStore.PLAY_STORE.packageString));
assertTrue(TrustedAppStore.isTrustedStore("com.xiaomi.market"));
assertFalse(TrustedAppStore.isTrustedStore("test"));
assertFalse(TrustedAppStore.isTrustedStore(null));
- rsvp = new RouterServiceValidator(this.mContext);
+ rsvp = new RouterServiceValidator(getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- PackageManager packageManager = mContext.getPackageManager();
+ PackageManager packageManager = getTargetContext().getPackageManager();
List<PackageInfo> packages = packageManager.getInstalledPackages(0);
String appStore;
for(PackageInfo info: packages){
@@ -297,9 +323,10 @@ public class RSVTestCase extends AndroidTestCase2 {
assertFalse(rsvp.wasInstalledByAppStore(null));
}
-
+
+ @Test
public void testVersionBlackList(){
- rsvp = new RouterServiceValidator(this.mContext);
+ rsvp = new RouterServiceValidator(getTargetContext());
JSONArray array = new JSONArray();
for(int i=0; i<25; i++){
if(i%3 == 0){
@@ -315,6 +342,7 @@ public class RSVTestCase extends AndroidTestCase2 {
}
static boolean didFinish = false;
+ @Test
public void testGetAndCheckList(){
requestTListLock();
@@ -343,7 +371,7 @@ public class RSVTestCase extends AndroidTestCase2 {
}
};
- assertTrue(RouterServiceValidator.createTrustedListRequest(mContext,true, cb));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getTargetContext(),true, cb));
//Now wait for call to finish
synchronized(REQUEST_LOCK){
try {
@@ -360,11 +388,12 @@ public class RSVTestCase extends AndroidTestCase2 {
/**
* Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
*/
+ @Test
public void testRequestChange(){
requestTListLock();
- RouterServiceValidator.setLastRequest(mContext, null);
- assertNull(RouterServiceValidator.getLastRequest(mContext));
+ RouterServiceValidator.setLastRequest(getTargetContext(), null);
+ assertNull(RouterServiceValidator.getLastRequest(getTargetContext()));
JSONObject object = null;
try {
@@ -373,11 +402,11 @@ public class RSVTestCase extends AndroidTestCase2 {
e.printStackTrace();
}
assertNotNull(object);
- assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
+ assertFalse(object.equals(RouterServiceValidator.getLastRequest(getTargetContext())));
- assertTrue(RouterServiceValidator.setLastRequest(mContext, object.toString()));
+ assertTrue(RouterServiceValidator.setLastRequest(getTargetContext(), object.toString()));
- String oldRequest = RouterServiceValidator.getLastRequest(mContext);
+ String oldRequest = RouterServiceValidator.getLastRequest(getTargetContext());
assertNotNull(oldRequest);
assertTrue(object.toString().equals(oldRequest));
@@ -390,9 +419,9 @@ public class RSVTestCase extends AndroidTestCase2 {
e.printStackTrace();
}
assertNotNull(object);
- assertFalse(object.equals(RouterServiceValidator.getLastRequest(mContext)));
+ assertFalse(object.equals(RouterServiceValidator.getLastRequest(getTargetContext())));
//Clear it for next test
- RouterServiceValidator.setLastRequest(mContext, null);
+ RouterServiceValidator.setLastRequest(getTargetContext(), null);
releaseTListLock();
}
@@ -401,6 +430,7 @@ public class RSVTestCase extends AndroidTestCase2 {
* Test app's router validation. Validation should fail when the given context and ComponentName object are from different packages and security setting is not OFF
* and app is not on trusted list. Validation should pass when the given context and ComponentName object are from the same package.
*/
+ @Test
public void testAppSelfValidation() {
class RouterServiceValidatorTest extends RouterServiceValidator{
@@ -419,12 +449,12 @@ public class RSVTestCase extends AndroidTestCase2 {
}
// Fail, different package name for context and service and app security setting is not OFF and app is not on trusted list
- RouterServiceValidatorTest rsvpFail = new RouterServiceValidatorTest(this.mContext, new ComponentName("anything", mContext.getClass().getSimpleName()));
+ RouterServiceValidatorTest rsvpFail = new RouterServiceValidatorTest(getTargetContext(), new ComponentName("anything", getTargetContext().getClass().getSimpleName()));
rsvpFail.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
assertFalse(rsvpFail.validate());
// Success, same package name for context and service
- RouterServiceValidatorTest rsvpPass = new RouterServiceValidatorTest(this.mContext, new ComponentName(mContext.getPackageName(), mContext.getClass().getSimpleName()));
+ RouterServiceValidatorTest rsvpPass = new RouterServiceValidatorTest(getTargetContext(), new ComponentName(getTargetContext().getPackageName(), getTargetContext().getClass().getSimpleName()));
rsvpPass.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
assertTrue(rsvpPass.validate());
}
@@ -432,8 +462,9 @@ public class RSVTestCase extends AndroidTestCase2 {
/**
* Unit test for validateAsync.
*/
+ @Test
public void testValidateAsync() {
- final MultiplexTransportConfig config = new MultiplexTransportConfig(mContext, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ final MultiplexTransportConfig config = new MultiplexTransportConfig(getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
final RouterServiceValidator validator = new RouterServiceValidator(config);
final ConditionVariable cond = new ConditionVariable();
validator.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
@@ -447,7 +478,7 @@ public class RSVTestCase extends AndroidTestCase2 {
cond.block();
// next, test for FLAG_MULTI_SECURITY_OFF
- final MultiplexTransportConfig config2 = new MultiplexTransportConfig(mContext, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+ final MultiplexTransportConfig config2 = new MultiplexTransportConfig(getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
final RouterServiceValidator validator2 = new RouterServiceValidator(config2);
cond.close();
validator2.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
index 89dbae3ab..2cf70d1be 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
@@ -2,20 +2,26 @@ package com.smartdevicelink.transport;
import android.os.Looper;
import android.os.Messenger;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
/**
* Created by brettywhite on 4/4/17.
*/
-
-public class RegisteredAppTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class RegisteredAppTests {
private static final String APP_ID = "123451123";
private static final Messenger messenger = null;
private static byte[] bytes = new byte[1];
+ @Test
public void testHandleMessage() {
if (Looper.myLooper() == null) {
@@ -35,6 +41,7 @@ public class RegisteredAppTests extends AndroidTestCase2 {
}
+ @Test
public void testNullBuffer() {
if (Looper.myLooper() == null) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
index e01fdbaf2..5995b457f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
@@ -5,11 +5,11 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseIntArray;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.BinaryFrameHeader;
import com.smartdevicelink.protocol.ProtocolMessage;
@@ -25,6 +25,8 @@ import com.smartdevicelink.transport.utl.TransportRecord;
import junit.framework.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import java.lang.ref.WeakReference;
@@ -36,6 +38,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Vector;
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -44,7 +48,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-public class SdlRouterServiceTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class SdlRouterServiceTests {
public static final String TAG = "SdlRouterServiceTests";
private final int SAMPLE_RPC_CORRELATION_ID = 630;
@@ -53,21 +58,11 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
ProtocolMessage pm = null;
BinaryFrameHeader binFrameHeader = null;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- //Nothing here for now
- }
-
/**
* Ensure that the router service hardcoded number is the same as the integer value in
* the resources.
*/
+ @Test
public void testVersionCorrectness(){
int resourceVersion = getContext().getResources().getInteger(com.smartdevicelink.test.R.integer.sdl_router_service_version_value);
assertEquals(resourceVersion, SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER);
@@ -77,6 +72,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
* Test null bundle handling in AltTransportHandler when handling messages. Only test the case of
* msg.what == TransportConstants.ROUTER_RECEIVED_PACKET
*/
+ @Test
public void testAlTransportHandlerHandleNullBundle() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -134,6 +130,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
*
* @see SdlRouterService#writeBytesToTransport(Bundle)
*/
+ @Test
public void testWriteBytesToTransport() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -178,6 +175,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
*
* @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
*/
+ @Test
public void testRegisterAppExistingSessionIDDifferentApp() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -270,6 +268,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
*
* @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
*/
+ @Test
public void testRegisterAppExistingSessionIDSameApp() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -360,6 +359,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
/**
* Test router service correctly picks up Hash ID from start service ACK (prior to V5)
*/
+ @Test
public void testStartSessionAckHashId() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -398,6 +398,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
/**
* Test router service correctly acquires Hash ID from V5 start service ACK
*/
+ @Test
public void testStartSessionAckV5HashId() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -439,6 +440,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
/**
* Test router service sends a valid end service request from attemptToCleanupModule()
*/
+ @Test
public void testEndSessionV5FromAttemptToCleanupModule() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -506,6 +508,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
* Test router service sends a valid end service request when it receives a packet from Core
* and the app has been unregistered
*/
+ @Test
public void testEndSessionV5WhenPacketForUnregisteredAppReceived() {
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -584,6 +587,7 @@ public class SdlRouterServiceTests extends AndroidTestCase2 {
* Test router service sends a valid end service request when it fails to deliver a message
* to an app
*/
+ @Test
public void testEndSessionV5WhenSendMessageToClientFailed() {
if (Looper.myLooper() == null) {
Looper.prepare();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
index ac97857ad..d74501313 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
@@ -5,19 +5,28 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.test.util.DeviceUtil;
-public class TransportBrokerTest extends AndroidTestCase2 {
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public class TransportBrokerTest {
RouterServiceValidator rsvp;
// public TransportBrokerThread(Context context, String appId, ComponentName service){
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- rsvp = new RouterServiceValidator(this.mContext);
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getTargetContext());
rsvp.validate();
}
@@ -27,25 +36,27 @@ public class TransportBrokerTest extends AndroidTestCase2 {
Thread.sleep(500);
}catch(Exception e){}
}
-
+
+ @Test
public void testStart(){
if (Looper.myLooper() == null) {
Looper.prepare();
}
- TransportBroker broker = new TransportBroker(mContext, SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
+ TransportBroker broker = new TransportBroker(getTargetContext(), SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
assertTrue(broker.start());
}
broker.stop();
}
-
+
+ @Test
public void testSendPacket(){
if (Looper.myLooper() == null) {
Looper.prepare();
}
- TransportBroker broker = new TransportBroker(mContext, SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
+ TransportBroker broker = new TransportBroker(getTargetContext(), SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
assertTrue(broker.start());
@@ -73,24 +84,26 @@ public class TransportBrokerTest extends AndroidTestCase2 {
broker.stop();
}
-
+
+ @Test
public void testOnPacketReceived(){
if (Looper.myLooper() == null) {
Looper.prepare();
}
- TransportBroker broker = new TransportBroker(mContext, SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+ TransportBroker broker = new TransportBroker(getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
assertTrue(broker.start());
}
}
-
+
+ @Test
public void testSendMessageToRouterService(){
if (Looper.myLooper() == null) {
Looper.prepare();
}
- TransportBroker broker = new TransportBroker(mContext, SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+ TransportBroker broker = new TransportBroker(getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
Handler handler = new Handler();
Message message = new Message();
broker.routerServiceMessenger = null;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
index b73460c72..454a32633 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
@@ -2,8 +2,8 @@ package com.smartdevicelink.transport;
import android.content.ComponentName;
import android.os.Looper;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.SdlPacketFactory;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -11,10 +11,22 @@ import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.TransportRecord;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.Collections;
import java.util.List;
-public class TransportManagerTests extends AndroidTestCase2 {
+import static android.support.test.InstrumentationRegistry.getContext;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+
+@RunWith(AndroidJUnit4.class)
+public class TransportManagerTests {
MultiplexTransportConfig config;
final TransportRecord defaultBtRecord = new TransportRecord(TransportType.BLUETOOTH, "12:34:56:78:90");
@@ -36,9 +48,9 @@ public class TransportManagerTests extends AndroidTestCase2 {
};
- @Override
- protected void setUp() throws Exception {
- config = new MultiplexTransportConfig(this.mContext, SdlUnitTestContants.TEST_APP_ID);
+ @Before
+ public void setUp() throws Exception {
+ config = new MultiplexTransportConfig(getContext(), SdlUnitTestContants.TEST_APP_ID);
config.setService(routerServiceComponentName);
if (Looper.myLooper() == null) {
Looper.prepare();
@@ -54,18 +66,20 @@ public class TransportManagerTests extends AndroidTestCase2 {
assertNull(manager.legacyBluetoothHandler);
manager.exitLegacyMode("Test");
- manager.transport = manager.new TransportBrokerImpl(mContext, config.appId, routerServiceComponentName);
+ manager.transport = manager.new TransportBrokerImpl(getContext(), config.appId, routerServiceComponentName);
manager.start();
assert true;
return manager;
}
+ @Test
public void testBase(){
TransportManager manager = new TransportManager(config,defaultListener);
assertNotNull(manager);
}
+ @Test
public void testConnectionStatus(){
TransportManager manager = new TransportManager(config,defaultListener);
@@ -91,6 +105,7 @@ public class TransportManagerTests extends AndroidTestCase2 {
}
+ @Test
public void testOnTransportConnections(){
TransportManager manager = createTransportManager();
@@ -112,6 +127,7 @@ public class TransportManagerTests extends AndroidTestCase2 {
}
+ @Test
public void testOnPacket(){
TransportManager manager = createTransportManager();
assertNotNull(manager.transportListener);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
index 471bc19f0..9a204df9b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
@@ -4,25 +4,34 @@ import android.content.Context;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.os.Build;
+import android.support.test.runner.AndroidJUnit4;
-import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.Vector;
+import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertNotNull;
+import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
-public class MediaStreamingStatusTests extends AndroidTestCase2 {
+@RunWith(AndroidJUnit4.class)
+public class MediaStreamingStatusTests {
@@ -48,7 +57,7 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
};
- @Override
+ @Before
public void setUp() throws Exception{
mockedContext = mock(Context.class);
doAnswer(onGetSystemService).when(mockedContext).getSystemService(Context.AUDIO_SERVICE);
@@ -56,6 +65,7 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
}
+ @Test
public void testEmptyAudioDeviceInfoList(){
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
assertNotNull(mockedContext);
@@ -77,6 +87,7 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
}
}
+ @Test
public void testNullAudioDeviceInfoList(){
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
assertNotNull(mockedContext);
@@ -93,12 +104,13 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
}
+ @Test
public void testSdlManagerMedia(){
- SdlManager.Builder builder = new SdlManager.Builder(getContext(), Test.GENERAL_FULL_APP_ID, Test.GENERAL_STRING, mock(SdlManagerListener.class));
+ SdlManager.Builder builder = new SdlManager.Builder(getTargetContext(), TestValues.GENERAL_FULL_APP_ID, TestValues.GENERAL_STRING, mock(SdlManagerListener.class));
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.MEDIA);
builder.setAppTypes(appType);
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(getContext(),Test.GENERAL_FULL_APP_ID);
+ MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(getTargetContext(), TestValues.GENERAL_FULL_APP_ID);
assertNull(multiplexTransportConfig.requiresAudioSupport());
builder.setTransportType(multiplexTransportConfig);
@@ -110,12 +122,13 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
assertTrue(multiplexTransportConfig.requiresAudioSupport());
}
+ @Test
public void testSdlManagerNonMedia(){
- SdlManager.Builder builder = new SdlManager.Builder(getContext(), Test.GENERAL_FULL_APP_ID, Test.GENERAL_STRING, mock(SdlManagerListener.class));
+ SdlManager.Builder builder = new SdlManager.Builder(getTargetContext(), TestValues.GENERAL_FULL_APP_ID, TestValues.GENERAL_STRING, mock(SdlManagerListener.class));
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.DEFAULT);
builder.setAppTypes(appType);
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(getContext(),Test.GENERAL_FULL_APP_ID);
+ MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(getTargetContext(), TestValues.GENERAL_FULL_APP_ID);
assertNull(multiplexTransportConfig.requiresAudioSupport());
builder.setTransportType(multiplexTransportConfig);
@@ -127,8 +140,9 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
assertFalse(multiplexTransportConfig.requiresAudioSupport());
}
+ @Test
public void testAcceptedBTDevices(){
- MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getContext(), mock(MediaStreamingStatus.Callback.class)));
+ MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getTargetContext(), mock(MediaStreamingStatus.Callback.class)));
doAnswer(new Answer() {
@Override
@@ -141,8 +155,9 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
assertTrue(mediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_BLUETOOTH_A2DP));
}
+ @Test
public void testAcceptedUSBDevices(){
- MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getContext(), mock(MediaStreamingStatus.Callback.class)));
+ MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getTargetContext(), mock(MediaStreamingStatus.Callback.class)));
doAnswer(new Answer() {
@Override
@@ -158,6 +173,7 @@ public class MediaStreamingStatusTests extends AndroidTestCase2 {
assertTrue(mediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_DOCK));
}
+ @Test
public void testAcceptedLineDevices(){
assertTrue(defaultMediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_LINE_ANALOG));
assertTrue(defaultMediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_LINE_DIGITAL));
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
index f5265ccf0..cdba04757 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -1,39 +1,38 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.SdlConnection;
import android.content.ComponentName;
-import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.AbstractProtocol;
@@ -56,6 +55,7 @@ import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.USBTransport;
import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -127,10 +127,10 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
//rsvp = new RouterServiceValidator(((MultiplexTransportConfig)transportConfig).getContext());
//vlad.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
if(rsvp.validate()){
- Log.w(TAG, "SDL Router service is valid; attempting to connect");
+ DebugTool.logWarning(TAG, "SDL Router service is valid; attempting to connect");
((MultiplexTransportConfig)transportConfig).setService(rsvp.getService());//Let thes the transport broker know which service to connect to
}else{
- Log.w(TAG, "SDL Router service isn't trusted. Enabling legacy bluetooth connection.");
+ DebugTool.logWarning(TAG, "SDL Router service isn't trusted. Enabling legacy bluetooth connection.");
if(cachedMultiConfig == null){
cachedMultiConfig = (MultiplexTransportConfig) transportConfig;
cachedMultiConfig.setService(null);
@@ -573,7 +573,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
public void forceHardwareConnectEvent(TransportType type){
if(_transport == null){
- Log.w(TAG, "Unable to force connect, transport was null!");
+ DebugTool.logWarning(TAG, "Unable to force connect, transport was null!");
return;
}
if(isLegacyModeEnabled()){//We know we should no longer be in legacy mode for future connections, so lets clear out that flag
@@ -594,7 +594,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
}
}else if(tempCompName!=null){
//We have a conflicting service request
- Log.w(TAG, "Conflicting services. Disconnecting from current and connecting to new");
+ DebugTool.logWarning(TAG, "Conflicting services. Disconnecting from current and connecting to new");
//Log.w(TAG, "Old service " + config.getService().toShortString());
//Log.w(TAG, "New Serivce " + tempCompName.toString());
multi.disconnect();
@@ -626,9 +626,9 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
//_transport.disconnect();
return;
}
- Log.w(TAG, "Using own transport, but not connected. Attempting to join multiplexing");
+ DebugTool.logWarning(TAG, "Using own transport, but not connected. Attempting to join multiplexing");
}else{
- Log.w(TAG, "Currently in legacy mode connected to own transport service. Nothing will take place on trnasport cycle");
+ DebugTool.logWarning(TAG, "Currently in legacy mode connected to own transport service. Nothing will take place on trnasport cycle");
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 7b6f67e6b..86488cca0 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -33,7 +33,6 @@ package com.smartdevicelink.SdlConnection;
import android.annotation.SuppressLint;
import android.os.Build;
-import android.util.Log;
import android.view.Surface;
import com.smartdevicelink.encoder.SdlEncoder;
@@ -61,6 +60,7 @@ import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransport;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
import java.io.IOException;
@@ -264,7 +264,7 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
return packetizer;
}
default:
- Log.e(TAG, "Protocol " + protocol + " is not supported.");
+ DebugTool.logError(TAG, "Protocol " + protocol + " is not supported.");
return null;
}
} catch (IOException e) {
@@ -291,7 +291,7 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0, this);
mRPCPacketizer.start();
} catch (Exception e) {
- Log.e(TAG, "Unable to start streaming:" + e.toString());
+ DebugTool.logError(TAG, "Unable to start streaming:" + e.toString());
}
}
@@ -304,7 +304,7 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
mRPCPacketizer.start();
return os;
} catch (Exception e) {
- Log.e(TAG, "Unable to start streaming:" + e.toString());
+ DebugTool.logError(TAG, "Unable to start streaming:" + e.toString());
}
return null;
}
@@ -638,7 +638,7 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
@Override
public void sendHeartbeat(IHeartbeatMonitor monitor) {
- Log.d(TAG, "Asked to send heartbeat");
+ DebugTool.logInfo(TAG, "Asked to send heartbeat");
if (_sdlConnection != null)
_sdlConnection.sendHeartbeat(this);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
index 14258cbfe..44bb1fbfc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
@@ -33,7 +33,6 @@
package com.smartdevicelink.SdlConnection;
import android.content.Context;
-import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.ISdlProtocol;
@@ -47,6 +46,7 @@ import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.MediaStreamingStatus;
import com.smartdevicelink.util.Version;
@@ -210,7 +210,7 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
public void shutdown(String info){
- Log.d(TAG, "Shutdown - " + info);
+ DebugTool.logInfo(TAG, "Shutdown - " + info);
if(mediaStreamingStatus != null) {
mediaStreamingStatus.clear();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
index 362564da8..8f3001294 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
@@ -33,7 +33,8 @@ package com.smartdevicelink.encoder;
import android.annotation.TargetApi;
import android.media.MediaFormat;
import android.os.Build;
-import android.util.Log;
+
+import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
@@ -63,7 +64,7 @@ public final class EncoderUtils {
if (name.equals("video/avc")) {
return getAVCCodecSpecificData(format);
} else {
- Log.w(TAG, "Retrieving codec-specific data for " + name + " is not supported");
+ DebugTool.logWarning(TAG, "Retrieving codec-specific data for " + name + " is not supported");
return null;
}
}
@@ -81,7 +82,7 @@ public final class EncoderUtils {
// For H.264, "csd-0" contains SPS and "csd-1" contains PPS. Refer to the documentation
// of MediaCodec.
if (!(format.containsKey("csd-0") && format.containsKey("csd-1"))) {
- Log.w(TAG, "H264 codec specific data not found");
+ DebugTool.logWarning(TAG, "H264 codec specific data not found");
return null;
}
@@ -96,7 +97,7 @@ public final class EncoderUtils {
pps.get(output, spsLen, ppsLen);
} catch (Exception e) {
// should not happen
- Log.w(TAG, "Error while copying H264 codec specific data: " + e);
+ DebugTool.logWarning(TAG, "Error while copying H264 codec specific data: " + e);
return null;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
index dafb3207c..7172b0225 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
@@ -36,10 +36,10 @@ import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
-import android.util.Log;
import android.view.Surface;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.io.PipedOutputStream;
@@ -198,7 +198,7 @@ public class SdlEncoder {
MediaFormat format = mEncoder.getOutputFormat();
mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
} else {
- Log.w(TAG, "Output format change notified more than once, ignoring.");
+ DebugTool.logWarning(TAG, "Output format change notified more than once, ignoring.");
}
} else if (encoderStatus < 0) {
} else {
@@ -208,7 +208,7 @@ public class SdlEncoder {
if (mH264CodecSpecificData != null) {
mBufferInfo.size = 0;
} else {
- Log.i(TAG, "H264 codec specific data not retrieved yet.");
+ DebugTool.logInfo(TAG, "H264 codec specific data not retrieved yet.");
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
index 6b7f2a686..766e10aaa 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
@@ -40,7 +40,6 @@ import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
-import android.util.Log;
import android.view.Display;
import android.view.Surface;
@@ -49,6 +48,7 @@ import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
@@ -83,12 +83,12 @@ public class VirtualDisplayEncoder {
*/
public void init(Context context, IVideoStreamListener outputListener, VideoStreamingParameters streamingParams) throws Exception {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
- Log.e(TAG, "API level of 19 required for VirtualDisplayEncoder");
+ DebugTool.logError(TAG, "API level of 19 required for VirtualDisplayEncoder");
throw new Exception("API level of 19 required");
}
if (context == null || outputListener == null || streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
- Log.e(TAG, "init parameters cannot be null for VirtualDisplayEncoder");
+ DebugTool.logError(TAG, "init parameters cannot be null for VirtualDisplayEncoder");
throw new Exception("init parameters cannot be null");
}
@@ -122,7 +122,7 @@ public class VirtualDisplayEncoder {
*/
public void start() throws Exception {
if (!initPassed) {
- Log.e(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
+ DebugTool.logError(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
return;
}
if (streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
@@ -142,7 +142,7 @@ public class VirtualDisplayEncoder {
startEncoder();
} catch (Exception ex) {
- Log.e(TAG, "Unable to create Virtual Display.");
+ DebugTool.logError(TAG, "Unable to create Virtual Display.");
throw new RuntimeException(ex);
}
}
@@ -150,7 +150,7 @@ public class VirtualDisplayEncoder {
public void shutDown() {
if (!initPassed) {
- Log.e(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
+ DebugTool.logError(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
return;
}
try {
@@ -175,7 +175,7 @@ public class VirtualDisplayEncoder {
inputSurface = null;
}
} catch (Exception ex) {
- Log.e(TAG, "shutDown() failed");
+ DebugTool.logError(TAG, "shutDown() failed");
}
}
@@ -266,7 +266,7 @@ public class VirtualDisplayEncoder {
encoderThread = new Thread(new EncoderCompat());
} else {
- Log.e(TAG, "Unable to start encoder. Android OS version " + Build.VERSION.SDK_INT + "is not supported");
+ DebugTool.logError(TAG, "Unable to start encoder. Android OS version " + Build.VERSION.SDK_INT + "is not supported");
}
return surface;
@@ -315,7 +315,7 @@ public class VirtualDisplayEncoder {
try {
drainEncoder(false);
} catch (Exception e) {
- Log.w(TAG, "Error attempting to drain encoder");
+ DebugTool.logWarning(TAG, "Error attempting to drain encoder");
} finally {
mVideoEncoder.release();
}
@@ -349,7 +349,7 @@ public class VirtualDisplayEncoder {
MediaFormat format = mVideoEncoder.getOutputFormat();
mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
} else {
- Log.w(TAG, "Output format change notified more than once, ignoring.");
+ DebugTool.logWarning(TAG, "Output format change notified more than once, ignoring.");
}
}
} else {
@@ -359,7 +359,7 @@ public class VirtualDisplayEncoder {
if (mH264CodecSpecificData != null) {
mVideoBufferInfo.size = 0;
} else {
- Log.i(TAG, "H264 codec specific data not retrieved yet.");
+ DebugTool.logInfo(TAG, "H264 codec specific data not retrieved yet.");
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index b5a817df8..06b9abd7b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -39,1214 +39,340 @@ import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.util.Log;
-import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.audio.AudioStreamManager;
import com.smartdevicelink.managers.file.FileManager;
-import com.smartdevicelink.managers.file.FileManagerConfig;
-import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
-import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.managers.lockscreen.LockScreenManager;
import com.smartdevicelink.managers.permission.PermissionManager;
import com.smartdevicelink.managers.screen.ScreenManager;
import com.smartdevicelink.managers.video.VideoStreamManager;
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.RPCMessage;
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SdlProxyBase;
-import com.smartdevicelink.proxy.SystemCapabilityManager;
-import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
-import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
-import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
-import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
-import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
-import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.ChangeRegistration;
-import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SetAppIcon;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
-import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
-import com.smartdevicelink.streaming.audio.AudioStreamingParams;
-import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.TransportRecord;
import com.smartdevicelink.util.DebugTool;
-import com.smartdevicelink.util.Version;
-import org.json.JSONException;
-
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Vector;
/**
* <strong>SDLManager</strong> <br>
- *
+ * <p>
* This is the main point of contact between an application and SDL <br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. SDLManagerBuilder <br>
* 2. ISdl Interface along with its overridden methods - This can be passed into attached managers <br>
* 3. Sending Requests <br>
* 4. Helper methods
*/
-public class SdlManager extends BaseSdlManager{
- private static final String TAG = "SdlManager";
- private SdlProxyBase proxy;
- private SdlArtwork appIcon;
- private Context context;
- private SdlManagerListener managerListener;
- private List<Class<? extends SdlSecurityBase>> sdlSecList;
- private LockScreenConfig lockScreenConfig;
- private FileManagerConfig fileManagerConfig;
- private ServiceEncryptionListener serviceEncryptionListener;
-
- // Managers
- private PermissionManager permissionManager;
- private FileManager fileManager;
- private LockScreenManager lockScreenManager;
- private ScreenManager screenManager;
- private VideoStreamManager videoStreamManager;
- private AudioStreamManager audioStreamManager;
-
-
- // Initialize proxyBridge with anonymous lifecycleListener
- private final ProxyBridge proxyBridge = new ProxyBridge(new ProxyBridge.LifecycleListener() {
- @Override
- public void onProxyConnected() {
- DebugTool.logInfo("Proxy is connected. Now initializing.");
- changeRegistrationRetry = 0;
- checkLifecycleConfiguration();
- initialize();
- }
-
- @Override
- public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason){
- if (!reason.equals(SdlDisconnectedReason.LANGUAGE_CHANGE)){
- dispose();
- }
- }
-
- @Override
- public void onServiceEnded(OnServiceEnded serviceEnded){
-
- }
-
- @Override
- public void onServiceNACKed(OnServiceNACKed serviceNACKed){
-
- }
-
- @Override
- public void onError(String info, Exception e){
-
- }
- });
-
- // Sub manager listener
- private final CompletionListener subManagerListener = new CompletionListener() {
- @Override
- public synchronized void onComplete(boolean success) {
- if(!success){
- Log.e(TAG, "Sub manager failed to initialize");
- }
- checkState();
- }
- };
-
- @Override
- void checkState() {
- if (permissionManager != null && fileManager != null && screenManager != null && (!lockScreenConfig.isEnabled() || lockScreenManager != null)) {
- if (permissionManager.getState() == BaseSubManager.READY && fileManager.getState() == BaseSubManager.READY && screenManager.getState() == BaseSubManager.READY && (!lockScreenConfig.isEnabled() || lockScreenManager.getState() == BaseSubManager.READY)) {
- DebugTool.logInfo("Starting sdl manager, all sub managers are in ready state");
- transitionToState(BaseSubManager.READY);
- handleQueuedNotifications();
- notifyDevListener(null);
- onReady();
- } else if (permissionManager.getState() == BaseSubManager.ERROR && fileManager.getState() == BaseSubManager.ERROR && screenManager.getState() == BaseSubManager.ERROR && (!lockScreenConfig.isEnabled() || lockScreenManager.getState() == BaseSubManager.ERROR)) {
- String info = "ERROR starting sdl manager, all sub managers are in error state";
- Log.e(TAG, info);
- transitionToState(BaseSubManager.ERROR);
- notifyDevListener(info);
- } else if (permissionManager.getState() == BaseSubManager.SETTING_UP || fileManager.getState() == BaseSubManager.SETTING_UP || screenManager.getState() == BaseSubManager.SETTING_UP || (lockScreenConfig.isEnabled() && lockScreenManager != null && lockScreenManager.getState() == BaseSubManager.SETTING_UP)) {
- DebugTool.logInfo("SETTING UP sdl manager, some sub managers are still setting up");
- transitionToState(BaseSubManager.SETTING_UP);
- // No need to notify developer here!
- } else {
- Log.w(TAG, "LIMITED starting sdl manager, some sub managers are in error or limited state and the others finished setting up");
- transitionToState(BaseSubManager.LIMITED);
- handleQueuedNotifications();
- notifyDevListener(null);
- onReady();
- }
- } else {
- // We should never be here, but somehow one of the sub-sub managers is null
- String info = "ERROR one of the sdl sub managers is null";
- Log.e(TAG, info);
- transitionToState(BaseSubManager.ERROR);
- notifyDevListener(info);
- }
- }
-
- private void notifyDevListener(String info) {
- if (managerListener != null) {
- if (getState() == BaseSubManager.ERROR){
- managerListener.onError(info, null);
- } else {
- managerListener.onStart();
- }
- }
- }
-
- private void onReady(){
- // Set the app icon
- if (SdlManager.this.appIcon != null && SdlManager.this.appIcon.getName() != null) {
- if (fileManager != null && fileManager.getState() == BaseSubManager.READY && !fileManager.hasUploadedFile(SdlManager.this.appIcon)) {
- fileManager.uploadArtwork(SdlManager.this.appIcon, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (success) {
- SetAppIcon msg = new SetAppIcon(SdlManager.this.appIcon.getName());
- _internalInterface.sendRPCRequest(msg);
- }
- }
- });
- } else {
- SetAppIcon msg = new SetAppIcon(SdlManager.this.appIcon.getName());
- _internalInterface.sendRPCRequest(msg);
- }
- }
- }
+public class SdlManager extends BaseSdlManager {
+ private Context context;
+ private LockScreenConfig lockScreenConfig;
- @Override
- protected void checkLifecycleConfiguration(){
- final Language actualLanguage = this.getRegisterAppInterfaceResponse().getLanguage();
+ // Managers
+ private LockScreenManager lockScreenManager;
+ private VideoStreamManager videoStreamManager;
+ private AudioStreamManager audioStreamManager;
- if (actualLanguage != null && !actualLanguage.equals(hmiLanguage)) {
-
- final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
-
- if (lcu != null) {
- ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
- changeRegistration.setAppName(lcu.getAppName());
- changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
- changeRegistration.setTtsName(lcu.getTtsName());
- changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
- changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()){
- // go through and change sdlManager properties that were changed via the LCU update
- hmiLanguage = actualLanguage;
-
- if (lcu.getAppName() != null) {
- appName = lcu.getAppName();
- }
-
- if (lcu.getShortAppName() != null) {
- shortAppName = lcu.getShortAppName();
- }
-
- if (lcu.getTtsName() != null) {
- ttsChunks = lcu.getTtsName();
- }
-
- if (lcu.getVoiceRecognitionCommandNames() != null) {
- vrSynonyms = lcu.getVoiceRecognitionCommandNames();
- }
- }
- try {
- DebugTool.logInfo(response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Change Registration onError: " + resultCode + " | Info: " + info);
- changeRegistrationRetry++;
- if (changeRegistrationRetry < MAX_RETRY) {
- final Handler handler = new Handler(Looper.getMainLooper());
- handler.postDelayed(new Runnable() {
- @Override
- public void run() {
- checkLifecycleConfiguration();
- DebugTool.logInfo("Retry Change Registration Count: " + changeRegistrationRetry);
- }
- }, 3000);
- }
- }
- });
- this.sendRPC(changeRegistration);
- }
- }
- }
-
- @Override
- protected void initialize(){
- // Instantiate sub managers
- this.permissionManager = new PermissionManager(_internalInterface);
- this.fileManager = new FileManager(_internalInterface, context, fileManagerConfig);
- if (lockScreenConfig.isEnabled()) {
- this.lockScreenManager = new LockScreenManager(lockScreenConfig, context, _internalInterface);
- }
- this.screenManager = new ScreenManager(_internalInterface, this.fileManager);
- if(getAppTypes().contains(AppHMIType.NAVIGATION) || getAppTypes().contains(AppHMIType.PROJECTION)){
- this.videoStreamManager = new VideoStreamManager(_internalInterface);
- } else {
- this.videoStreamManager = null;
- }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
- && (getAppTypes().contains(AppHMIType.NAVIGATION) || getAppTypes().contains(AppHMIType.PROJECTION)) ) {
- this.audioStreamManager = new AudioStreamManager(_internalInterface, context);
- } else {
- this.audioStreamManager = null;
- }
-
- // Start sub managers
- this.permissionManager.start(subManagerListener);
- this.fileManager.start(subManagerListener);
- if (lockScreenConfig.isEnabled()){
- this.lockScreenManager.start(subManagerListener);
- }
- this.screenManager.start(subManagerListener);
- }
-
- /** Dispose SdlManager and clean its resources
- * <strong>Note: new instance of SdlManager should be created on every connection. SdlManager cannot be reused after getting disposed.</strong>
- */
- @SuppressLint("NewApi")
- @Override
- public void dispose() {
- if (this.permissionManager != null) {
- this.permissionManager.dispose();
- }
-
- if (this.fileManager != null) {
- this.fileManager.dispose();
- }
+ /**
+ * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up
+ */
+ @Override
+ public void start() {
+ if (lifecycleManager == null) {
+ if (transport != null && transport.getTransportType() == TransportType.MULTIPLEX) {
+ //Do the thing
+ MultiplexTransportConfig multiplexTransportConfig = (MultiplexTransportConfig) (transport);
+ final MultiplexTransportConfig.TransportListener devListener = multiplexTransportConfig.getTransportListener();
+ multiplexTransportConfig.setTransportListener(new MultiplexTransportConfig.TransportListener() {
+ @Override
+ public void onTransportEvent(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
+
+ //Pass to submanagers that need it
+ if (videoStreamManager != null) {
+ videoStreamManager.handleTransportUpdated(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
+ }
+
+ if (audioStreamManager != null) {
+ audioStreamManager.handleTransportUpdated(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
+ }
+ //If the developer supplied a listener to start, it is time to call that
+ if (devListener != null) {
+ devListener.onTransportEvent(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
+ }
+ }
+ });
+
+ //If the requires audio support has not been set, it should be set to true if the
+ //app is a media app, and false otherwise
+ if (multiplexTransportConfig.requiresAudioSupport() == null) {
+ multiplexTransportConfig.setRequiresAudioSupport(isMediaApp);
+ }
+ }
+
+ super.start();
+
+ lifecycleManager.setContext(context);
+ lifecycleManager.start();
+ }
+ }
+
+ @Override
+ protected void initialize() {
+ // Instantiate sub managers
+ this.permissionManager = new PermissionManager(_internalInterface);
+ this.fileManager = new FileManager(_internalInterface, context, fileManagerConfig);
+ if (lockScreenConfig.isEnabled()) {
+ this.lockScreenManager = new LockScreenManager(lockScreenConfig, context, _internalInterface);
+ }
+ this.screenManager = new ScreenManager(_internalInterface, this.fileManager);
+ if (getAppTypes().contains(AppHMIType.NAVIGATION) || getAppTypes().contains(AppHMIType.PROJECTION)) {
+ this.videoStreamManager = new VideoStreamManager(_internalInterface);
+ } else {
+ this.videoStreamManager = null;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
+ && (getAppTypes().contains(AppHMIType.NAVIGATION) || getAppTypes().contains(AppHMIType.PROJECTION))) {
+ this.audioStreamManager = new AudioStreamManager(_internalInterface, context);
+ } else {
+ this.audioStreamManager = null;
+ }
+
+ // Start sub managers
+ this.permissionManager.start(subManagerListener);
+ this.fileManager.start(subManagerListener);
+ if (lockScreenConfig.isEnabled()) {
+ this.lockScreenManager.start(subManagerListener);
+ }
+ this.screenManager.start(subManagerListener);
+ }
+
+ @Override
+ void checkState() {
+ if (permissionManager != null && fileManager != null && screenManager != null && (!lockScreenConfig.isEnabled() || lockScreenManager != null)) {
+ if (permissionManager.getState() == BaseSubManager.READY && fileManager.getState() == BaseSubManager.READY && screenManager.getState() == BaseSubManager.READY && (!lockScreenConfig.isEnabled() || lockScreenManager.getState() == BaseSubManager.READY)) {
+ DebugTool.logInfo(TAG, "Starting sdl manager, all sub managers are in ready state");
+ transitionToState(BaseSubManager.READY);
+ handleQueuedNotifications();
+ notifyDevListener(null);
+ onReady();
+ } else if (permissionManager.getState() == BaseSubManager.ERROR && fileManager.getState() == BaseSubManager.ERROR && screenManager.getState() == BaseSubManager.ERROR && (!lockScreenConfig.isEnabled() || lockScreenManager.getState() == BaseSubManager.ERROR)) {
+ String info = "ERROR starting sdl manager, all sub managers are in error state";
+ DebugTool.logError(TAG, info);
+ transitionToState(BaseSubManager.ERROR);
+ notifyDevListener(info);
+ } else if (permissionManager.getState() == BaseSubManager.SETTING_UP || fileManager.getState() == BaseSubManager.SETTING_UP || screenManager.getState() == BaseSubManager.SETTING_UP || (lockScreenConfig.isEnabled() && lockScreenManager != null && lockScreenManager.getState() == BaseSubManager.SETTING_UP)) {
+ DebugTool.logInfo(TAG, "SETTING UP sdl manager, some sub managers are still setting up");
+ transitionToState(BaseSubManager.SETTING_UP);
+ // No need to notify developer here!
+ } else {
+ DebugTool.logWarning(TAG, "LIMITED starting sdl manager, some sub managers are in error or limited state and the others finished setting up");
+ transitionToState(BaseSubManager.LIMITED);
+ handleQueuedNotifications();
+ notifyDevListener(null);
+ onReady();
+ }
+ } else {
+ // We should never be here, but somehow one of the sub-sub managers is null
+ String info = "ERROR one of the sdl sub managers is null";
+ DebugTool.logError(TAG, info);
+ transitionToState(BaseSubManager.ERROR);
+ notifyDevListener(info);
+ }
+ }
+
+ private void notifyDevListener(String info) {
+ if (managerListener != null) {
+ if (getState() == BaseSubManager.ERROR) {
+ managerListener.onError(info, null);
+ } else {
+ managerListener.onStart();
+ }
+ }
+ }
+
+ @Override
+ void retryChangeRegistration() {
+ changeRegistrationRetry++;
+ if (changeRegistrationRetry < MAX_RETRY) {
+ final Handler handler = new Handler(Looper.getMainLooper());
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ checkLifecycleConfiguration();
+ DebugTool.logInfo(TAG, "Retry Change Registration Count: " + changeRegistrationRetry);
+ }
+ }, 3000);
+ }
+ }
- if (this.lockScreenManager != null) {
- this.lockScreenManager.dispose();
- }
+ /**
+ * Dispose SdlManager and clean its resources
+ * <strong>Note: new instance of SdlManager should be created on every connection. SdlManager cannot be reused after getting disposed.</strong>
+ */
+ @SuppressLint("NewApi")
+ @Override
+ public synchronized void dispose() {
+ if (this.permissionManager != null) {
+ this.permissionManager.dispose();
+ }
- if (this.screenManager != null) {
- this.screenManager.dispose();
- }
+ if (this.fileManager != null) {
+ this.fileManager.dispose();
+ }
- if(this.videoStreamManager != null) {
- this.videoStreamManager.dispose();
- }
+ if (this.lockScreenManager != null) {
+ this.lockScreenManager.dispose();
+ }
- // SuppressLint("NewApi") is used because audioStreamManager is only available on android >= jelly bean
- if (this.audioStreamManager != null) {
- this.audioStreamManager.dispose();
- }
+ if (this.screenManager != null) {
+ this.screenManager.dispose();
+ }
- if (this.proxy != null && !proxy.isDisposed()) {
- try {
- this.proxy.dispose();
- } catch (SdlException e) {
- DebugTool.logError("Issue disposing proxy in SdlManager", e);
- }
- }
+ if (this.videoStreamManager != null) {
+ this.videoStreamManager.dispose();
+ }
- if(managerListener != null){
- managerListener.onDestroy();
- managerListener = null;
- }
+ // SuppressLint("NewApi") is used because audioStreamManager is only available on android >= jelly bean
+ if (this.audioStreamManager != null) {
+ this.audioStreamManager.dispose();
+ }
- transitionToState(BaseSubManager.SHUTDOWN);
- }
+ if (this.lifecycleManager != null) {
+ this.lifecycleManager.stop();
+ }
- // MANAGER GETTERS
+ if (managerListener != null) {
+ managerListener.onDestroy();
+ managerListener = null;
+ }
- /**
- * Gets the PermissionManager. <br>
- * <strong>Note: PermissionManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a PermissionManager object
- */
- public PermissionManager getPermissionManager() {
- if (permissionManager.getState() != BaseSubManager.READY && permissionManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG,"PermissionManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return permissionManager;
- }
+ transitionToState(BaseSubManager.SHUTDOWN);
+ }
- /**
- * Gets the FileManager. <br>
- * <strong>Note: FileManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a FileManager object
- */
- public FileManager getFileManager() {
- if (fileManager.getState() != BaseSubManager.READY && fileManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "FileManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return fileManager;
- }
+ // MANAGER GETTERS
/**
* Gets the VideoStreamManager. <br>
- * The VideoStreamManager returned will only be not null if the registered app type is
- * either NAVIGATION or PROJECTION. Once the VideoStreamManager is retrieved, its start()
- * method will need to be called before use.
+ * The VideoStreamManager returned will only be not null if the registered app type is
+ * either NAVIGATION or PROJECTION. Once the VideoStreamManager is retrieved, its start()
+ * method will need to be called before use.
* <br><br><strong>Note: VideoStreamManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
* @return a VideoStreamManager object attached to this SdlManager instance
*/
- public @Nullable
+ public @Nullable
VideoStreamManager getVideoStreamManager() {
- checkSdlManagerState();
- return videoStreamManager;
- }
+ checkSdlManagerState();
+ return videoStreamManager;
+ }
/**
* Gets the AudioStreamManager. <br>
- * The AudioStreamManager returned will only be not null if the registered app type is
- * either NAVIGATION or PROJECTION. Once the AudioStreamManager is retrieved, its start()
- * method will need to be called before use.
+ * The AudioStreamManager returned will only be not null if the registered app type is
+ * either NAVIGATION or PROJECTION. Once the AudioStreamManager is retrieved, its start()
+ * method will need to be called before use.
* <br><strong>Note: AudioStreamManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
* @return a AudioStreamManager object
*/
- public @Nullable AudioStreamManager getAudioStreamManager() {
- checkSdlManagerState();
- return audioStreamManager;
- }
-
- /**
- * Gets the ScreenManager. <br>
- * <strong>Note: ScreenManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a ScreenManager object
- */
- public ScreenManager getScreenManager() {
- if (screenManager.getState() != BaseSubManager.READY && screenManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "ScreenManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return screenManager;
- }
-
- /**
- * Gets the LockScreenManager. <br>
- * <strong>Note: LockScreenManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a LockScreenManager object
- */
- public LockScreenManager getLockScreenManager() {
- if (lockScreenManager.getState() != BaseSubManager.READY && lockScreenManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "LockScreenManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return lockScreenManager;
- }
-
- /**
- * Gets the SystemCapabilityManager. <br>
- * <strong>Note: SystemCapabilityManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a SystemCapabilityManager object
- */
- public SystemCapabilityManager getSystemCapabilityManager(){
- return proxy.getSystemCapabilityManager();
- }
-
- /**
- * Method to retrieve the RegisterAppInterface Response message that was sent back from the
- * module. It contains various attributes about the connected module and can be used to adapt
- * to different module types and their supported features.
- *
- * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
- * registered with the module.
- */
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse(){
- if(proxy != null){
- return proxy.getRegisterAppInterfaceResponse();
- }
- return null;
- }
-
- /**
- * Get the current OnHMIStatus
- * @return OnHMIStatus object represents the current OnHMIStatus
- */
- @Override
- public OnHMIStatus getCurrentHMIStatus(){
- if(this.proxy !=null ){
- return proxy.getCurrentHMIStatus();
- }
- return null;
- }
-
- /**
- * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
- * service from the module. For example, this should be used to login to a user account.
- * @return the string representation of the auth token
- */
- @Override
- public String getAuthToken(){
- return this.proxy.getAuthToken();
- }
-
- // PROTECTED GETTERS
-
- protected LockScreenConfig getLockScreenConfig() { return lockScreenConfig; }
-
- protected FileManagerConfig getFileManagerConfig() { return fileManagerConfig; }
-
- // SENDING REQUESTS
-
- /**
- * Send RPC Message
- * @param message RPCMessage
- */
- @Override
- public void sendRPC(RPCMessage message) {
- try{
- proxy.sendRPC(message);
- }catch (SdlException exception){
- handleSdlException(exception);
- }
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests asynchronously, use sendRequests <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong><br>
- *
- * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- */
- @Override
- public void sendSequentialRPCs(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener){
-
- List<RPCRequest> rpcRequestList = new ArrayList<>();
- for (int i = 0; i < rpcs.size(); i++) {
- if (rpcs.get(i) instanceof RPCRequest){
- rpcRequestList.add((RPCRequest)rpcs.get(i));
- }
- }
-
- if (rpcRequestList.size() > 0) {
- try{
- proxy.sendSequentialRequests(rpcRequestList, listener);
- }catch (SdlException exception){
- handleSdlException(exception);
- }
- }
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests synchronously, use sendSequentialRPCs <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong> <br>
- *
- * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- */
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) {
-
- List<RPCRequest> rpcRequestList = new ArrayList<>();
- for (int i = 0; i < rpcs.size(); i++) {
- if (rpcs.get(i) instanceof RPCRequest){
- rpcRequestList.add((RPCRequest)rpcs.get(i));
- }
- }
-
- if (rpcRequestList.size() > 0) {
- try{
- proxy.sendRequests(rpcRequestList, listener);
- }catch (SdlException exception){
- handleSdlException(exception);
- }
- }
- }
-
- private void handleSdlException(SdlException exception){
- if(exception != null){
- DebugTool.logError("Caught SdlException: " + exception.getSdlExceptionCause());
- // In the future this should handle logic to dispose the manager if it is an unrecoverable error
- }else{
- DebugTool.logError("Caught SdlException" );
- }
- }
-
- /**
- * Add an OnRPCNotificationListener
- * @param listener listener that will be called when a notification is received
- */
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- proxy.addOnRPCNotificationListener(notificationId,listener);
- }
-
- /**
- * Remove an OnRPCNotificationListener
- * @param listener listener that was previously added
- */
- @Override
- public void removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- proxy.removeOnRPCNotificationListener(notificationId, listener);
- }
-
- /**
- * Add an OnRPCRequestListener
- * @param listener listener that will be called when a request is received
- */
- @Override
- public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- proxy.addOnRPCRequestListener(requestId,listener);
- }
-
- /**
- * Remove an OnRPCRequestListener
- * @param listener listener that was previously added
- */
- @Override
- public void removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- proxy.removeOnRPCRequestListener(requestId, listener);
- }
-
- // LIFECYCLE / OTHER
-
- // STARTUP
-
- /**
- * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up
- */
- @SuppressWarnings("unchecked")
- @Override
- public void start(){
- if (proxy == null) {
- try {
- if(transport!= null && transport.getTransportType() == TransportType.MULTIPLEX){
- //Do the thing
- MultiplexTransportConfig multiplexTransportConfig = (MultiplexTransportConfig)(transport);
- final MultiplexTransportConfig.TransportListener devListener = multiplexTransportConfig.getTransportListener();
- multiplexTransportConfig.setTransportListener(new MultiplexTransportConfig.TransportListener() {
- @Override
- public void onTransportEvent(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
-
- //Pass to submanagers that need it
- if(videoStreamManager != null){
- videoStreamManager.handleTransportUpdated(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
- }
-
- if(audioStreamManager != null){
- audioStreamManager.handleTransportUpdated(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
- }
- //If the developer supplied a listener to start, it is time to call that
- if(devListener != null){
- devListener.onTransportEvent(connectedTransports,audioStreamTransportAvail,videoStreamTransportAvail);
- }
- }
- });
-
- //If the requires audio support has not been set, it should be set to true if the
- //app is a media app, and false otherwise
- if(multiplexTransportConfig.requiresAudioSupport() == null){
- multiplexTransportConfig.setRequiresAudioSupport(isMediaApp);
- }
- }
-
- proxy = new SdlProxyBase(proxyBridge, context, appName, shortAppName, isMediaApp, hmiLanguage,
- hmiLanguage, hmiTypes, appId, transport, vrSynonyms, ttsChunks, dayColorScheme,
- nightColorScheme) {};
- proxy.setMinimumProtocolVersion(minimumProtocolVersion);
- proxy.setMinimumRPCVersion(minimumRPCVersion);
- if (sdlSecList != null && !sdlSecList.isEmpty()) {
- proxy.setSdlSecurity(sdlSecList, serviceEncryptionListener);
- }
- //Setup the notification queue
- initNotificationQueue();
-
- } catch (SdlException e) {
- transitionToState(BaseSubManager.ERROR);
- if (managerListener != null) {
- managerListener.onError("Unable to start manager", e);
- }
- }
- }
- }
-
- protected void setProxy(SdlProxyBase proxy){
- this.proxy = proxy;
- }
-
- // INTERNAL INTERFACE
- private ISdl _internalInterface = new ISdl() {
- @Override
- public void start() {
- try{
- proxy.initializeProxy();
- }catch (SdlException e){
- e.printStackTrace();
- }
- }
-
- @Override
- public void stop() {
- try{
- proxy.dispose();
- }catch (SdlException e){
- e.printStackTrace();
- }
- }
-
- @Override
- public boolean isConnected() {
- return proxy.getIsConnected();
- }
-
- @Override
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- proxy.addServiceListener(serviceType,sdlServiceListener);
- }
-
- @Override
- public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- proxy.removeServiceListener(serviceType,sdlServiceListener);
- }
-
- @Override
- public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
- if(proxy.getIsConnected()){
- proxy.startVideoService(encrypted,parameters);
- }
- }
+ public @Nullable
+ AudioStreamManager getAudioStreamManager() {
+ checkSdlManagerState();
+ return audioStreamManager;
+ }
- @Override
- public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters){
- if(proxy.getIsConnected()){
- return proxy.startVideoStream(isEncrypted, parameters);
- }else{
- DebugTool.logError("Unable to start video stream, proxy not connected");
- return null;
- }
- }
-
- @Override
- public void stopVideoService() {
- if(proxy.getIsConnected()){
- proxy.endVideoStream();
- }
- }
-
- @Override
- public void startAudioService(boolean isEncrypted, AudioStreamingCodec codec,
- AudioStreamingParams params) {
- if(proxy.getIsConnected()){
- proxy.startAudioStream(isEncrypted, codec, params);
- }
- }
-
- @Override
- public void startAudioService(boolean encrypted) {
- if(isConnected()){
- proxy.startService(SessionType.PCM, encrypted);
- }
- }
-
- @Override
- public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec,
- AudioStreamingParams params) {
- return proxy.startAudioStream(isEncrypted, codec, params);
- }
-
- @Override
- public void stopAudioService() {
- if(proxy.getIsConnected()){
- proxy.endAudioStream();
- }
- }
-
- @Override
- public void sendRPCRequest(RPCRequest message){
- try {
- proxy.sendRPC(message);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRPC(RPCMessage message) {
- try {
- proxy.sendRPC(message);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
- try {
- proxy.sendRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- try {
- proxy.sendRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- try {
- proxy.sendSequentialRequests(rpcs,listener);
- } catch (SdlException e) {
- DebugTool.logError("Issue sending sequential RPCs ", e);
- }
- }
-
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- proxy.addOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- return proxy.removeOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public void addOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
- proxy.addOnRPCRequestListener(functionID, listener);
- }
-
- @Override
- public boolean removeOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
- return proxy.removeOnRPCRequestListener(functionID, listener);
- }
-
- @Override
- public void addOnRPCListener(final FunctionID responseId, final OnRPCListener listener) {
- proxyBridge.addRpcListener(responseId, listener);
- }
-
- @Override
- public boolean removeOnRPCListener(final FunctionID responseId, final OnRPCListener listener) {
- return proxyBridge.removeOnRPCListener(responseId, listener);
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType){
- return proxy.getCapability(systemCapabilityType);
- }
-
- @Override
- public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) {
- proxy.getCapability(systemCapabilityType, scListener);
- }
-
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
- return proxy.getRegisterAppInterfaceResponse();
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener, boolean forceUpdate) {
- if (proxy != null && proxy.getSystemCapabilityManager() != null) {
- return proxy.getSystemCapabilityManager().getCapability(systemCapabilityType, scListener, forceUpdate);
- }
- return null;
- }
-
- @Override
- public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType){
- return proxy.isCapabilitySupported(systemCapabilityType);
- }
-
- @Override
- public void addOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- proxy.addOnSystemCapabilityListener(systemCapabilityType, listener);
- }
-
- @Override
- public boolean removeOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- return proxy.removeOnSystemCapabilityListener(systemCapabilityType, listener);
- }
-
- @Override
- public boolean isTransportForServiceAvailable(SessionType serviceType) {
- if(SessionType.NAV.equals(serviceType)){
- return proxy.isVideoStreamTransportAvailable();
- }else if(SessionType.PCM.equals(serviceType)){
- return proxy.isAudioStreamTransportAvailable();
- }
- return false;
- }
-
- @Override
- public SdlMsgVersion getSdlMsgVersion(){
- try {
- return proxy.getSdlMsgVersion();
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- @Override
- public @NonNull Version getProtocolVersion() {
- if(proxy.getProtocolVersion() != null){
- return proxy.getProtocolVersion();
- }else{
- return new Version(1,0,0);
- }
- }
-
- @Override
- public void startRPCEncryption() {
- if (proxy != null) {
- proxy.startProtectedRPCService();
- }
- }
-
- };
-
-
- // BUILDER
- public static class Builder {
- SdlManager sdlManager;
-
- /**
- * Builder for the SdlManager. Parameters in the constructor are required.
- * @param context the current context
- * @param appId the app's ID
- * @param appName the app's name
- * @param listener a SdlManagerListener object
- */
- public Builder(@NonNull Context context, @NonNull final String appId, @NonNull final String appName, @NonNull final SdlManagerListener listener){
- sdlManager = new SdlManager();
- setContext(context);
- setAppId(appId);
- setAppName(appName);
- setManagerListener(listener);
- }
- /**
- * Builder for the SdlManager. Parameters in the constructor are required.
- * @param context the current context
- * @param appId the app's ID
- * @param appName the app's name
- * @param listener a SdlManagerListener object
- */
- public Builder(@NonNull Context context, @NonNull final String appId, @NonNull final String appName, @NonNull BaseTransportConfig transport, @NonNull final SdlManagerListener listener){
- sdlManager = new SdlManager();
- setContext(context);
- setAppId(appId);
- setAppName(appName);
- setTransportType(transport);
- setManagerListener(listener);
- }
-
- /**
- * Sets the App ID
- * @param appId
- */
- public Builder setAppId(@NonNull final String appId){
- sdlManager.appId = appId;
- return this;
- }
-
- /**
- * Sets the Application Name
- * @param appName
- */
- public Builder setAppName(@NonNull final String appName){
- sdlManager.appName = appName;
- return this;
- }
-
- /**
- * Sets the Short Application Name
- * @param shortAppName
- */
- public Builder setShortAppName(final String shortAppName) {
- sdlManager.shortAppName = shortAppName;
- return this;
- }
-
- /**
- * Sets the minimum protocol version that will be permitted to connect.
- * If the protocol version of the head unit connected is below this version,
- * the app will disconnect with an EndService protocol message and will not register.
- * @param minimumProtocolVersion the minimum Protocol spec version that should be accepted
- */
- public Builder setMinimumProtocolVersion(final Version minimumProtocolVersion) {
- sdlManager.minimumProtocolVersion = minimumProtocolVersion;
- return this;
- }
-
- /**
- * The minimum RPC version that will be permitted to connect.
- * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
- * @param minimumRPCVersion the minimum RPC spec version that should be accepted
- */
- public Builder setMinimumRPCVersion(final Version minimumRPCVersion) {
- sdlManager.minimumRPCVersion = minimumRPCVersion;
- return this;
- }
-
- /**
- * Sets the Language of the App
- * @param hmiLanguage the desired language to be used on the display/HMI of the connected module
- */
- public Builder setLanguage(final Language hmiLanguage){
- sdlManager.hmiLanguage = hmiLanguage;
- return this;
- }
-
- /**
- * Sets the TemplateColorScheme for daytime
- * @param dayColorScheme color scheme that will be used (if supported) when the display is
- * in a "Day Mode" or similar. Should comprise of colors that contrast
- * well during the day under sunlight.
- */
- public Builder setDayColorScheme(final TemplateColorScheme dayColorScheme){
- sdlManager.dayColorScheme = dayColorScheme;
- return this;
- }
-
- /**
- * Sets the TemplateColorScheme for nighttime
- * @param nightColorScheme color scheme that will be used (if supported) when the display is
- * in a "Night Mode" or similar. Should comprise of colors that
- * contrast well during the night and are not brighter than average.
- */
- public Builder setNightColorScheme(final TemplateColorScheme nightColorScheme){
- sdlManager.nightColorScheme = nightColorScheme;
- return this;
- }
-
- /**
- * Sets the FileManagerConfig for the session.<br>
- * <strong>Note: If not set, the default configuration value of 1 will be set for
- * artworkRetryCount and fileRetryCount in FileManagerConfig</strong>
- * @param fileManagerConfig - configuration options
- */
- public Builder setFileManagerConfig (final FileManagerConfig fileManagerConfig){
- sdlManager.fileManagerConfig = fileManagerConfig;
- return this;
- }
-
- /**
- * Sets the LockScreenConfig for the session. <br>
- * <strong>Note: If not set, the default configuration will be used.</strong>
- * @param lockScreenConfig - configuration options
- */
- public Builder setLockScreenConfig (final LockScreenConfig lockScreenConfig){
- sdlManager.lockScreenConfig = lockScreenConfig;
- return this;
- }
-
- /**
- * Sets the icon for the app on head unit / In-Vehicle-Infotainment system <br>
- * @param sdlArtwork the icon that will be used to represent this application on the
- * connected module
- */
- public Builder setAppIcon(final SdlArtwork sdlArtwork){
- sdlManager.appIcon = sdlArtwork;
- return this;
- }
-
- /**
- * Sets the vector of AppHMIType <br>
- * <strong>Note: This should be an ordered list from most -> least relevant</strong>
- * @param hmiTypes HMI types that represent this application. For example, if the app is a
- * music player, the MEDIA HMIType should be included.
- */
- public Builder setAppTypes(final Vector<AppHMIType> hmiTypes){
-
- sdlManager.hmiTypes = hmiTypes;
-
- if (hmiTypes != null) {
- sdlManager.isMediaApp = hmiTypes.contains(AppHMIType.MEDIA);
- }
-
- return this;
- }
-
- /**
- * Sets the voice recognition synonyms that can be used to identify this application.
- * @param vrSynonyms a vector of Strings that can be associated with this app. For example the app's name should
- * be included as well as any phonetic spellings of the app name that might help the on-board
- * VR system associated a users spoken word with the supplied synonyms.
- */
- public Builder setVrSynonyms(final Vector<String> vrSynonyms) {
- sdlManager.vrSynonyms = vrSynonyms;
- return this;
- }
-
- /**
- * Sets the Text-To-Speech Name of the application. These TTSChunks might be used by the module as an audio
- * representation of the app's name.
- * @param ttsChunks the TTS chunks that can represent this app's name
- */
- public Builder setTtsName(final Vector<TTSChunk> ttsChunks) {
- sdlManager.ttsChunks = ttsChunks;
- return this;
- }
-
- /**
- * This Object type may change with the transport refactor
- * Sets the BaseTransportConfig
- * @param transport the type of transport that should be used for this SdlManager instance.
- */
- public Builder setTransportType(@NonNull BaseTransportConfig transport){
- sdlManager.transport = transport;
- return this;
- }
-
- /**
- * Sets the Context
- * @param context
- */
- public Builder setContext(Context context){
- sdlManager.context = context;
- return this;
- }
-
- /**
- * Sets the Security library
- * @param secList The list of security class(es)
- */
- @Deprecated
- public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> secList) {
- sdlManager.sdlSecList = secList;
- return this;
- }
-
- /**
- * Sets the security libraries and a callback to notify caller when there is update to encryption service
- * @param secList The list of security class(es)
- * @param listener The callback object
- */
- public Builder setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
- sdlManager.sdlSecList = secList;
- sdlManager.serviceEncryptionListener = listener;
- return this;
- }
-
- /**
- * Set the SdlManager Listener
- * @param listener the listener
- */
- public Builder setManagerListener(@NonNull final SdlManagerListener listener){
- sdlManager.managerListener = listener;
- return this;
- }
-
- /**
- * Set RPCNotification listeners. SdlManager will preload these listeners before any RPCs are sent/received.
- * @param listeners a map of listeners that will be called when a notification is received.
- * Key represents the FunctionID of the notification and value represents the listener
- */
- public Builder setRPCNotificationListeners(Map<FunctionID, OnRPCNotificationListener> listeners){
- sdlManager.onRPCNotificationListeners = listeners;
- return this;
- }
-
- /**
- * Build SdlManager ang get it ready to be started
- * <strong>Note: new instance of SdlManager should be created on every connection. SdlManager cannot be reused after getting disposed.</strong>
- * @return SdlManager instance that is ready to be started
- */
- public SdlManager build() {
-
- if (sdlManager.appName == null) {
- throw new IllegalArgumentException("You must specify an app name by calling setAppName");
- }
-
- if (sdlManager.appId == null) {
- throw new IllegalArgumentException("You must specify an app ID by calling setAppId");
- }
-
- if (sdlManager.managerListener == null) {
- throw new IllegalArgumentException("You must set a SdlManagerListener object");
- }
-
- if (sdlManager.transport == null) {
- throw new IllegalArgumentException("You must set a transport type object");
- }
-
- if (sdlManager.hmiTypes == null) {
- Vector<AppHMIType> hmiTypesDefault = new Vector<>();
- hmiTypesDefault.add(AppHMIType.DEFAULT);
- sdlManager.hmiTypes = hmiTypesDefault;
- sdlManager.isMediaApp = false;
- }
-
- if (sdlManager.lockScreenConfig == null){
- // if lock screen params are not set, use default
- sdlManager.lockScreenConfig = new LockScreenConfig();
- }
-
- if(sdlManager.fileManagerConfig == null){
- //if FileManagerConfig is not set use default
- sdlManager.fileManagerConfig = new FileManagerConfig();
- }
-
- if (sdlManager.hmiLanguage == null){
- sdlManager.hmiLanguage = Language.EN_US;
- }
-
- if (sdlManager.minimumProtocolVersion == null){
- sdlManager.minimumProtocolVersion = new Version("1.0.0");
- }
-
- if (sdlManager.minimumRPCVersion == null){
- sdlManager.minimumRPCVersion = new Version("1.0.0");
- }
-
- sdlManager.transitionToState(BaseSubManager.SETTING_UP);
-
- return sdlManager;
- }
- }
-
- /**
- * Start a secured RPC service
- */
- public void startRPCEncryption() {
- if (proxy != null) {
- proxy.startProtectedRPCService();
- }
- }
+ /**
+ * Gets the LockScreenManager. <br>
+ * <strong>Note: LockScreenManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
+ * @return a LockScreenManager object
+ */
+ public LockScreenManager getLockScreenManager() {
+ if (lockScreenManager.getState() != BaseSubManager.READY && lockScreenManager.getState() != BaseSubManager.LIMITED) {
+ DebugTool.logError(TAG, "LockScreenManager should not be accessed because it is not in READY/LIMITED state");
+ }
+ checkSdlManagerState();
+ return lockScreenManager;
+ }
+
+ // PROTECTED GETTERS
+ protected LockScreenConfig getLockScreenConfig() {
+ return lockScreenConfig;
+ }
+
+ // BUILDER
+ public static class Builder extends BaseSdlManager.Builder {
+ /**
+ * Builder for the SdlManager. Parameters in the constructor are required.
+ *
+ * @param context the current context
+ * @param appId the app's ID
+ * @param appName the app's name
+ * @param listener a SdlManagerListener object
+ */
+ public Builder(@NonNull Context context, @NonNull final String appId, @NonNull final String appName, @NonNull final SdlManagerListener listener) {
+ super(appId, appName, listener);
+ setContext(context);
+ }
+
+ /**
+ * Builder for the SdlManager. Parameters in the constructor are required.
+ *
+ * @param context the current context
+ * @param appId the app's ID
+ * @param appName the app's name
+ * @param listener a SdlManagerListener object
+ */
+ public Builder(@NonNull Context context, @NonNull final String appId, @NonNull final String appName, @NonNull BaseTransportConfig transport, @NonNull final SdlManagerListener listener) {
+ super(appId, appName, listener);
+ setContext(context);
+ setTransportType(transport);
+ }
+
+ /**
+ * Sets the LockScreenConfig for the session. <br>
+ * <strong>Note: If not set, the default configuration will be used.</strong>
+ *
+ * @param lockScreenConfig - configuration options
+ */
+ public Builder setLockScreenConfig(final LockScreenConfig lockScreenConfig) {
+ sdlManager.lockScreenConfig = lockScreenConfig;
+ return this;
+ }
+
+ /**
+ * Sets the Context
+ *
+ * @param context the current context
+ */
+ public Builder setContext(Context context) {
+ sdlManager.context = context;
+ return this;
+ }
+
+ /**
+ * Build SdlManager ang get it ready to be started
+ * <strong>Note: new instance of SdlManager should be created on every connection. SdlManager cannot be reused after getting disposed.</strong>
+ *
+ * @return SdlManager instance that is ready to be started
+ */
+ public SdlManager build() {
+ if (sdlManager.transport == null) {
+ throw new IllegalArgumentException("You must set a transport type object");
+ }
+
+ if (sdlManager.lockScreenConfig == null) {
+ // if lock screen params are not set, use default
+ sdlManager.lockScreenConfig = new LockScreenConfig();
+ }
+
+ super.build();
+
+ return sdlManager;
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index d27ac27b5..aa0e4f84a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -64,6 +64,22 @@ public interface SdlManagerListener extends BaseSdlManagerListener{
* @param language The language of the connected head unit the manager is trying to update the configuration.
* @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
* otherwise null to indicate that the language is not supported.
+ * @deprecated use {@link #managerShouldUpdateLifecycle(Language language, Language hmiLanguage)} instead
*/
+ @Deprecated
LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The VR+TTS language of the connected head unit the manager is trying to update the configuration.
+ * @param hmiLanguage The HMI display language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
index e88313036..cba0d212b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.managers.audio;
import android.content.Context;
@@ -38,9 +38,9 @@ import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
-import android.util.Log;
import com.smartdevicelink.managers.audio.AudioStreamManager.SampleType;
+import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
@@ -89,7 +89,7 @@ public class AudioDecoder extends BaseAudioDecoder {
SampleBuffer targetSampleBuffer = AudioDecoder.super.onOutputBufferAvailable(outputBuffer);
AudioDecoder.this.listener.onAudioDataAvailable(targetSampleBuffer);
} else {
- Log.w(TAG, "output buffer empty. Chance that silence was detected");
+ DebugTool.logWarning(TAG, "output buffer empty. Chance that silence was detected");
}
mediaCodec.releaseOutputBuffer(i, false);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
index 984475eaf..1fdf5b219 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
@@ -38,9 +38,9 @@ import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
-import android.util.Log;
import com.smartdevicelink.managers.audio.AudioStreamManager.SampleType;
+import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
@@ -107,7 +107,7 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
public void run() {
final AudioDecoderCompat reference = weakReference.get();
if (reference == null) {
- Log.w(TAG, "AudioDecoderCompat reference was null");
+ DebugTool.logWarning(TAG, "AudioDecoderCompat reference was null");
return;
}
final ByteBuffer[] inputBuffersArray = reference.decoder.getInputBuffers();
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
index 55bff7bba..bb78741c7 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
@@ -41,7 +41,6 @@ import android.os.Looper;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
-import android.util.Log;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.managers.CompletionListener;
@@ -60,6 +59,7 @@ import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
import java.lang.annotation.Retention;
@@ -145,7 +145,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
serviceCompletionHandler.removeCallbacks(serviceCompletionTimeoutCallback);
streamingStateMachine.transitionToState(StreamingStateMachine.ERROR);
- Log.e(TAG, "OnServiceError: " + reason);
+ DebugTool.logError(TAG, "OnServiceError: " + reason);
streamingStateMachine.transitionToState(StreamingStateMachine.NONE);
if (serviceCompletionListener != null) {
@@ -229,7 +229,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
@Override
public void onError(String info) {
- Log.e(TAG, "Error retrieving audio streaming capability: " + info);
+ DebugTool.logError(TAG, "Error retrieving audio streaming capability: " + info);
streamingStateMachine.transitionToState(StreamingStateMachine.ERROR);
transitionToState(ERROR);
}
@@ -256,14 +256,14 @@ public class AudioStreamManager extends BaseAudioStreamManager {
public void startAudioStream(boolean encrypted, final CompletionListener completionListener) {
// audio stream cannot be started without a connected internal interface
if (!internalInterface.isConnected()) {
- Log.w(TAG, "startAudioStream called without being connected.");
+ DebugTool.logWarning(TAG, "startAudioStream called without being connected.");
finish(completionListener, false);
return;
}
// streaming state must be NONE (starting the service is ready. starting stream is started)
if (streamingStateMachine.getState() != StreamingStateMachine.NONE) {
- Log.w(TAG, "startAudioStream called but streamingStateMachine is not in state NONE (current: " + streamingStateMachine.getState() + ")");
+ DebugTool.logWarning(TAG, "startAudioStream called but streamingStateMachine is not in state NONE (current: " + streamingStateMachine.getState() + ")");
finish(completionListener, false);
return;
}
@@ -333,14 +333,14 @@ public class AudioStreamManager extends BaseAudioStreamManager {
*/
public void stopAudioStream(final CompletionListener completionListener) {
if (!internalInterface.isConnected()) {
- Log.w(TAG, "stopAudioStream called without being connected");
+ DebugTool.logWarning(TAG, "stopAudioStream called without being connected");
finish(completionListener, false);
return;
}
// streaming state must be STARTED (starting the service is ready. starting stream is started)
if (streamingStateMachine.getState() != StreamingStateMachine.STARTED) {
- Log.w(TAG, "stopAudioStream called but streamingStateMachine is not STARTED (current: " + streamingStateMachine.getState() + ")");
+ DebugTool.logWarning(TAG, "stopAudioStream called but streamingStateMachine is not STARTED (current: " + streamingStateMachine.getState() + ")");
finish(completionListener, false);
return;
}
@@ -414,7 +414,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
@Override
public void onDecoderError(Exception e) {
- Log.e(TAG, "decoder error", e);
+ DebugTool.logError(TAG, "decoder error", e);
}
};
@@ -444,7 +444,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
public void pushBuffer(ByteBuffer data, CompletionListener completionListener) {
// streaming state must be STARTED (starting the service is ready. starting stream is started)
if (streamingStateMachine.getState() != StreamingStateMachine.STARTED) {
- Log.w(TAG, "AudioStreamManager is not ready!");
+ DebugTool.logWarning(TAG, "AudioStreamManager is not ready!");
return;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
index f0a04dc7b..14ad46620 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.managers.audio;
import android.content.Context;
@@ -40,10 +40,10 @@ import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
-import android.util.Log;
import com.smartdevicelink.managers.audio.AudioStreamManager.SampleType;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
+import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
@@ -252,7 +252,7 @@ public abstract class BaseAudioDecoder {
}
protected void onMediaCodecError(@NonNull MediaCodec.CodecException e) {
- Log.e(TAG, "MediaCodec.onError: " + e.getLocalizedMessage());
+ DebugTool.logError(TAG, "MediaCodec.onError: " + e.getLocalizedMessage());
if (listener != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
listener.onDecoderError(e);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
index af618c696..05a9cc285 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
@@ -1,39 +1,38 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.managers.audio;
-import android.util.Log;
-
import com.smartdevicelink.managers.audio.AudioStreamManager.SampleType;
+import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -210,7 +209,7 @@ public class SampleBuffer {
return avg;
}
default: {
- Log.e(TAG, "SampleBuffer.get(int): The sample type is not known: " + sampleType);
+ DebugTool.logError(TAG, "SampleBuffer.get(int): The sample type is not known: " + sampleType);
return 0.0;
}
}
@@ -274,7 +273,7 @@ public class SampleBuffer {
break;
}
default: {
- Log.e(TAG, "SampleBuffer.set(int): The sample type is not known: " + sampleType);
+ DebugTool.logError(TAG, "SampleBuffer.set(int): The sample type is not known: " + sampleType);
}
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
index 3e1702346..a29ce1536 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
@@ -36,11 +36,11 @@ import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.PutFile;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.io.InputStream;
@@ -142,7 +142,7 @@ public class FileManager extends BaseFileManager {
is = context.get().getResources().openRawResource(resource);
return contentsOfInputStream(is);
} catch (Resources.NotFoundException e) {
- Log.w(TAG, "Can't read from resource", e);
+ DebugTool.logError(TAG, "Can't read from resource", e);
return null;
} finally {
if (is != null) {
@@ -166,7 +166,7 @@ public class FileManager extends BaseFileManager {
is = context.get().getContentResolver().openInputStream(uri);
return contentsOfInputStream(is);
} catch (IOException e){
- Log.w(TAG, "Can't read from Uri", e);
+ DebugTool.logError(TAG, "Can't read from Uri", e);
return null;
} finally {
if (is != null) {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
new file mode 100644
index 000000000..99723b456
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.managers.ServiceEncryptionListener;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+
+class EncryptionLifecycleManager extends BaseEncryptionLifecycleManager {
+
+ EncryptionLifecycleManager(@NonNull ISdl internalInterface, ServiceEncryptionListener listener) {
+ super(internalInterface, listener);
+ internalInterface.addServiceListener(SessionType.NAV, securedServiceListener);
+ internalInterface.addServiceListener(SessionType.PCM, securedServiceListener);
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
new file mode 100644
index 000000000..021e5d49a
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2019-2020 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.app.Service;
+import android.content.Context;
+import android.support.annotation.RestrictTo;
+
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.SdlConnection.SdlSession2;
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.USBTransportConfig;
+import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * The lifecycle manager creates a central point for all SDL session logic to converge. It should only be used by
+ * the library itself. Usage outside the library is not permitted and will not be protected for in the future.
+ *
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+public class LifecycleManager extends BaseLifecycleManager {
+ private ISdlServiceListener videoServiceListener;
+ private boolean videoServiceStartResponseReceived = false;
+ private boolean videoServiceStartResponse = false;
+ private WeakReference<Context> contextWeakReference;
+
+ public LifecycleManager(AppConfig appConfig, BaseTransportConfig config, LifecycleListener listener) {
+ super(appConfig, config, listener);
+ }
+
+ @Override
+ void initialize() {
+ super.initialize();
+
+ //Handle legacy USB connections
+ if (_transportConfig != null && TransportType.USB.equals(_transportConfig.getTransportType())) {
+ //A USB transport config was provided
+ USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
+ if (usbTransportConfig.getUsbAccessory() == null) {
+ DebugTool.logInfo(TAG,"Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
+ //The accessory was null which means it came from a router service
+ MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), appConfig.getAppID());
+ multiplexTransportConfig.setRequiresHighBandwidth(true);
+ multiplexTransportConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+ multiplexTransportConfig.setPrimaryTransports(Collections.singletonList(TransportType.USB));
+ multiplexTransportConfig.setSecondaryTransports(new ArrayList<TransportType>());
+ _transportConfig = multiplexTransportConfig;
+ }
+ }
+
+ if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
+ this.session = new SdlSession2(sdlConnectionListener, (MultiplexTransportConfig) _transportConfig);
+ } else if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.TCP)) {
+ this.session = new SdlSession2(sdlConnectionListener, (TCPTransportConfig) _transportConfig);
+ } else {
+ this.session = SdlSession.createSession((byte) getProtocolVersion().getMajor(), sdlConnectionListener, _transportConfig);
+ }
+ }
+
+ @Override
+ void cycle(SdlDisconnectedReason disconnectedReason) {
+ clean();
+ initialize();
+ if (!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason) && !SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST.equals(disconnectedReason)) {
+ //We don't want to alert higher if we are just cycling for legacy bluetooth
+ onClose("Sdl Proxy Cycled", new SdlException("Sdl Proxy Cycled", SdlExceptionCause.SDL_PROXY_CYCLED), disconnectedReason);
+ }
+ if (session != null) {
+ try {
+ session.startSession();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public void setContext(Context context) {
+ this.contextWeakReference = new WeakReference<>(context);
+ }
+
+ @Override
+ void setSdlSecurityStaticVars() {
+ super.setSdlSecurityStaticVars();
+
+ Context context = null;
+ Service service = null;
+
+ if(this.contextWeakReference != null){
+ context = contextWeakReference.get();
+ }
+ if (context != null && context instanceof Service) {
+ service = (Service) context;
+ }
+ SdlSecurityBase.setAppService(service);
+ SdlSecurityBase.setContext(context);
+ }
+
+ @Override
+ void onServiceStarted(SessionType sessionType) {
+ super.onServiceStarted(sessionType);
+ if (sessionType.eq(SessionType.NAV)) {
+ videoServiceStartResponseReceived = true;
+ videoServiceStartResponse = true;
+ }
+ }
+
+ @Override
+ void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
+ super.onTransportDisconnected(info, availablePrimary, transportConfig);
+ if (availablePrimary) {
+ _transportConfig = transportConfig;
+ DebugTool.logInfo(TAG, "notifying RPC session ended, but potential primary transport available");
+ cycle(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
+ } else {
+ onClose(info, null, null);
+ }
+ }
+
+ @Override
+ void onStartServiceNACKed(SessionType sessionType) {
+ super.onStartServiceNACKed(sessionType);
+ if (sessionType.eq(SessionType.NAV)) {
+ videoServiceStartResponseReceived = true;
+ videoServiceStartResponse = false;
+ }
+ }
+
+ /**
+ * This method will try to start the video service with the requested parameters.
+ * When it returns it will attempt to store the accepted parameters if available.
+ *
+ * @param isEncrypted if the service should be encrypted
+ * @param parameters the desired video streaming parameters
+ */
+ @Override
+ void startVideoService(boolean isEncrypted, VideoStreamingParameters parameters) {
+ if (session == null) {
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
+ return;
+ }
+ if (!session.getIsConnected()) {
+ DebugTool.logWarning(TAG, "Connection is not available.");
+ return;
+ }
+
+ session.setDesiredVideoParams(parameters);
+ tryStartVideoStream(isEncrypted, parameters);
+ }
+
+ /**
+ * Try to open a video service by using the video streaming parameters supplied.
+ * Only information from codecs, width and height are used during video format negotiation.
+ *
+ * @param isEncrypted Specify true if packets on this service have to be encrypted
+ * @param parameters VideoStreamingParameters that are desired. Does not guarantee this is what will be accepted.
+ * @return If the service is opened successfully, an instance of VideoStreamingParams is
+ * returned which contains accepted video format. If the service is opened with legacy
+ * mode (i.e. without any negotiation) then an instance of VideoStreamingParams is
+ * returned. If the service was not opened then null is returned.
+ */
+ private void tryStartVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
+ if (session == null) {
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
+ return;
+ }
+ if (getProtocolVersion() != null && getProtocolVersion().getMajor() >= 5 && !systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)) {
+ DebugTool.logWarning(TAG, "Module doesn't support video streaming.");
+ return;
+ }
+ if (parameters == null) {
+ DebugTool.logWarning(TAG, "Video parameters were not supplied.");
+ return;
+ }
+
+
+ if (!videoServiceStartResponseReceived || !videoServiceStartResponse //If we haven't started the service before
+ || (videoServiceStartResponse && isEncrypted && !session.isServiceProtected(SessionType.NAV))) { //Or the service has been started but we'd like to start an encrypted one
+ session.setDesiredVideoParams(parameters);
+
+ videoServiceStartResponseReceived = false;
+ videoServiceStartResponse = false;
+
+ addVideoServiceListener();
+ session.startService(SessionType.NAV, session.getSessionId(), isEncrypted);
+
+ }
+ }
+
+ private void addVideoServiceListener() {
+ // videos may be started and stopped. Only add this once
+ if (videoServiceListener == null) {
+
+ videoServiceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+ videoServiceStartResponseReceived = true;
+ videoServiceStartResponse = true;
+ }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ // reset nav flags so nav can start upon the next transport connection
+ videoServiceStartResponseReceived = false;
+ videoServiceStartResponse = false;
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ // if there is an error reset the flags so that there is a chance to restart streaming
+ videoServiceStartResponseReceived = false;
+ videoServiceStartResponse = false;
+ }
+ };
+ session.addServiceListener(SessionType.NAV, videoServiceListener);
+ }
+ }
+
+ /**
+ * Closes the opened video service (serviceType 11)
+ *
+ * @return true if the video service is closed successfully, return false otherwise
+ */
+ @Override
+ void endVideoStream() {
+ if (session == null) {
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
+ return;
+ }
+ if (!session.getIsConnected()) {
+ DebugTool.logWarning(TAG, "Connection is not available.");
+ return;
+ }
+
+ session.stopVideoStream();
+ }
+
+ @Override
+ void startAudioService(boolean isEncrypted) {
+ if (session == null) {
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
+ return;
+ }
+ if (!session.getIsConnected()) {
+ DebugTool.logWarning(TAG, "Connection is not available.");
+ return;
+ }
+ session.startService(SessionType.PCM, session.getSessionId(), isEncrypted);
+ }
+
+ /**
+ * Closes the opened audio service (serviceType 10)
+ *
+ * @return true if the audio service is closed successfully, return false otherwise
+ */
+ @Override
+ void endAudioStream() {
+ if (session == null) {
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
+ return;
+ }
+ if (!session.getIsConnected()) {
+ DebugTool.logWarning(TAG, "Connection is not available.");
+ return;
+ }
+
+ session.stopAudioStream();
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
index b2b8e6b14..711afcc72 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
@@ -27,6 +27,7 @@ class LockScreenDeviceIconManager {
private Context context;
private static final String SDL_DEVICE_STATUS_SHARED_PREFS = "sdl.lockScreenIcon";
private static final String STORED_ICON_DIRECTORY_PATH = "sdl/lock_screen_icon/";
+ private static final String TAG = "LockScreenDeviceIconManager";
interface OnIconRetrievedListener {
void onImageRetrieved(Bitmap icon);
@@ -49,10 +50,10 @@ class LockScreenDeviceIconManager {
Bitmap icon = null;
try {
if (isIconCachedAndValid(iconURL)) {
- DebugTool.logInfo("Icon Is Up To Date");
+ DebugTool.logInfo(TAG, "Icon Is Up To Date");
icon = getFileFromCache(iconURL);
if (icon == null) {
- DebugTool.logInfo("Icon from cache was null, attempting to re-download");
+ DebugTool.logInfo(TAG, "Icon from cache was null, attempting to re-download");
icon = AndroidTools.downloadImage(iconURL);
if (icon != null) {
saveFileToCache(icon, iconURL);
@@ -64,7 +65,7 @@ class LockScreenDeviceIconManager {
iconRetrievedListener.onImageRetrieved(icon);
} else {
// The icon is unknown or expired. Download the image, save it to the cache, and update the archive file
- DebugTool.logInfo("Lock Screen Icon Update Needed");
+ DebugTool.logInfo(TAG, "Lock Screen Icon Update Needed");
icon = AndroidTools.downloadImage(iconURL);
if (icon != null) {
saveFileToCache(icon, iconURL);
@@ -94,15 +95,15 @@ class LockScreenDeviceIconManager {
SharedPreferences sharedPref = this.context.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
String iconLastUpdatedTime = sharedPref.getString(iconHash, null);
if(iconLastUpdatedTime == null) {
- DebugTool.logInfo("No Icon Details Found In Shared Preferences");
+ DebugTool.logInfo(TAG, "No Icon Details Found In Shared Preferences");
return false;
} else {
- DebugTool.logInfo("Icon Details Found");
+ DebugTool.logInfo(TAG, "Icon Details Found");
long lastUpdatedTime = 0;
try {
lastUpdatedTime = Long.parseLong(iconLastUpdatedTime);
} catch (NumberFormatException e) {
- DebugTool.logInfo("Invalid time stamp stored to shared preferences, clearing cache and share preferences");
+ DebugTool.logInfo(TAG, "Invalid time stamp stored to shared preferences, clearing cache and share preferences");
clearIconDirectory();
sharedPref.edit().clear().commit();
}
@@ -134,7 +135,7 @@ class LockScreenDeviceIconManager {
fos.close();
writeDeviceIconParametersToSharedPreferences(iconHash);
} catch (Exception e) {
- DebugTool.logError("Failed to save icon to cache");
+ DebugTool.logError(TAG, "Failed to save icon to cache");
e.printStackTrace();
}
}
@@ -152,7 +153,7 @@ class LockScreenDeviceIconManager {
if (iconLastUpdatedTime != null) {
Bitmap cachedIcon = BitmapFactory.decodeFile(this.context.getCacheDir() + "/" + STORED_ICON_DIRECTORY_PATH + "/" + iconHash);
if(cachedIcon == null) {
- DebugTool.logError("Failed to get Bitmap from decoding file cache");
+ DebugTool.logError(TAG, "Failed to get Bitmap from decoding file cache");
clearIconDirectory();
sharedPref.edit().clear().commit();
return null;
@@ -160,7 +161,7 @@ class LockScreenDeviceIconManager {
return cachedIcon;
}
} else {
- DebugTool.logError("Failed to get shared preferences");
+ DebugTool.logError(TAG, "Failed to get shared preferences");
return null;
}
}
@@ -194,7 +195,7 @@ class LockScreenDeviceIconManager {
}
iconHash = hashtext;
} catch (NoSuchAlgorithmException e) {
- DebugTool.logError("Unable to hash icon url");
+ DebugTool.logError(TAG, "Unable to hash icon url");
e.printStackTrace();
}
return iconHash;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
index 2e81894ed..9e63b9fb8 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
@@ -38,7 +38,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Build;
-import android.util.Log;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -192,7 +191,7 @@ public class LockScreenManager extends BaseSubManager {
if (notification != null) {
OnDriverDistraction ddState = (OnDriverDistraction) notification;
Boolean isDismissible = ddState.getLockscreenDismissibility();
- Log.i(TAG, "Lock screen dismissible: "+ isDismissible);
+ DebugTool.logInfo(TAG, "Lock screen dismissible: "+ isDismissible);
if (isDismissible != null) {
// both of these conditions must be met to be able to dismiss lockscreen
if (isDismissible && enableDismissGesture){
@@ -393,7 +392,7 @@ public class LockScreenManager extends BaseSubManager {
@Override
public void onError(String info) {
- DebugTool.logError(info);
+ DebugTool.logError(TAG, info);
}
});
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
new file mode 100644
index 000000000..f38cf79d0
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
@@ -0,0 +1,17 @@
+package com.smartdevicelink.managers.screen;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+
+/**
+ * <strong>SubscribeButtonManager</strong> <br>
+ *
+ * Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
+ *
+ */
+class SubscribeButtonManager extends BaseSubscribeButtonManager {
+
+ SubscribeButtonManager(@NonNull ISdl internalInterface) {
+ super(internalInterface);
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
index b6f49a9a4..a9225e0eb 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
@@ -36,7 +36,6 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.os.SystemClock;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.Display;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -110,7 +109,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
if (VideoStreamManager.this.streamListener == null) {
- Log.e(TAG, "Error starting video stream");
+ DebugTool.logError(TAG, "Error starting video stream");
stateMachine.transitionToState(StreamingStateMachine.ERROR);
return;
}
@@ -137,7 +136,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
@Override
public void onServiceError(SdlSession session, SessionType type, String reason) {
- DebugTool.logError("Unable to start video service: " + reason);
+ DebugTool.logError(TAG, "Unable to start video service: " + reason);
stateMachine.transitionToState(StreamingStateMachine.ERROR);
transitionToState(BaseSubManager.ERROR);
}
@@ -236,7 +235,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
@Override
public void onError(String info) {
- Log.e(TAG, "Error retrieving video streaming capability: " + info);
+ DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
stateMachine.transitionToState(StreamingStateMachine.ERROR);
transitionToState(ERROR);
}
@@ -269,7 +268,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
this.remoteDisplayClass = remoteDisplayClass;
int majorProtocolVersion = internalInterface.getProtocolVersion().getMajor();
if(majorProtocolVersion >= 5 && !internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
- Log.e(TAG, "Video streaming not supported on this module");
+ DebugTool.logError(TAG, "Video streaming not supported on this module");
stateMachine.transitionToState(StreamingStateMachine.ERROR);
return;
}
@@ -286,7 +285,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
@Override
public void onError(String info) {
stateMachine.transitionToState(StreamingStateMachine.ERROR);
- Log.e(TAG, "Error retrieving video streaming capability: " + info);
+ DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
}
});
}else{
@@ -313,7 +312,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
protected void startStreaming(VideoStreamingParameters parameters, boolean encrypted){
this.parameters = parameters;
if (!isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
- Log.e(TAG, "Cannot start video service in the current HMI status");
+ DebugTool.logError(TAG, "Cannot start video service in the current HMI status");
return;
}
//Start the video service
@@ -496,7 +495,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
showPresentation.start();
} catch (Exception ex) {
- Log.e(TAG, "Unable to create Virtual Display.");
+ DebugTool.logError(TAG, "Unable to create Virtual Display.");
if(DebugTool.isDebugEnabled()){
ex.printStackTrace();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
new file mode 100644
index 000000000..21a34c695
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -0,0 +1,116 @@
+package com.smartdevicelink.protocol;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
+
+public class SdlPacket extends BaseSdlPacket implements Parcelable {
+ private static final String TAG = "SdlPacket";
+ private static final int EXTRA_PARCEL_DATA_LENGTH = 24;
+
+ public SdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload);
+ }
+
+ public SdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
+ super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload, offset, bytesToWrite);
+ }
+
+ protected SdlPacket() {
+ super();
+ }
+
+ protected SdlPacket(BaseSdlPacket packet) {
+ super(packet);
+ }
+
+ /* ***************************************************************************************************************************************************
+ * *********************************************************** Parceable Overrides *****************************************************************
+ *****************************************************************************************************************************************************/
+
+
+
+ //I think this is FIFO...right?
+ public SdlPacket(Parcel p) {
+ this.version = p.readInt();
+ this.encryption = (p.readInt() == 0) ? false : true;
+ this.frameType = p.readInt();
+ this.serviceType = p.readInt();
+ this.frameInfo = p.readInt();
+ this.sessionId = p.readInt();
+ this.dataSize = p.readInt();
+ this.messageId = p.readInt();
+ if(p.readInt() == 1){ //We should have a payload attached
+ payload = new byte[dataSize];
+ p.readByteArray(payload);
+ }
+
+ this.priorityCoefficient = p.readInt();
+
+ if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0
+ try {
+ messagingVersion = p.readInt();
+ if (messagingVersion >= 2) {
+ if (p.readInt() == 1) { //We should have a transport type attached
+ this.transportRecord = (TransportRecord) p.readParcelable(TransportRecord.class.getClassLoader());
+ }
+ }
+ }catch (RuntimeException e){
+ DebugTool.logError(TAG, "Error creating packet from parcel", e);
+ }
+ }
+ }
+
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+
+ dest.writeInt(version);
+ dest.writeInt(encryption? 1 : 0);
+ dest.writeInt(frameType);
+ dest.writeInt(serviceType);
+ dest.writeInt(frameInfo);
+ dest.writeInt(sessionId);
+ dest.writeInt(dataSize);
+ dest.writeInt(messageId);
+ dest.writeInt(payload!=null? 1 : 0);
+ if(payload!=null){
+ dest.writeByteArray(payload);
+ }
+ dest.writeInt(priorityCoefficient);
+
+ ///Additions after initial creation
+ if(messagingVersion > 1){
+ dest.writeInt(messagingVersion);
+
+ dest.writeInt(transportRecord!=null? 1 : 0);
+ if(transportRecord != null){
+ dest.writeParcelable(transportRecord,0);
+ }
+ }
+
+ }
+
+ public static final Parcelable.Creator<SdlPacket> CREATOR = new Parcelable.Creator<SdlPacket>() {
+ public SdlPacket createFromParcel(Parcel in) {
+ return new SdlPacket(in);
+ }
+
+ @Override
+ public SdlPacket[] newArray(int size) {
+ return new SdlPacket[size];
+ }
+
+ };
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
index 4a9c68dc5..ad887929a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.protocol;
import com.smartdevicelink.SdlConnection.SdlConnection;
@@ -60,6 +60,7 @@ import java.util.List;
*/
@Deprecated
public class WiProProtocol extends AbstractProtocol {
+ private static final String TAG = "WiProProtocol";
private final static String FailurePropagating_Msg = "Failure propagating ";
//If increasing MAX PROTOCOL VERSION major version, make sure to alter it in SdlPsm
public static final Version MAX_PROTOCOL_VERSION = new Version("5.0.0");
@@ -365,7 +366,7 @@ public class WiProProtocol extends AbstractProtocol {
try {
accumulator = new ByteArrayOutputStream(totalSize);
}catch(OutOfMemoryError e){
- DebugTool.logError("OutOfMemory error", e); //Garbled bits were received
+ DebugTool.logError(TAG, "OutOfMemory error", e); //Garbled bits were received
accumulator = null;
}
}
@@ -405,7 +406,7 @@ public class WiProProtocol extends AbstractProtocol {
try {
handleProtocolMessageReceived(message);
} catch (Exception excp) {
- DebugTool.logError(FailurePropagating_Msg + "onProtocolMessageReceived: " + excp.toString(), excp);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "onProtocolMessageReceived: " + excp.toString(), excp);
} // end-catch
hasFirstFrame = false;
@@ -631,7 +632,7 @@ public class WiProProtocol extends AbstractProtocol {
try {
handleProtocolMessageReceived(message);
} catch (Exception ex) {
- DebugTool.logError(FailurePropagating_Msg + "onProtocolMessageReceived: " + ex.toString(), ex);
+ DebugTool.logError(TAG,FailurePropagating_Msg + "onProtocolMessageReceived: " + ex.toString(), ex);
handleProtocolError(FailurePropagating_Msg + "onProtocolMessageReceived: ", ex);
} // end-catch
} // end-method
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index b0bda2d26..b3d6df61d 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -43,13 +43,13 @@ import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.util.SparseArray;
import android.view.Display;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.Surface;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.BuildConfig;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher;
@@ -313,6 +313,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private Set<String> encryptionRequiredRPCs = new HashSet<>();
private boolean rpcSecuredServiceStarted;
private ServiceEncryptionListener serviceEncryptionListener;
+ private Taskmaster taskmaster;
// Interface broker
private SdlInterfaceBroker _interfaceBroker = null;
@@ -414,7 +415,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
try{
SdlProxyBase.this.sendSequentialRequests(rpcs,listener);
}catch (SdlException e ){
- DebugTool.logError("Issue sending sequential RPCs ", e);
+ DebugTool.logError(TAG, "Issue sending sequential RPCs ", e);
}
}
@@ -537,7 +538,23 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void startRPCEncryption() {
SdlProxyBase.this.startProtectedRPCService();
}
+
+ @Override
+ public Taskmaster getTaskmaster() {
+ return SdlProxyBase.this.getTaskmaster();
+ }
};
+
+ Taskmaster getTaskmaster() {
+ if (taskmaster == null) {
+ Taskmaster.Builder builder = new Taskmaster.Builder();
+ builder.setThreadCount(2);
+ builder.shouldBeDaemon(false);
+ taskmaster = builder.build();
+ taskmaster.start();
+ }
+ return taskmaster;
+ }
private void notifyPutFileStreamError(Exception e, String info)
{
@@ -574,7 +591,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//if (!_advancedLifecycleManagementEnabled) {
// If original model, notify app the proxy is closed so it will delete and reinstanciate
- Log.d(TAG, "notifying proxy of closed");
+ DebugTool.logInfo(TAG, "notifying proxy of closed");
notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
//}// else If ALM, nothing is required to be done here
@@ -587,7 +604,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (altTransportAvailable){
SdlProxyBase.this._transportConfig = transportConfig;
- Log.d(TAG, "notifying RPC session ended, but potential primary transport available");
+ DebugTool.logInfo(TAG, "notifying RPC session ended, but potential primary transport available");
cycleProxy(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
}else{
notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
@@ -596,7 +613,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onTransportError(String info, Exception e) {
- DebugTool.logError("Transport failure: " + info, e);
+ DebugTool.logError(TAG, "Transport failure: " + info, e);
notifyPutFileStreamError(e, info);
@@ -643,7 +660,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1){
- Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
try {
disposeInternal(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
} catch (SdlException e) {
@@ -751,7 +768,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onHeartbeatTimedOut(byte sessionID) {
final String msg = "Heartbeat timeout";
- DebugTool.logInfo(msg);
+ DebugTool.logInfo(TAG, msg);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onHeartbeatTimedOut");
@@ -877,7 +894,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
boolean callbackToUIThread, Boolean preRegister, String sHashID, Boolean bAppResumeEnab,
BaseTransportConfig transportConfig) throws SdlException
{
- Log.i(TAG, "SDL_LIB_VERSION: " + BuildConfig.VERSION_NAME);
+ DebugTool.logInfo(TAG, "SDL_LIB_VERSION: " + BuildConfig.VERSION_NAME);
setProtocolVersion(new Version(PROX_PROT_VER_ONE,0,0));
if (preRegister != null && preRegister)
@@ -1374,7 +1391,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (urlConnection == null)
{
- Log.i(TAG, "urlConnection is null, check RPC input parameters");
+ DebugTool.logInfo(TAG, "urlConnection is null, check RPC input parameters");
updateBroadcastIntent(sendIntent, "COMMENT2", "urlConnection is null, check RPC input parameters");
return;
}
@@ -1401,7 +1418,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (iResponseCode != HttpURLConnection.HTTP_OK)
{
- Log.i(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
+ DebugTool.logInfo(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
updateBroadcastIntent(sendIntent, "COMMENT2", "Response code not HTTP_OK, aborting request. ");
return;
}
@@ -1428,7 +1445,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
sendRPCMessagePrivate(putFile);
- Log.i("sendSystemRequestToUrl", "sent to sdl");
+ DebugTool.logInfo(TAG, "sendSystemRequestToUrl sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
@@ -1460,7 +1477,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else
{
- DebugTool.logError("sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
//Log.i("sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
return;
}
@@ -1495,7 +1512,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (getIsConnected())
{
sendRPCMessagePrivate(mySystemRequest);
- Log.i("sendSystemRequestToUrl", "sent to sdl");
+ DebugTool.logInfo(TAG, "sendSystemRequestToUrl sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
@@ -1505,43 +1522,43 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
catch (SdlException e)
{
- DebugTool.logError("sendSystemRequestToUrl: Could not get data from JSONObject received.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not get data from JSONObject received.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " SdlException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not get data from JSONObject received."+ e);
}
catch (JSONException e)
{
- DebugTool.logError("sendSystemRequestToUrl: JSONException: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: JSONException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " JSONException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: JSONException: "+ e);
}
catch (UnsupportedEncodingException e)
{
- DebugTool.logError("sendSystemRequestToUrl: Could not encode string.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not encode string.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " UnsupportedEncodingException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not encode string."+ e);
}
catch (ProtocolException e)
{
- DebugTool.logError("sendSystemRequestToUrl: Could not set request method to post.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not set request method to post.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " ProtocolException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not set request method to post."+ e);
}
catch (MalformedURLException e)
{
- DebugTool.logError("sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " MalformedURLException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server."+ e);
}
catch (IOException e)
{
- DebugTool.logError("sendSystemRequestToUrl: IOException: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: IOException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " IOException while sending to cloud: IOException: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: IOException: "+ e);
}
catch (Exception e)
{
- DebugTool.logError("sendSystemRequestToUrl: Unexpected Exception: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Unexpected Exception: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " Exception encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Unexpected Exception: " + e);
}
@@ -1616,7 +1633,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//A USB transport config was provided
USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
if (usbTransportConfig.getUsbAccessory() == null) {
- DebugTool.logInfo("Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
+ DebugTool.logInfo(TAG, "Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
//The accessory was null which means it came from a router service
MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), _appID);
multiplexTransportConfig.setRequiresHighBandwidth(true);
@@ -1648,7 +1665,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void forceOnConnected(){
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null) {
- Log.d(TAG, "Forcing on connected.... might actually need this"); //FIXME
+ DebugTool.logInfo(TAG, "Forcing on connected.... might actually need this"); //FIXME
/*if(sdlSession.getSdlConnection()==null){ //There is an issue when switching from v1 to v2+ where the connection is closed. So we restart the session during this call.
try {
sdlSession.startSession();
@@ -1832,6 +1849,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void dispose() throws SdlException {
SdlTrace.logProxyEvent("Application called dispose() method.", SDL_LIB_TRACE_KEY);
disposeInternal(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
+ if (taskmaster != null) {
+ taskmaster.shutdown();
+ }
}
/**
* Terminates the App's Interface Registration, closes the transport connection, ends the protocol session, and frees any resources used by the proxy.
@@ -1973,7 +1993,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (functionName != null) {
hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
} else {
- DebugTool.logWarning("Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
+ DebugTool.logWarning(TAG, "Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
return;
}
if (message.getRPCType() == 0x00) {
@@ -1990,13 +2010,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
handleRPCMessage(hash);
} catch (final Exception excp) {
- DebugTool.logError("Failure handling protocol message: " + excp.toString(), excp);
+ DebugTool.logError(TAG, "Failure handling protocol message: " + excp.toString(), excp);
passErrorToProxyListener("Error handing incoming protocol message.", excp);
} // end-catch
} //else { Handle other protocol message types here}
} catch (final Exception e) {
// Pass error to application through listener
- DebugTool.logError("Error handing proxy event.", e);
+ DebugTool.logError(TAG, "Error handing proxy event.", e);
passErrorToProxyListener("Error handing incoming protocol message.", e);
}
}
@@ -2024,7 +2044,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
catch (final Exception e)
{
- DebugTool.logError("Error handing proxy event.", e);
+ DebugTool.logError(TAG, "Error handing proxy event.", e);
passErrorToProxyListener("Error serializing message.", e);
return null;
}
@@ -2129,14 +2149,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
default:
// Diagnostics
SdlTrace.logProxyEvent("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.", SDL_LIB_TRACE_KEY);
- DebugTool.logError("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.");
+ DebugTool.logError(TAG, "Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.");
break;
}
SdlTrace.logProxyEvent("Proxy fired callback: " + message.getFunctionName(), SDL_LIB_TRACE_KEY);
} catch(final Exception e) {
// Pass error to application through listener
- DebugTool.logError("Error handing proxy event.", e);
+ DebugTool.logError(TAG, "Error handing proxy event.", e);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2152,11 +2172,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
private void handleErrorsFromInternalMessageDispatcher(String info, Exception e) {
- DebugTool.logError(info, e);
+ DebugTool.logError(TAG, info, e);
// This error cannot be passed to the user, as it indicates an error
// in the communication between the proxy and the application.
- DebugTool.logError("InternalMessageDispatcher failed.", e);
+ DebugTool.logError(TAG, "InternalMessageDispatcher failed.", e);
// Note, this is the only place where the _proxyListener should be referenced asdlhronously,
// with an error on the internalMessageDispatcher, we have no other reliable way of
@@ -2193,7 +2213,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
if(_proxyDisposed){
- DebugTool.logInfo("Ignoring start service packet, proxy is disposed");
+ DebugTool.logInfo(TAG, "Ignoring start service packet, proxy is disposed");
return;
}
if(SessionType.RPC.equals(type)){
@@ -2202,13 +2222,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, isEncrypted, null);
}
- DebugTool.logInfo("onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
+ DebugTool.logInfo(TAG, "onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
}
@Override
public void onServiceEnded(SdlSession session, SessionType type) {
if(_proxyDisposed){
- DebugTool.logInfo("Ignoring end service packet, proxy is disposed");
+ DebugTool.logInfo(TAG, "Ignoring end service packet, proxy is disposed");
return;
}
if (SessionType.RPC.equals(type)) {
@@ -2217,13 +2237,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, false, null);
}
- DebugTool.logInfo("onServiceEnded, session Type: " + type.getName());
+ DebugTool.logInfo(TAG, "onServiceEnded, session Type: " + type.getName());
}
@Override
public void onServiceError(SdlSession session, SessionType type, String reason) {
if(_proxyDisposed){
- DebugTool.logInfo("Ignoring start service error, proxy is disposed");
+ DebugTool.logInfo(TAG, "Ignoring start service error, proxy is disposed");
return;
}
if (SessionType.RPC.equals(type)) {
@@ -2232,7 +2252,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, false, "onServiceError: " + reason);
}
- DebugTool.logError("onServiceError, session Type: " + type.getName() + ", reason: " + reason);
+ DebugTool.logError(TAG, "onServiceError, session Type: " + type.getName() + ", reason: " + reason);
}
};
@@ -2317,7 +2337,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
}
}
- DebugTool.logWarning(errorInfo);
+ DebugTool.logWarning(TAG, errorInfo);
return;
}
@@ -2640,14 +2660,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void handleRPCMessage(Hashtable<String, Object> hash) {
if (hash == null){
- DebugTool.logError("handleRPCMessage: hash is null, returning.");
+ DebugTool.logError(TAG, "handleRPCMessage: hash is null, returning.");
return;
}
RPCMessage rpcMsg = RpcConverter.convertTableToRpc(hash);
if (rpcMsg == null){
- DebugTool.logError("handleRPCMessage: rpcMsg is null, returning.");
+ DebugTool.logError(TAG, "handleRPCMessage: rpcMsg is null, returning.");
return;
}
@@ -2705,7 +2725,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}else{
rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
}
- DebugTool.logInfo("Negotiated RPC Spec version = " + rpcSpecVersion);
+ DebugTool.logInfo(TAG, "Negotiated RPC Spec version = " + rpcSpecVersion);
_vehicleType = msg.getVehicleType();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
@@ -2733,11 +2753,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (!isDebugEnabled())
{
enableDebugTool();
- DebugTool.logInfo(sVersionInfo, false);
+ DebugTool.logInfo(TAG, sVersionInfo, false);
disableDebugTool();
}
else
- DebugTool.logInfo(sVersionInfo, false);
+ DebugTool.logInfo(TAG, sVersionInfo, false);
sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "RAI_RESPONSE");
@@ -2755,7 +2775,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//If the RPC version is too low we should simply dispose this proxy
if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
- Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
try {
disposeInternal(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
} catch (SdlException e) {
@@ -2785,7 +2805,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
&& functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
- Log.i("pt", "POLICIES_CORRELATION_ID SystemRequest Notification (Legacy)");
+ DebugTool.logInfo(TAG, "POLICIES_CORRELATION_ID SystemRequest Notification (Legacy)");
final OnSystemRequest msg = new OnSystemRequest(hash);
@@ -2806,7 +2826,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
&& functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
- Log.i("pt", "POLICIES_CORRELATION_ID SystemRequest Response (Legacy)");
+ DebugTool.logInfo(TAG, "POLICIES_CORRELATION_ID SystemRequest Response (Legacy)");
final SystemRequestResponse msg = new SystemRequestResponse(hash);
Intent sendIntent = createBroadcastIntent();
@@ -2874,7 +2894,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
}
- DebugTool.logInfo("Negotiated RPC Spec version = " + rpcSpecVersion);
+ DebugTool.logInfo(TAG, "Negotiated RPC Spec version = " + rpcSpecVersion);
_vehicleType = msg.getVehicleType();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
@@ -2896,11 +2916,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (!isDebugEnabled())
{
enableDebugTool();
- DebugTool.logInfo("SDL Proxy Version: " + _proxyVersionInfo);
+ DebugTool.logInfo(TAG, "SDL Proxy Version: " + _proxyVersionInfo);
disableDebugTool();
}
else
- DebugTool.logInfo("SDL Proxy Version: " + _proxyVersionInfo);
+ DebugTool.logInfo(TAG, "SDL Proxy Version: " + _proxyVersionInfo);
// RegisterAppInterface
if (_advancedLifecycleManagementEnabled) {
@@ -2915,7 +2935,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
//If the RPC version is too low we should simply dispose this proxy
if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
- Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
try {
disposeInternal(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
} catch (SdlException e) {
@@ -4016,10 +4036,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else {
if (_sdlMsgVersion != null) {
- DebugTool.logError("Unrecognized response Message: " + functionName +
+ DebugTool.logError(TAG, "Unrecognized response Message: " + functionName +
" SDL Message Version = " + _sdlMsgVersion);
} else {
- DebugTool.logError("Unrecognized response Message: " + functionName);
+ DebugTool.logError(TAG, "Unrecognized response Message: " + functionName);
}
} // end-if
@@ -4139,7 +4159,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "COMMENT1", "Sending to cloud: " + msg.getUrl());
sendBroadcastIntent(sendIntent);
- Log.i("pt", "send to url");
+ DebugTool.logInfo(TAG, "send to url");
if ( (msg.getUrl() != null) )
{
@@ -4327,7 +4347,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
e.printStackTrace();
}
} else {
- DebugTool.logError("File was null at: " + urlHttps);
+ DebugTool.logError(TAG, "File was null at: " + urlHttps);
}
}
};
@@ -4551,10 +4571,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else {
if (_sdlMsgVersion != null) {
- DebugTool.logInfo("Unrecognized notification Message: " + functionName +
+ DebugTool.logInfo(TAG, "Unrecognized notification Message: " + functionName +
" connected to SDL using message version: " + _sdlMsgVersion.getMajorVersion() + "." + _sdlMsgVersion.getMinorVersion());
} else {
- DebugTool.logInfo("Unrecognized notification Message: " + functionName);
+ DebugTool.logInfo(TAG, "Unrecognized notification Message: " + functionName);
}
} // end-if
} // end-if notification
@@ -4881,7 +4901,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected void notifyProxyClosed(final String info, final Exception e, final SdlDisconnectedReason reason) {
SdlTrace.logProxyEvent("NotifyProxyClose", SDL_LIB_TRACE_KEY);
- Log.d(TAG, "notifyProxyClosed: " + info);
+ DebugTool.logInfo(TAG, "notifyProxyClosed: " + info);
OnProxyClosed message = new OnProxyClosed(info, e, reason);
queueInternalMessage(message);
}
@@ -5001,7 +5021,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcPacketizer.start();
return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
- Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
+ DebugTool.logError(TAG, "SyncConnectionUnable to start streaming:", e);
return null;
}
}
@@ -5022,7 +5042,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcPacketizer.start();
return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
- Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
+ DebugTool.logError(TAG, "SyncConnection Unable to start streaming:", e);
return null;
}
}
@@ -5307,10 +5327,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
builder.append(paramName);
}
- DebugTool.logWarning("StartService for nav failed. Rejected params: " + builder.toString());
+ DebugTool.logWarning(TAG, "StartService for nav failed. Rejected params: " + builder.toString());
} else {
- DebugTool.logWarning("StartService for nav failed (rejected params not supplied)");
+ DebugTool.logWarning(TAG, "StartService for nav failed (rejected params not supplied)");
}
return null;
}
@@ -5347,11 +5367,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@SuppressWarnings("unused")
public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
if (sdlSession == null) {
- DebugTool.logWarning("SdlSession is not created yet.");
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
return null;
}
if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning("Connection is not available.");
+ DebugTool.logWarning(TAG, "Connection is not available.");
return null;
}
@@ -5373,11 +5393,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*/
public void startVideoService(boolean isEncrypted, VideoStreamingParameters parameters) {
if (sdlSession == null) {
- DebugTool.logWarning("SdlSession is not created yet.");
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
return;
}
if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning("Connection is not available.");
+ DebugTool.logWarning(TAG, "Connection is not available.");
return;
}
@@ -5475,7 +5495,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@TargetApi(19)
public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
- Log.e(TAG, "Video streaming not supported on this module");
+ DebugTool.logError(TAG, "Video streaming not supported on this module");
return;
}
//Create streaming manager
@@ -5496,7 +5516,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onError(String info) {
- Log.e(TAG, "Error retrieving video streaming capability: " + info);
+ DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
}
});
@@ -5542,15 +5562,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@SuppressWarnings("unused")
private VideoStreamingParameters tryStartVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
if (sdlSession == null) {
- DebugTool.logWarning("SdlSession is not created yet.");
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
return null;
}
if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
- DebugTool.logWarning("Module doesn't support video streaming.");
+ DebugTool.logWarning(TAG, "Module doesn't support video streaming.");
return null;
}
if (parameters == null) {
- DebugTool.logWarning("Video parameters were not supplied.");
+ DebugTool.logWarning(TAG, "Video parameters were not supplied.");
return null;
}
@@ -5589,10 +5609,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
builder.append(paramName);
}
- DebugTool.logWarning("StartService for nav failed. Rejected params: " + builder.toString());
+ DebugTool.logWarning(TAG, "StartService for nav failed. Rejected params: " + builder.toString());
} else {
- DebugTool.logWarning("StartService for nav failed (rejected params not supplied)");
+ DebugTool.logWarning(TAG, "StartService for nav failed (rejected params not supplied)");
}
return null;
@@ -5680,15 +5700,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec,
AudioStreamingParams params) {
if (sdlSession == null) {
- DebugTool.logWarning("SdlSession is not created yet.");
+ DebugTool.logWarning(TAG, "SdlSession is not created yet.");
return null;
}
if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning("Connection is not available.");
+ DebugTool.logWarning(TAG, "Connection is not available.");
return null;
}
if (codec != AudioStreamingCodec.LPCM) {
- DebugTool.logWarning("Audio codec " + codec + " is not supported.");
+ DebugTool.logWarning(TAG, "Audio codec " + codec + " is not supported.");
return null;
}
@@ -5705,7 +5725,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
scheduler.shutdown();
if (pcmServiceStartResponse) {
- DebugTool.logInfo("StartService for audio succeeded");
+ DebugTool.logInfo(TAG, "StartService for audio succeeded");
return sdlSession.startAudioStream();
} else {
if (pcmServiceStartRejectedParams != null) {
@@ -5716,9 +5736,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
builder.append(paramName);
}
- DebugTool.logWarning("StartService for audio failed. Rejected params: " + builder.toString());
+ DebugTool.logWarning(TAG, "StartService for audio failed. Rejected params: " + builder.toString());
} else {
- DebugTool.logWarning("StartService for audio failed (rejected params not supplied)");
+ DebugTool.logWarning(TAG, "StartService for audio failed (rejected params not supplied)");
}
return null;
}
@@ -6754,7 +6774,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (sdlMsgVersion == null) {
sdlMsgVersion = new SdlMsgVersion();
if(protocolVersion.getMajor() == 1) {
- DebugTool.logInfo("Connected to an older module, must send 1.0.0 as RPC spec");
+ DebugTool.logInfo(TAG, "Connected to an older module, must send 1.0.0 as RPC spec");
sdlMsgVersion.setMajorVersion(1);
sdlMsgVersion.setMinorVersion(0);
}else {
@@ -8390,7 +8410,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//streamListener = startVideoStream(encrypted,parameters);d
streamListener = sdlSession.startVideoStream();
if(streamListener == null){
- Log.e(TAG, "Error starting video service");
+ DebugTool.logError(TAG, "Error starting video service");
return;
}
VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
@@ -8407,7 +8427,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} catch (Exception e) {
e.printStackTrace();
}
- Log.d(TAG, parameters.toString());
+ DebugTool.logInfo(TAG, parameters.toString());
}
public void stopStreaming(){
@@ -8496,14 +8516,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
showPresentation.start();
} catch (Exception ex) {
- Log.e(TAG, "Unable to create Virtual Display.");
+ DebugTool.logError(TAG, "Unable to create Virtual Display.");
}
}
@Override
public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
if(SessionType.NAV.equals(type) && session != null ){
- DebugTool.logInfo("Video service has been started. Starting video stream from proxy");
+ DebugTool.logInfo(TAG, "Video service has been started. Starting video stream from proxy");
if(session.getAcceptedVideoParams() != null){
videoStreamingParameters = session.getAcceptedVideoParams();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
index c720cd22c..cdb80ef1e 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
@@ -39,13 +39,14 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import com.smartdevicelink.util.DebugTool;
+
import java.lang.reflect.Constructor;
import java.util.concurrent.Callable;
@@ -183,7 +184,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
remoteDisplay = (SdlRemoteDisplay) constructor.newInstance(context, mDisplay);
} catch (Exception e) {
e.printStackTrace();
- Log.e(TAG, "Unable to create Presentation Class");
+ DebugTool.logError(TAG, "Unable to create Presentation Class");
presentationShowError = true;
return;
}
@@ -196,7 +197,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
}
} catch (WindowManager.InvalidDisplayException ex) {
- Log.e(TAG, "Couldn't show presentation! Display was removed in the meantime.", ex);
+ DebugTool.logError(TAG, "Couldn't show presentation! Display was removed in the meantime.", ex);
remoteDisplay = null;
presentationShowError = true;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
index 531f02831..e3bedd6a2 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
@@ -433,7 +433,7 @@ public class SdlTrace {
try {
localTraceListener.logXmlMsg(msg, SDL_LIB_TRACE_KEY);
} catch (Exception ex) {
- DebugTool.logError("Failure calling ISTListener: " + ex.toString(), ex);
+ DebugTool.logError(SYSTEM_LOG_TAG, "Failure calling ISTListener: " + ex.toString(), ex);
return false;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java b/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
index 587a6ae2b..584b388ef 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
/**
*
*/
@@ -50,6 +50,7 @@ import java.util.Set;
public class TraceDeviceInfo {
// http://developer.android.com/guide/topics/data/data-storage.html
+ private static final String TAG = "TraceDeviceInfo";
private static TelephonyManager m_telephonyManager;
// Constructor
@@ -74,7 +75,7 @@ public class TraceDeviceInfo {
try { // getDeviceId() requires android.permission.READ_PHONE_STATE
info = "<deviceid>" + m_telephonyManager.getDeviceId() + "</deviceid>";
} catch (Exception e1) {
- DebugTool.logError("Failure getting telephony device ID: " + e1.toString(), e1);
+ DebugTool.logError(TAG, "Failure getting telephony device ID: " + e1.toString(), e1);
}
info = "<pt>";
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
index bc204ebaf..f86a3f062 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.transport;
import android.bluetooth.BluetoothAdapter;
@@ -58,7 +58,8 @@ import java.util.UUID;
*
*/
@Deprecated
-public class BTTransport extends SdlTransport {
+public class BTTransport extends SdlTransport {
+ private static final String TAG = "BTTransport";
//936DA01F9ABD4D9D80C702AF85C822A8
private final static UUID SDL_V4_MOBILE_APPLICATION_SVC_CLASS = new UUID(0x936DA01F9ABD4D9DL, 0x80C702AF85C822A8L);
@@ -296,7 +297,7 @@ public class BTTransport extends SdlTransport {
_transportReader = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to stop transport reader thread.", e);
+ DebugTool.logError(TAG, "Failed to stop transport reader thread.", e);
} // end-catch
try {
@@ -305,7 +306,7 @@ public class BTTransport extends SdlTransport {
_bluetoothAdapterMonitor = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to stop adapter monitor thread.", e);
+ DebugTool.logError(TAG, "Failed to stop adapter monitor thread.", e);
}
try {
@@ -314,7 +315,7 @@ public class BTTransport extends SdlTransport {
_serverSocket = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to close serverSocket", e);
+ DebugTool.logError(TAG, "Failed to close serverSocket", e);
} // end-catch
try {
@@ -323,7 +324,7 @@ public class BTTransport extends SdlTransport {
_activeSocket = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to close activeSocket", e);
+ DebugTool.logError(TAG, "Failed to close activeSocket", e);
} // end-catch
@@ -334,7 +335,7 @@ public class BTTransport extends SdlTransport {
_output = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to close output stream", e);
+ DebugTool.logError(TAG, "Failed to close output stream", e);
} // end-catch
if (ex == null) {
@@ -361,7 +362,7 @@ public class BTTransport extends SdlTransport {
_output.write(msgBytes, 0, msgBytes.length);
sendResult = true;
} catch (Exception ex) {
- DebugTool.logError("Error writing to Bluetooth socket: " + ex.toString(), ex);
+ DebugTool.logError(TAG, "Error writing to Bluetooth socket: " + ex.toString(), ex);
handleTransportError("Error writing to Bluetooth socket:", ex);
sendResult = false;
} // end-catch
@@ -461,7 +462,7 @@ public class BTTransport extends SdlTransport {
if(currentByte == -1){ //If we read a -1 and the psm didn't move forward, then there is a problem
if (!isHalted) {
// Only call disconnect if the thread has not been halted
- DebugTool.logError("End of stream reached!");
+ DebugTool.logError(TAG, "End of stream reached!");
disconnect("End of stream reached.", null);
}
}
@@ -479,7 +480,7 @@ public class BTTransport extends SdlTransport {
// Only call disconnect if the thread has not been halted
clearInputStream();
String errString = "Failure in BTTransport reader thread: " + excp.toString();
- DebugTool.logError(errString, excp);
+ DebugTool.logError(TAG, errString, excp);
disconnect(errString, excp);
}
return;
@@ -493,7 +494,7 @@ public class BTTransport extends SdlTransport {
_input = null;
}
} catch (Exception e) {
- DebugTool.logError("Failed to close input stream", e);
+ DebugTool.logError(TAG, "Failed to close input stream", e);
} // end-catch
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
index cc7b030c7..5b67fa444 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
@@ -30,11 +30,11 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.RequiresPermission;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.io.InputStream;
@@ -272,7 +272,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
@Override
protected synchronized void stop(int stateToTransitionTo, byte error) {
super.stop(stateToTransitionTo, error);
- Log.d(TAG, "Attempting to close the bluetooth serial server");
+ DebugTool.logInfo(TAG, "Attempting to close the bluetooth serial server");
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
@@ -403,7 +403,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
@RequiresPermission(Manifest.permission.BLUETOOTH)
public void run() {
synchronized(THREAD_LOCK){
- Log.d(TAG, "Socket Type: " + mSocketType +
+ DebugTool.logInfo(TAG, "Socket Type: " + mSocketType +
" BEGIN mAcceptThread" + this);
setName("AcceptThread" + mSocketType);
@@ -414,12 +414,12 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
while (mState != STATE_CONNECTED) {
try {
if(listenAttempts>=5){
- Log.e(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
+ DebugTool.logError(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
return;
}
listenAttempts++;
- Log.d(TAG, "SDL Bluetooth Accept thread is running.");
+ DebugTool.logInfo(TAG, "SDL Bluetooth Accept thread is running.");
// This is a blocking call and will only return on a
// successful connection or an exception
@@ -429,12 +429,12 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
else{
- Log.e(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
+ DebugTool.logError(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
return;
}
} catch (IOException e) {
- Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed");
+ DebugTool.logError(TAG, "Socket Type: " + mSocketType + "accept() failed");
MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_SPP_ERROR);
return;
}
@@ -453,29 +453,29 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
case STATE_CONNECTED:
// Either not ready or already connected. Terminate new socket.
try {
- Log.d(TAG, "Close unwanted socket");
+ DebugTool.logInfo(TAG, "Close unwanted socket");
socket.close();
} catch (IOException e) {
- Log.e(TAG, "Could not close unwanted socket", e);
+ DebugTool.logError(TAG, "Could not close unwanted socket", e);
}
break;
}
}
}
}
- Log.d(TAG, mState + " END mAcceptThread, socket Type: " + mSocketType);
+ DebugTool.logInfo(TAG, mState + " END mAcceptThread, socket Type: " + mSocketType);
}
}
public synchronized void cancel() {
- Log.d(TAG, mState + " Socket Type " + mSocketType + " cancel ");
+ DebugTool.logInfo(TAG, mState + " Socket Type " + mSocketType + " cancel ");
try {
if(mmServerSocket != null){
mmServerSocket.close();
}
} catch (IOException e) {
- Log.e(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ Arrays.toString(e.getStackTrace()));
+ DebugTool.logError(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ Arrays.toString(e.getStackTrace()));
}
}
}
@@ -501,7 +501,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
try{
mAdapter.cancelDiscovery();
}catch(SecurityException e2){
- Log.e(TAG, "Don't have required permision to cancel discovery. Moving on");
+ DebugTool.logError(TAG, "Don't have required permision to cancel discovery. Moving on");
}
}
@@ -588,11 +588,11 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}else{tryInsecure = true;}
} catch (IOException io) {
tryInsecure = true;
- Log.e(TAG,"createRfcommSocketToServiceRecord exception - " + io.toString());
+ DebugTool.logError(TAG, "createRfcommSocketToServiceRecord exception - " + io.toString());
SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
} catch (Exception e){
- Log.e(TAG,"createRfcommSocketToServiceRecord exception - " + e.toString());
+ DebugTool.logError(TAG, "createRfcommSocketToServiceRecord exception - " + e.toString());
SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
}
@@ -653,13 +653,13 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
connectionFailed();
- Log.e(TAG,e.getClass().getSimpleName()
+ DebugTool.logError(TAG,e.getClass().getSimpleName()
+ " caught connecting to the bluetooth socket: "
+ e.toString());
try {
mmSocket.close();
} catch (IOException e2) {
- Log.e(TAG,"unable to close() socket during connection failure" + e2);
+ DebugTool.logError(TAG, "unable to close() socket during connection failure" + e2);
}
return;
}
@@ -678,13 +678,13 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
else
{
- Log.e(TAG, "There was a problem opening up RFCOMM");
+ DebugTool.logError(TAG, "There was a problem opening up RFCOMM");
}
}
public void cancel() {
try {
- Log.d(TAG, "Calling Cancel in the connect thread");
+ DebugTool.logInfo(TAG, "Calling Cancel in the connect thread");
mmSocket.close();
} catch (IOException e) {
// close() of connect socket failed
@@ -714,7 +714,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
tmpOut = socket.getOutputStream();
} catch (IOException e) {
// temp sockets not created
- Log.e(TAG, "Connected Write Thread: " + e.getMessage());
+ DebugTool.logError(TAG, "Connected Write Thread: " + e.getMessage());
}
mmOutStream = tmpOut;
@@ -727,7 +727,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
public void write(byte[] buffer, int offset, int count) {
try {
if(buffer==null){
- Log.w(TAG, "Can't write to device, nothing to send");
+ DebugTool.logWarning(TAG, "Can't write to device, nothing to send");
return;
}
//This would be a good spot to log out all bytes received
@@ -736,7 +736,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
} catch (IOException|NullPointerException e) { // STRICTLY to catch mmOutStream NPE
// Exception during write
//OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
- Log.e(TAG, "Error sending bytes to connected device!");
+ DebugTool.logError(TAG, "Error sending bytes to connected device!");
connectionLost();
}
}
@@ -753,7 +753,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
// close() of connect socket failed
- Log.d(TAG, "Write Thread: " + e.getMessage());
+ DebugTool.logInfo(TAG, "Write Thread: " + e.getMessage());
}
}
}
@@ -773,7 +773,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
tmpIn = socket.getInputStream();
} catch (IOException e) {
// temp sockets not created
- Log.e(TAG, "Connected Read Thread: "+e.getMessage());
+ DebugTool.logError(TAG, "Connected Read Thread: "+e.getMessage());
}
mmInStream = tmpIn;
@@ -781,7 +781,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
@SuppressLint("NewApi")
public void run() {
- Log.d(TAG, "Running the Connected Thread");
+ DebugTool.logInfo(TAG, "Running the Connected Thread");
byte input = 0;
int bytesRead = 0;
byte[] buffer = new byte[READ_BUFFER_SIZE];
@@ -814,9 +814,11 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
}
} catch (IOException|NullPointerException e) { // NPE is ONLY to catch error on mmInStream
- Log.e(TAG, "Lost connection in the Connected Thread");
- e.printStackTrace();
- connectionLost();
+ DebugTool.logError(TAG, "Lost connection in the Connected Thread");
+ if(DebugTool.isDebugEnabled()){
+ e.printStackTrace();
+ }
+ connectionLost();
break;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
index 0fa211bd9..50d6ba051 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
@@ -36,11 +36,11 @@ import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.WiFiSocketFactory;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.io.InputStream;
@@ -99,7 +99,7 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
} catch (Exception e) {
- logError("TCPTransport: Exception during transport thread starting", e);
+ logError(TAG, "TCPTransport: Exception during transport thread starting", e);
}
}
} else {
@@ -134,7 +134,7 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
mSocket = null;
} catch (IOException e) {
- logError("TCPTransport.disconnect: Exception during disconnect: " + e.getMessage());
+ logError(TAG,"TCPTransport.disconnect: Exception during disconnect: " + e.getMessage());
}
setState(state);
@@ -227,7 +227,7 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
mInputStream = mSocket.getInputStream();
startWriteThread();
} catch (IOException e) {
- logError("TCPTransport.connect: Exception during connect stage: " + e.getMessage());
+ logError(TAG, "TCPTransport.connect: Exception during connect stage: " + e.getMessage());
}
bConnected = (null != mSocket) && mSocket.isConnected();
@@ -314,7 +314,7 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
if (psm.getState() == SdlPsm.FINISHED_STATE)
{
synchronized (MultiplexTcpTransport.this) {
- Log.d(TAG, "Packet formed, sending off");
+ DebugTool.logInfo(TAG, "Packet formed, sending off");
SdlPacket packet = psm.getFormedPacket();
packet.setTransportRecord(getTransportRecord());
handler.obtainMessage(SdlRouterService.MESSAGE_READ, packet).sendToTarget();
@@ -348,9 +348,9 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
*/
private void internalHandleStreamReadError() {
if(isHalted){
- logError("TCPTransport.run: Exception during reading data, but thread already halted");
+ logError(TAG, "TCPTransport.run: Exception during reading data, but thread already halted");
} else {
- logError("TCPTransport.run: Exception during reading data");
+ logError(TAG, "TCPTransport.run: Exception during reading data");
MultiplexTcpTransport.this.stop(STATE_NONE);
}
}
@@ -382,13 +382,13 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
logInfo("TCPTransport.sendBytesOverTransport: successfully sent data");
}
} catch (IOException e) {
- logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
+ logError(TAG, "TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
}
} else {
if (isHalted) {
- logError("TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
+ logError(TAG, "TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
} else {
- logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
+ logError(TAG, "TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
}
}
@@ -418,13 +418,13 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
try {
mOutputStream.flush();
} catch (IOException e) {
- logError("TCPTransport flushing output stream failed: " + e.getMessage());
+ logError(TAG, "TCPTransport flushing output stream failed: " + e.getMessage());
}
try {
mOutputStream.close();
} catch (IOException e) {
- logError("TCPTransport closing output stream failed: " + e.getMessage());
+ logError(TAG, "TCPTransport closing output stream failed: " + e.getMessage());
}
mOutputStream = null;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransport.java
index eac5a27e0..0bacd3a2f 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransport.java
@@ -38,13 +38,13 @@ import android.content.Context;
import android.os.Build;
import android.os.Looper;
import android.os.Parcelable;
-import android.util.Log;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import java.util.List;
@@ -122,7 +122,7 @@ public class MultiplexTransport extends SdlTransport{
@Override
public void openConnection() throws SdlException {
- Log.d(TAG, "Open connection");
+ DebugTool.logInfo(TAG, "Open connection");
if(brokerThread!=null){
brokerThread.startConnection();
}//else should log out
@@ -134,7 +134,7 @@ public class MultiplexTransport extends SdlTransport{
if(isDisconnecting){
return;
}
- Log.d(TAG, "Close connection");
+ DebugTool.logInfo(TAG, "Close connection");
this.isDisconnecting= true;
if(brokerThread!= null){
brokerThread.cancel();
@@ -275,7 +275,7 @@ public class MultiplexTransport extends SdlTransport{
@Override
public boolean onHardwareConnected(TransportType type) {
if(super.onHardwareConnected(type)){
- Log.d(TAG, "On transport connected...");
+ DebugTool.logInfo(TAG, "On transport connected...");
if(!connected){
connected = true;
handleTransportConnected();
@@ -299,17 +299,17 @@ public class MultiplexTransport extends SdlTransport{
public void onHardwareDisconnected(TransportType type) {
super.onHardwareDisconnected(type);
if(connected){
- Log.d(TAG, "Handling disconnect");
+ DebugTool.logInfo(TAG, "Handling disconnect");
connected = false;
SdlConnection.enableLegacyMode(isLegacyModeEnabled(), TransportType.BLUETOOTH);
if(isLegacyModeEnabled()){
- Log.d(TAG, "Handle transport disconnect, legacy mode enabled");
+ DebugTool.logInfo(TAG, "Handle transport disconnect, legacy mode enabled");
this.stop();
isDisconnecting = true;
//handleTransportDisconnected("");
handleTransportError("",null); //This seems wrong, but it works
}else{
- Log.d(TAG, "Handle transport Error");
+ DebugTool.logInfo(TAG, "Handle transport Error");
isDisconnecting = true;
handleTransportError("",null); //This seems wrong, but it works
}
@@ -321,7 +321,7 @@ public class MultiplexTransport extends SdlTransport{
super.onLegacyModeEnabled();
SdlConnection.enableLegacyMode(isLegacyModeEnabled(), TransportType.BLUETOOTH);
if(isLegacyModeEnabled()){
- Log.d(TAG, "Handle on legacy mode enabled");
+ DebugTool.logInfo(TAG, "Handle on legacy mode enabled");
this.stop();
isDisconnecting = true;
//handleTransportDisconnected("");
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
index d72987a88..42bbc29a4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
@@ -36,10 +36,10 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.ParcelFileDescriptor;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import java.io.FileDescriptor;
import java.io.FileInputStream;
@@ -68,7 +68,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
MultiplexUsbTransport(ParcelFileDescriptor parcelFileDescriptor, Handler handler, Bundle bundle){
super(handler, TransportType.USB);
if(parcelFileDescriptor == null){
- Log.e(TAG, "Error with object");
+ DebugTool.logError(TAG, "Error with object");
this.parcelFileDescriptor = null;
throw new ExceptionInInitializerError("ParcelFileDescriptor can't be null");
}else{
@@ -101,7 +101,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
setState(STATE_CONNECTING);
FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
if(fileDescriptor == null || !fileDescriptor.valid()){
- Log.e(TAG, "USB FD was null or not valid,");
+ DebugTool.logError(TAG, "USB FD was null or not valid,");
setState(STATE_NONE);
return;
}
@@ -228,15 +228,15 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
bytesRead = inputStream.read(buffer);
if (bytesRead == -1) {
if (isInterrupted()) {
- Log.e(TAG,"EOF reached, and thread is interrupted");
+ DebugTool.logError(TAG,"EOF reached, and thread is interrupted");
} else {
- Log.i(TAG,"EOF reached, disconnecting!");
+ DebugTool.logInfo(TAG,"EOF reached, disconnecting!");
connectionLost();
}
return;
}
if (isInterrupted()) {
- Log.w(TAG,"Read some data, but thread is interrupted");
+ DebugTool.logWarning(TAG,"Read some data, but thread is interrupted");
return;
}
if(connectionSuccessful != null && connectionSuccessful == false){
@@ -268,9 +268,9 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
if (isInterrupted()) {
- Log.w(TAG,"Can't read data, and thread is interrupted");
+ DebugTool.logWarning(TAG,"Can't read data, and thread is interrupted");
} else {
- Log.w(TAG,"Can't read data, disconnecting!");
+ DebugTool.logWarning(TAG,"Can't read data, disconnecting!");
connectionLost();
}
return;
@@ -319,7 +319,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
public void write(byte[] buffer, int offset, int count) {
try {
if(buffer==null){
- Log.w(TAG, "Can't write to device, nothing to send");
+ DebugTool.logWarning(TAG, "Can't write to device, nothing to send");
return;
}
//This would be a good spot to log out all bytes received
@@ -331,7 +331,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
} catch (IOException|NullPointerException e) { // STRICTLY to catch mmOutStream NPE
// Exception during write
//OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
- Log.e(TAG, "Error sending bytes to connected device!");
+ DebugTool.logError(TAG, "Error sending bytes to connected device!");
connectionLost();
}
}
@@ -345,7 +345,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
// close() of connect socket failed
- Log.d(TAG, "Write Thread: " + e.getMessage());
+ DebugTool.logInfo(TAG, "Write Thread: " + e.getMessage());
}
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
index 227b0b894..a9aca1ff4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
@@ -48,7 +48,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.DebugTool;
@@ -172,11 +171,11 @@ public class RouterServiceValidator {
String packageName = null;
if(this.service != null){
- Log.d(TAG, "Supplied service name of " + this.service.getClassName());
+ DebugTool.logInfo(TAG, "Supplied service name of " + this.service.getClassName());
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !isServiceRunning(context,this.service)){
//This means our service isn't actually running, so set to null. Hopefully we can find a real router service after this.
service = null;
- Log.w(TAG, "Supplied service is not actually running.");
+ DebugTool.logWarning(TAG, "Supplied service is not actually running.");
} else {
// If the running router service is created by this app, the validation is good by default
if (this.service.getPackageName().equals(context.getPackageName())) {
@@ -227,11 +226,11 @@ public class RouterServiceValidator {
//Grab the package for the currently running router service. We need this call regardless of if we are in debug mode or not.
if(this.service != null){
- DebugTool.logInfo("Supplied service name of " + this.service.getClassName());
+ DebugTool.logInfo(TAG, "Supplied service name of " + this.service.getClassName());
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !isServiceRunning(context,this.service)){
//This means our service isn't actually running, so set to null. Hopefully we can find a real router service after this.
service = null;
- DebugTool.logWarning("Supplied service is not actually running.");
+ DebugTool.logWarning(TAG, "Supplied service is not actually running.");
} else {
// If the running router service is created by this app, the validation is good by default
if (this.service.getPackageName().equals(context.getPackageName()) && callback != null) {
@@ -242,17 +241,17 @@ public class RouterServiceValidator {
}
if(this.service == null){
- DebugTool.logInfo("about finding the best Router by using retrieveBestRouterServiceName");
+ DebugTool.logInfo(TAG, "about finding the best Router by using retrieveBestRouterServiceName");
new FindRouterTask(new FindConnectedRouterCallback() {
@Override
public void onFound(ComponentName component) {
- DebugTool.logInfo("FindConnectedRouterCallback.onFound got called. Package=" + component);
+ DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFound got called. Package=" + component);
checkTrustedRouter(callback, pm, component);
}
@Override
public void onFailed() {
- DebugTool.logInfo("FindConnectedRouterCallback.onFailed was called");
+ DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFailed was called");
if (callback != null) {
callback.onFinishedValidation(false, null);
}
@@ -342,17 +341,17 @@ public class RouterServiceValidator {
public void run() {
_counter.incrementAndGet();
if (connected) {
- DebugTool.logInfo("We found the connected service (" + service + "); currentThread is " + Thread.currentThread().getName());
+ DebugTool.logInfo(TAG, "We found the connected service (" + service + "); currentThread is " + Thread.currentThread().getName());
serviceQueue.add(service);
} else if (_counter.get() == numServices) {
- DebugTool.logInfo("SdlRouterStatusProvider returns service=" + service + "; connected=" + connected);
+ DebugTool.logInfo(TAG, "SdlRouterStatusProvider returns service=" + service + "; connected=" + connected);
_currentThread.interrupt();
}
}
});
}
});
- DebugTool.logInfo("about checkIsConnected; thread=" + Thread.currentThread().getName());
+ DebugTool.logInfo(TAG, "about checkIsConnected; thread=" + Thread.currentThread().getName());
provider.checkIsConnected();
}
}
@@ -362,14 +361,14 @@ public class RouterServiceValidator {
ComponentName found = serviceQueue.poll(TIMEOUT_MSEC, TimeUnit.MILLISECONDS);
return found;
} catch(InterruptedException e) {
- DebugTool.logInfo("FindRouterTask was interrupted because connected Router cannot be found");
+ DebugTool.logInfo(TAG,"FindRouterTask was interrupted because connected Router cannot be found");
}
return null;
}
@Override
protected void onPostExecute(ComponentName componentName) {
- DebugTool.logInfo("onPostExecute componentName=" + componentName);
+ DebugTool.logInfo(TAG,"onPostExecute componentName=" + componentName);
super.onPostExecute(componentName);
if (mCallback != null) {
if (componentName != null && componentName.getPackageName() != null && componentName.getPackageName().length() != 0) {
@@ -622,7 +621,7 @@ public class RouterServiceValidator {
return apps;
}else{
- Log.i(TAG, "No SDL apps, list was null");
+ DebugTool.logInfo(TAG, "No SDL apps, list was null");
return null;
}
}
@@ -635,7 +634,7 @@ public class RouterServiceValidator {
public static boolean createTrustedListRequest(final Context context, boolean forceRefresh){
return createTrustedListRequest(context,forceRefresh,null,null);
}
- public static boolean createTrustedListRequest(final Context context, boolean forceRefresh, TrustedListCallback listCallback){Log.d(TAG,"Checking to make sure we have a list");
+ public static boolean createTrustedListRequest(final Context context, boolean forceRefresh, TrustedListCallback listCallback){DebugTool.logInfo(TAG,"Checking to make sure we have a list");
return createTrustedListRequest(context,forceRefresh,null,listCallback);
}
@@ -691,7 +690,7 @@ public class RouterServiceValidator {
}
return false;
}else{
- Log.d(TAG, "Sdl apps have changed. Need to request new trusted router service list.");
+ DebugTool.logInfo(TAG, "Sdl apps have changed. Need to request new trusted router service list.");
}
}
@@ -710,7 +709,7 @@ public class RouterServiceValidator {
@Override
public void httpFailure(int statusCode) {
- Log.e(TAG, "Error while requesting trusted app list: "
+ DebugTool.logError(TAG, "Error while requesting trusted app list: "
+ statusCode);
pendingListRefresh = false;
if(listCallback!=null){listCallback.onListObtained(false);}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index ba1cc80a0..dff9efb0d 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -48,11 +48,11 @@ import android.os.Build;
import android.os.Looper;
import android.os.Parcelable;
import android.util.AndroidRuntimeException;
-import android.util.Log;
import com.smartdevicelink.R;
import com.smartdevicelink.transport.RouterServiceValidator.TrustedListCallback;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.SdlDeviceListener;
import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.SdlAppInfo;
@@ -85,6 +85,8 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
private static final Object QUEUED_SERVICE_LOCK = new Object();
private static ComponentName queuedService = null;
private static Thread.UncaughtExceptionHandler foregroundExceptionHandler = null;
+ private static final Object DEVICE_LISTENER_LOCK = new Object();
+ private static SdlDeviceListener sdlDeviceListener;
public int getRouterServiceVersion(){
return SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER;
@@ -116,7 +118,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
if(action.equalsIgnoreCase(USBTransport.ACTION_USB_ACCESSORY_ATTACHED)){
- Log.d(TAG, "Usb connected");
+ DebugTool.logInfo(TAG,"Usb connected");
intent.setAction(null);
onSdlEnabled(context, intent);
return;
@@ -143,23 +145,23 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
}
if (!serviceFilterHasAction){
- Log.e(TAG, "WARNING: This application has not specified its intent-filter for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logError(TAG, "WARNING: This application has not specified its intent-filter for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
}
// Check if the service declaration in AndroidManifest has the router service version metadata specified correctly
ResolveInfo info = context.getPackageManager().resolveService(new Intent(context, localRouterClass), PackageManager.GET_META_DATA);
if (info != null) {
if (info.serviceInfo.metaData == null || !info.serviceInfo.metaData.containsKey(context.getString(R.string.sdl_router_service_version_name))) {
- Log.e(TAG, "WARNING: This application has not specified its metadata tags for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logError(TAG, "WARNING: This application has not specified its metadata tags for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
}
} else {
- Log.e(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logError(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
}
}
}
if(localRouterClass != null && localRouterClass.getName().equalsIgnoreCase(com.smartdevicelink.transport.SdlRouterService.class.getName())){
- Log.e(TAG, "You cannot use the default SdlRouterService class, it must be extended in your project. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logError(TAG, "You cannot use the default SdlRouterService class, it must be extended in your project. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
}
//This will only be true if we are being told to reopen our SDL service because SDL is enabled
@@ -189,10 +191,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
});
}
-
- }else{
- //This was previously not hooked up, so let's leave it commented out
- //onSdlDisabled(context);
+
}
return;
}else if(intent.getBooleanExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, false)){
@@ -204,10 +203,10 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
- Log.d(TAG, "Check for local router");
+ DebugTool.logInfo(TAG, "Check for local router");
if(localRouterClass!=null){ //If there is a supplied router service lets run some logic regarding starting one
- if(!didStart){Log.d(TAG, "attempting to wake up router service");
+ if(!didStart){DebugTool.logInfo(TAG, "attempting to wake up router service");
didStart = wakeUpRouterService(context, true,false, device);
}
@@ -223,8 +222,57 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
}
+ /**
+ * This method will attempt to start the router service.
+ * @param context to be used to start the service and send broadcasts
+ * @param componentName the router service that should be started
+ * @param altTransportWake if the alt transport flag should be set. Only used in debug
+ * @param device the connected bluetooth device
+ */
+ private static void startRouterService(Context context, ComponentName componentName, boolean altTransportWake, BluetoothDevice device, boolean confirmedDevice) {
+ if (componentName == null) {
+ return;
+ }
+
+ Intent serviceIntent = new Intent();
+ serviceIntent.setComponent(componentName);
+
+ if (altTransportWake) {
+ serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
+ }
+
+ if (device != null) {
+ serviceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+ }
+
+ if (confirmedDevice) {
+ serviceIntent.putExtra(TransportConstants.CONFIRMED_SDL_DEVICE, confirmedDevice);
+ }
+
+ try {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ context.startService(serviceIntent);
+ } else {
+ serviceIntent.putExtra(FOREGROUND_EXTRA, true);
+ DebugTool.logInfo("Attempting to startForegroundService - " + System.currentTimeMillis());
+ setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
+ context.startForegroundService(serviceIntent);
+
+ }
+ //Make sure to send this out for old apps to close down
+ SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
+ Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, true);
+ context.sendBroadcast(restart);
+
+ } catch (SecurityException e) {
+ DebugTool.logError(TAG, "Security exception, process is bad");
+ }
+ }
+
private boolean wakeUpRouterService(final Context context, final boolean ping, final boolean altTransportWake, final BluetoothDevice device){
- new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
+ new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
@Override
public void onComplete(Vector<ComponentName> routerServices) {
runningBluetoothServicePackage = new Vector<ComponentName>();
@@ -232,43 +280,43 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
if (runningBluetoothServicePackage.isEmpty()) {
//If there isn't a service running we should try to start one
//We will try to sort the SDL enabled apps and find the one that's been installed the longest
- Intent serviceIntent;
- List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ synchronized (DEVICE_LISTENER_LOCK) {
+ final boolean sdlDeviceListenerEnabled = SdlDeviceListener.isFeatureSupported(sdlAppInfoList);
+ if (sdlDeviceListenerEnabled) {
+ String myPackage = context.getPackageName();
+ String routerServicePackage = null;
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty() && sdlAppInfoList.get(0).getRouterServiceComponentName() != null) {
+ routerServicePackage = sdlAppInfoList.get(0).getRouterServiceComponentName().getPackageName();
+ }
+ DebugTool.logInfo(TAG, ": This app's package: " + myPackage);
+ DebugTool.logInfo(TAG, ": Router service app's package: " + routerServicePackage);
+ if (myPackage != null && myPackage.equalsIgnoreCase(routerServicePackage)) {
+ SdlDeviceListener sdlDeviceListener = getSdlDeviceListener(context, device);
+ if (!sdlDeviceListener.isRunning()) {
+ sdlDeviceListener.start();
+ }
+ } else {
+ DebugTool.logInfo(TAG, ": Not the app to start the router service nor device listener");
+ }
+ return;
+ }
+ }
+
if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
- serviceIntent = new Intent();
- serviceIntent.setComponent(sdlAppInfoList.get(0).getRouterServiceComponentName());
+ startRouterService(context, sdlAppInfoList.get(0).getRouterServiceComponentName(), altTransportWake, device, false);
} else{
- Log.d(TAG, "No SDL Router Services found");
- Log.d(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logInfo(TAG, "No SDL Router Services found");
+ DebugTool.logInfo(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
return;
}
- if (altTransportWake) {
- serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
- }
- if(device != null){
- serviceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
- }
- try {
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- context.startService(serviceIntent);
- }else {
- serviceIntent.putExtra(FOREGROUND_EXTRA, true);
- DebugTool.logInfo("Attempting to startForegroundService - " + System.currentTimeMillis());
- setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
- context.startForegroundService(serviceIntent);
+ } else { //There are currently running services
+ if(DebugTool.isDebugEnabled()){
+ for(ComponentName service : runningBluetoothServicePackage){
+ DebugTool.logInfo("Currently running router service: " + service.getPackageName());
}
- //Make sure to send this out for old apps to close down
- SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
- Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
- restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
- restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, true);
- context.sendBroadcast(restart);
-
- } catch (SecurityException e) {
- Log.e(TAG, "Security exception, process is bad");
}
- } else {
if (altTransportWake) {
wakeRouterServiceAltTransport(context);
return;
@@ -281,7 +329,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
}
});
- return true;
+ return true;
}
private void wakeRouterServiceAltTransport(Context context){
@@ -289,7 +337,11 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
for (ComponentName compName : runningBluetoothServicePackage) {
serviceIntent.setComponent(compName);
- context.startService(serviceIntent);
+ try{
+ context.startService(serviceIntent);
+ } catch (Exception e){
+ DebugTool.logError(TAG, "Can't start router service for alt transport");
+ }
}
}
@@ -314,7 +366,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
&& "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
&& e.getMessage().contains("SdlRouterService")) {
- Log.i(TAG, "Handling failed startForegroundService call");
+ DebugTool.logInfo(TAG, "Handling failed startForegroundService call");
Looper.loop();
} else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
defaultUncaughtExceptionHandler.uncaughtException(t, e);
@@ -329,12 +381,11 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
* Determines if an instance of the Router Service is currently running on the device.<p>
* <b>Note:</b> This method no longer works on Android Oreo or newer
* @param context A context to access Android system services through.
- * @param pingService Set this to true if you want to make sure the service is up and listening to bluetooth
* @return True if a SDL Router Service is currently running, false otherwise.
*/
- private static boolean isRouterServiceRunning(Context context, boolean pingService){
+ private static boolean isRouterServiceRunning(Context context){
if(context == null){
- Log.e(TAG, "Can't look for router service, context supplied was null");
+ DebugTool.logError(TAG, "Can't look for router service, context supplied was null");
return false;
}
if (runningBluetoothServicePackage == null) {
@@ -348,7 +399,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
try {
runningServices = manager.getRunningServices(Integer.MAX_VALUE);
} catch (NullPointerException e) {
- Log.e(TAG, "Can't get list of running services");
+ DebugTool.logError(TAG, "Can't get list of running services");
return false;
}
for (RunningServiceInfo service : runningServices) {
@@ -356,9 +407,6 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
//Log.d(TAG, "Found Service: "+ service.service.getClassName());
if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SDL_ROUTER_SERVICE_CLASS_NAME) && AndroidTools.isServiceExported(context, service.service)) {
runningBluetoothServicePackage.add(service.service); //Store which instance is running
- if (pingService) {
- pingRouterService(context, service.service.getPackageName(), service.service.getClassName());
- }
}
}
return runningBluetoothServicePackage.size() > 0;
@@ -366,7 +414,8 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
/**
- * Attempts to ping a running router service
+ * Attempts to ping a running router service. It does call startForegroundService so it is
+ * important to only call this as a ping if the service is already started.
* @param context A context to access Android system services through.
* @param packageName Package name for service to ping
* @param className Class name for service to ping
@@ -381,14 +430,14 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
intent.putExtra(FOREGROUND_EXTRA, true);
- DebugTool.logInfo("Attempting to startForegroundService - " + System.currentTimeMillis());
+ DebugTool.logInfo(TAG, "Attempting to startForegroundService - " + System.currentTimeMillis());
setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
context.startForegroundService(intent);
}else {
context.startService(intent);
}
}catch(SecurityException e){
- Log.e(TAG, "Security exception, process is bad");
+ DebugTool.logError(TAG, "Security exception, process is bad");
// This service could not be started
}
}
@@ -431,7 +480,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
return;
}
- if((!lookForServices || isRouterServiceRunning(context,false)) && !runningBluetoothServicePackage.isEmpty()){ //So there is a service up, let's see if it's connected
+ if((!lookForServices || isRouterServiceRunning(context)) && !runningBluetoothServicePackage.isEmpty()){ //So there is a service up, let's see if it's connected
final ConcurrentLinkedQueue<ComponentName> list = new ConcurrentLinkedQueue<ComponentName>(runningBluetoothServicePackage);
final SdlRouterStatusProvider.ConnectedStatusCallback sdlBrCallback = new SdlRouterStatusProvider.ConnectedStatusCallback() {
@@ -443,9 +492,9 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
provider.checkIsConnected();
}else{
if(service!=null){
- Log.d(TAG, service.getPackageName() + " is connected = " + connected);
+ DebugTool.logInfo(TAG, service.getPackageName() + " is connected = " + connected);
}else{
- Log.d(TAG,"No service is connected/running");
+ DebugTool.logInfo(TAG, "No service is connected/running");
}
if(callback!=null){
callback.onConnectionStatusUpdate(connected, service,context);
@@ -469,14 +518,15 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
});
}else{
- Log.w(TAG, "Router service isn't running, returning false.");
+ DebugTool.logWarning(TAG, "Router service isn't running, returning false.");
if(isBluetoothConnected()){
- Log.d(TAG, "Bluetooth is connected. Attempting to start Router Service");
+ DebugTool.logInfo(TAG, "Bluetooth is connected. Attempting to ping Router Service");
Intent serviceIntent = new Intent();
serviceIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
serviceIntent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- AndroidTools.sendExplicitBroadcast(context,serviceIntent,null);
+ AndroidTools.sendExplicitBroadcast(context, serviceIntent,null);
}
+
if(callback!=null){
callback.onConnectionStatusUpdate(false, null,context);
}
@@ -500,6 +550,49 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
return false;
}
+
+ private static SdlDeviceListener getSdlDeviceListener(Context context, BluetoothDevice bluetoothDevice){
+
+ synchronized (DEVICE_LISTENER_LOCK){
+ if (sdlDeviceListener == null){
+ sdlDeviceListener = new SdlDeviceListener(context, bluetoothDevice, new SdlDeviceListener.Callback() {
+ @Override
+ public boolean onTransportConnected(Context context, BluetoothDevice bluetoothDevice) {
+
+ synchronized (DEVICE_LISTENER_LOCK){
+ sdlDeviceListener = null;
+ if(context != null) {
+ final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ if(sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
+ ComponentName routerService = sdlAppInfoList.get(0).getRouterServiceComponentName();
+ startRouterService(context, routerService, false, bluetoothDevice, true);
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void onTransportDisconnected(BluetoothDevice bluetoothDevice) {
+ synchronized (DEVICE_LISTENER_LOCK){
+ sdlDeviceListener = null;
+ }
+ }
+
+ @Override
+ public void onTransportError(BluetoothDevice bluetoothDevice) {
+ synchronized (DEVICE_LISTENER_LOCK){
+ sdlDeviceListener = null;
+ }
+ }
+ });
+ }
+ }
+
+ return sdlDeviceListener;
+ }
+
public static ComponentName consumeQueuedRouterService(){
synchronized(QUEUED_SERVICE_LOCK){
ComponentName retVal = queuedService;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index 4edc639e8..5168bf50b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -73,7 +73,6 @@ import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.util.AndroidRuntimeException;
-import android.util.Log;
import android.util.SparseArray;
import android.util.SparseIntArray;
@@ -140,7 +139,7 @@ public class SdlRouterService extends Service{
/**
* <b> NOTE: DO NOT MODIFY THIS UNLESS YOU KNOW WHAT YOU'RE DOING.</b>
*/
- protected static final int ROUTER_SERVICE_VERSION_NUMBER = 12;
+ protected static final int ROUTER_SERVICE_VERSION_NUMBER = 13;
private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
@@ -276,16 +275,16 @@ public class SdlRouterService extends Service{
if(startSequenceComplete &&
!connectAsClient && (bluetoothTransport ==null
|| bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_NONE)){
- Log.e(TAG, "Serial service not initialized while registering app");
+ DebugTool.logError(TAG, "Serial service not initialized while registering app");
//Maybe we should try to do a connect here instead
- Log.d(TAG, "Serial service being restarted");
+ DebugTool.logInfo(TAG, "Serial service being restarted");
initBluetoothSerialService();
}
}
- Log.i(TAG, app.appId + " has just been registered with SDL Router Service");
+ DebugTool.logInfo(TAG, app.appId + " has just been registered with SDL Router Service");
}
/**
@@ -300,9 +299,9 @@ public class SdlRouterService extends Service{
{
String action = intent.getAction();
if(action == null){
- Log.d(TAG, "Disconnect received with no action.");
+ DebugTool.logInfo(TAG, "Disconnect received with no action.");
}else {
- Log.d(TAG, "Disconnect received. Action: " + intent.getAction());
+ DebugTool.logInfo(TAG, "Disconnect received. Action: " + intent.getAction());
if(action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
@@ -313,7 +312,7 @@ public class SdlRouterService extends Service{
return;
case BluetoothAdapter.STATE_TURNING_OFF:
case BluetoothAdapter.STATE_OFF:
- Log.d(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
+ DebugTool.logInfo(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
connectAsClient = false;
if(!shouldServiceRemainOpen(intent)){
closeSelf();
@@ -326,7 +325,7 @@ public class SdlRouterService extends Service{
//Otherwise
connectAsClient = false;
if (legacyModeEnabled) {
- Log.d(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
+ DebugTool.logInfo(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
enableLegacyMode(false);
onTransportDisconnected(new TransportRecord(TransportType.BLUETOOTH,null));
initBluetoothSerialService();
@@ -377,7 +376,7 @@ public class SdlRouterService extends Service{
BluetoothDevice device = receivedBundle.getParcelable(BluetoothDevice.EXTRA_DEVICE);
connectAsClient = true;
if(device==null || !service.bluetoothConnect(device)){
- Log.e(TAG, "Unable to connect to bluetooth device");
+ DebugTool.logError(TAG, "Unable to connect to bluetooth device");
connectAsClient = false;
}
}
@@ -392,7 +391,7 @@ public class SdlRouterService extends Service{
appId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
}
if(appId.length()<=0 || msg.replyTo == null){
- Log.w(TAG, "Unable to register app as no id or messenger was included");
+ DebugTool.logWarning(TAG, "Unable to register app as no id or messenger was included");
if(msg.replyTo!=null){
message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED;
try {
@@ -404,7 +403,7 @@ public class SdlRouterService extends Service{
break;
}
if(service.legacyModeEnabled){
- Log.w(TAG, "Unable to register app as legacy mode is enabled");
+ DebugTool.logWarning(TAG, "Unable to register app as legacy mode is enabled");
if(msg.replyTo!=null){
message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED;
try {
@@ -423,7 +422,7 @@ public class SdlRouterService extends Service{
synchronized(service.REGISTERED_APPS_LOCK){
RegisteredApp old = registeredApps.put(app.getAppId(), app);
if(old!=null){
- Log.w(TAG, "Replacing already existing app with this app id");
+ DebugTool.logWarning(TAG, "Replacing already existing app with this app id");
service.removeAllSessionsForApp(old, true);
old.close();
}
@@ -460,7 +459,7 @@ public class SdlRouterService extends Service{
if(appIdToUnregister == null){
appIdToUnregister = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
}
- Log.i(TAG, "Unregistering client: " + appIdToUnregister);
+ DebugTool.logInfo(TAG, "Unregistering client: " + appIdToUnregister);
RegisteredApp unregisteredApp;
synchronized(service.REGISTERED_APPS_LOCK){
unregisteredApp = registeredApps.remove(appIdToUnregister);
@@ -474,14 +473,14 @@ public class SdlRouterService extends Service{
response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_SUCESS;
service.removeAllSessionsForApp(unregisteredApp,false);
}
- Log.i(TAG, "Unregistering client response: " + response.arg1 );
+ DebugTool.logInfo(TAG, "Unregistering client response: " + response.arg1 );
try {
msg.replyTo.send(response); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
} catch (RemoteException e) {
e.printStackTrace();
}catch(NullPointerException e2){
- Log.e(TAG, "No reply address included, can't send a reply");
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
}
break;
@@ -521,7 +520,7 @@ public class SdlRouterService extends Service{
// This means no transport is connected. Likely the
// router service has already disconnected and this
// is now just executing.
- DebugTool.logError("Can't send packet, no transport specified and none are connected.");
+ DebugTool.logError(TAG, "Can't send packet, no transport specified and none are connected.");
return;
}
//Log.d(TAG, "Transport type was null, so router set it to " + transportType.name());
@@ -587,7 +586,7 @@ public class SdlRouterService extends Service{
} catch (RemoteException e) {
e.printStackTrace();
}catch(NullPointerException e2){
- Log.e(TAG, "No reply address included, can't send a reply");
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
}
break;
case TransportConstants.ROUTER_REMOVE_SESSION:
@@ -628,7 +627,7 @@ public class SdlRouterService extends Service{
} catch (RemoteException e) {
e.printStackTrace();
}catch(NullPointerException e2){
- Log.e(TAG, "No reply address included, can't send a reply");
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
}
break;
case TransportConstants.ROUTER_REQUEST_SECONDARY_TRANSPORT_CONNECTION:
@@ -721,7 +720,7 @@ public class SdlRouterService extends Service{
Message retMsg = Message.obtain();
retMsg.what = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE;
if(altTransportService == null){ //Ok no other transport is connected, this is good
- Log.d(TAG, "Alt transport connected.");
+ DebugTool.logInfo(TAG, "Alt transport connected.");
if(msg.replyTo == null){
break;
}
@@ -754,13 +753,13 @@ public class SdlRouterService extends Service{
if(packet!=null){
service.onPacketRead(packet);
}else{
- Log.w(TAG, "Received null packet from alt transport service");
+ DebugTool.logWarning(TAG, "Received null packet from alt transport service");
}
}else{
- Log.w(TAG, "False positive packet reception");
+ DebugTool.logWarning(TAG, "False positive packet reception");
}
}else{
- Log.e(TAG, "Bundle was null while sending packet to router service from alt transport");
+ DebugTool.logError(TAG, "Bundle was null while sending packet to router service from alt transport");
}
break;
default:
@@ -813,7 +812,7 @@ public class SdlRouterService extends Service{
}
break;
default:
- Log.w(TAG, "Unsupported request: " + msg.what);
+ DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
break;
}
}
@@ -905,7 +904,7 @@ public class SdlRouterService extends Service{
case TransportConstants.ALT_TRANSPORT_CONNECTED:
break;
default:
- Log.w(TAG, "Unsupported request: " + msg.what);
+ DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
break;
}
}
@@ -920,7 +919,7 @@ public class SdlRouterService extends Service{
//Check intent to send back the correct binder (client binding vs alt transport)
if(intent!=null){
if(closing){
- Log.w(TAG, "Denying bind request due to service shutting down.");
+ DebugTool.logWarning(TAG, "Denying bind request due to service shutting down.");
return null;
}
String requestType = intent.getAction();//intent.getIntExtra(TransportConstants.ROUTER_BIND_REQUEST_TYPE_EXTRA, TransportConstants.BIND_REQUEST_TYPE_CLIENT);
@@ -935,7 +934,7 @@ public class SdlRouterService extends Service{
}else if(TransportConstants.BIND_REQUEST_TYPE_USB_PROVIDER.equals(requestType)){
return this.usbTransferMessenger.getBinder();
}else{
- Log.w(TAG, "Unknown bind request type");
+ DebugTool.logWarning(TAG, "Unknown bind request type");
}
}
@@ -946,17 +945,17 @@ public class SdlRouterService extends Service{
@Override
public boolean onUnbind(Intent intent) {
- Log.d(TAG, "Unbind being called.");
+ DebugTool.logInfo(TAG, "Unbind being called.");
return super.onUnbind(intent);
}
private void notifyClients(final Message message){
if(message==null){
- Log.w(TAG, "Can't notify clients, message was null");
+ DebugTool.logWarning(TAG, "Can't notify clients, message was null");
return;
}
- Log.d(TAG, "Notifying "+ registeredApps.size()+ " clients");
+ DebugTool.logInfo(TAG, "Notifying "+ registeredApps.size()+ " clients");
int result;
synchronized(REGISTERED_APPS_LOCK){
Collection<RegisteredApp> apps = registeredApps.values();
@@ -1028,7 +1027,7 @@ public class SdlRouterService extends Service{
@SuppressWarnings("unused")
private void pingClients(){
Message message = Message.obtain();
- Log.d(TAG, "Pinging "+ registeredApps.size()+ " clients");
+ DebugTool.logInfo(TAG, "Pinging "+ registeredApps.size()+ " clients");
int result;
synchronized(REGISTERED_APPS_LOCK){
Collection<RegisteredApp> apps = registeredApps.values();
@@ -1088,16 +1087,16 @@ public class SdlRouterService extends Service{
*/
private boolean initCheck(){
if(!processCheck()){
- Log.e(TAG, "Not using correct process. Shutting down");
+ DebugTool.logError(TAG, "Not using correct process. Shutting down");
wrongProcess = true;
return false;
}
if(!permissionCheck(Manifest.permission.BLUETOOTH)){
- Log.e(TAG, "Bluetooth Permission is not granted. Shutting down");
+ DebugTool.logError(TAG, "Bluetooth Permission is not granted. Shutting down");
return false;
}
if(!AndroidTools.isServiceExported(this, new ComponentName(this, this.getClass()))){ //We want to check to see if our service is actually exported
- Log.e(TAG, "Service isn't exported. Shutting down");
+ DebugTool.logError(TAG, "Service isn't exported. Shutting down");
return false;
}
return true;
@@ -1163,7 +1162,7 @@ public class SdlRouterService extends Service{
try{
startForegroundService(serviceIntent);
}catch (Exception e){
- Log.e(TAG, "Unable to start next SDL router service. " + e.getMessage());
+ DebugTool.logError(TAG, "Unable to start next SDL router service. " + e.getMessage());
}
}
break;
@@ -1171,7 +1170,7 @@ public class SdlRouterService extends Service{
}
}
} else{
- Log.d(TAG, "No sdl apps found");
+ DebugTool.logInfo(TAG, "No sdl apps found");
return;
}
closing = true;
@@ -1259,7 +1258,9 @@ public class SdlRouterService extends Service{
address = device.getAddress();
}
}
- int timeout = getNotificationTimeout(address);
+ boolean confirmedDevice = intent.getBooleanExtra(TransportConstants.CONFIRMED_SDL_DEVICE, false);
+ int timeout = getNotificationTimeout(address, confirmedDevice);
+
enterForeground("Waiting for connection...", timeout, false);
resetForegroundTimeOut(timeout);
} else {
@@ -1272,7 +1273,7 @@ public class SdlRouterService extends Service{
if(intent.hasExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA)){
//Make sure we are listening on RFCOMM
if(startSequenceComplete){ //We only check if we are sure we are already through the start up process
- Log.i(TAG, "Received ping, making sure we are listening to bluetooth rfcomm");
+ DebugTool.logInfo(TAG, "Received ping, making sure we are listening to bluetooth rfcomm");
initBluetoothSerialService();
}
}
@@ -1300,7 +1301,7 @@ public class SdlRouterService extends Service{
altTransportTimerHandler = null;
}
- Log.w(TAG, "Sdl Router Service Destroyed");
+ DebugTool.logWarning(TAG, "Sdl Router Service Destroyed");
closing = true;
//No need for this Broadcast Receiver anymore
unregisterAllReceivers();
@@ -1383,9 +1384,9 @@ public class SdlRouterService extends Service{
* @return the amount of time for a timeout handler to remove the notification.
*/
@SuppressLint("MissingPermission")
- private int getNotificationTimeout(String address){
+ private int getNotificationTimeout(String address, boolean confirmedDevice){
if(address != null){
- if(hasSDLConnected(address)){
+ if(confirmedDevice || hasSDLConnected(address)){
return FOREGROUND_TIMEOUT * 2;
}else if(this.isFirstStatusCheck(address)) {
// If this is the first time the service has ever connected to this device we want
@@ -1441,9 +1442,9 @@ public class SdlRouterService extends Service{
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
private void enterForeground(String content, long chronometerLength, boolean ongoing) {
- DebugTool.logInfo("Attempting to enter the foreground - " + System.currentTimeMillis());
+ DebugTool.logInfo(TAG, "Attempting to enter the foreground - " + System.currentTimeMillis());
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB){
- Log.w(TAG, "Unable to start service as foreground due to OS SDK version being lower than 11");
+ DebugTool.logWarning(TAG, "Unable to start service as foreground due to OS SDK version being lower than 11");
isForeground = false;
return;
}
@@ -1514,7 +1515,7 @@ public class SdlRouterService extends Service{
notificationChannel.enableVibration(false);
notificationManager.createNotificationChannel(notificationChannel);
} else {
- Log.e(TAG, "Unable to retrieve notification Manager service");
+ DebugTool.logError(TAG, "Unable to retrieve notification Manager service");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
safeStartForeground(FOREGROUND_SERVICE_ID, builder.build());
stopSelf(); //A valid notification channel must be supplied for SDK 27+
@@ -1556,16 +1557,16 @@ public class SdlRouterService extends Service{
notification = builder.build();
}
startForeground(id, notification);
- DebugTool.logInfo("Entered the foreground - " + System.currentTimeMillis());
+ DebugTool.logInfo(TAG, "Entered the foreground - " + System.currentTimeMillis());
}catch (Exception e){
- DebugTool.logError("Unable to start service in foreground", e);
+ DebugTool.logError(TAG, "Unable to start service in foreground", e);
}
}
private void exitForeground(){
synchronized (FOREGROUND_NOTIFICATION_LOCK) {
if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
- DebugTool.logInfo("SdlRouterService to exit foreground");
+ DebugTool.logInfo(TAG, "SdlRouterService to exit foreground");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.stopForeground(Service.STOP_FOREGROUND_DETACH);
}else{
@@ -1579,7 +1580,7 @@ public class SdlRouterService extends Service{
notificationManager.deleteNotificationChannel(SDL_NOTIFICATION_CHANNEL_ID);
}
} catch (Exception e) {
- DebugTool.logError("Issue when removing notification and channel", e);
+ DebugTool.logError(TAG, "Issue when removing notification and channel", e);
}
}
isForeground = false;
@@ -1686,24 +1687,24 @@ public class SdlRouterService extends Service{
ArrayList<TransportRecord> connectedTransports = getConnectedTransports();
if(connectedTransports != null && !connectedTransports.isEmpty()){ // stay open if we have any transports connected
- Log.d(TAG, "1 or more transports connected, remaining open");
+ DebugTool.logInfo(TAG, "1 or more transports connected, remaining open");
return true;
}else if(altTransportService!=null || altTransportTimerHandler !=null){
//We have been started by an alt transport, we must remain open. "My life for Auir...."
- Log.d(TAG, "Alt Transport connected, remaining open");
+ DebugTool.logInfo(TAG, "Alt Transport connected, remaining open");
return true;
}else if(intent!=null && TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(intent.getAction())){
- Log.i(TAG, "Received start intent with alt transport request.");
+ DebugTool.logInfo(TAG, "Received start intent with alt transport request.");
startAltTransportTimer();
return true;
}else if(!bluetoothAvailable()){//If bluetooth isn't on...there's nothing to see here
//Bluetooth is off, we should shut down
- Log.d(TAG, "Bluetooth not available, shutting down service");
+ DebugTool.logInfo(TAG, "Bluetooth not available, shutting down service");
return connectedTransports != null && connectedTransports.size() > 0; //If a transport is connected the list will be >0
}else{
- Log.d(TAG, "Service to remain open");
+ DebugTool.logInfo(TAG, "Service to remain open");
return true;
}
}
@@ -1729,7 +1730,7 @@ public class SdlRouterService extends Service{
}
private synchronized void initBluetoothSerialService(){
if(legacyModeEnabled){
- Log.d(TAG, "Not starting own bluetooth during legacy mode");
+ DebugTool.logInfo(TAG, "Not starting own bluetooth during legacy mode");
return;
}
//init serial service
@@ -1740,7 +1741,7 @@ public class SdlRouterService extends Service{
// Only if the state is STATE_NONE, do we know that we haven't started already
if (bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_NONE) {
// Start the Bluetooth services
- Log.i(TAG, "Starting bluetooth transport");
+ DebugTool.logInfo(TAG, "Starting bluetooth transport");
bluetoothTransport.start();
}
@@ -1912,7 +1913,7 @@ public class SdlRouterService extends Service{
return;
}
- Log.e(TAG, "Notifying client service of hardware disconnect.");
+ DebugTool.logError(TAG, "Notifying client service of hardware disconnect.");
//We've notified our clients, less clean up the mess now.
@@ -2035,7 +2036,7 @@ public class SdlRouterService extends Service{
}
byte[] packet = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
if(packet==null) {
- Log.w(TAG, "Ignoring null packet");
+ DebugTool.logWarning(TAG, "Ignoring null packet");
return false;
}
int offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
@@ -2064,7 +2065,7 @@ public class SdlRouterService extends Service{
}
}
}
- Log.e(TAG, "Can't send data, no transport of specified type connected");
+ DebugTool.logError(TAG, "Can't send data, no transport of specified type connected");
return false;
}
@@ -2105,12 +2106,12 @@ public class SdlRouterService extends Service{
try {
altTransportService.send(msg);
} catch (RemoteException e) {
- Log.e(TAG, "Unable to send through alt transport!");
+ DebugTool.logError(TAG, "Unable to send through alt transport!");
e.printStackTrace();
}
return true;
}else{
- Log.w(TAG, "Unable to send packet through alt transport, it was null");
+ DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
}
return false;
}
@@ -2132,12 +2133,12 @@ public class SdlRouterService extends Service{
try {
altTransportService.send(msg);
} catch (RemoteException e) {
- Log.e(TAG, "Unable to send through alt transport!");
+ DebugTool.logError(TAG, "Unable to send through alt transport!");
e.printStackTrace();
}
return true;
}else{
- Log.w(TAG, "Unable to send packet through alt transport, it was null");
+ DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
}
return false;
}
@@ -2171,7 +2172,7 @@ public class SdlRouterService extends Service{
}
if(app == null){
- Log.e(TAG, "No app found for app id " + appid + " Removing session mapping and sending unregisterAI to head unit.");
+ DebugTool.logError(TAG, "No app found for app id " + appid + " Removing session mapping and sending unregisterAI to head unit.");
//We have no app to match the app id tied to this session
removeSessionFromMap(session, Collections.singletonList(packet.getTransportRecord().getType()));
@@ -2195,7 +2196,7 @@ public class SdlRouterService extends Service{
byte[] stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)packet.getVersion(), hashId).constructPacket();
manuallyWriteBytes(packet.getTransportRecord().getType(), stopService,0,stopService.length);
}else{
- Log.w(TAG, "No where to send a packet from what appears to be a non primary transport");
+ DebugTool.logWarning(TAG, "No where to send a packet from what appears to be a non primary transport");
}
return false;
@@ -2212,7 +2213,7 @@ public class SdlRouterService extends Service{
this.sessionHashIdMap.put(session, hashId);
}
} else {
- Log.w(TAG, "Hash ID not found in V5 start service ACK frame for session " + session);
+ DebugTool.logWarning(TAG, "Hash ID not found in V5 start service ACK frame for session " + session);
}
} else {
if (packet.getPayload() != null && packet.getDataSize() == 4){ //hashid will be 4 bytes in length
@@ -2228,7 +2229,7 @@ public class SdlRouterService extends Service{
if(packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
if (binFrameHeader != null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()) {
- Log.d(TAG, "Received an unregister app interface. Checking session hash before sending");
+ DebugTool.logInfo(TAG, "Received an unregister app interface. Checking session hash before sending");
// make sure that we don't try to unregister a recently added app that might have a
// session ID of a removed app whose UAI was delayed
int hashOfRemoved = this.cleanedSessionMap.get(session, -1);
@@ -2237,7 +2238,7 @@ public class SdlRouterService extends Service{
// Current session contains key that was held before
if (hashOfRemoved != currentHash) {
// App assigned same session id but is a different app. Keep this from being killed
- Log.d(TAG, "same session id for different apps found, dropping packet");
+ DebugTool.logInfo(TAG, "same session id for different apps found, dropping packet");
this.cleanedSessionMap.delete(session);
return false;
}
@@ -2284,14 +2285,14 @@ public class SdlRouterService extends Service{
message.setData(bundle);
//Log.d(TAG, "First packet before sending: " + message.getData().toString());
if(!sendPacketMessageToClient(app, message, version)){
- Log.w(TAG, "Error sending first message of split packet to client " + app.appId);
+ DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
return false;
}
//Log.w(TAG, "Message too big for single IPC transaction. Breaking apart. Size - " + packet.getDataSize());
ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appid,TransportConstants.ROUTER_RECEIVED_PACKET,bytes,0);
while(splitter.isActive()){
if(!sendPacketMessageToClient(app,splitter.nextMessage(),version)){
- Log.w(TAG, "Error sending first message of split packet to client " + app.appId);
+ DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
splitter.close();
return false;
}
@@ -2300,24 +2301,24 @@ public class SdlRouterService extends Service{
}
}else{ //If we can't find a session for this packet we just drop the packet
- Log.e(TAG, "App Id was NULL for session! " + session);
+ DebugTool.logError(TAG, "App Id was NULL for session! " + session);
TransportType transportType = packet.getTransportRecord().getType();
if(removeSessionFromMap(session, Collections.singletonList(transportType))){ //If we found the session id still tied to an app in our map we need to remove it and send the proper shutdown sequence.
- Log.i(TAG, "Removed session from map. Sending unregister request to module.");
+ DebugTool.logInfo(TAG, "Removed session from map. Sending unregister request to module.");
attemptToCleanUpModule(session, packet.getVersion(), transportType);
}else{ //There was no mapping so let's try to resolve this
if(packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC){
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
if(binFrameHeader!=null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()){
- Log.d(TAG, "Received an unregister app interface with no where to send it, dropping the packet.");
+ DebugTool.logInfo(TAG, "Received an unregister app interface with no where to send it, dropping the packet.");
}else{
attemptToCleanUpModule(session, packet.getVersion(),transportType);
}
}else if((packet.getFrameType() == FrameType.Control
&& (packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_NAK))){
//We want to ignore this
- Log.d(TAG, "Received a stop service ack/nak with no where to send it, dropping the packet.");
+ DebugTool.logInfo(TAG, "Received a stop service ack/nak with no where to send it, dropping the packet.");
}else{
attemptToCleanUpModule(session, packet.getVersion(),transportType);
}
@@ -2334,7 +2335,7 @@ public class SdlRouterService extends Service{
* @param version the last known version that this session was operating with
*/
private void attemptToCleanUpModule(int session, int version, TransportType primaryTransport){
- Log.i(TAG, "Attempting to stop session " + session);
+ DebugTool.logInfo(TAG, "Attempting to stop session " + session);
byte[] uai = createForceUnregisterApp((byte)session, (byte)version);
manuallyWriteBytes(primaryTransport,uai,0,uai.length);
int hashId = 0;
@@ -2352,7 +2353,7 @@ public class SdlRouterService extends Service{
private boolean sendPacketMessageToClient(RegisteredApp app, Message message, byte version){
int result = app.sendMessage(message);
if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
- Log.d(TAG, "Dead object, removing app and sessions");
+ DebugTool.logInfo(TAG, "Dead object, removing app and sessions");
//Get all their sessions and send out unregister info
//Use the version in this packet as a best guess
app.close();
@@ -2406,7 +2407,7 @@ public class SdlRouterService extends Service{
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if(adapter != null && adapter.isEnabled()){
Set<BluetoothDevice> pairedBT= adapter.getBondedDevices();
- Log.d(TAG, "Query Bluetooth paired devices");
+ DebugTool.logInfo(TAG, "Query Bluetooth paired devices");
if (pairedBT.size() > 0) {
for (BluetoothDevice device : pairedBT) {
String name = device.getName().toLowerCase(Locale.US);
@@ -2417,14 +2418,14 @@ public class SdlRouterService extends Service{
}
}
}else{
- Log.e(TAG, "There was an issue with connecting as client");
+ DebugTool.logError(TAG, "There was an issue with connecting as client");
}
return false;
}
@SuppressWarnings("MissingPermission")
private synchronized boolean bluetoothConnect(BluetoothDevice device){
- Log.d(TAG,"Connecting to device: " + device.getName());
+ DebugTool.logInfo(TAG,"Connecting to device: " + device.getName());
if(bluetoothTransport == null || !bluetoothTransport.isConnected())
{ // Set up the Bluetooth serial object
bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
@@ -2437,7 +2438,7 @@ public class SdlRouterService extends Service{
}
}
- Log.d(TAG, "Bluetooth SPP Connect Attempt Completed");
+ DebugTool.logInfo(TAG, "Bluetooth SPP Connect Attempt Completed");
return false;
}
@@ -2455,7 +2456,7 @@ public class SdlRouterService extends Service{
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public static void setBluetoothPrefs (int level, String prefLocation) {
- Log.w(TAG, "This method is deprecated and will not take any action");
+ DebugTool.logWarning(TAG, "This method is deprecated and will not take any action");
}
/**
@@ -2510,7 +2511,7 @@ public class SdlRouterService extends Service{
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(key,value);
editor.commit();
- Log.d(TAG, "Preference set: " + key + " : " + value);
+ DebugTool.logInfo(TAG, "Preference set: " + key + " : " + value);
}
/**
@@ -2537,10 +2538,10 @@ public class SdlRouterService extends Service{
@Deprecated
protected static LocalRouterService getLocalRouterService(Intent launchIntent, ComponentName name){
if(launchIntent == null){
- Log.w(TAG, "Supplied intent was null, local router service will not contain intent");
+ DebugTool.logWarning(TAG, "Supplied intent was null, local router service will not contain intent");
}
if(name == null){
- Log.e(TAG, "Unable to create local router service object because component name was null");
+ DebugTool.logError(TAG, "Unable to create local router service object because component name was null");
return null;
}
//noinspection deprecation
@@ -2739,7 +2740,7 @@ public class SdlRouterService extends Service{
app.registerTransport(sessionId, transportType);
sessionMap.put(sessionId,appId);
}else{
- Log.w(TAG, "No registered app found when register secondary transport");
+ DebugTool.logWarning(TAG, "No registered app found when register secondary transport");
}
}
}
@@ -2757,7 +2758,7 @@ public class SdlRouterService extends Service{
private boolean legacyModeEnabled = false;
private void enableLegacyMode(boolean enable){
- Log.d(TAG, "Enable legacy mode: " + enable);
+ DebugTool.logInfo(TAG, "Enable legacy mode: " + enable);
legacyModeEnabled = enable; //We put this at the end to avoid a race condition between the bluetooth d/c and notify of legacy mode enabled
if(legacyModeEnabled){
@@ -2779,13 +2780,13 @@ public class SdlRouterService extends Service{
//DEBUG
if(bytes[0] != 0x00){
- Log.d(TAG, "Writing packet with header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
+ DebugTool.logInfo(TAG, "Writing packet with header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
}else{
//Log.d(TAG, "Writing packet with binary header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
//int length = bytes.length-12;
if(bytes.length<=8){
- Log.w(TAG, "No payload to debug or too small");
+ DebugTool.logWarning(TAG, "No payload to debug or too small");
return;
}
//Check first byte if 0, make to json
@@ -2796,7 +2797,7 @@ public class SdlRouterService extends Service{
try {
JSONObject object = new JSONObject(new String(buffer));
- Log.d(TAG, "JSON: " + object.toString());
+ DebugTool.logInfo(TAG, "JSON: " + object.toString());
} catch (JSONException e) {
e.printStackTrace();
}
@@ -2890,7 +2891,7 @@ public class SdlRouterService extends Service{
return;
}
if(isPingingClients){
- Log.w(TAG, "Already pinging clients. Resting count");
+ DebugTool.logWarning(TAG, "Already pinging clients. Resting count");
synchronized(PING_COUNT_LOCK){
pingCount = 0;
}
@@ -2909,7 +2910,7 @@ public class SdlRouterService extends Service{
@Override
public void run() {
if(getPingCount()>=10){
- Log.d(TAG, "Hit ping limit");
+ DebugTool.logInfo(TAG, "Hit ping limit");
stopClientPings();
return;
}
@@ -3405,7 +3406,7 @@ public class SdlRouterService extends Service{
}
if(buffer != null){
if (!buffer.handleMessage(flags, packet)) { //If this returns false
- Log.e(TAG, "Error handling bytes");
+ DebugTool.logError(TAG, "Error handling bytes");
}
if (buffer.isFinished()) { //We are finished building the buffer so we should write the bytes out
byte[] bytes = buffer.getBytes();
@@ -3449,7 +3450,7 @@ public class SdlRouterService extends Service{
if(queue!=null && queue.peek().priorityCoefficient>0){ //If this has any sort of priority coefficient we want to make it wait.
//Flag to wait
if(queueWaitHandler == null){
- Log.e(TAG, "Unable to pause queue, handler was null");
+ DebugTool.logError(TAG, "Unable to pause queue, handler was null");
}
if(queueWaitRunnable == null){
queueWaitRunnable = new Runnable(){
@@ -3488,7 +3489,7 @@ public class SdlRouterService extends Service{
@Override
public void binderDied() {
synchronized(deathLock){
- Log.w(TAG, "Binder died for app " + RegisteredApp.this.appId);
+ DebugTool.logWarning(TAG, "Binder died for app " + RegisteredApp.this.appId);
if(messenger.getBinder()!=null){
messenger.getBinder().unlinkToDeath(this, 0);
}
@@ -3819,7 +3820,7 @@ public class SdlRouterService extends Service{
builder.setOngoing(false);
- Log.e(TAG, "Notification: notifySppError entering");
+ DebugTool.logError(TAG, "Notification: notifySppError entering");
final String tag = "SDL";
//Now we need to add a notification channel
final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@@ -3836,7 +3837,7 @@ public class SdlRouterService extends Service{
Notification notification = builder.build();
notificationManager.notify(tag, TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT, notification);
} else {
- Log.e(TAG, "notifySppError: Unable to retrieve notification Manager service");
+ DebugTool.logError(TAG, "notifySppError: Unable to retrieve notification Manager service");
}
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
index 53e1dbbed..6a7230fcd 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
@@ -42,9 +42,9 @@ import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
-import android.util.Log;
import com.smartdevicelink.util.AndroidTools;
+import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
@@ -66,7 +66,7 @@ public class SdlRouterStatusProvider {
private ServiceConnection routerConnection= new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
- Log.d(TAG, "Bound to service " + className.toString());
+ DebugTool.logInfo(TAG, "Bound to service " + className.toString());
routerServiceMessenger = new Messenger(service);
isBound = true;
//So we just established our connection
@@ -86,7 +86,7 @@ public class SdlRouterStatusProvider {
}
public void onServiceDisconnected(ComponentName className) {
- Log.d(TAG, "UN-Bound from service " + className.getClassName());
+ DebugTool.logInfo(TAG, "UN-Bound from service " + className.getClassName());
routerServiceMessenger = null;
isBound = false;
}
@@ -146,7 +146,7 @@ public class SdlRouterStatusProvider {
if(context!=null && routerConnection!=null){
context.unbindService(routerConnection);
}else{
- Log.w(TAG, "Unable to unbind from router service, context was null");
+ DebugTool.logWarning(TAG, "Unable to unbind from router service, context was null");
}
}catch(IllegalArgumentException e){
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java
index 0fa64d7f5..32fe26fee 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java
@@ -39,6 +39,7 @@ import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
public abstract class SdlTransport {
+ private static final String TAG = "SdlTransport";
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
private final static String FailurePropagating_Msg = "Failure propagating ";
@@ -73,7 +74,7 @@ public abstract class SdlTransport {
_transportListener.onTransportPacketReceived(packet);
} // end-if
} catch (Exception excp) {
- DebugTool.logError(FailurePropagating_Msg + "handleBytesFromTransport: " + excp.toString(), excp);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "handleBytesFromTransport: " + excp.toString(), excp);
handleTransportError(FailurePropagating_Msg, excp);
} // end-catch
} // end-method
@@ -113,7 +114,7 @@ public abstract class SdlTransport {
SdlTrace.logTransportEvent("Transport.connected", null, InterfaceActivityDirection.Receive, null, 0, SDL_LIB_TRACE_KEY);
_transportListener.onTransportConnected();
} catch (Exception excp) {
- DebugTool.logError(FailurePropagating_Msg + "onTransportConnected: " + excp.toString(), excp);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "onTransportConnected: " + excp.toString(), excp);
handleTransportError(FailurePropagating_Msg + "onTransportConnected", excp);
} // end-catch
} // end-method
@@ -127,7 +128,7 @@ public abstract class SdlTransport {
SdlTrace.logTransportEvent("Transport.disconnect: " + info, null, InterfaceActivityDirection.Transmit, null, 0, SDL_LIB_TRACE_KEY);
_transportListener.onTransportDisconnected(info);
} catch (Exception excp) {
- DebugTool.logError(FailurePropagating_Msg + "onTransportDisconnected: " + excp.toString(), excp);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "onTransportDisconnected: " + excp.toString(), excp);
} // end-catch
} // end-method
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
index 4ae010a8c..3629e883c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
@@ -35,12 +35,12 @@ import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.NetworkOnMainThreadException;
-import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.io.InputStream;
@@ -77,7 +77,7 @@ import java.net.Socket;
* Class that implements TCP transport
*/
public class TCPTransport extends SdlTransport {
-
+ private static final String TAG = "TCPTransport";
/**
* Size of the read buffer.
*/
@@ -293,7 +293,7 @@ public class TCPTransport extends SdlTransport {
* @param message Message to log
*/
protected void logInfo(String message) {
- Log.i(getClass().getName(), message);
+ DebugTool.logInfo(TAG, message);
}
/**
@@ -301,7 +301,7 @@ public class TCPTransport extends SdlTransport {
* @param message Message to log
*/
protected void logError(String message) {
- Log.e(getClass().getName(), message);
+ DebugTool.logError(TAG, message);
}
/**
@@ -309,7 +309,7 @@ public class TCPTransport extends SdlTransport {
* @param message Message to log
*/
protected void logWarning(String message) {
- Log.w(getClass().getName(), message);
+ DebugTool.logWarning(TAG, message);
}
/**
@@ -318,7 +318,7 @@ public class TCPTransport extends SdlTransport {
* @param throwable Exception, that was the main reason for logged error message
*/
protected void logError(String message, Throwable throwable) {
- Log.e(getClass().getName(), message, throwable);
+ DebugTool.logError(TAG, message, throwable);
}
/**
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
index 29e0c3aa1..aca8789ac 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
@@ -2,7 +2,6 @@ package com.smartdevicelink.transport;
import android.os.Handler;
import android.os.Message;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
@@ -21,7 +20,7 @@ public class TCPTransportManager extends TransportManagerBase{
public TCPTransportManager(TCPTransportConfig config, TransportEventListener transportEventListener){
super(config,transportEventListener);
- Log.d(TAG, "USING THE TCP TRANSPORT MANAGER");
+ DebugTool.logInfo(TAG, "USING THE TCP TRANSPORT MANAGER");
this.config = config;
tcpHandler = new TCPHandler(this);
transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(),tcpHandler, null);
@@ -98,7 +97,7 @@ public class TCPTransportManager extends TransportManagerBase{
service.transportStatus.clear();
service.transportStatus.add(service.transport.getTransportRecord());
}
- DebugTool.logInfo("TCP transport has connected");
+ DebugTool.logInfo(TAG, "TCP transport has connected");
service.transportListener.onTransportConnected(service.transportStatus);
break;
case MultiplexBaseTransport.STATE_CONNECTING:
@@ -120,7 +119,7 @@ public class TCPTransportManager extends TransportManagerBase{
}
break;
case MultiplexBaseTransport.STATE_ERROR:
- Log.d(TAG, "TCP transport encountered an error");
+ DebugTool.logInfo(TAG, "TCP transport encountered an error");
service.transportListener.onError("TCP transport encountered an error" );
break;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
index 710e9d610..becbdcbb4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
@@ -48,7 +48,6 @@ import android.os.Messenger;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.TransactionTooLargeException;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
@@ -86,8 +85,7 @@ public class TransportBroker {
private Context currentContext = null;
private final Object INIT_LOCK = new Object();
-
- private TransportType queuedOnTransportConnect = null;
+ private final Object MESSAGE_SEND_LOCK = new Object();
Messenger routerServiceMessenger = null;
final Messenger clientMessenger;
@@ -108,7 +106,7 @@ public class TransportBroker {
routerConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
- Log.d(TAG, "Bound to service " + className.toString());
+ DebugTool.logInfo(TAG, "Bound to service " + className.toString());
routerServiceMessenger = new Messenger(service);
isBound = true;
//So we just established our connection
@@ -117,7 +115,7 @@ public class TransportBroker {
}
public void onServiceDisconnected(ComponentName className) {
- Log.d(TAG, "Unbound from service " + className.getClassName());
+ DebugTool.logInfo(TAG, "Unbound from service " + className.getClassName());
routerServiceMessenger = null;
registeredWithRouterService = false;
isBound = false;
@@ -126,59 +124,55 @@ public class TransportBroker {
};
}
- protected synchronized boolean sendMessageToRouterService(Message message) {
+ protected boolean sendMessageToRouterService(Message message) {
return sendMessageToRouterService(message, 0);
}
- protected synchronized boolean sendMessageToRouterService(Message message, int retryCount) {
- if (message == null) {
- Log.w(TAG, "Attempted to send null message");
- return false;
- }
- //Log.i(TAG, "Attempting to send message type - " + message.what);
- if (isBound && routerServiceMessenger != null) {
- if (registeredWithRouterService
- || message.what == TransportConstants.ROUTER_REGISTER_CLIENT) { //We can send a message if we are registered or are attempting to register
- try {
- routerServiceMessenger.send(message);
- return true;
- } catch (RemoteException e) {
- e.printStackTrace();
- //Let's check to see if we should retry
- if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && e instanceof TransactionTooLargeException )
- || (retryCount < 5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder())) { //We probably just failed on a small transaction =\
- try {
- Thread.sleep(100);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
+ protected boolean sendMessageToRouterService(Message message, int retryCount) {
+ synchronized (MESSAGE_SEND_LOCK) {
+ if (message == null) {
+ DebugTool.logWarning(TAG, "Attempted to send null message");
+ return false;
+ }
+ //Log.i(TAG, "Attempting to send message type - " + message.what);
+ if (isBound && routerServiceMessenger != null && routerServiceMessenger.getBinder() != null && routerServiceMessenger.getBinder().isBinderAlive()) {
+ if (registeredWithRouterService
+ || message.what == TransportConstants.ROUTER_REGISTER_CLIENT) { //We can send a message if we are registered or are attempting to register
+ try {
+ routerServiceMessenger.send(message);
+ return true;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ //Let's check to see if we should retry
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && e instanceof TransactionTooLargeException)
+ || (retryCount < 5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder())) { //We probably just failed on a small transaction =\
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ return sendMessageToRouterService(message, retryCount++);
+ } else {
+ //DeadObject, time to kill our connection
+ DebugTool.logInfo(TAG, "Dead object while attempting to send packet");
+ stop();
+ onHardwareDisconnected(null, null);
+ return false;
}
- return sendMessageToRouterService(message, retryCount++);
- } else {
- //DeadObject, time to kill our connection
- Log.d(TAG, "Dead object while attempting to send packet");
- routerServiceMessenger = null;
- registeredWithRouterService = false;
- unBindFromRouterService();
- isBound = false;
+ } catch (NullPointerException e) {
+ DebugTool.logInfo(TAG, "Null messenger while attempting to send packet"); // NPE, routerServiceMessenger is null
+ stop();
onHardwareDisconnected(null, null);
return false;
}
- } catch (NullPointerException e) {
- Log.d(TAG, "Null messenger while attempting to send packet"); // NPE, routerServiceMessenger is null
- routerServiceMessenger = null;
- registeredWithRouterService = false;
- unBindFromRouterService();
- isBound = false;
- onHardwareDisconnected(null, null);
+ } else {
+ DebugTool.logError(TAG, "Unable to send message to router service. Not registered.");
return false;
}
} else {
- Log.e(TAG, "Unable to send message to router service. Not registered.");
+ DebugTool.logError(TAG, "Unable to send message to router service. Not bound.");
return false;
}
- } else {
- Log.e(TAG, "Unable to send message to router service. Not bound.");
- return false;
}
}
@@ -199,7 +193,7 @@ public class TransportBroker {
public void handleMessage(Message msg) {
TransportBroker broker = provider.get();
if (broker == null) {
- Log.e(TAG, "Broker object null, unable to process message");
+ DebugTool.logError(TAG, "Broker object null, unable to process message");
return;
}
Bundle bundle = msg.getData();
@@ -238,7 +232,7 @@ public class TransportBroker {
}
break;
case TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED:
- Log.d(TAG, "Denied registration because router is in legacy mode");
+ DebugTool.logInfo(TAG, "Denied registration because router is in legacy mode");
broker.registeredWithRouterService = false;
broker.enableLegacyMode(true);
//We call this so we can start the process of legacy connection
@@ -247,7 +241,7 @@ public class TransportBroker {
break;
default:
broker.registeredWithRouterService = false;
- Log.w(TAG, "Registration denied from router service. Reason - " + msg.arg1);
+ DebugTool.logWarning(TAG, "Registration denied from router service. Reason - " + msg.arg1);
break;
}
;
@@ -260,14 +254,14 @@ public class TransportBroker {
} else { //We were denied our unregister request to the router service, let's see why
- Log.w(TAG, "Unregister request denied from router service. Reason - " + msg.arg1);
+ DebugTool.logWarning(TAG, "Unregister request denied from router service. Reason - " + msg.arg1);
//Do we care?
}
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
if(bundle == null){
- DebugTool.logWarning("Received packet message from router service with no bundle");
+ DebugTool.logWarning(TAG, "Received packet message from router service with no bundle");
return;
}
//So the intent has a packet with it. PEFRECT! Let's send it through the library
@@ -288,7 +282,7 @@ public class TransportBroker {
broker.onPacketReceived(packet);
} else {
- Log.w(TAG, "Received null packet from router service, not passing along");
+ DebugTool.logWarning(TAG, "Received null packet from router service, not passing along");
}
} else if (flags == TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED) {
broker.bufferedPacket = (SdlPacket) packet;
@@ -306,7 +300,7 @@ public class TransportBroker {
byte[] chunk = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
if (!broker.bufferedPayloadAssembler.handleMessage(flags, chunk)) {
//If there was a problem
- Log.e(TAG, "Error handling bytes for split packet");
+ DebugTool.logError(TAG, "Error handling bytes for split packet");
}
if (broker.bufferedPayloadAssembler.isFinished()) {
broker.bufferedPacket.setPayload(broker.bufferedPayloadAssembler.getBytes());
@@ -320,18 +314,18 @@ public class TransportBroker {
//}
//}
} else {
- Log.w(TAG, "Flase positive packet reception");
+ DebugTool.logWarning(TAG, "Flase positive packet reception");
}
break;
case TransportConstants.HARDWARE_CONNECTION_EVENT:
if(bundle == null){
- DebugTool.logWarning("Received hardware connection message from router service with no bundle");
+ DebugTool.logWarning(TAG, "Received hardware connection message from router service with no bundle");
return;
}
if (bundle.containsKey(TransportConstants.TRANSPORT_DISCONNECTED)
|| bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
//We should shut down, so call
- Log.d(TAG, "Hardware disconnected");
+ DebugTool.logInfo(TAG, "Hardware disconnected");
if (isLegacyModeEnabled()) {
broker.onLegacyModeEnabled();
} else {
@@ -416,7 +410,6 @@ public class TransportBroker {
}
//this.appId = appId.concat(timeStamp);
this.appId = appId;
- queuedOnTransportConnect = null;
currentContext = context;
//Log.d(TAG, "Registering our reply receiver: " + whereToReply);
this.routerService = service;
@@ -448,7 +441,6 @@ public class TransportBroker {
synchronized (INIT_LOCK) {
unregisterWithRouterService();
routerServiceMessenger = null;
- queuedOnTransportConnect = null;
unBindFromRouterService();
isBound = false;
}
@@ -458,24 +450,23 @@ public class TransportBroker {
* This method will end our communication with the router service.
*/
public void stop() {
- DebugTool.logInfo("Stopping transport broker for " + whereToReply);
+ DebugTool.logInfo(TAG, "Stopping transport broker for " + whereToReply);
synchronized (INIT_LOCK) {
unregisterWithRouterService();
unBindFromRouterService();
routerServiceMessenger = null;
- queuedOnTransportConnect = null;
currentContext = null;
}
}
- private synchronized void unBindFromRouterService() {
+ private void unBindFromRouterService() {
try {
getContext().unbindService(routerConnection);
} catch (Exception e) {
//This is ok
- Log.w(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
+ DebugTool.logWarning(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
}finally {
isBound = false;
}
@@ -487,27 +478,17 @@ public class TransportBroker {
public void onServiceUnregsiteredFromRouterService(int unregisterCode) {
- queuedOnTransportConnect = null;
}
@Deprecated
public void onHardwareDisconnected(TransportType type) {
- routerServiceDisconnect();
+ stop();
}
public void onHardwareDisconnected(TransportRecord record, List<TransportRecord> connectedTransports) {
}
- private void routerServiceDisconnect() {
- synchronized (INIT_LOCK) {
- unBindFromRouterService();
- routerServiceMessenger = null;
- routerConnection = null;
- queuedOnTransportConnect = null;
- }
- }
-
/**
* WILL NO LONGER BE CALLED
*
@@ -518,7 +499,6 @@ public class TransportBroker {
public boolean onHardwareConnected(TransportType type) {
synchronized (INIT_LOCK) {
if (routerServiceMessenger == null) {
- queuedOnTransportConnect = type;
return false;
}
return true;
@@ -528,7 +508,6 @@ public class TransportBroker {
public boolean onHardwareConnected(List<TransportRecord> transports) {
synchronized (INIT_LOCK) {
if (routerServiceMessenger == null && transports != null && transports.size() > 0) {
- queuedOnTransportConnect = transports.get(transports.size() - 1).getType();
return false;
}
return true;
@@ -575,14 +554,14 @@ public class TransportBroker {
//Log.d(TAG,whereToReply + "Sending packet to router service");
if (routerServiceMessenger == null) {
- Log.d(TAG, whereToReply + " tried to send packet, but no where to send");
+ DebugTool.logInfo(TAG, whereToReply + " tried to send packet, but no where to send");
return false;
}
if (packet == null
//|| offset<0
//|| count<0
) {//|| count>(bytes.length-offset)){
- Log.w(TAG, whereToReply + "incorrect params supplied");
+ DebugTool.logWarning(TAG, whereToReply + "incorrect params supplied");
return false;
}
byte[] bytes = packet.constructPacket();
@@ -616,7 +595,7 @@ public class TransportBroker {
ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appId, TransportConstants.ROUTER_SEND_PACKET, bytes, packet.getPrioirtyCoefficient());
splitter.setRouterServiceVersion(routerServiceVersion);
splitter.setTransportRecord(packet.getTransportRecord());
- while (splitter.isActive()) {
+ while (splitter.isActive() && routerServiceMessenger != null) {
sendMessageToRouterService(splitter.nextMessage());
}
return splitter.close();
@@ -629,18 +608,18 @@ public class TransportBroker {
*/
private boolean registerWithRouterService() {
if (getContext() == null) {
- Log.e(TAG, "Context set to null, failing out");
+ DebugTool.logError(TAG, "Context set to null, failing out");
return false;
}
if (routerServiceMessenger != null) {
- Log.w(TAG, "Already registered with router service");
+ DebugTool.logWarning(TAG, "Already registered with router service");
return false;
}
//Make sure we know where to bind to
if (this.routerService == null) {
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.O) && !isRouterServiceRunning(getContext())) {//We should be able to ignore this case because of the validation now
- Log.d(TAG, whereToReply + " found no router service. Shutting down.");
+ DebugTool.logInfo(TAG, whereToReply + " found no router service. Shutting down.");
this.onHardwareDisconnected(null);
return false;
}
@@ -650,7 +629,7 @@ public class TransportBroker {
}
if (!sendBindingIntent()) {
- Log.e(TAG, "Something went wrong while trying to bind with the router service.");
+ DebugTool.logError(TAG, "Something went wrong while trying to bind with the router service.");
SdlBroadcastReceiver.queryForConnectedService(currentContext);
return false;
}
@@ -661,11 +640,11 @@ public class TransportBroker {
@SuppressLint("InlinedApi")
private boolean sendBindingIntent() {
if(this.isBound){
- Log.e(TAG, "Already bound");
+ DebugTool.logError(TAG, "Already bound");
return false;
}
if (this.routerPackage != null && this.routerClassName != null) {
- Log.d(TAG, "Sending bind request to " + this.routerPackage + " - " + this.routerClassName);
+ DebugTool.logInfo(TAG, "Sending bind request to " + this.routerPackage + " - " + this.routerClassName);
Intent bindingIntent = new Intent();
bindingIntent.setClassName(this.routerPackage, this.routerClassName);//This sets an explicit intent
//Quickly make sure it's just up and running
@@ -690,7 +669,7 @@ public class TransportBroker {
}
private void unregisterWithRouterService() {
- Log.i(TAG, "Attempting to unregister with Sdl Router Service");
+ DebugTool.logInfo(TAG, "Attempting to unregister with Sdl Router Service");
if (isBound && routerServiceMessenger != null) {
Message msg = Message.obtain();
msg.what = TransportConstants.ROUTER_UNREGISTER_CLIENT;
@@ -703,7 +682,7 @@ public class TransportBroker {
msg.setData(bundle);
sendMessageToRouterService(msg);
} else {
- Log.w(TAG, "Unable to unregister, not bound to router service");
+ DebugTool.logWarning(TAG, "Unable to unregister, not bound to router service");
}
routerServiceMessenger = null;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
index 1a0951503..5039b0e0e 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -44,11 +44,11 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.enums.ControlFrameTags;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.SdlDeviceListener;
import com.smartdevicelink.transport.utl.TransportRecord;
import com.smartdevicelink.util.DebugTool;
@@ -96,11 +96,11 @@ public class TransportManager extends TransportManagerBase{
validator.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
@Override
public void onFinishedValidation(boolean valid, ComponentName name) {
- DebugTool.logInfo("onFinishedValidation valid=" + valid + "; name=" + ((name == null)? "null" : name.getPackageName()));
+ DebugTool.logInfo(TAG, "onFinishedValidation valid=" + valid + "; name=" + ((name == null)? "null" : name.getPackageName()));
if (valid) {
mConfig.service = name;
transport = new TransportBrokerImpl(contextWeakReference.get(), mConfig.appId, mConfig.service);
- DebugTool.logInfo("TransportManager start got called; transport=" + transport);
+ DebugTool.logInfo(TAG, "TransportManager start was called; transport=" + transport);
if(transport != null){
transport.start();
}
@@ -245,7 +245,7 @@ public class TransportManager extends TransportManagerBase{
if(transport != null){
transport.requestNewSession(transportRecord);
}else if(legacyBluetoothTransport != null){
- Log.w(TAG, "Session requested for non-bluetooth transport while in legacy mode");
+ DebugTool.logWarning(TAG, "Session requested for non-bluetooth transport while in legacy mode");
}
}
@@ -294,7 +294,7 @@ public class TransportManager extends TransportManagerBase{
@Override
public synchronized boolean onHardwareConnected(List<TransportRecord> transports) {
super.onHardwareConnected(transports);
- DebugTool.logInfo("OnHardwareConnected");
+ DebugTool.logInfo(TAG, "OnHardwareConnected");
if(shuttingDown){
return false;
}
@@ -302,6 +302,16 @@ public class TransportManager extends TransportManagerBase{
transportStatus.clear();
transportStatus.addAll(transports);
}
+ //If a bluetooth device has connected, make sure to save the mac address in the case
+ //this app is asked to host the router service, the app knows to do so immediately on connection.
+ if(transports != null && transports.size() > 0) {
+ for (TransportRecord record : transports) {
+ if(record != null && TransportType.BLUETOOTH.equals(record.getType())) {
+ SdlDeviceListener.setSDLConnectedStatus(contextWeakReference.get(), record.getAddress(),true);
+ }
+ }
+ }
+
transportListener.onTransportConnected(transports);
return true;
}
@@ -310,9 +320,9 @@ public class TransportManager extends TransportManagerBase{
@Override
public synchronized void onHardwareDisconnected(TransportRecord record, List<TransportRecord> connectedTransports) {
if(record != null){
- Log.d(TAG, "Transport disconnected - " + record);
+ DebugTool.logInfo(TAG, "Transport disconnected - " + record);
}else{
- Log.d(TAG, "Transport disconnected");
+ DebugTool.logInfo(TAG, "Transport disconnected");
}
if(shuttingDown){
@@ -344,7 +354,7 @@ public class TransportManager extends TransportManagerBase{
if (foundMatch) { //Remove item after the loop to avoid concurrent modifications
TransportManager.this.transportStatus.remove(record);
- Log.d(TAG, "Handling corner case of transport disconnect mismatch");
+ DebugTool.logInfo(TAG, "Handling corner case of transport disconnect mismatch");
}
}
}
@@ -471,7 +481,7 @@ public class TransportManager extends TransportManagerBase{
}else if(action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
if(bluetoothState == BluetoothAdapter.STATE_TURNING_OFF || bluetoothState == BluetoothAdapter.STATE_OFF){
- Log.d(TAG, "Bluetooth is shutting off, exiting legacy mode.");
+ DebugTool.logInfo(TAG, "Bluetooth is shutting off, exiting legacy mode.");
exitLegacyMode("Bluetooth adapter shutting off");
}
}
@@ -519,7 +529,7 @@ public class TransportManager extends TransportManagerBase{
service.exitLegacyMode("Lost connection");
break;
case MultiplexBaseTransport.STATE_ERROR:
- Log.d(TAG, "Bluetooth serial server error received, setting state to none, and clearing local copy");
+ DebugTool.logInfo(TAG, "Bluetooth serial server error received, setting state to none, and clearing local copy");
service.exitLegacyMode("Transport error");
break;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
index b724377ed..419ba6ca3 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
@@ -42,7 +42,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.RequiresApi;
-import android.util.Log;
import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.DebugTool;
@@ -118,7 +117,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
}
final Intent intent = getIntent();
String action = intent.getAction();
- Log.d(TAG, "Received intent with action: " + action);
+ DebugTool.logInfo(TAG, "Received intent with action: " + action);
if (UsbManager.ACTION_USB_ACCESSORY_ATTACHED.equals(action)) {
usbAccessory = intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
@@ -164,8 +163,8 @@ public class USBAccessoryAttachmentActivity extends Activity {
serviceIntent = new Intent();
serviceIntent.setComponent(optimalRouterService.getRouterServiceComponentName());
} else{
- Log.d(TAG, "No SDL Router Services found");
- Log.d(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ DebugTool.logInfo(TAG, "No SDL Router Services found");
+ DebugTool.logInfo(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
// At this point to ensure that USB connection is still possible it might be
// worth trying to use the legacy USB transport scheme
attemptLegacyUsbConnection(usbAccessory);
@@ -184,7 +183,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
if(startedService == null){
// A router service was not started or is not running.
- DebugTool.logError(TAG + " - Error starting router service. Attempting legacy connection ");
+ DebugTool.logError(TAG, " - Error starting router service. Attempting legacy connection ");
attemptLegacyUsbConnection(usbAccessory);
return;
}
@@ -207,7 +206,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
}
} catch (SecurityException e) {
- Log.e(TAG, "Security exception, process is bad");
+ DebugTool.logError(TAG, "Security exception, process is bad");
}
} else {
if (usbAccessory!=null) {
@@ -226,13 +225,13 @@ public class USBAccessoryAttachmentActivity extends Activity {
private void attemptLegacyUsbConnection(UsbAccessory usbAccessory){
if(usbAccessory != null) {
- DebugTool.logInfo("Attempting to send USB connection intent using legacy method");
+ DebugTool.logInfo(TAG, "Attempting to send USB connection intent using legacy method");
Intent usbAccessoryAttachedIntent = new Intent(USBTransport.ACTION_USB_ACCESSORY_ATTACHED);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_ACCESSORY, usbAccessory);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, permissionGranted);
AndroidTools.sendExplicitBroadcast(getApplicationContext(), usbAccessoryAttachedIntent, null);
}else{
- DebugTool.logError("Unable to start legacy USB mode as the accessory was null");
+ DebugTool.logError(TAG, "Unable to start legacy USB mode as the accessory was null");
}
finish();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
index 698396ae1..0ab2f2fcf 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
@@ -341,7 +341,7 @@ public class USBTransport extends SdlTransport {
*/
//@Override
public void stopReading() {
- DebugTool.logInfo("USBTransport: stop reading requested, doing nothing");
+ DebugTool.logInfo(TAG, "USBTransport: stop reading requested, doing nothing");
// TODO - put back stopUSBReading(); @see <a href="https://adc.luxoft.com/jira/browse/SmartDeviceLink-3450">SmartDeviceLink-3450</a>
}
@@ -632,7 +632,7 @@ public class USBTransport extends SdlTransport {
* @param tr throwable to log
*/
private void logE(String s, Throwable tr) {
- DebugTool.logError(s, tr);
+ DebugTool.logError(TAG, s, tr);
}
/**
@@ -641,7 +641,7 @@ public class USBTransport extends SdlTransport {
* @param s string to log
*/
private void logW(String s) {
- DebugTool.logWarning(s);
+ DebugTool.logWarning(TAG, s);
}
/**
@@ -665,7 +665,7 @@ public class USBTransport extends SdlTransport {
* @param s string to log
*/
private void logI(String s) {
- DebugTool.logInfo(s);
+ DebugTool.logInfo(TAG, s);
}
/**
@@ -675,7 +675,7 @@ public class USBTransport extends SdlTransport {
*/
private void logD(String s) {
// DebugTool doesn't support DEBUG level, so we use INFO instead
- DebugTool.logInfo(DEBUG_PREFIX + s);
+ DebugTool.logInfo(TAG, DEBUG_PREFIX + s);
}
/**
@@ -882,15 +882,15 @@ public class USBTransport extends SdlTransport {
// Log functions
private void logD(String s) {
- DebugTool.logInfo(DEBUG_PREFIX + s);
+ DebugTool.logInfo(TAG, DEBUG_PREFIX + s);
}
private void logI(String s) {
- DebugTool.logInfo(s);
+ DebugTool.logInfo(TAG, s);
}
private void logW(String s) {
- DebugTool.logWarning(s);
+ DebugTool.logWarning(TAG, s);
}
private void logW(String s, Throwable tr) {
@@ -903,7 +903,7 @@ public class USBTransport extends SdlTransport {
}
private void logE(String s, Throwable tr) {
- DebugTool.logError(s, tr);
+ DebugTool.logError(TAG, s, tr);
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
index 6fb17172a..cd351a622 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
@@ -48,9 +48,9 @@ import android.os.Message;
import android.os.Messenger;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
-import android.util.Log;
import com.smartdevicelink.util.AndroidTools;
+import com.smartdevicelink.util.DebugTool;
import java.io.IOException;
import java.lang.ref.WeakReference;
@@ -74,7 +74,7 @@ public class UsbTransferProvider {
private ServiceConnection routerConnection= new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
- Log.d(TAG, "Bound to service " + className.toString());
+ DebugTool.logInfo(TAG, "Bound to service " + className.toString());
routerServiceMessenger = new Messenger(service);
isBound = true;
//So we just established our connection
@@ -95,7 +95,7 @@ public class UsbTransferProvider {
}
public void onServiceDisconnected(ComponentName className) {
- Log.d(TAG, "UN-Bound from service " + className.getClassName());
+ DebugTool.logInfo(TAG, "UN-Bound from service " + className.getClassName());
routerServiceMessenger = null;
isBound = false;
}
@@ -121,7 +121,7 @@ public class UsbTransferProvider {
usbInfoBundle.putString(MultiplexUsbTransport.DESCRIPTION, usbAccessory.getDescription());
checkIsConnected();
}else{
- Log.e(TAG, "Unable to open accessory");
+ DebugTool.logError(TAG, "Unable to open accessory");
clientMessenger = null;
if(callback != null){
callback.onUsbTransferUpdate(false);
@@ -152,7 +152,7 @@ public class UsbTransferProvider {
public void checkIsConnected(){
if(!AndroidTools.isServiceExported(context,routerService) || !bindToService()){
//We are unable to bind to service
- Log.e(TAG, "Unable to bind to service");
+ DebugTool.logError(TAG, "Unable to bind to service");
unBindFromService();
}
}
@@ -183,7 +183,7 @@ public class UsbTransferProvider {
if(context!=null && routerConnection!=null){
context.unbindService(routerConnection);
}else{
- Log.w(TAG, "Unable to unbind from router service, context was null");
+ DebugTool.logWarning(TAG, "Unable to unbind from router service, context was null");
}
}catch(IllegalArgumentException e){
@@ -222,7 +222,7 @@ public class UsbTransferProvider {
}
switch (msg.what) {
case TransportConstants.ROUTER_USB_ACC_RECEIVED:
- Log.d(TAG, "Successful USB transfer");
+ DebugTool.logInfo(TAG, "Successful USB transfer");
provider.get().finish();
break;
default:
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
index 4f9c5096e..163b2268b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
@@ -31,10 +31,9 @@
*/
package com.smartdevicelink.transport.utl;
-import android.util.Log;
-
import com.smartdevicelink.transport.TransportConstants;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -92,8 +91,8 @@ public class ByteAraryMessageAssembler {
append(packet);
this.isFinished = true;
break;
- default:
- Log.e(TAG, "Error handling message");
+ default:
+ DebugTool.logError(TAG, "Error handling message");
return false;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
index 107901ccb..c7333fb08 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
@@ -33,10 +33,10 @@ package com.smartdevicelink.transport.utl;
import android.os.Bundle;
import android.os.Message;
-import android.util.Log;
import com.smartdevicelink.transport.TransportBroker;
import com.smartdevicelink.transport.TransportConstants;
+import com.smartdevicelink.util.DebugTool;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -151,7 +151,7 @@ public class ByteArrayMessageSpliter {
}
bundle.putString(TransportConstants.APP_ID_EXTRA_STRING, appId);
message.setData(bundle);
- Log.i(TAG, ((100 - ((stream.available()*100)/orginalSize) ))+ " percent complete.");
+ DebugTool.logInfo(TAG, ((100 - ((stream.available()*100)/orginalSize) ))+ " percent complete.");
return message;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java
new file mode 100644
index 000000000..488a117b4
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2020 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+package com.smartdevicelink.transport.utl;
+
+import android.bluetooth.BluetoothDevice;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.transport.MultiplexBaseTransport;
+import com.smartdevicelink.transport.MultiplexBluetoothTransport;
+import com.smartdevicelink.transport.SdlRouterService;
+import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.SdlAppInfo;
+
+import java.lang.ref.WeakReference;
+import java.util.List;
+
+
+public class SdlDeviceListener {
+
+ private static final String TAG = "SdlListener";
+ private static final int MIN_VERSION_REQUIRED = 13;
+ private static final String SDL_DEVICE_STATUS_SHARED_PREFS = "sdl.device.status";
+ private static final Object LOCK = new Object(), RUNNING_LOCK = new Object();
+
+ private final WeakReference<Context> contextWeakReference;
+ private final Callback callback;
+ private final BluetoothDevice connectedDevice;
+ private MultiplexBluetoothTransport bluetoothTransport;
+ private TransportHandler bluetoothHandler;
+ private Handler timeoutHandler;
+ private Runnable timeoutRunner;
+ private boolean isRunning = false;
+
+
+ public SdlDeviceListener(Context context, BluetoothDevice device, Callback callback) {
+ this.contextWeakReference = new WeakReference<>(context);
+ this.connectedDevice = device;
+ this.callback = callback;
+ }
+
+ /**
+ * This will start the SDL Device Listener with two paths. The first path will be a check
+ * against the supplied bluetooth device to see if it has already successfully connected as an
+ * SDL device. If it has, the supplied callback will be called immediately. If the device hasn't
+ * connected as an SDL device before, the SDL Device Listener will then open up an RFCOMM channel
+ * using the SDL UUID and await a potential connection. A timeout is used to ensure this only
+ * listens for a finite amount of time. If this is the first time the device has been seen, this
+ * will listen for 30 seconds, if it is not, this will listen for 15 seconds instead.
+ */
+ public void start() {
+ if(connectedDevice == null) {
+ DebugTool.logInfo(TAG, ": No supplied bluetooth device");
+ if(callback != null){
+ callback.onTransportError(null);
+ }
+ return;
+ }
+
+ if (hasSDLConnected(contextWeakReference.get(), connectedDevice.getAddress())) {
+ DebugTool.logInfo(TAG, ": Confirmed SDL device, should start router service");
+ //This device has connected to SDL previously, it is ok to start the RS right now
+ callback.onTransportConnected(contextWeakReference.get(), connectedDevice);
+ return;
+ }
+ synchronized (RUNNING_LOCK) {
+ isRunning = true;
+ // set timeout = if first time seeing BT device, 30s, if not 15s
+ int timeout = isFirstStatusCheck(connectedDevice.getAddress()) ? 30000 : 15000;
+ //Set our preference as false for this device for now
+ setSDLConnectedStatus(contextWeakReference.get(), connectedDevice.getAddress(), false);
+ bluetoothHandler = new TransportHandler(this);
+ bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
+ bluetoothTransport.start();
+ timeoutRunner = new Runnable() {
+ @Override
+ public void run() {
+ if (bluetoothTransport != null) {
+ int state = bluetoothTransport.getState();
+ if (state != MultiplexBluetoothTransport.STATE_CONNECTED) {
+ DebugTool.logInfo(TAG, ": No bluetooth connection made");
+ bluetoothTransport.stop();
+ } //else BT is connected; it will close itself through callbacks
+ }
+ }
+ };
+ timeoutHandler = new Handler(Looper.getMainLooper());
+ timeoutHandler.postDelayed(timeoutRunner, timeout);
+ }
+ }
+
+ /**
+ * Check to see if this instance is in the middle of running or not
+ *
+ * @return if this is already in the process of running
+ */
+ public boolean isRunning() {
+ synchronized (RUNNING_LOCK) {
+ return isRunning;
+ }
+ }
+
+ private static class TransportHandler extends Handler {
+
+ final WeakReference<SdlDeviceListener> provider;
+
+ TransportHandler(SdlDeviceListener provider) {
+ this.provider = new WeakReference<>(provider);
+ }
+
+ @Override
+ public void handleMessage(@NonNull Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ SdlDeviceListener sdlListener = this.provider.get();
+ switch (msg.what) {
+
+ case SdlRouterService.MESSAGE_STATE_CHANGE:
+ switch (msg.arg1) {
+ case MultiplexBaseTransport.STATE_CONNECTED:
+ sdlListener.setSDLConnectedStatus(sdlListener.contextWeakReference.get(), sdlListener.connectedDevice.getAddress(), true);
+ boolean keepConnectionOpen = sdlListener.callback.onTransportConnected(sdlListener.contextWeakReference.get(), sdlListener.connectedDevice);
+ if (!keepConnectionOpen) {
+ sdlListener.bluetoothTransport.stop();
+ sdlListener.bluetoothTransport = null;
+ sdlListener.timeoutHandler.removeCallbacks(sdlListener.timeoutRunner);
+ }
+ break;
+ case MultiplexBaseTransport.STATE_NONE:
+ // We've just lost the connection
+ sdlListener.callback.onTransportDisconnected(sdlListener.connectedDevice);
+ break;
+ case MultiplexBaseTransport.STATE_ERROR:
+ sdlListener.callback.onTransportError(sdlListener.connectedDevice);
+ break;
+ }
+ break;
+
+ case com.smartdevicelink.transport.SdlRouterService.MESSAGE_READ:
+ break;
+ }
+ }
+ }
+
+
+ /**
+ * Set the connection establishment status of the particular device
+ *
+ * @param address address of the device in question
+ * @param hasSDLConnected true if a connection has been established, false if not
+ */
+ public static void setSDLConnectedStatus(Context context, String address, boolean hasSDLConnected) {
+ synchronized (LOCK) {
+ if (context != null) {
+ DebugTool.logInfo(TAG, ": Saving connected status - " + address + " : " + hasSDLConnected);
+ SharedPreferences preferences = context.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ if (preferences.contains(address) && hasSDLConnected == preferences.getBoolean(address, false)) {
+ //The same key/value exists in our shared preferences. No reason to write again.
+ return;
+ }
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean(address, hasSDLConnected);
+ editor.commit();
+ }
+ }
+ }
+
+ /**
+ * Checks to see if a device address has connected to SDL before.
+ *
+ * @param address the mac address of the device in question
+ * @return if this is the first status check of this device
+ */
+ private boolean isFirstStatusCheck(String address) {
+ synchronized (LOCK) {
+ Context context = contextWeakReference.get();
+ if (context != null) {
+ SharedPreferences preferences = context.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ return !preferences.contains(address);
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Checks to see if a device address has connected to SDL before.
+ *
+ * @param address the mac address of the device in question
+ * @return if an SDL connection has ever been established with this device
+ */
+ public static boolean hasSDLConnected(Context context, String address) {
+ synchronized (LOCK) {
+ if (context != null) {
+ SharedPreferences preferences = context.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ return preferences.contains(address) && preferences.getBoolean(address, false);
+ }
+ return false;
+ }
+ }
+
+ /**
+ * This method will check the current device and list of SDL enabled apps to derive if the
+ * feature can be supported. Due to older libraries sending their intents to start the router
+ * service right at the bluetooth A2DP/HFS connections, this feature can't be used until all
+ * applications are updated to the point they include the feature.
+ *
+ * @param sdlAppInfoList current list of SDL enabled applications on the device
+ * @return if this feature is supported or not. If it is not, the caller should follow the
+ * previously used flow, ie start the router service.
+ */
+ public static boolean isFeatureSupported(List<SdlAppInfo> sdlAppInfoList) {
+
+ SdlAppInfo appInfo;
+ for (int i = sdlAppInfoList.size() - 1; i >= 0; i--) {
+ appInfo = sdlAppInfoList.get(i);
+ if (appInfo != null
+ && !appInfo.isCustomRouterService()
+ && appInfo.getRouterServiceVersion() < MIN_VERSION_REQUIRED) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Callback for the SdlDeviceListener. It will return if the supplied device makes a bluetooth
+ * connection on the SDL UUID RFCOMM chanel or not. Most of the time the only callback that
+ * matters will be the onTransportConnected.
+ */
+ public interface Callback {
+ /**
+ * @param bluetoothDevice the BT device that successfully connected to SDL's UUID
+ * @return if the RFCOMM connection should stay open. In most cases this should be false
+ */
+ boolean onTransportConnected(Context context, BluetoothDevice bluetoothDevice);
+
+ void onTransportDisconnected(BluetoothDevice bluetoothDevice);
+
+ void onTransportError(BluetoothDevice bluetoothDevice);
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
new file mode 100644
index 000000000..bd31e746e
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
@@ -0,0 +1,56 @@
+package com.smartdevicelink.transport.utl;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.smartdevicelink.transport.enums.TransportType;
+
+public class TransportRecord extends BaseTransportRecord implements Parcelable {
+
+ public TransportRecord(TransportType transportType, String address) {
+ super(transportType, address);
+ }
+
+ public TransportRecord(Parcel p) {
+ if (p.readInt() == 1) { //We should have a transport type attached
+ String transportName = p.readString();
+ if(transportName != null){
+ this.type = TransportType.valueOf(transportName);
+ }
+ }
+
+ if (p.readInt() == 1) { //We should have a transport address attached
+ address = p.readString();
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(type!=null? 1 : 0);
+ if(type != null){
+ dest.writeString(type.name());
+ }
+
+ dest.writeInt(address !=null? 1 : 0);
+ if(address != null){
+ dest.writeString(address);
+ }
+ }
+
+ public static final Parcelable.Creator<TransportRecord> CREATOR = new Parcelable.Creator<TransportRecord>() {
+ public TransportRecord createFromParcel(Parcel in) {
+ return new TransportRecord(in);
+ }
+
+ @Override
+ public TransportRecord[] newArray(int size) {
+ return new TransportRecord[size];
+ }
+
+ };
+}
diff --git a/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
index 3eee85a05..44125dff2 100644
--- a/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.util;
import android.os.AsyncTask;
-import android.util.Log;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -97,7 +96,7 @@ public class HttpRequestTask extends AsyncTask<String, String, String> {
}
if(urlString == null || request_type == null){
- Log.e(TAG, "Can't process request, param error");
+ DebugTool.logError(TAG, "Can't process request, param error");
if(cb!=null){
cb.httpFailure(-1);
cb = null;
@@ -161,7 +160,7 @@ public class HttpRequestTask extends AsyncTask<String, String, String> {
cb.httpFailure(responseCode);
cb = null;
}
- Log.e(TAG, "Failed to download file - " + responseCode);
+ DebugTool.logError(TAG, "Failed to download file - " + responseCode);
return null;
}
@@ -180,7 +179,7 @@ public class HttpRequestTask extends AsyncTask<String, String, String> {
try {
reader.close();
} catch (final IOException e) {
- Log.e(TAG, "Error closing stream", e);
+ DebugTool.logError(TAG, "Error closing stream", e);
}
}
if(cb!=null){
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/Log.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/Log.java
new file mode 100644
index 000000000..150d9b3e9
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/Log.java
@@ -0,0 +1,22 @@
+package com.smartdevicelink.util;
+
+public class Log {
+ public static int i(String tag, String message) {
+ android.util.Log.i(tag, message);
+ return 10;
+ }
+
+ public static int w(String tag, String message) {
+ android.util.Log.w(tag, message);
+ return 10;
+ }
+
+ public static int e(String tag, String message, Throwable t) {
+ if (t != null) {
+ android.util.Log.e(tag, message, t);
+ } else {
+ android.util.Log.e(tag, message);
+ }
+ return 10;
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
index be55e1102..b74c7aac9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
@@ -59,6 +59,7 @@ import java.util.List;
*/
public class MediaStreamingStatus {
+ private static final String TAG = "MediaStreamingStatus";
private static final Object BROADCAST_RECEIVER_LOCK = new Object();
private boolean broadcastReceiverValid = true;
@@ -137,7 +138,7 @@ public class MediaStreamingStatus {
* @return
*/
boolean isSupportedAudioDevice(int audioDevice){
- DebugTool.logInfo("Audio device connected: " + audioDevice);
+ DebugTool.logInfo(TAG, "Audio device connected: " + audioDevice);
switch (audioDevice){
case AudioDeviceInfo.TYPE_BLUETOOTH_A2DP:
if(isBluetoothActuallyAvailable()) {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
index d90045371..8dc481323 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
@@ -37,7 +37,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Bundle;
-import android.util.Log;
import java.util.Comparator;
@@ -77,7 +76,7 @@ public class SdlAppInfo {
this.isCustomRouterService = metadata.getBoolean(SDL_CUSTOM_ROUTER_METADATA);
}
} else {
- Log.w(TAG, packageName + " has not supplied metadata with their router service!");
+ DebugTool.logWarning(TAG, packageName + " has not supplied metadata with their router service!");
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
index 6f1740878..5ce18165f 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
@@ -40,7 +40,6 @@ import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
-import android.util.Log;
import com.smartdevicelink.transport.SdlRouterService;
@@ -98,11 +97,11 @@ public class ServiceFinder {
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received intent " + intent);
+ DebugTool.logInfo(TAG, "Received intent " + intent);
if (intent != null) {
String packageName = intent.getStringExtra(BIND_LOCATION_PACKAGE_NAME_EXTRA);
String className = intent.getStringExtra(BIND_LOCATION_CLASS_NAME_EXTRA);
- Log.d(TAG, "Received intent from package: " + packageName + ". Classname: " + className);
+ DebugTool.logInfo(TAG, "Received intent from package: " + packageName + ". Classname: " + className);
synchronized (LIST_LOCK) {
//Add to running services
services.add(new ComponentName(packageName, className));
diff --git a/android/sdl_android/src/main/res/values/sdl.xml b/android/sdl_android/src/main/res/values/sdl.xml
index e2a20bff8..bc83d733e 100644
--- a/android/sdl_android/src/main/res/values/sdl.xml
+++ b/android/sdl_android/src/main/res/values/sdl.xml
@@ -2,7 +2,7 @@
<resources>
<string name="sdl_router_service_version_name" translatable="false">sdl_router_version</string>
- <integer name="sdl_router_service_version_value">12</integer>
+ <integer name="sdl_router_service_version_value">13</integer>
<string name="sdl_router_service_is_custom_name" translatable="false">sdl_custom_router</string>
</resources>
diff --git a/base/src/main/java/android/os/AsyncTask.java b/base/src/main/java/android/os/AsyncTask.java
index f3953f16a..db6b69a8e 100644
--- a/base/src/main/java/android/os/AsyncTask.java
+++ b/base/src/main/java/android/os/AsyncTask.java
@@ -18,6 +18,7 @@
package android.os;
+@Deprecated
public abstract class AsyncTask<Params, Progress, Result> {
diff --git a/base/src/main/java/android/os/Parcel.java b/base/src/main/java/android/os/Parcel.java
index 4dbf6b7ce..b99dbc671 100644
--- a/base/src/main/java/android/os/Parcel.java
+++ b/base/src/main/java/android/os/Parcel.java
@@ -18,6 +18,7 @@
package android.os;
+@Deprecated
public class Parcel {
public void writeInt(int data){
diff --git a/base/src/main/java/android/os/Parcelable.java b/base/src/main/java/android/os/Parcelable.java
index 76499a99c..e09a1754c 100644
--- a/base/src/main/java/android/os/Parcelable.java
+++ b/base/src/main/java/android/os/Parcelable.java
@@ -17,6 +17,7 @@
*/
package android.os;
+@Deprecated
public interface Parcelable {
int describeContents();
diff --git a/base/src/main/java/android/util/Log.java b/base/src/main/java/android/util/Log.java
index bdbc3cdc6..7374ff04c 100644
--- a/base/src/main/java/android/util/Log.java
+++ b/base/src/main/java/android/util/Log.java
@@ -16,8 +16,9 @@
* Note: This file has been modified from its original form.
*/
- package android.util;
+package android.util;
+@Deprecated
public class Log {
diff --git a/base/src/main/java/com/livio/BSON/BsonEncoder.java b/base/src/main/java/com/livio/BSON/BsonEncoder.java
index c0e03f5cf..22c47f6cb 100644
--- a/base/src/main/java/com/livio/BSON/BsonEncoder.java
+++ b/base/src/main/java/com/livio/BSON/BsonEncoder.java
@@ -37,7 +37,7 @@ import org.bson.*;
import java.util.*;
public class BsonEncoder {
-
+ private static final String TAG = "BsonEncoder";
public static byte[] encodeToBytes(HashMap<String, Object> map) throws ClassCastException {
if(map != null) {
@@ -47,7 +47,7 @@ public class BsonEncoder {
return encoder.encode(bson);
}
- DebugTool.logError("Something went wrong encoding the map into BSON bytes");
+ DebugTool.logError(TAG, "Something went wrong encoding the map into BSON bytes");
return null;
}
@@ -63,7 +63,7 @@ public class BsonEncoder {
}
}
}
- DebugTool.logError("Something went wrong decoding bytes into BSON");
+ DebugTool.logError(TAG, "Something went wrong decoding bytes into BSON");
return null;
}
diff --git a/base/src/main/java/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java b/base/src/main/java/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
index 37013b914..16681e600 100644
--- a/base/src/main/java/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
+++ b/base/src/main/java/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
@@ -37,6 +37,7 @@ import java.util.concurrent.LinkedBlockingQueue;
@Deprecated
public class ProxyMessageDispatcher<T> {
+ private static final String TAG = "ProxyMessageDispatcher";
LinkedBlockingQueue<T> _queue = null;
private Thread _messageDispatchingThread = null;
IDispatchingStrategy<T> _strategy = null;
@@ -78,7 +79,7 @@ public class ProxyMessageDispatcher<T> {
// Thread was interrupted by dispose() method, no action required
return;
} catch (Exception e) {
- DebugTool.logError("Error occurred dispating message.", e);
+ DebugTool.logError(TAG, "Error occurred dispating message.", e);
_strategy.handleDispatchingError("Error occurred dispating message.", e);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 1afd69470..fb82bd8a2 100644
--- a/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/base/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.SdlConnection;
-import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.ISdlProtocol;
@@ -48,6 +47,7 @@ import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
import java.util.HashMap;
@@ -153,7 +153,7 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, ISecuri
public void shutdown(String info){
- Log.d(TAG, "Shutdown - " + info);
+ DebugTool.logInfo(TAG, "Shutdown - " + info);
this.sessionListener.onTransportDisconnected(info);
}
@@ -261,7 +261,7 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, ISecuri
public void onProtocolSessionStarted(SessionType sessionType,
byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
- Log.i(TAG, "Protocol session started");
+ DebugTool.logInfo(TAG, "Protocol session started");
this.sessionId = sessionID;
if (sessionType.eq(SessionType.RPC)){
@@ -295,7 +295,7 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, ISecuri
@Override
public void onProtocolError(String info, Exception e) {
this.sessionListener.onProtocolError(info, e);
- Log.e(TAG, "on protocol error", e);
+ DebugTool.logError(TAG,"on protocol error", e);
}
@@ -397,7 +397,7 @@ public class SdlSession implements ISdlProtocol, ISdlConnectionListener, ISecuri
*************************************************************************************************************************************************************************/
public void onProtocolMessageBytesToSend(SdlPacket packet) {
- //Log.d(TAG, "onProtocolMessageBytesToSend - " + packet.getTransportType());
+ //DebugTool.logInfo(TAG, "onProtocolMessageBytesToSend - " + packet.getTransportType());
sdlProtocol.sendPacket(packet);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
index 95ec756b1..f362f990c 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
@@ -31,24 +31,45 @@
*/
package com.smartdevicelink.managers;
-import android.util.Log;
-
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.managers.file.FileManager;
+import com.smartdevicelink.managers.file.FileManagerConfig;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
+import com.smartdevicelink.managers.lifecycle.LifecycleManager;
+import com.smartdevicelink.managers.permission.PermissionManager;
+import com.smartdevicelink.managers.screen.ScreenManager;
import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.ChangeRegistration;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SetAppIcon;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
+import org.json.JSONException;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
@@ -58,16 +79,13 @@ import java.util.concurrent.ConcurrentLinkedQueue;
abstract class BaseSdlManager {
- private static final String TAG = "BaseSubManager";
-
+ static final String TAG = "BaseSubManager";
final Object STATE_LOCK = new Object();
int state = -1;
-
- static final int MAX_RETRY = 3;
- int changeRegistrationRetry = 0;
- String appId, appName, shortAppName;
+ String appId, appName, shortAppName, resumeHash;
boolean isMediaApp;
Language hmiLanguage;
+ Language language;
Vector<AppHMIType> hmiTypes;
BaseTransportConfig transport;
Vector<String> vrSynonyms;
@@ -75,39 +93,154 @@ abstract class BaseSdlManager {
TemplateColorScheme dayColorScheme, nightColorScheme;
Version minimumProtocolVersion;
Version minimumRPCVersion;
-
Queue<RPCNotification> queuedNotifications = null;
OnRPCNotificationListener queuedNotificationListener = null;
Map<FunctionID, OnRPCNotificationListener> onRPCNotificationListeners;
+ SdlArtwork appIcon;
+ SdlManagerListener managerListener;
+ List<Class<? extends SdlSecurityBase>> sdlSecList;
+ ServiceEncryptionListener serviceEncryptionListener;
+ FileManagerConfig fileManagerConfig;
+ int changeRegistrationRetry = 0;
+ static final int MAX_RETRY = 3;
- // PROTECTED GETTERS
- protected String getAppName() { return appName; }
+ // Managers
+ LifecycleManager lifecycleManager;
+ PermissionManager permissionManager;
+ FileManager fileManager;
+ ScreenManager screenManager;
+
+ // INTERNAL INTERFACE
+ /**
+ * This is from the LifeCycleManager directly. In the future if there is a reason to be a man in the middle
+ * the SdlManager could create it's own, however right now it was only a duplication of logic tied to the LCM.
+ */
+ ISdl _internalInterface;
+
+ // Initialize with anonymous lifecycleListener
+ final LifecycleManager.LifecycleListener lifecycleListener = new LifecycleManager.LifecycleListener() {
+ @Override
+ public void onConnected(LifecycleManager lifeCycleManager) {
+ DebugTool.logInfo(TAG, "Proxy is connected. Now initializing.");
+ synchronized (this) {
+ changeRegistrationRetry = 0;
+ checkLifecycleConfiguration();
+ initialize();
+ }
+ }
- protected String getAppId() { return appId; }
+ @Override
+ public void onServiceStarted(SessionType sessionType) {
- protected String getShortAppName() { return shortAppName; }
+ }
- protected Version getMinimumProtocolVersion() { return minimumProtocolVersion; }
+ @Override
+ public void onServiceEnded(SessionType sessionType) {
- protected Version getMinimumRPCVersion() { return minimumRPCVersion; }
+ }
- protected Language getHmiLanguage() { return hmiLanguage; }
+ @Override
+ public void onClosed(LifecycleManager lifeCycleManager, String info, Exception e, SdlDisconnectedReason reason) {
+ DebugTool.logInfo(TAG, "Proxy is closed.");
+ if (reason == null || !reason.equals(SdlDisconnectedReason.LANGUAGE_CHANGE)) {
+ dispose();
+ }
+ }
- protected TemplateColorScheme getDayColorScheme() { return dayColorScheme; }
+ @Override
+ public void onError(LifecycleManager lifeCycleManager, String info, Exception e) {
- protected TemplateColorScheme getNightColorScheme() { return nightColorScheme; }
+ }
+ };
+
+ // Sub manager listener
+ final CompletionListener subManagerListener = new CompletionListener() {
+ @Override
+ public synchronized void onComplete(boolean success) {
+ if (!success) {
+ DebugTool.logError(TAG, "Sub manager failed to initialize");
+ }
+ checkState();
+ }
+ };
+
+ // ABSTRACT METHODS
+ abstract void retryChangeRegistration();
- protected Vector<AppHMIType> getAppTypes() { return hmiTypes; }
+ abstract void checkState();
+
+ abstract void initialize();
- protected Vector<String> getVrSynonyms() { return vrSynonyms; }
+ public abstract void dispose();
- protected Vector<TTSChunk> getTtsChunks() { return ttsChunks; }
+ protected void checkLifecycleConfiguration() {
+ final Language actualLanguage = this.getRegisterAppInterfaceResponse().getLanguage();
+ final Language actualHMILanguage = this.getRegisterAppInterfaceResponse().getHmiDisplayLanguage();
+
+ if ((actualLanguage != null && !actualLanguage.equals(language)) || (actualHMILanguage != null && !actualHMILanguage.equals(hmiLanguage))) {
+
+ LifecycleConfigurationUpdate lcuNew = managerListener.managerShouldUpdateLifecycle(actualLanguage, actualHMILanguage);
+ LifecycleConfigurationUpdate lcuOld = managerListener.managerShouldUpdateLifecycle(actualLanguage);
+ final LifecycleConfigurationUpdate lcu;
+ ChangeRegistration changeRegistration;
+ if (lcuNew == null) {
+ lcu = lcuOld;
+ changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
+ } else {
+ lcu = lcuNew;
+ changeRegistration = new ChangeRegistration(actualLanguage, actualHMILanguage);
+ }
- protected BaseTransportConfig getTransport() { return transport; }
+ if (lcu != null) {
+ changeRegistration.setAppName(lcu.getAppName());
+ changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
+ changeRegistration.setTtsName(lcu.getTtsName());
+ changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
+ changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // go through and change sdlManager properties that were changed via the LCU update
+ hmiLanguage = actualHMILanguage;
+ language = actualLanguage;
+
+ if (lcu.getAppName() != null) {
+ appName = lcu.getAppName();
+ }
+
+ if (lcu.getShortAppName() != null) {
+ shortAppName = lcu.getShortAppName();
+ }
+
+ if (lcu.getTtsName() != null) {
+ ttsChunks = lcu.getTtsName();
+ }
+
+ if (lcu.getVoiceRecognitionCommandNames() != null) {
+ vrSynonyms = lcu.getVoiceRecognitionCommandNames();
+ }
+ }
+ try {
+ DebugTool.logInfo(TAG, response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError(TAG, "Change Registration onError: " + resultCode + " | Info: " + info);
+ retryChangeRegistration();
+ }
+ });
+ this.sendRPC(changeRegistration);
+ }
+ }
+ }
/**
* Get the current state for the SdlManager
+ *
* @return int value that represents the current state
* @see BaseSubManager
*/
@@ -125,11 +258,11 @@ abstract class BaseSdlManager {
void checkSdlManagerState(){
if (getState() != BaseSubManager.READY && getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "SdlManager is not ready for use, be sure to initialize with start() method, implement callback, and use SubManagers in the SdlManager's callback");
+ DebugTool.logError(TAG, "SdlManager is not ready for use, be sure to initialize with start() method, implement callback, and use SubManagers in the SdlManager's callback");
}
}
- void initNotificationQueue(){
+ void initNotificationQueue() {
//Setup the notification queue
if (onRPCNotificationListeners != null) {
Set<FunctionID> functionIDSet = onRPCNotificationListeners.keySet();
@@ -148,7 +281,7 @@ abstract class BaseSdlManager {
}
}
- void handleQueuedNotifications(){
+ void handleQueuedNotifications() {
//Handle queued notifications and add the listeners
if (onRPCNotificationListeners != null) {
Set<FunctionID> functionIDSet = onRPCNotificationListeners.keySet();
@@ -160,7 +293,7 @@ abstract class BaseSdlManager {
listener.onNotified(notification);
}
} catch (Exception e) {
- DebugTool.logError("Error going through queued notifications", e);
+ DebugTool.logError(TAG, "Error going through queued notifications", e);
}
}
}
@@ -177,43 +310,578 @@ abstract class BaseSdlManager {
//Set variables to null that are no longer needed
queuedNotifications = null;
queuedNotificationListener = null;
- onRPCNotificationListeners = null;
}
}
- abstract void checkState();
+ /**
+ * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up
+ */
+ @SuppressWarnings("unchecked")
+ public void start() {
+ LifecycleManager.AppConfig appConfig = new LifecycleManager.AppConfig();
+ appConfig.setAppName(appName);
+ //short app name
+ appConfig.setMediaApp(isMediaApp);
+ appConfig.setHmiDisplayLanguageDesired(hmiLanguage);
+ appConfig.setLanguageDesired(hmiLanguage);
+ appConfig.setAppType(hmiTypes);
+ appConfig.setVrSynonyms(vrSynonyms);
+ appConfig.setTtsName(ttsChunks);
+ appConfig.setDayColorScheme(dayColorScheme);
+ appConfig.setNightColorScheme(nightColorScheme);
+ appConfig.setAppID(appId);
+ appConfig.setMinimumProtocolVersion(minimumProtocolVersion);
+ appConfig.setMinimumRPCVersion(minimumRPCVersion);
+ appConfig.setResumeHash(resumeHash);
+
+ lifecycleManager = new LifecycleManager(appConfig, transport, lifecycleListener);
+ _internalInterface = lifecycleManager.getInternalInterface((SdlManager) BaseSdlManager.this);
+
+ if (sdlSecList != null && !sdlSecList.isEmpty()) {
+ lifecycleManager.setSdlSecurity(sdlSecList, serviceEncryptionListener);
+ }
- protected abstract void initialize();
- protected abstract void checkLifecycleConfiguration();
+ //Setup the notification queue
+ initNotificationQueue();
+ }
- //Public abstract API
- public abstract void start();
- public abstract void dispose();
- public abstract void sendRPC(RPCMessage message);
- public abstract void sendSequentialRPCs(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener);
- public abstract void sendRPCs(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener);
- public abstract RegisterAppInterfaceResponse getRegisterAppInterfaceResponse();
- public abstract OnHMIStatus getCurrentHMIStatus();
- public abstract String getAuthToken();
+ void onReady() {
+ // Set the app icon
+ if (BaseSdlManager.this.appIcon != null && BaseSdlManager.this.appIcon.getName() != null) {
+ if (fileManager != null && fileManager.getState() == BaseSubManager.READY && !fileManager.hasUploadedFile(BaseSdlManager.this.appIcon)) {
+ fileManager.uploadArtwork(BaseSdlManager.this.appIcon, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (success) {
+ SetAppIcon msg = new SetAppIcon(BaseSdlManager.this.appIcon.getName());
+ _internalInterface.sendRPC(msg);
+ }
+ }
+ });
+ } else {
+ SetAppIcon msg = new SetAppIcon(BaseSdlManager.this.appIcon.getName());
+ _internalInterface.sendRPC(msg);
+ }
+ }
+ }
- public abstract void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener);
+ // PROTECTED GETTERS
+ protected String getAppName() {
+ return appName;
+ }
+
+ protected String getAppId() {
+ return appId;
+ }
+
+ protected String getShortAppName() {
+ return shortAppName;
+ }
+
+ protected Version getMinimumProtocolVersion() {
+ return minimumProtocolVersion;
+ }
+
+ protected Version getMinimumRPCVersion() {
+ return minimumRPCVersion;
+ }
+
+ protected Language getHmiLanguage() {
+ return hmiLanguage;
+ }
+
+ protected Language getLanguage() {
+ return language;
+ }
+
+ protected TemplateColorScheme getDayColorScheme() {
+ return dayColorScheme;
+ }
+
+ protected TemplateColorScheme getNightColorScheme() {
+ return nightColorScheme;
+ }
+
+ protected Vector<AppHMIType> getAppTypes() {
+ return hmiTypes;
+ }
+
+ protected Vector<String> getVrSynonyms() {
+ return vrSynonyms;
+ }
+
+ protected Vector<TTSChunk> getTtsChunks() {
+ return ttsChunks;
+ }
+
+ protected BaseTransportConfig getTransport() {
+ return transport;
+ }
+
+ protected FileManagerConfig getFileManagerConfig() {
+ return fileManagerConfig;
+ }
+
+ // MANAGER GETTERS
+
+ /**
+ * Gets the PermissionManager. <br>
+ * <strong>Note: PermissionManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
+ * @return a PermissionManager object
+ */
+ public PermissionManager getPermissionManager() {
+ if (permissionManager.getState() != BaseSubManager.READY && permissionManager.getState() != BaseSubManager.LIMITED) {
+ DebugTool.logError(TAG, "PermissionManager should not be accessed because it is not in READY/LIMITED state");
+ }
+ checkSdlManagerState();
+ return permissionManager;
+ }
+
+ /**
+ * Gets the FileManager. <br>
+ * <strong>Note: FileManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
+ * @return a FileManager object
+ */
+ public FileManager getFileManager() {
+ if (fileManager.getState() != BaseSubManager.READY && fileManager.getState() != BaseSubManager.LIMITED) {
+ DebugTool.logError(TAG, "FileManager should not be accessed because it is not in READY/LIMITED state");
+ }
+ checkSdlManagerState();
+ return fileManager;
+ }
+
+ /**
+ * Gets the ScreenManager. <br>
+ * <strong>Note: ScreenManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
+ * @return a ScreenManager object
+ */
+ public ScreenManager getScreenManager() {
+ if (screenManager.getState() != BaseSubManager.READY && screenManager.getState() != BaseSubManager.LIMITED) {
+ DebugTool.logError(TAG, "ScreenManager should not be accessed because it is not in READY/LIMITED state");
+ }
+ checkSdlManagerState();
+ return screenManager;
+ }
+
+ /**
+ * Gets the SystemCapabilityManager. <br>
+ * <strong>Note: SystemCapabilityManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
+ *
+ * @return a SystemCapabilityManager object
+ */
+ public SystemCapabilityManager getSystemCapabilityManager() {
+ return lifecycleManager.getSystemCapabilityManager((SdlManager) this);
+ }
+
+ /**
+ * Method to retrieve the RegisterAppInterface Response message that was sent back from the
+ * module. It contains various attributes about the connected module and can be used to adapt
+ * to different module types and their supported features.
+ *
+ * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
+ * registered with the module.
+ */
+ public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
+ if (lifecycleManager != null) {
+ return lifecycleManager.getRegisterAppInterfaceResponse();
+ }
+ return null;
+ }
+
+ /**
+ * Get the current OnHMIStatus
+ *
+ * @return OnHMIStatus object represents the current OnHMIStatus
+ */
+ public OnHMIStatus getCurrentHMIStatus() {
+ if (this.lifecycleManager != null) {
+ return lifecycleManager.getCurrentHMIStatus();
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
+ * service from the module. For example, this should be used to login to a user account.
+ *
+ * @return the string representation of the auth token
+ */
+ public String getAuthToken() {
+ return this.lifecycleManager.getAuthToken();
+ }
+
+ // SENDING REQUESTS
+
+ /**
+ * Send RPC Message <br>
+ *
+ * @param message RPCMessage
+ */
+ public void sendRPC(RPCMessage message) {
+ _internalInterface.sendRPC(message);
+ }
+
+ /**
+ * Takes a list of RPCMessages and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
+ * For sending requests asynchronously, use sendRPCs <br>
+ *
+ * <strong>NOTE: This will override any listeners on individual RPCs</strong><br>
+ *
+ * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
+ *
+ * @param rpcs is the list of RPCMessages being sent
+ * @param listener listener for updates and completions
+ */
+ public void sendSequentialRPCs(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) {
+ List<RPCRequest> rpcRequestList = new ArrayList<>();
+ for (int i = 0; i < rpcs.size(); i++) {
+ if (rpcs.get(i) instanceof RPCRequest) {
+ rpcRequestList.add((RPCRequest) rpcs.get(i));
+ }
+ }
+
+ if (rpcRequestList.size() > 0) {
+ _internalInterface.sendSequentialRPCs(rpcRequestList, listener);
+ }
+ }
+
+ /**
+ * Takes a list of RPCMessages and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
+ * For sending requests synchronously, use sendSequentialRPCs <br>
+ *
+ * <strong>NOTE: This will override any listeners on individual RPCs</strong> <br>
+ *
+ * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
+ *
+ * @param rpcs is the list of RPCMessages being sent
+ * @param listener listener for updates and completions
+ */
+ public void sendRPCs(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) {
+ List<RPCRequest> rpcRequestList = new ArrayList<>();
+ for (int i = 0; i < rpcs.size(); i++) {
+ if (rpcs.get(i) instanceof RPCRequest) {
+ rpcRequestList.add((RPCRequest) rpcs.get(i));
+ }
+ }
+
+ if (rpcRequestList.size() > 0) {
+ _internalInterface.sendRPCs(rpcRequestList, listener);
+ }
+ }
+
+ /**
+ * Add an OnRPCNotificationListener
+ *
+ * @param listener listener that will be called when a notification is received
+ */
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ _internalInterface.addOnRPCNotificationListener(notificationId, listener);
+ }
/**
* Remove an OnRPCNotificationListener
+ *
* @param listener listener that was previously added
*/
- public abstract void removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener);
+ public void removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ _internalInterface.removeOnRPCNotificationListener(notificationId, listener);
+ }
/**
* Add an OnRPCRequestListener
+ *
* @param listener listener that will be called when a request is received
*/
- public abstract void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener);
+ public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener) {
+ _internalInterface.addOnRPCRequestListener(requestId, listener);
+ }
/**
* Remove an OnRPCRequestListener
+ *
* @param listener listener that was previously added
*/
- public abstract void removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener);
+ public void removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener) {
+ _internalInterface.removeOnRPCRequestListener(requestId, listener);
+ }
+
+ // BUILDER
+ public static class Builder {
+ SdlManager sdlManager;
+
+ Builder(@NonNull final String appId, @NonNull final String appName, @NonNull final SdlManagerListener listener) {
+ sdlManager = new SdlManager();
+ setAppId(appId);
+ setAppName(appName);
+ setManagerListener(listener);
+ }
+
+ /**
+ * Sets the App ID
+ *
+ * @param appId String representation of the App ID retreived from the SDL Developer Portal
+ */
+ public Builder setAppId(@NonNull final String appId) {
+ sdlManager.appId = appId;
+ return this;
+ }
+
+ /**
+ * Sets the Resumption Hash ID
+ *
+ * @param resumeHash String representation of the Hash ID Used to resume the application
+ */
+ public Builder setResumeHash(final String resumeHash) {
+ sdlManager.resumeHash = resumeHash;
+ return this;
+ }
+
+ /**
+ * Sets the Application Name
+ *
+ * @param appName String that will be associated as the app's name
+ */
+ public Builder setAppName(@NonNull final String appName) {
+ sdlManager.appName = appName;
+ return this;
+ }
+
+ /**
+ * Sets the Short Application Name
+ *
+ * @param shortAppName a shorter representation of the app's name for smaller displays
+ */
+ public Builder setShortAppName(final String shortAppName) {
+ sdlManager.shortAppName = shortAppName;
+ return this;
+ }
+
+ /**
+ * Sets the minimum protocol version that will be permitted to connect.
+ * If the protocol version of the head unit connected is below this version,
+ * the app will disconnect with an EndService protocol message and will not register.
+ *
+ * @param minimumProtocolVersion the minimum Protocol spec version that should be accepted
+ */
+ public Builder setMinimumProtocolVersion(final Version minimumProtocolVersion) {
+ sdlManager.minimumProtocolVersion = minimumProtocolVersion;
+ return this;
+ }
+
+ /**
+ * The minimum RPC version that will be permitted to connect.
+ * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
+ *
+ * @param minimumRPCVersion the minimum RPC spec version that should be accepted
+ */
+ public Builder setMinimumRPCVersion(final Version minimumRPCVersion) {
+ sdlManager.minimumRPCVersion = minimumRPCVersion;
+ return this;
+ }
+ /**
+ * Sets the Language of the App
+ *
+ * @param hmiLanguage the desired language to be used on the display/HMI of the connected module
+ */
+ public Builder setLanguage(final Language hmiLanguage) {
+ sdlManager.hmiLanguage = hmiLanguage;
+ sdlManager.language = hmiLanguage;
+ return this;
+ }
+
+ /**
+ * Sets the TemplateColorScheme for daytime
+ *
+ * @param dayColorScheme color scheme that will be used (if supported) when the display is in a "Day Mode" or
+ * similar. Should comprise of colors that contrast well during the day under sunlight.
+ */
+ public Builder setDayColorScheme(final TemplateColorScheme dayColorScheme) {
+ sdlManager.dayColorScheme = dayColorScheme;
+ return this;
+ }
+
+ /**
+ * Sets the TemplateColorScheme for nighttime
+ *
+ * @param nightColorScheme color scheme that will be used (if supported) when the display is in a "Night Mode"
+ * or similar. Should comprise of colors that contrast well during the night and are not
+ * brighter than average.
+ */
+ public Builder setNightColorScheme(final TemplateColorScheme nightColorScheme) {
+ sdlManager.nightColorScheme = nightColorScheme;
+ return this;
+ }
+
+ /**
+ * Sets the icon for the app on head unit / In-Vehicle-Infotainment system <br>
+ *
+ * @param sdlArtwork the icon that will be used to represent this application on the connected module
+ */
+ public Builder setAppIcon(final SdlArtwork sdlArtwork) {
+ sdlManager.appIcon = sdlArtwork;
+ return this;
+ }
+
+ /**
+ * Sets the vector of AppHMIType <br>
+ * <strong>Note: This should be an ordered list from most -> least relevant</strong>
+ *
+ * @param hmiTypes HMI types that represent this application. For example, if the app is a music player, the
+ * MEDIA HMIType should be included.
+ */
+ public Builder setAppTypes(final Vector<AppHMIType> hmiTypes) {
+ sdlManager.hmiTypes = hmiTypes;
+
+ if (hmiTypes != null) {
+ sdlManager.isMediaApp = hmiTypes.contains(AppHMIType.MEDIA);
+ }
+
+ return this;
+ }
+
+ /**
+ * Sets the FileManagerConfig for the session.<br>
+ * <strong>Note: If not set, the default configuration value of 1 will be set for
+ * artworkRetryCount and fileRetryCount in FileManagerConfig</strong>
+ *
+ * @param fileManagerConfig - configuration options
+ */
+ public Builder setFileManagerConfig(final FileManagerConfig fileManagerConfig) {
+ sdlManager.fileManagerConfig = fileManagerConfig;
+ return this;
+ }
+
+ /**
+ * Sets the voice recognition synonyms that can be used to identify this application.
+ *
+ * @param vrSynonyms a vector of Strings that can be associated with this app. For example the app's name should
+ * be included as well as any phonetic spellings of the app name that might help the on-board
+ * VR system associated a users spoken word with the supplied synonyms.
+ */
+ public Builder setVrSynonyms(final Vector<String> vrSynonyms) {
+ sdlManager.vrSynonyms = vrSynonyms;
+ return this;
+ }
+
+ /**
+ * Sets the Text-To-Speech Name of the application. These TTSChunks might be used by the module as an audio
+ * representation of the app's name.
+ *
+ * @param ttsChunks the TTS chunks that can represent this app's name
+ */
+ public Builder setTtsName(final Vector<TTSChunk> ttsChunks) {
+ sdlManager.ttsChunks = ttsChunks;
+ return this;
+ }
+
+ /**
+ * This Object type may change with the transport refactor
+ * Sets the BaseTransportConfig
+ *
+ * @param transport the type of transport that should be used for this SdlManager instance.
+ */
+ public Builder setTransportType(@NonNull BaseTransportConfig transport) {
+ sdlManager.transport = transport;
+ return this;
+ }
+
+ /**
+ * Sets the Security libraries
+ *
+ * @param secList The list of security class(es)
+ */
+ @Deprecated
+ public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> secList) {
+ sdlManager.sdlSecList = secList;
+ return this;
+ }
+
+ /**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ *
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public Builder setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ sdlManager.sdlSecList = secList;
+ sdlManager.serviceEncryptionListener = listener;
+ return this;
+ }
+
+ /**
+ * Set the SdlManager Listener
+ *
+ * @param listener the listener
+ */
+ public Builder setManagerListener(@NonNull final SdlManagerListener listener) {
+ sdlManager.managerListener = listener;
+ return this;
+ }
+
+ /**
+ * Set RPCNotification listeners. SdlManager will preload these listeners before any RPCs are sent/received.
+ *
+ * @param listeners a map of listeners that will be called when a notification is received.
+ * Key represents the FunctionID of the notification and value represents the listener
+ */
+ public Builder setRPCNotificationListeners(Map<FunctionID, OnRPCNotificationListener> listeners) {
+ sdlManager.onRPCNotificationListeners = listeners;
+ return this;
+ }
+
+ public SdlManager build() {
+ if (sdlManager.appName == null) {
+ throw new IllegalArgumentException("You must specify an app name by calling setAppName");
+ }
+
+ if (sdlManager.appId == null) {
+ throw new IllegalArgumentException("You must specify an app ID by calling setAppId");
+ }
+
+ if (sdlManager.managerListener == null) {
+ throw new IllegalArgumentException("You must set a SdlManagerListener object");
+ }
+
+ if (sdlManager.hmiTypes == null) {
+ Vector<AppHMIType> hmiTypesDefault = new Vector<>();
+ hmiTypesDefault.add(AppHMIType.DEFAULT);
+ sdlManager.hmiTypes = hmiTypesDefault;
+ sdlManager.isMediaApp = false;
+ }
+ if (sdlManager.fileManagerConfig == null) {
+ //if FileManagerConfig is not set use default
+ sdlManager.fileManagerConfig = new FileManagerConfig();
+ }
+
+ if (sdlManager.hmiLanguage == null) {
+ sdlManager.hmiLanguage = Language.EN_US;
+ sdlManager.language = Language.EN_US;
+ }
+
+ if (sdlManager.minimumProtocolVersion == null) {
+ sdlManager.minimumProtocolVersion = new Version("1.0.0");
+ }
+
+ if (sdlManager.minimumRPCVersion == null) {
+ sdlManager.minimumRPCVersion = new Version("1.0.0");
+ }
+
+ sdlManager.transitionToState(BaseSubManager.SETTING_UP);
+
+ return sdlManager;
+ }
+ }
+
+ /**
+ * Start a secured RPC service
+ */
+ public void startRPCEncryption() {
+ if (lifecycleManager != null) {
+ lifecycleManager.startRPCEncryption();
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
index 6dd65b40b..30a9f92bc 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
@@ -34,7 +34,6 @@ package com.smartdevicelink.managers.file;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -161,7 +160,7 @@ abstract class BaseFileManager extends BaseSubManager {
@Override
public void onError(int correlationId, Result resultCode, String info) {
// file list could not be received. assume that setting can work and allow SDLManager to start
- DebugTool.logError("File Manager could not list files");
+ DebugTool.logError(TAG, "File Manager could not list files");
bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
transitionToState(BaseSubManager.READY);
}
@@ -325,12 +324,12 @@ abstract class BaseFileManager extends BaseSubManager {
*/
public void uploadFile(@NonNull final SdlFile file, final CompletionListener listener) {
if (file.isStaticIcon()) {
- Log.w(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
listener.onComplete(true);
return;
}
if (!file.getOverwrite() && hasUploadedFile(file)) {
- Log.w(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
+ DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
listener.onComplete(true);
return;
}
@@ -398,11 +397,11 @@ abstract class BaseFileManager extends BaseSubManager {
final List<PutFile> putFileRequests = new ArrayList<>();
for (SdlFile file : files) {
if (file.isStaticIcon()) {
- Log.w(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
continue;
}
if (!file.getOverwrite() && hasUploadedFile(file)) {
- Log.w(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
+ DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
continue;
}
putFileRequests.add(createPutFile(file));
@@ -480,7 +479,7 @@ abstract class BaseFileManager extends BaseSubManager {
}
return os.toByteArray();
} catch (IOException e){
- Log.e(TAG, "Can't read from InputStream", e);
+ DebugTool.logError(TAG, "Can't read from InputStream", e);
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
index 808f4b0cd..33bb0a67a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
@@ -52,11 +52,13 @@ import java.util.List;
import java.util.Set;
abstract class BaseEncryptionLifecycleManager {
+ private static final String TAG = "BaseEncryptionLifecycleManager";
private ISdl internalInterface;
private ServiceEncryptionListener serviceEncryptionListener;
private HMILevel currentHMILevel;
private Set<String> encryptionRequiredRPCs = new HashSet<>();
private boolean rpcSecuredServiceStarted;
+ ISdlServiceListener securedServiceListener;
BaseEncryptionLifecycleManager(@NonNull ISdl isdl, ServiceEncryptionListener listener) {
internalInterface = isdl;
@@ -94,7 +96,7 @@ abstract class BaseEncryptionLifecycleManager {
}
};
- ISdlServiceListener securedServiceListener = new ISdlServiceListener() {
+ securedServiceListener = new ISdlServiceListener() {
@Override
public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
if(SessionType.RPC.equals(type)){
@@ -103,7 +105,7 @@ abstract class BaseEncryptionLifecycleManager {
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, isEncrypted, null);
}
- DebugTool.logInfo("onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
+ DebugTool.logInfo(TAG, "onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
}
@Override
@@ -114,7 +116,7 @@ abstract class BaseEncryptionLifecycleManager {
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, false, null);
}
- DebugTool.logInfo("onServiceEnded, session Type: " + type.getName());
+ DebugTool.logInfo(TAG, "onServiceEnded, session Type: " + type.getName());
}
@Override
@@ -125,7 +127,7 @@ abstract class BaseEncryptionLifecycleManager {
if (serviceEncryptionListener != null) {
serviceEncryptionListener.onEncryptionServiceUpdated(type, false, "onServiceError: " + reason);
}
- DebugTool.logError("onServiceError, session Type: " + type.getName() + ", reason: " + reason);
+ DebugTool.logError(TAG, "onServiceError, session Type: " + type.getName() + ", reason: " + reason);
}
};
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index 254b0d505..4a0d0f096 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -32,5 +32,1534 @@
package com.smartdevicelink.managers.lifecycle;
+import android.support.annotation.NonNull;
+import android.support.annotation.RestrictTo;
+
+import com.livio.taskmaster.Taskmaster;
+import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.managers.SdlManager;
+import com.smartdevicelink.managers.ServiceEncryptionListener;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.MessageType;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
+import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.OnSystemRequest;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SubscribeButton;
+import com.smartdevicelink.proxy.rpc.SystemRequest;
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
+import com.smartdevicelink.proxy.rpc.VehicleType;
+import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
+import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.RequestType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
+import com.smartdevicelink.streaming.audio.AudioStreamingParams;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.util.CorrelationIdGenerator;
+import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.FileUtls;
+import com.smartdevicelink.util.Version;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
+
abstract class BaseLifecycleManager {
+
+ static final String TAG = "Lifecycle Manager";
+ public static final Version MAX_SUPPORTED_RPC_VERSION = new Version(6, 0, 0);
+
+ // Protected Correlation IDs
+ private final int REGISTER_APP_INTERFACE_CORRELATION_ID = 65529,
+ UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
+
+ // Sdl Synchronization Objects
+ private static final Object RPC_LISTENER_LOCK = new Object(),
+ ON_UPDATE_LISTENER_LOCK = new Object(),
+ ON_REQUEST_LISTENER_LOCK = new Object(),
+ ON_NOTIFICATION_LISTENER_LOCK = new Object();
+
+ SdlSession session;
+ AppConfig appConfig;
+ Version rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
+ HashMap<Integer, CopyOnWriteArrayList<OnRPCListener>> rpcListeners;
+ HashMap<Integer, OnRPCResponseListener> rpcResponseListeners;
+ HashMap<Integer, CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners;
+ HashMap<Integer, CopyOnWriteArrayList<OnRPCRequestListener>> rpcRequestListeners;
+ SystemCapabilityManager systemCapabilityManager;
+ private EncryptionLifecycleManager encryptionLifecycleManager;
+ RegisterAppInterfaceResponse raiResponse = null;
+ private OnHMIStatus currentHMIStatus;
+ boolean firstTimeFull = true;
+ LifecycleListener lifecycleListener;
+ private List<Class<? extends SdlSecurityBase>> _secList = null;
+ private String authToken;
+ Version minimumProtocolVersion;
+ Version minimumRPCVersion;
+ BaseTransportConfig _transportConfig;
+ private Taskmaster taskmaster;
+
+ BaseLifecycleManager(AppConfig appConfig, BaseTransportConfig config, LifecycleListener listener) {
+ this.appConfig = appConfig;
+ this._transportConfig = config;
+ this.lifecycleListener = listener;
+ this.minimumProtocolVersion = appConfig.getMinimumProtocolVersion();
+ this.minimumRPCVersion = appConfig.getMinimumRPCVersion();
+ initialize();
+ }
+
+ public void start() {
+ try {
+ session.startSession();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Start a secured RPC service
+ */
+ public void startRPCEncryption() {
+ if (session != null) {
+ session.startService(SessionType.RPC, session.getSessionId(), true);
+ }
+ }
+
+ public synchronized void stop() {
+ if(session != null) {
+ session.close();
+ session = null;
+ }
+ if (taskmaster != null) {
+ taskmaster.shutdown();
+ }
+ }
+
+ Taskmaster getTaskmaster() {
+ if (taskmaster == null) {
+ Taskmaster.Builder builder = new Taskmaster.Builder();
+ builder.setThreadCount(2);
+ builder.shouldBeDaemon(true);
+ taskmaster = builder.build();
+ taskmaster.start();
+ }
+ return taskmaster;
+ }
+
+ Version getProtocolVersion() {
+ if (session != null && session.getProtocolVersion() != null) {
+ return session.getProtocolVersion();
+ }
+ return new Version(1, 0, 0);
+ }
+
+ private void sendRPCs(List<? extends RPCMessage> messages, final OnMultipleRequestListener listener) {
+ if (messages != null) {
+ for (RPCMessage message : messages) {
+ // Request Specifics
+ if (message instanceof RPCRequest) {
+ RPCRequest request = ((RPCRequest) message);
+ final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+ if (listener != null) {
+ listener.addCorrelationId(request.getCorrelationID());
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (devOnRPCResponseListener != null) {
+ devOnRPCResponseListener.onResponse(correlationId, response);
+ }
+ if (listener.getSingleRpcResponseListener() != null) {
+ listener.getSingleRpcResponseListener().onResponse(correlationId, response);
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ super.onError(correlationId, resultCode, info);
+ if (devOnRPCResponseListener != null) {
+ devOnRPCResponseListener.onError(correlationId, resultCode, info);
+ }
+ if (listener.getSingleRpcResponseListener() != null) {
+ listener.getSingleRpcResponseListener().onError(correlationId, resultCode, info);
+ }
+ }
+ });
+ }
+ sendRPCMessagePrivate(request, false);
+ } else {
+ // Notifications and Responses
+ sendRPCMessagePrivate(message, false);
+ if (listener != null) {
+ listener.onUpdate(messages.size());
+ if (messages.size() == 0) {
+ listener.onFinished();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void sendSequentialRPCs(final List<? extends RPCMessage> messages, final OnMultipleRequestListener listener) {
+ if (messages != null) {
+ // Break out of recursion, we have finished the requests
+ if (messages.size() == 0) {
+ if (listener != null) {
+ listener.onFinished();
+ }
+ return;
+ }
+
+ RPCMessage rpc = messages.remove(0);
+
+ // Request Specifics
+ if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) rpc;
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+
+ final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
+
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (devOnRPCResponseListener != null) {
+ devOnRPCResponseListener.onResponse(correlationId, response);
+ }
+ if (listener != null) {
+ listener.onResponse(correlationId, response);
+ listener.onUpdate(messages.size());
+ }
+ // recurse after onResponse
+ sendSequentialRPCs(messages, listener);
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ if (devOnRPCResponseListener != null) {
+ devOnRPCResponseListener.onError(correlationId, resultCode, info);
+ }
+ if (listener != null) {
+ listener.onError(correlationId, resultCode, info);
+ listener.onUpdate(messages.size());
+
+ }
+ // recurse after onError
+ sendSequentialRPCs(messages, listener);
+ }
+ });
+ sendRPCMessagePrivate(request, false);
+ } else {
+ // Notifications and Responses
+ sendRPCMessagePrivate(rpc, false);
+ if (listener != null) {
+ listener.onUpdate(messages.size());
+ }
+ // recurse after sending a notification or response as there is no response.
+ sendSequentialRPCs(messages, listener);
+ }
+ }
+ }
+
+ /**
+ * This method is used to ensure all of the methods in this class can remain private and no grantees can be made
+ * to the developer what methods are available or not.
+ *
+ * <b>NOTE: THERE IS NO GURANTEE THIS WILL BE A VALID SYSTEM CAPABILITY MANAGER</b>
+ *
+ * @param sdlManager this must be a working manager instance
+ * @return the system capability manager.
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public SystemCapabilityManager getSystemCapabilityManager(SdlManager sdlManager) {
+ if (sdlManager != null) {
+ return systemCapabilityManager;
+ }
+ return null;
+ }
+
+ private boolean isConnected() {
+ if (session != null) {
+ return session.getIsConnected();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Method to retrieve the RegisterAppInterface Response message that was sent back from the
+ * module. It contains various attributes about the connected module and can be used to adapt
+ * to different module types and their supported features.
+ *
+ * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
+ * registered with the module.
+ */
+ public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
+ return this.raiResponse;
+ }
+
+ /**
+ * Get the current OnHMIStatus
+ *
+ * @return OnHMIStatus object represents the current OnHMIStatus
+ */
+ public OnHMIStatus getCurrentHMIStatus() {
+ return currentHMIStatus;
+ }
+
+ void onClose(String info, Exception e, SdlDisconnectedReason reason) {
+ DebugTool.logInfo(TAG, "onClose");
+ if (lifecycleListener != null) {
+ lifecycleListener.onClosed((LifecycleManager) this, info, e, reason);
+ }
+ }
+
+ /**
+ * This method is used to ensure all of the methods in this class can remain private and no grantees can be made
+ * to the developer what methods are available or not.
+ *
+ * @param sdlManager this must be a working manager instance
+ * @return the internal interface that hooks into this manager
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public ISdl getInternalInterface(SdlManager sdlManager) {
+ if (sdlManager != null) {
+ return internalInterface;
+ }
+ return null;
+ }
+
+ /* *******************************************************************************************************
+ ********************************** INTERNAL - RPC LISTENERS !! START !! *********************************
+ *********************************************************************************************************/
+
+ private void setupInternalRpcListeners() {
+ addRpcListener(FunctionID.REGISTER_APP_INTERFACE, rpcListener);
+ addRpcListener(FunctionID.ON_HMI_STATUS, rpcListener);
+ addRpcListener(FunctionID.ON_HASH_CHANGE, rpcListener);
+ addRpcListener(FunctionID.ON_SYSTEM_REQUEST, rpcListener);
+ addRpcListener(FunctionID.ON_APP_INTERFACE_UNREGISTERED, rpcListener);
+ addRpcListener(FunctionID.UNREGISTER_APP_INTERFACE, rpcListener);
+ }
+
+ private OnRPCListener rpcListener = new OnRPCListener() {
+ @Override
+ public void onReceived(RPCMessage message) {
+ //Make sure this is a response as expected
+ FunctionID functionID = message.getFunctionID();
+ if (functionID != null) {
+ switch (functionID) {
+ case REGISTER_APP_INTERFACE:
+ //We have begun
+ DebugTool.logInfo(TAG, "RAI Response");
+ raiResponse = (RegisterAppInterfaceResponse) message;
+ SdlMsgVersion rpcVersion = ((RegisterAppInterfaceResponse) message).getSdlMsgVersion();
+ if (rpcVersion != null) {
+ BaseLifecycleManager.this.rpcSpecVersion = new Version(rpcVersion.getMajorVersion(), rpcVersion.getMinorVersion(), rpcVersion.getPatchVersion());
+ } else {
+ BaseLifecycleManager.this.rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
+ }
+ if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
+ UnregisterAppInterface msg = new UnregisterAppInterface();
+ msg.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
+ sendRPCMessagePrivate(msg, true);
+ clean();
+ return;
+ }
+ processRaiResponse(raiResponse);
+ systemCapabilityManager.parseRAIResponse(raiResponse);
+ break;
+ case ON_HMI_STATUS:
+ DebugTool.logInfo(TAG, "on hmi status");
+ boolean shouldInit = currentHMIStatus == null;
+ currentHMIStatus = (OnHMIStatus) message;
+ if (lifecycleListener != null && shouldInit) {
+ lifecycleListener.onConnected((LifecycleManager) BaseLifecycleManager.this);
+ }
+ break;
+ case ON_HASH_CHANGE:
+ break;
+ case ON_SYSTEM_REQUEST:
+ final OnSystemRequest onSystemRequest = (OnSystemRequest) message;
+ if ((onSystemRequest.getUrl() != null) &&
+ (((onSystemRequest.getRequestType() == RequestType.PROPRIETARY) && (onSystemRequest.getFileType() == FileType.JSON))
+ || ((onSystemRequest.getRequestType() == RequestType.HTTP) && (onSystemRequest.getFileType() == FileType.BINARY)))) {
+ Thread handleOffboardTransmissionThread = new Thread() {
+ @Override
+ public void run() {
+ RPCRequest request = PoliciesFetcher.fetchPolicies(onSystemRequest);
+ if (request != null && isConnected()) {
+ sendRPCMessagePrivate(request, true);
+ }
+ }
+ };
+ handleOffboardTransmissionThread.start();
+ } else if (onSystemRequest.getRequestType() == RequestType.ICON_URL && onSystemRequest.getUrl() != null) {
+ //Download the icon file and send SystemRequest RPC
+ Thread handleOffBoardTransmissionThread = new Thread() {
+ @Override
+ public void run() {
+ final String urlHttps = onSystemRequest.getUrl().replaceFirst("http://", "https://");
+ byte[] file = FileUtls.downloadFile(urlHttps);
+ if (file != null) {
+ SystemRequest systemRequest = new SystemRequest();
+ systemRequest.setFileName(onSystemRequest.getUrl());
+ systemRequest.setBulkData(file);
+ systemRequest.setRequestType(RequestType.ICON_URL);
+ if (isConnected()) {
+ sendRPCMessagePrivate(systemRequest, true);
+ }
+ } else {
+ DebugTool.logError(TAG, "File was null at: " + urlHttps);
+ }
+ }
+ };
+ handleOffBoardTransmissionThread.start();
+ }
+ break;
+ case ON_APP_INTERFACE_UNREGISTERED:
+
+ OnAppInterfaceUnregistered onAppInterfaceUnregistered = (OnAppInterfaceUnregistered) message;
+
+ if (!onAppInterfaceUnregistered.getReason().equals(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE)) {
+ DebugTool.logInfo(TAG, "on app interface unregistered");
+ clean();
+ } else {
+ DebugTool.logInfo(TAG, "re-registering for language change");
+ cycle(SdlDisconnectedReason.LANGUAGE_CHANGE);
+ }
+ break;
+ case UNREGISTER_APP_INTERFACE:
+ DebugTool.logInfo(TAG, "unregister app interface");
+ clean();
+ break;
+ }
+ }
+ }
+
+
+ };
+
+ /* *******************************************************************************************************
+ ********************************** INTERNAL - RPC LISTENERS !! END !! *********************************
+ *********************************************************************************************************/
+
+
+ /* *******************************************************************************************************
+ ********************************** METHODS - RPC LISTENERS !! START !! **********************************
+ *********************************************************************************************************/
+
+ private boolean onRPCReceived(final RPCMessage message) {
+ synchronized (RPC_LISTENER_LOCK) {
+ if (message == null || message.getFunctionID() == null) {
+ return false;
+ }
+
+ final int id = message.getFunctionID().getId();
+ CopyOnWriteArrayList<OnRPCListener> listeners = rpcListeners.get(id);
+ if (listeners != null && listeners.size() > 0) {
+ for (OnRPCListener listener : listeners) {
+ listener.onReceived(message);
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private void addRpcListener(FunctionID id, OnRPCListener listener) {
+ synchronized (RPC_LISTENER_LOCK) {
+ if (id != null && listener != null) {
+ if (!rpcListeners.containsKey(id.getId())) {
+ rpcListeners.put(id.getId(), new CopyOnWriteArrayList<OnRPCListener>());
+ }
+
+ rpcListeners.get(id.getId()).add(listener);
+ }
+ }
+ }
+
+ private boolean removeOnRPCListener(FunctionID id, OnRPCListener listener) {
+ synchronized (RPC_LISTENER_LOCK) {
+ if (rpcListeners != null
+ && id != null
+ && listener != null
+ && rpcListeners.containsKey(id.getId())) {
+ return rpcListeners.get(id.getId()).remove(listener);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Only call this method for a PutFile response. It will cause a class cast exception if not.
+ *
+ * @param correlationId correlation id of the packet being updated
+ * @param bytesWritten how many bytes were written
+ * @param totalSize the total size in bytes
+ */
+ @SuppressWarnings("unused")
+ private void onPacketProgress(int correlationId, long bytesWritten, long totalSize) {
+ synchronized (ON_UPDATE_LISTENER_LOCK) {
+ if (rpcResponseListeners != null
+ && rpcResponseListeners.containsKey(correlationId)) {
+ ((OnPutFileUpdateListener) rpcResponseListeners.get(correlationId)).onUpdate(correlationId, bytesWritten, totalSize);
+ }
+ }
+
+ }
+
+ /**
+ * Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
+ * <p>Will automatically remove the listener for the list of listeners on completion.
+ *
+ * @param msg The RPCResponse message that was received
+ * @return if a listener was called or not
+ */
+ @SuppressWarnings("UnusedReturnValue")
+ private boolean onRPCResponseReceived(RPCResponse msg) {
+ synchronized (ON_UPDATE_LISTENER_LOCK) {
+ int correlationId = msg.getCorrelationID();
+ if (rpcResponseListeners != null
+ && rpcResponseListeners.containsKey(correlationId)) {
+ OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
+ if (msg.getSuccess()) {
+ listener.onResponse(correlationId, msg);
+ } else {
+ listener.onError(correlationId, msg.getResultCode(), msg.getInfo());
+ }
+ rpcResponseListeners.remove(correlationId);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Add a listener that will receive the response to the specific RPCRequest sent with the corresponding correlation id
+ *
+ * @param listener that will get called back when a response is received
+ * @param correlationId of the RPCRequest that was sent
+ * @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
+ */
+ private void addOnRPCResponseListener(OnRPCResponseListener listener, int correlationId, int totalSize) {
+ synchronized (ON_UPDATE_LISTENER_LOCK) {
+ if (rpcResponseListeners != null
+ && listener != null) {
+ if (listener.getListenerType() == OnRPCResponseListener.UPDATE_LISTENER_TYPE_PUT_FILE) {
+ ((OnPutFileUpdateListener) listener).setTotalSize(totalSize);
+ }
+ listener.onStart(correlationId);
+ rpcResponseListeners.put(correlationId, listener);
+ }
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private HashMap<Integer, OnRPCResponseListener> getResponseListeners() {
+ synchronized (ON_UPDATE_LISTENER_LOCK) {
+ return this.rpcResponseListeners;
+ }
+ }
+
+ /**
+ * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
+ * service from the module. For example, this should be used to login to a user account.
+ *
+ * @return the string representation of the auth token
+ */
+ public String getAuthToken() {
+ return this.authToken;
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ private boolean onRPCNotificationReceived(RPCNotification notification) {
+ if (notification == null) {
+ DebugTool.logError(TAG, "onRPCNotificationReceived - Notification was null");
+ return false;
+ }
+ DebugTool.logInfo(TAG, "onRPCNotificationReceived - " + notification.getFunctionName());
+
+ //Before updating any listeners, make sure to do any final updates to the notification RPC now
+ if (FunctionID.ON_HMI_STATUS.toString().equals(notification.getFunctionName())) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ onHMIStatus.setFirstRun(firstTimeFull);
+ if (onHMIStatus.getHmiLevel() == HMILevel.HMI_FULL) {
+ firstTimeFull = false;
+ }
+ }
+
+ synchronized (ON_NOTIFICATION_LISTENER_LOCK) {
+ CopyOnWriteArrayList<OnRPCNotificationListener> listeners = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
+ if (listeners != null && listeners.size() > 0) {
+ for (OnRPCNotificationListener listener : listeners) {
+ listener.onNotified(notification);
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * This will add a listener for the specific type of notification. As of now it will only allow
+ * a single listener per notification function id
+ *
+ * @param notificationId The notification type that this listener is designated for
+ * @param listener The listener that will be called when a notification of the provided type is received
+ */
+ @SuppressWarnings("unused")
+ private void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ synchronized (ON_NOTIFICATION_LISTENER_LOCK) {
+ if (notificationId != null && listener != null) {
+ if (!rpcNotificationListeners.containsKey(notificationId.getId())) {
+ rpcNotificationListeners.put(notificationId.getId(), new CopyOnWriteArrayList<OnRPCNotificationListener>());
+ }
+ rpcNotificationListeners.get(notificationId.getId()).add(listener);
+ }
+ }
+ }
+
+ private boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ synchronized (ON_NOTIFICATION_LISTENER_LOCK) {
+ if (rpcNotificationListeners != null
+ && notificationId != null
+ && listener != null
+ && rpcNotificationListeners.containsKey(notificationId.getId())) {
+ return rpcNotificationListeners.get(notificationId.getId()).remove(listener);
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ private boolean onRPCRequestReceived(RPCRequest request) {
+ if (request == null) {
+ DebugTool.logError("onRPCRequestReceived - request was null");
+ return false;
+ }
+ DebugTool.logInfo(TAG, "onRPCRequestReceived - " + request.getFunctionName());
+
+ synchronized (ON_REQUEST_LISTENER_LOCK) {
+ CopyOnWriteArrayList<OnRPCRequestListener> listeners = rpcRequestListeners.get(FunctionID.getFunctionId(request.getFunctionName()));
+ if (listeners != null && listeners.size() > 0) {
+ for (OnRPCRequestListener listener : listeners) {
+ listener.onRequest(request);
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * This will add a listener for the specific type of request. As of now it will only allow
+ * a single listener per request function id
+ *
+ * @param requestId The request type that this listener is designated for
+ * @param listener The listener that will be called when a request of the provided type is received
+ */
+ @SuppressWarnings("unused")
+ private void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener) {
+ synchronized (ON_REQUEST_LISTENER_LOCK) {
+ if (requestId != null && listener != null) {
+ if (!rpcRequestListeners.containsKey(requestId.getId())) {
+ rpcRequestListeners.put(requestId.getId(), new CopyOnWriteArrayList<OnRPCRequestListener>());
+ }
+ rpcRequestListeners.get(requestId.getId()).add(listener);
+ }
+ }
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ private boolean removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener) {
+ synchronized (ON_REQUEST_LISTENER_LOCK) {
+ if (rpcRequestListeners != null
+ && requestId != null
+ && listener != null
+ && rpcRequestListeners.containsKey(requestId.getId())) {
+ return rpcRequestListeners.get(requestId.getId()).remove(listener);
+ }
+ }
+ return false;
+ }
+
+ /* *******************************************************************************************************
+ **************************************** RPC LISTENERS !! END !! ****************************************
+ *********************************************************************************************************/
+
+ private void sendRPCMessagePrivate(RPCMessage message, boolean isInternalMessage) {
+ try {
+ if (!isInternalMessage && message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) message;
+ OnRPCResponseListener listener = request.getOnRPCResponseListener();
+
+ // Test for illegal correlation ID
+ if (request.getCorrelationID() == REGISTER_APP_INTERFACE_CORRELATION_ID || request.getCorrelationID() == UNREGISTER_APP_INTERFACE_CORRELATION_ID || request.getCorrelationID() == PoliciesFetcher.POLICIES_CORRELATION_ID) {
+ if (listener != null) {
+ request.getOnRPCResponseListener().onError(request.getCorrelationID(), Result.REJECTED, "Invalid correlation ID. The correlation ID, " + request.getCorrelationID() + " , is a reserved correlation ID.");
+ }
+ return;
+ }
+
+ // Prevent developer from sending RAI or UAI manually
+ if (request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString()) || request.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
+ if (listener != null) {
+ request.getOnRPCResponseListener().onError(request.getCorrelationID(), Result.REJECTED, "The RPCRequest, " + message.getFunctionName() + ", is un-allowed to be sent manually by the developer.");
+ }
+ return;
+ }
+ }
+
+ //FIXME this is temporary until the next major release of the library where OK is removed
+ if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
+ RPCRequest request = (RPCRequest) message;
+ if (FunctionID.SUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
+ || FunctionID.UNSUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
+ || FunctionID.BUTTON_PRESS.toString().equals(request.getFunctionName())) {
+
+ ButtonName buttonName = (ButtonName) request.getObject(ButtonName.class, SubscribeButton.KEY_BUTTON_NAME);
+
+
+ if (rpcSpecVersion != null) {
+ if (rpcSpecVersion.getMajor() < 5) {
+
+ if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
+ request.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.OK);
+ }
+ } else { //Newer than version 5.0.0
+ if (ButtonName.OK.equals(buttonName)) {
+ RPCRequest request2 = new RPCRequest(request);
+ request2.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.PLAY_PAUSE);
+ request2.setOnRPCResponseListener(request.getOnRPCResponseListener());
+ sendRPCMessagePrivate(request2, true);
+ return;
+ }
+ }
+ }
+
+ }
+ }
+
+ message.format(rpcSpecVersion, true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte) getProtocolVersion().getMajor());
+
+ final ProtocolMessage pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ if (session != null) {
+ pm.setSessionID(session.getSessionId());
+ }
+
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
+
+ if (encryptionLifecycleManager != null && encryptionLifecycleManager.isEncryptionReady() && encryptionLifecycleManager.getRPCRequiresEncryption(message.getFunctionID())) {
+ pm.setPayloadProtected(true);
+ } else {
+ pm.setPayloadProtected(message.isPayloadProtected());
+ }
+ if (pm.getPayloadProtected() && (encryptionLifecycleManager == null || !encryptionLifecycleManager.isEncryptionReady())) {
+ String errorInfo = "Trying to send an encrypted message and there is no secured service";
+ if (message.getMessageType().equals((RPCMessage.KEY_REQUEST))) {
+ RPCRequest request = (RPCRequest) message;
+ OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
+ if (listener != null) {
+ listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
+ }
+ }
+ DebugTool.logWarning(TAG, errorInfo);
+ return;
+ }
+
+ if (RPCMessage.KEY_REQUEST.equals(message.getMessageType())) { // Request Specifics
+ pm.setRPCType((byte) 0x00);
+ Integer corrId = ((RPCRequest) message).getCorrelationID();
+ if (corrId == null) {
+ DebugTool.logError(TAG, "No correlation ID attached to request. Not sending");
+ return;
+ } else {
+ pm.setCorrID(corrId);
+
+ OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
+ if (listener != null) {
+ addOnRPCResponseListener(listener, corrId, msgBytes.length);
+ }
+ }
+ } else if (RPCMessage.KEY_RESPONSE.equals(message.getMessageType())) { // Response Specifics
+ RPCResponse response = (RPCResponse) message;
+ pm.setRPCType((byte) 0x01);
+ if (response.getCorrelationID() == null) {
+ //Log error here
+ //throw new SdlException("CorrelationID cannot be null. RPC: " + response.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
+ DebugTool.logError(TAG, "No correlation ID attached to response. Not sending");
+ return;
+ } else {
+ pm.setCorrID(response.getCorrelationID());
+ }
+ } else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) { // Notification Specifics
+ pm.setRPCType((byte) 0x02);
+ }
+
+ if (message.getBulkData() != null) {
+ pm.setBulkData(message.getBulkData());
+ }
+
+ if (message.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())) {
+ pm.setPriorityCoefficient(1);
+ }
+
+ session.sendMessage(pm);
+
+ } catch (OutOfMemoryError e) {
+ e.printStackTrace();
+ }
+ }
+
+ /* *******************************************************************************************************
+ *************************************** ISdlConnectionListener START ************************************
+ *********************************************************************************************************/
+
+ final ISdlConnectionListener sdlConnectionListener = new ISdlConnectionListener() {
+ @Override
+ public void onTransportDisconnected(String info) {
+ onClose(info, null, null);
+
+ }
+
+ @Override
+ public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
+ BaseLifecycleManager.this.onTransportDisconnected(info, availablePrimary, transportConfig);
+
+ }
+
+ @Override
+ public void onTransportError(String info, Exception e) {
+ onClose(info, e, null);
+
+ }
+
+ @Override
+ public void onProtocolMessageReceived(ProtocolMessage msg) {
+ //Incoming message
+ if (SessionType.RPC.equals(msg.getSessionType())
+ || SessionType.BULK_DATA.equals(msg.getSessionType())) {
+
+ RPCMessage rpc = RpcConverter.extractRpc(msg, session.getProtocolVersion());
+ if (rpc != null) {
+ String messageType = rpc.getMessageType();
+ DebugTool.logInfo(TAG, "RPC received - " + messageType);
+
+ rpc.format(rpcSpecVersion, true);
+
+ onRPCReceived(rpc);
+
+ if (RPCMessage.KEY_RESPONSE.equals(messageType)) {
+
+ onRPCResponseReceived((RPCResponse) rpc);
+
+ } else if (RPCMessage.KEY_NOTIFICATION.equals(messageType)) {
+ FunctionID functionID = rpc.getFunctionID();
+ if (functionID != null && (functionID.equals(FunctionID.ON_BUTTON_PRESS)) || functionID.equals(FunctionID.ON_BUTTON_EVENT)) {
+ RPCNotification notificationCompat = handleButtonNotificationFormatting(rpc);
+ if (notificationCompat != null) {
+ onRPCNotificationReceived((notificationCompat));
+ }
+ }
+
+ onRPCNotificationReceived((RPCNotification) rpc);
+
+ } else if (RPCMessage.KEY_REQUEST.equals(messageType)) {
+
+ onRPCRequestReceived((RPCRequest) rpc);
+
+ }
+ } else {
+ DebugTool.logWarning(TAG, "Shouldn't be here");
+ }
+ }
+
+ }
+
+ @Override
+ public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+ DebugTool.logWarning(TAG, sessionType.getName() + " onProtocolSessionStartedNACKed " + sessionID + " RejectedParams: " + rejectedParams);
+ BaseLifecycleManager.this.onStartServiceNACKed(sessionType);
+ }
+
+ @Override
+ public void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
+ DebugTool.logInfo(TAG, "on protocol session started");
+ BaseLifecycleManager.this.onServiceStarted(sessionType);
+ }
+
+ @Override
+ public void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID) {
+ //Currently not necessary
+ }
+
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID) {
+ //Currently not necessary
+ }
+
+ @Override
+ public void onProtocolError(String info, Exception e) {
+ DebugTool.logError(TAG, "Protocol Error - " + info, e);
+ }
+
+ @Override
+ public void onHeartbeatTimedOut(byte sessionID) { /* Deprecated */ }
+
+ @Override
+ public void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID) {/* Unused */ }
+
+
+ @Override
+ public void onAuthTokenReceived(String token, byte sessionID) {
+ BaseLifecycleManager.this.authToken = token;
+ }
+ };
+
+ /* *******************************************************************************************************
+ *************************************** ISdlConnectionListener END ************************************
+ *********************************************************************************************************/
+
+
+ /* *******************************************************************************************************
+ ******************************************** ISdl - START ***********************************************
+ *********************************************************************************************************/
+
+ final ISdl internalInterface = new ISdl() {
+ @Override
+ public void start() {
+ BaseLifecycleManager.this.start();
+ }
+
+ @Override
+ public void stop() {
+ BaseLifecycleManager.this.stop();
+ }
+
+ @Override
+ public boolean isConnected() {
+ return BaseLifecycleManager.this.session.getIsConnected();
+ }
+
+ @Override
+ public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ BaseLifecycleManager.this.session.addServiceListener(serviceType, sdlServiceListener);
+ }
+
+ @Override
+ public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ BaseLifecycleManager.this.session.removeServiceListener(serviceType, sdlServiceListener);
+ }
+
+ @Override
+ public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
+ BaseLifecycleManager.this.startVideoService(encrypted, parameters);
+ }
+
+ @Override
+ public void stopVideoService() {
+ BaseLifecycleManager.this.endVideoStream();
+ }
+
+ @Override
+ public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
+ DebugTool.logWarning(TAG, "startVideoStream is not currently implemented");
+ return null;
+ }
+
+ @Override
+ public void startAudioService(boolean encrypted, AudioStreamingCodec codec, AudioStreamingParams params) {
+ DebugTool.logWarning(TAG, "startAudioService is not currently implemented");
+ }
+
+ @Override
+ public void startAudioService(boolean encrypted) {
+ BaseLifecycleManager.this.startAudioService(encrypted);
+ }
+
+ @Override
+ public void stopAudioService() {
+ BaseLifecycleManager.this.endAudioStream();
+ }
+
+ @Override
+ public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec, AudioStreamingParams params) {
+ DebugTool.logWarning(TAG, "startAudioStream is not currently implemented");
+ return null;
+ }
+
+ @Override
+ public void sendRPCRequest(RPCRequest message) {
+ BaseLifecycleManager.this.sendRPCMessagePrivate(message, false);
+ }
+
+ @Override
+ public void sendRPC(RPCMessage message) {
+ if (isConnected()) {
+ BaseLifecycleManager.this.sendRPCMessagePrivate(message, false);
+ }
+ }
+
+ @Override
+ public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
+ BaseLifecycleManager.this.sendRPCs(rpcs, listener);
+ }
+
+ @Override
+ public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
+ BaseLifecycleManager.this.sendRPCs(rpcs, listener);
+ }
+
+ @Override
+ public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
+ BaseLifecycleManager.this.sendSequentialRPCs(rpcs, listener);
+ }
+
+ @Override
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ BaseLifecycleManager.this.addOnRPCNotificationListener(notificationId, listener);
+ }
+
+ @Override
+ public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ return BaseLifecycleManager.this.removeOnRPCNotificationListener(notificationId, listener);
+ }
+
+ @Override
+ public void addOnRPCRequestListener(FunctionID notificationId, OnRPCRequestListener listener) {
+ BaseLifecycleManager.this.addOnRPCRequestListener(notificationId, listener);
+ }
+
+ @Override
+ public boolean removeOnRPCRequestListener(FunctionID notificationId, OnRPCRequestListener listener) {
+ return BaseLifecycleManager.this.removeOnRPCRequestListener(notificationId, listener);
+ }
+
+ @Override
+ public void addOnRPCListener(FunctionID responseId, OnRPCListener listener) {
+ BaseLifecycleManager.this.addRpcListener(responseId, listener);
+ }
+
+ @Override
+ public boolean removeOnRPCListener(FunctionID responseId, OnRPCListener listener) {
+ return BaseLifecycleManager.this.removeOnRPCListener(responseId, listener);
+ }
+
+ @Override
+ public Object getCapability(SystemCapabilityType systemCapabilityType) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ return BaseLifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ BaseLifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType, scListener);
+ }
+ }
+
+ @Override
+ public Object getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener, boolean forceUpdate) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ return BaseLifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType, scListener, forceUpdate);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
+ return raiResponse;
+ }
+
+ @Override
+ public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ return BaseLifecycleManager.this.systemCapabilityManager.isCapabilitySupported(systemCapabilityType);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void addOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ BaseLifecycleManager.this.systemCapabilityManager.addOnSystemCapabilityListener(systemCapabilityType, listener);
+ }
+ }
+
+ @Override
+ public boolean removeOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
+ if (BaseLifecycleManager.this.systemCapabilityManager != null) {
+ return BaseLifecycleManager.this.systemCapabilityManager.removeOnSystemCapabilityListener(systemCapabilityType, listener);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isTransportForServiceAvailable(SessionType serviceType) {
+ return BaseLifecycleManager.this.session.isTransportForServiceAvailable(serviceType);
+ }
+
+ @Override
+ public SdlMsgVersion getSdlMsgVersion() {
+ SdlMsgVersion msgVersion = new SdlMsgVersion(rpcSpecVersion.getMajor(), rpcSpecVersion.getMinor());
+ msgVersion.setPatchVersion(rpcSpecVersion.getPatch());
+ return msgVersion;
+ }
+
+ @Override
+ public Version getProtocolVersion() {
+ return BaseLifecycleManager.this.getProtocolVersion();
+ }
+
+ @Override
+ public void startRPCEncryption() {
+ BaseLifecycleManager.this.startRPCEncryption();
+ }
+
+ @Override
+ public Taskmaster getTaskmaster() {
+ return BaseLifecycleManager.this.getTaskmaster();
+ }
+ };
+
+ /* *******************************************************************************************************
+ ********************************************* ISdl - END ************************************************
+ *********************************************************************************************************/
+
+ /**
+ * Temporary method to bridge the new PLAY_PAUSE and OKAY button functionality with the old
+ * OK button name. This should be removed during the next major release
+ *
+ * @param notification an RPC message object that should be either an ON_BUTTON_EVENT or ON_BUTTON_PRESS otherwise
+ * it will be ignored
+ */
+ private RPCNotification handleButtonNotificationFormatting(RPCMessage notification) {
+ if (FunctionID.ON_BUTTON_EVENT.toString().equals(notification.getFunctionName())
+ || FunctionID.ON_BUTTON_PRESS.toString().equals(notification.getFunctionName())) {
+
+ ButtonName buttonName = (ButtonName) notification.getObject(ButtonName.class, OnButtonEvent.KEY_BUTTON_NAME);
+ ButtonName compatBtnName = null;
+
+ if (rpcSpecVersion != null && rpcSpecVersion.getMajor() >= 5) {
+ if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
+ compatBtnName = ButtonName.OK;
+ }
+ } else { // rpc spec version is either null or less than 5
+ if (ButtonName.OK.equals(buttonName)) {
+ compatBtnName = ButtonName.PLAY_PAUSE;
+ }
+ }
+
+ try {
+ if (compatBtnName != null) { //There is a button name that needs to be swapped out
+ RPCNotification notification2;
+ //The following is done because there is currently no way to make a deep copy
+ //of an RPC. Since this code will be removed, it's ugliness is borderline acceptable.
+ if (notification instanceof OnButtonEvent) {
+ OnButtonEvent onButtonEvent = new OnButtonEvent();
+ onButtonEvent.setButtonEventMode(((OnButtonEvent) notification).getButtonEventMode());
+ onButtonEvent.setCustomButtonID(((OnButtonEvent) notification).getCustomButtonID());
+ notification2 = onButtonEvent;
+ } else if (notification instanceof OnButtonPress) {
+ OnButtonPress onButtonPress = new OnButtonPress();
+ onButtonPress.setButtonPressMode(((OnButtonPress) notification).getButtonPressMode());
+ onButtonPress.setCustomButtonName(((OnButtonPress) notification).getCustomButtonName());
+ notification2 = onButtonPress;
+ } else {
+ return null;
+ }
+
+ notification2.setParameters(OnButtonEvent.KEY_BUTTON_NAME, compatBtnName);
+ return notification2;
+ }
+ } catch (Exception e) {
+ //Should never get here
+ }
+ }
+ return null;
+ }
+
+ void clean() {
+ firstTimeFull = true;
+ currentHMIStatus = null;
+ if (rpcListeners != null) {
+ rpcListeners.clear();
+ }
+ if (rpcResponseListeners != null) {
+ rpcResponseListeners.clear();
+ }
+ if (rpcNotificationListeners != null) {
+ rpcNotificationListeners.clear();
+ }
+ if (rpcRequestListeners != null) {
+ rpcRequestListeners.clear();
+ }
+ if (session != null && session.getIsConnected()) {
+ session.close();
+ }
+ if (encryptionLifecycleManager != null) {
+ encryptionLifecycleManager.dispose();
+ }
+ }
+
+ @Deprecated
+ public void setSdlSecurityClassList(List<Class<? extends SdlSecurityBase>> list) {
+ _secList = list;
+ }
+
+ /**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ *
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public void setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ this._secList = secList;
+ this.encryptionLifecycleManager = new EncryptionLifecycleManager(internalInterface, listener);
+ }
+
+ private void processRaiResponse(RegisterAppInterfaceResponse rai) {
+ if (rai == null) return;
+
+ this.raiResponse = rai;
+
+ VehicleType vt = rai.getVehicleType();
+ if (vt == null) return;
+
+ String make = vt.getMake();
+ if (make == null) return;
+
+ if (_secList == null) return;
+
+ setSdlSecurityStaticVars();
+
+ SdlSecurityBase sec;
+
+ for (Class<? extends SdlSecurityBase> cls : _secList) {
+ try {
+ sec = cls.newInstance();
+ } catch (Exception e) {
+ continue;
+ }
+
+ if ((sec != null) && (sec.getMakeList() != null)) {
+ if (sec.getMakeList().contains(make)) {
+ sec.setAppId(appConfig.getAppID());
+ if (session != null) {
+ session.setSdlSecurity(sec);
+ sec.handleSdlSession(session);
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ /* *******************************************************************************************************
+ ********************************** Platform specific methods - START *************************************
+ *********************************************************************************************************/
+
+ void initialize() {
+ this.rpcListeners = new HashMap<>();
+ this.rpcResponseListeners = new HashMap<>();
+ this.rpcNotificationListeners = new HashMap<>();
+ this.rpcRequestListeners = new HashMap<>();
+ this.systemCapabilityManager = new SystemCapabilityManager(internalInterface);
+ setupInternalRpcListeners();
+ }
+
+ void onServiceStarted(SessionType sessionType) {
+ if (sessionType != null) {
+ if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1) {
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
+ session.endService(sessionType, session.getSessionId());
+ clean();
+ return;
+ }
+
+ if (sessionType.equals(SessionType.RPC)) {
+ if (appConfig != null) {
+
+ appConfig.prepare();
+
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion();
+ sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
+ sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
+ sdlMsgVersion.setPatchVersion(MAX_SUPPORTED_RPC_VERSION.getPatch());
+
+ RegisterAppInterface rai = new RegisterAppInterface(sdlMsgVersion,
+ appConfig.getAppName(), appConfig.isMediaApp(), appConfig.getLanguageDesired(),
+ appConfig.getHmiDisplayLanguageDesired(), appConfig.getAppID());
+ rai.setCorrelationID(REGISTER_APP_INTERFACE_CORRELATION_ID);
+
+ rai.setTtsName(appConfig.getTtsName());
+ rai.setNgnMediaScreenAppName(appConfig.getNgnMediaScreenAppName());
+ rai.setVrSynonyms(appConfig.getVrSynonyms());
+ rai.setAppHMIType(appConfig.getAppType());
+ rai.setDayColorScheme(appConfig.getDayColorScheme());
+ rai.setNightColorScheme(appConfig.getNightColorScheme());
+ rai.setHashID(appConfig.getResumeHash());
+
+ //Add device/system info in the future
+
+ sendRPCMessagePrivate(rai, true);
+ } else {
+ DebugTool.logError(TAG, "App config was null, soo...");
+ }
+ }
+ }
+ }
+
+ abstract void cycle(SdlDisconnectedReason disconnectedReason);
+
+ void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
+ }
+
+ void onStartServiceNACKed(SessionType sessionType) {
+ }
+
+
+ void startVideoService(boolean encrypted, VideoStreamingParameters parameters) {
+ }
+
+ void endVideoStream() {
+ }
+
+ void startAudioService(boolean encrypted) {
+ }
+
+ void endAudioStream() {
+ }
+
+ void setSdlSecurityStaticVars() {
+ }
+
+ /* *******************************************************************************************************
+ ********************************** Platform specific methods - End *************************************
+ *********************************************************************************************************/
+
+ /* *******************************************************************************************************
+ ****************************** Inner Classes and Interfaces - Start *************************************
+ *********************************************************************************************************/
+
+ public interface LifecycleListener {
+ void onConnected(LifecycleManager lifeCycleManager);
+
+ void onClosed(LifecycleManager lifeCycleManager, String info, Exception e, SdlDisconnectedReason reason);
+
+ void onServiceStarted(SessionType sessionType);
+
+ void onServiceEnded(SessionType sessionType);
+
+ void onError(LifecycleManager lifeCycleManager, String info, Exception e);
+ }
+
+ public static class AppConfig {
+ private String appID, appName, ngnMediaScreenAppName, resumeHash;
+ private Vector<TTSChunk> ttsName;
+ private Vector<String> vrSynonyms;
+ private boolean isMediaApp = false;
+ private Language languageDesired, hmiDisplayLanguageDesired;
+ private Vector<AppHMIType> appType;
+ private TemplateColorScheme dayColorScheme, nightColorScheme;
+ private Version minimumProtocolVersion;
+ private Version minimumRPCVersion;
+
+ private void prepare() {
+ if (getNgnMediaScreenAppName() == null) {
+ setNgnMediaScreenAppName(getAppName());
+ }
+
+ if (getLanguageDesired() == null) {
+ setLanguageDesired(Language.EN_US);
+ }
+
+ if (getHmiDisplayLanguageDesired() == null) {
+ setHmiDisplayLanguageDesired(Language.EN_US);
+ }
+
+ if (getVrSynonyms() == null) {
+ setVrSynonyms(new Vector<String>());
+ getVrSynonyms().add(getAppName());
+ }
+ }
+
+ public String getAppID() {
+ return appID;
+ }
+
+ public void setAppID(String appID) {
+ this.appID = appID;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public String getNgnMediaScreenAppName() {
+ return ngnMediaScreenAppName;
+ }
+
+ public void setNgnMediaScreenAppName(String ngnMediaScreenAppName) {
+ this.ngnMediaScreenAppName = ngnMediaScreenAppName;
+ }
+
+ public Vector<TTSChunk> getTtsName() {
+ return ttsName;
+ }
+
+ public void setTtsName(Vector<TTSChunk> ttsName) {
+ this.ttsName = ttsName;
+ }
+
+ public Vector<String> getVrSynonyms() {
+ return vrSynonyms;
+ }
+
+ public void setVrSynonyms(Vector<String> vrSynonyms) {
+ this.vrSynonyms = vrSynonyms;
+ }
+
+ public boolean isMediaApp() {
+ return isMediaApp;
+ }
+
+ public void setMediaApp(boolean mediaApp) {
+ isMediaApp = mediaApp;
+ }
+
+ public Language getLanguageDesired() {
+ return languageDesired;
+ }
+
+ public void setLanguageDesired(Language languageDesired) {
+ this.languageDesired = languageDesired;
+ }
+
+ public Language getHmiDisplayLanguageDesired() {
+ return hmiDisplayLanguageDesired;
+ }
+
+ public void setHmiDisplayLanguageDesired(Language hmiDisplayLanguageDesired) {
+ this.hmiDisplayLanguageDesired = hmiDisplayLanguageDesired;
+ }
+
+ public Vector<AppHMIType> getAppType() {
+ return appType;
+ }
+
+ public void setAppType(Vector<AppHMIType> appType) {
+ this.appType = appType;
+ }
+
+ public String getResumeHash() {
+ return this.resumeHash;
+ }
+
+ public void setResumeHash(String resumeHash) {
+ this.resumeHash = resumeHash;
+ }
+
+ public TemplateColorScheme getDayColorScheme() {
+ return dayColorScheme;
+ }
+
+ public void setDayColorScheme(TemplateColorScheme dayColorScheme) {
+ this.dayColorScheme = dayColorScheme;
+ }
+
+ public TemplateColorScheme getNightColorScheme() {
+ return nightColorScheme;
+ }
+
+ public void setNightColorScheme(TemplateColorScheme nightColorScheme) {
+ this.nightColorScheme = nightColorScheme;
+ }
+
+ public Version getMinimumProtocolVersion() {
+ return minimumProtocolVersion;
+ }
+
+ /**
+ * Sets the minimum protocol version that will be permitted to connect.
+ * If the protocol version of the head unit connected is below this version,
+ * the app will disconnect with an EndService protocol message and will not register.
+ *
+ * @param minimumProtocolVersion a Version object with the minimally accepted Protocol version
+ */
+ public void setMinimumProtocolVersion(Version minimumProtocolVersion) {
+ this.minimumProtocolVersion = minimumProtocolVersion;
+ }
+
+ public Version getMinimumRPCVersion() {
+ return minimumRPCVersion;
+ }
+
+ /**
+ * The minimum RPC version that will be permitted to connect.
+ * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
+ *
+ * @param minimumRPCVersion a Version object with the minimally accepted RPC spec version
+ */
+ public void setMinimumRPCVersion(Version minimumRPCVersion) {
+ this.minimumRPCVersion = minimumRPCVersion;
+ }
+ }
+
+ /* *******************************************************************************************************
+ ****************************** Inner Classes and Interfaces - End ***************************************
+ *********************************************************************************************************/
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/PoliciesFetcher.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/PoliciesFetcher.java
index f8d59261a..a217cfb07 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/PoliciesFetcher.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/PoliciesFetcher.java
@@ -31,7 +31,6 @@
*/
package com.smartdevicelink.managers.lifecycle;
-import android.util.Log;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.Headers;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
@@ -55,7 +54,7 @@ import java.util.Vector;
class PoliciesFetcher {
private static final String TAG = PoliciesFetcher.class.getSimpleName();
- private static final int POLICIES_CORRELATION_ID = 65535;
+ static final int POLICIES_CORRELATION_ID = 65535;
private static HttpURLConnection getURLConnection(Headers myHeader, String sURLString, int Timeout, int iContentLen) {
String sContentType = "application/json";
@@ -150,7 +149,7 @@ class PoliciesFetcher {
urlConnection = getURLConnection(myHeader, sURLString, iTimeout, length);
if (urlConnection == null) {
- Log.i(TAG, "urlConnection is null, check RPC input parameters");
+ DebugTool.logInfo(TAG, "urlConnection is null, check RPC input parameters");
return null;
}
@@ -172,7 +171,7 @@ class PoliciesFetcher {
int iResponseCode = urlConnection.getResponseCode();
if (iResponseCode != HttpURLConnection.HTTP_OK) {
- Log.i(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
+ DebugTool.logInfo(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
return null;
}
@@ -206,16 +205,16 @@ class PoliciesFetcher {
for (int i = 0; i < jsonArray.length(); i++) {
if (jsonArray.get(i) instanceof String) {
cloudDataReceived.add(jsonArray.getString(i));
- //Log.i("sendSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
+ //DebugTool.logInfo(TAG, "sendSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
}
}
} else if (jsonResponse.get(dataKey) instanceof String) {
cloudDataReceived.add(jsonResponse.getString(dataKey));
- //Log.i("sendSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
+ //DebugTool.logInfo(TAG, "sendSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
}
} else {
- DebugTool.logError("sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
- //Log.i("sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
+ //DebugTool.logInfo(TAG, "sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
return null;
}
@@ -246,17 +245,17 @@ class PoliciesFetcher {
}
} catch (JSONException e) {
- DebugTool.logError("sendSystemRequestToUrl: JSONException: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: JSONException: ", e);
} catch (UnsupportedEncodingException e) {
- DebugTool.logError("sendSystemRequestToUrl: Could not encode string.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not encode string.", e);
} catch (ProtocolException e) {
- DebugTool.logError("sendSystemRequestToUrl: Could not set request method to post.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not set request method to post.", e);
} catch (MalformedURLException e) {
- DebugTool.logError("sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
} catch (IOException e) {
- DebugTool.logError("sendSystemRequestToUrl: IOException: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: IOException: ", e);
} catch (Exception e) {
- DebugTool.logError("sendSystemRequestToUrl: Unexpected Exception: ", e);
+ DebugTool.logError(TAG, "sendSystemRequestToUrl: Unexpected Exception: ", e);
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
index c8e234504..9cc9eee25 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
@@ -31,8 +31,6 @@
*/
package com.smartdevicelink.managers.lifecycle;
-import android.util.Log;
-
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -68,7 +66,7 @@ public class RpcConverter {
try{
return convertTableToRpc(tempTable);
}catch (Exception e){
- DebugTool.logError("Error converting RPC",e);
+ DebugTool.logError(TAG, "Error converting RPC",e);
}
}
return null;
@@ -92,7 +90,7 @@ public class RpcConverter {
if (functionName != null) {
hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
} else {
- DebugTool.logWarning("Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
+ DebugTool.logWarning(TAG, "Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
return null;
}
@@ -124,7 +122,7 @@ public class RpcConverter {
}else if(rpcHashTable.containsKey((RPCMessage.KEY_REQUEST))){
params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_REQUEST));
}else{
- DebugTool.logError(TAG + " Corrupted RPC table.");
+ DebugTool.logError(TAG, " Corrupted RPC table.");
return null;
}
@@ -132,7 +130,7 @@ public class RpcConverter {
if (params != null) {
Set<String> keySet = params.keySet();
for (String key : keySet) {
- Log.i(TAG, key + " - " + params.get(key));
+ DebugTool.logInfo(TAG, key + " - " + params.get(key));
}
}
}
@@ -151,7 +149,7 @@ public class RpcConverter {
rpcClassName.append(RESPONSE_KEY);
}
- DebugTool.logInfo(TAG + " Attempting to create " + rpcClassName.toString());
+ DebugTool.logInfo(TAG, " Attempting to create " + rpcClassName.toString());
try {
Class rpcClass = Class.forName(rpcClassName.toString());
if(rpcClass != null){
@@ -160,13 +158,13 @@ public class RpcConverter {
return (RPCMessage)rpcConstructor.newInstance(rpcHashTable);
}
} else {
- DebugTool.logError(TAG + " Java class cannot be found for " + rpcClassName.toString());
+ DebugTool.logError(TAG, " Java class cannot be found for " + rpcClassName.toString());
}
} catch (Exception e) {
- DebugTool.logError("RPCConverter was unable to process RPC", e);
+ DebugTool.logError(TAG, "RPCConverter was unable to process RPC", e);
}
}else{
- DebugTool.logError(TAG + " Unable to parse into RPC");
+ DebugTool.logError(TAG, " Unable to parse into RPC");
}
return null;
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
index 730200b17..5314d0fd5 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
@@ -392,7 +392,8 @@ abstract class BasePermissionManager extends BaseSubManager{
}
/**
- * Add a listener to be called when there is permissions change
+ * Add a listener to be called when there is permissions change.
+ * When the listener is added it will be called immediately with the current permission values if the values comply with with the passed groupType
* @param permissionElements list of PermissionElement that represents the RPC names and their parameters
* @param groupType PermissionGroupType int value represents whether we need the listener to be called when there is any permissions change or only when all permission become allowed
* @param listener OnPermissionChangeListener interface
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index 82e4c4131..7b6ee1c30 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -33,7 +33,6 @@ package com.smartdevicelink.managers.screen;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.util.Log;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -51,6 +50,7 @@ import com.smartdevicelink.managers.screen.menu.VoiceCommand;
import com.smartdevicelink.managers.screen.menu.VoiceCommandManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
@@ -74,28 +74,32 @@ abstract class BaseScreenManager extends BaseSubManager {
private VoiceCommandManager voiceCommandManager;
private MenuManager menuManager;
private ChoiceSetManager choiceSetManager;
+ private SubscribeButtonManager subscribeButtonManager;
// Sub manager listener
private final CompletionListener subManagerListener = new CompletionListener() {
@Override
public synchronized void onComplete(boolean success) {
- if (softButtonManager != null && textAndGraphicManager != null && voiceCommandManager != null && menuManager != null && choiceSetManager != null) {
- if (softButtonManager.getState() == BaseSubManager.READY && textAndGraphicManager.getState() == BaseSubManager.READY && voiceCommandManager.getState() == BaseSubManager.READY && menuManager.getState() == BaseSubManager.READY) {
- DebugTool.logInfo("Starting screen manager, all sub managers are in ready state");
+ if (softButtonManager != null && textAndGraphicManager != null && voiceCommandManager != null && menuManager != null && choiceSetManager != null && subscribeButtonManager != null) {
+ if (softButtonManager.getState() == BaseSubManager.READY && textAndGraphicManager.getState() == BaseSubManager.READY && voiceCommandManager.getState() == BaseSubManager.READY && menuManager.getState() == BaseSubManager.READY
+ && subscribeButtonManager.getState() == BaseSubManager.READY) {
+ DebugTool.logInfo(TAG, "Starting screen manager, all sub managers are in ready state");
transitionToState(READY);
- } else if (softButtonManager.getState() == BaseSubManager.ERROR && textAndGraphicManager.getState() == BaseSubManager.ERROR && voiceCommandManager.getState() == BaseSubManager.ERROR && menuManager.getState() == BaseSubManager.ERROR && choiceSetManager.getState() == BaseSubManager.ERROR) {
- Log.e(TAG, "ERROR starting screen manager, all sub managers are in error state");
+ } else if (softButtonManager.getState() == BaseSubManager.ERROR && textAndGraphicManager.getState() == BaseSubManager.ERROR && voiceCommandManager.getState() == BaseSubManager.ERROR && menuManager.getState() == BaseSubManager.ERROR
+ && choiceSetManager.getState() == BaseSubManager.ERROR && subscribeButtonManager.getState() == BaseSubManager.ERROR) {
+ DebugTool.logError(TAG, "ERROR starting screen manager, all sub managers are in error state");
transitionToState(ERROR);
- } else if (textAndGraphicManager.getState() == BaseSubManager.SETTING_UP || softButtonManager.getState() == BaseSubManager.SETTING_UP || voiceCommandManager.getState() == BaseSubManager.SETTING_UP || menuManager.getState() == BaseSubManager.SETTING_UP || choiceSetManager.getState() == BaseSubManager.SETTING_UP) {
- DebugTool.logInfo("SETTING UP screen manager, at least one sub manager is still setting up");
+ } else if (textAndGraphicManager.getState() == BaseSubManager.SETTING_UP || softButtonManager.getState() == BaseSubManager.SETTING_UP || voiceCommandManager.getState() == BaseSubManager.SETTING_UP || menuManager.getState() == BaseSubManager.SETTING_UP
+ || choiceSetManager.getState() == BaseSubManager.SETTING_UP || subscribeButtonManager.getState() == BaseSubManager.SETTING_UP) {
+ DebugTool.logInfo(TAG, "SETTING UP screen manager, at least one sub manager is still setting up");
transitionToState(SETTING_UP);
} else {
- Log.w(TAG, "LIMITED starting screen manager, at least one sub manager is in error state and the others are ready");
+ DebugTool.logWarning(TAG, "LIMITED starting screen manager, at least one sub manager is in error state and the others are ready");
transitionToState(LIMITED);
}
} else {
// We should never be here, but somehow one of the sub-sub managers is null
- Log.e(TAG, "ERROR one of the screen sub managers is null");
+ DebugTool.logError(TAG, "ERROR one of the screen sub managers is null");
transitionToState(ERROR);
}
}
@@ -115,6 +119,7 @@ abstract class BaseScreenManager extends BaseSubManager {
this.voiceCommandManager.start(subManagerListener);
this.menuManager.start(subManagerListener);
this.choiceSetManager.start(subManagerListener);
+ this.subscribeButtonManager.start(subManagerListener);
}
private void initialize(){
@@ -124,6 +129,7 @@ abstract class BaseScreenManager extends BaseSubManager {
this.menuManager = new MenuManager(internalInterface, fileManager.get());
this.choiceSetManager = new ChoiceSetManager(internalInterface, fileManager.get());
}
+ this.subscribeButtonManager = new SubscribeButtonManager(internalInterface);
this.voiceCommandManager = new VoiceCommandManager(internalInterface);
}
@@ -137,6 +143,7 @@ abstract class BaseScreenManager extends BaseSubManager {
voiceCommandManager.dispose();
menuManager.dispose();
choiceSetManager.dispose();
+ subscribeButtonManager.dispose();
super.dispose();
}
@@ -568,26 +575,21 @@ abstract class BaseScreenManager extends BaseSubManager {
*/
public void commit(final CompletionListener listener){
softButtonManager.setBatchUpdates(false);
- softButtonManager.update(new CompletionListener() {
- boolean updateSuccessful = true;
+ textAndGraphicManager.setBatchUpdates(false);
+ textAndGraphicManager.update(new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (!success){
- updateSuccessful = false;
+ if (listener != null) {
+ listener.onComplete(success);
}
- textAndGraphicManager.setBatchUpdates(false);
- textAndGraphicManager.update(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (!success){
- updateSuccessful = false;
- }
- if (listener != null) {
- listener.onComplete(updateSuccessful);
- }
- }
- });
}
});
}
+
+ public void addButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener){
+ subscribeButtonManager.addButtonListener(buttonName,listener);
+ }
+ public void removeButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener){
+ subscribeButtonManager.removeButtonListener(buttonName, listener);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
index 6ba777ee4..a1c54e7de 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
@@ -32,16 +32,14 @@
package com.smartdevicelink.managers.screen;
import android.support.annotation.NonNull;
-import android.util.Log;
+import com.livio.taskmaster.Queue;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.FileManager;
-import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
-import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
@@ -49,24 +47,19 @@ import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.Show;
-import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -75,17 +68,16 @@ import java.util.concurrent.CopyOnWriteArrayList;
* Note: This class must be accessed through the SdlManager->ScreenManager. Do not instantiate it by itself.<br>
*/
abstract class BaseSoftButtonManager extends BaseSubManager {
-
- private static final String TAG = "SoftButtonManager";
- private WeakReference<FileManager> fileManager;
- WindowCapability defaultMainWindowCapability;
+ private static final String TAG = "BaseSoftButtonManager";
+ private final WeakReference<FileManager> fileManager;
+ SoftButtonCapabilities softButtonCapabilities;
private CopyOnWriteArrayList<SoftButtonObject> softButtonObjects;
private HMILevel currentHMILevel;
- private Show inProgressShowRPC;
- private CompletionListener inProgressListener, queuedUpdateListener, cachedListener;
- private boolean hasQueuedUpdate, batchUpdates, waitingOnHMILevelUpdateToSetButtons;
private final OnSystemCapabilityListener onDisplayCapabilityListener;
private final OnRPCNotificationListener onHMIStatusListener, onButtonPressListener, onButtonEventListener;
+ private Queue transactionQueue;
+ private final List<Task> batchQueue;
+ private boolean batchUpdates;
private final SoftButtonObject.UpdateListener updateListener;
/**
@@ -93,84 +85,90 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
*/
private String currentMainField1;
-
/**
* Creates a new instance of the SoftButtonManager
* @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
* @param fileManager an instance of the FileManager so that button graphics can be sent
*/
- BaseSoftButtonManager(@NonNull final ISdl internalInterface, @NonNull FileManager fileManager) {
+ BaseSoftButtonManager(@NonNull final ISdl internalInterface, @NonNull final FileManager fileManager) {
super(internalInterface);
+
this.fileManager = new WeakReference<>(fileManager);
this.softButtonObjects = new CopyOnWriteArrayList<>();
- this.currentHMILevel = HMILevel.HMI_NONE; // Assume NONE until we get something else
- this.waitingOnHMILevelUpdateToSetButtons = false;
+ this.currentHMILevel = null;
+ this.transactionQueue = newTransactionQueue();
+ this.batchQueue = new ArrayList<>();
+
this.updateListener = new SoftButtonObject.UpdateListener() {
@Override
public void onUpdate() {
- update(null);
+ transitionSoftButton();
}
};
+ // Add OnHMIStatusListener to keep currentHMILevel updated
+ this.onHMIStatusListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
+ updateTransactionQueueSuspended();
+ }
+ };
+ this.internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
// Add OnSoftButtonCapabilitiesListener to keep softButtonCapabilities updated
onDisplayCapabilityListener = new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
+ SoftButtonCapabilities oldSoftButtonCapabilities = softButtonCapabilities;
+
+ // Extract and update the capabilities
// instead of using the parameter it's more safe to use the convenience method
List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
- }else {
- DisplayCapability display = capabilities.get(0);
- for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ softButtonCapabilities = null;
+ } else {
+ DisplayCapability mainDisplay = capabilities.get(0);
+ for (WindowCapability windowCapability : mainDisplay.getWindowCapabilities()) {
int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- defaultMainWindowCapability = windowCapability;
+ softButtonCapabilities = windowCapability.getSoftButtonCapabilities().get(0);
+ break;
}
}
}
- }
- @Override
- public void onError(String info) {
- DebugTool.logError("Display Capability cannot be retrieved");
- defaultMainWindowCapability = null;
- }
- };
- this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
+ // Update the queue's suspend state
+ updateTransactionQueueSuspended();
- // Add OnHMIStatusListener to keep currentHMILevel updated
- this.onHMIStatusListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
- if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- return;
+ // Auto-send an updated Show if we have new capabilities
+ if (softButtonObjects != null && !softButtonObjects.isEmpty() && softButtonCapabilities != null && !softButtonCapabilitiesEquals(oldSoftButtonCapabilities, softButtonCapabilities)) {
+ SoftButtonReplaceOperation operation = new SoftButtonReplaceOperation(internalInterface, fileManager, softButtonCapabilities, softButtonObjects, currentMainField1);
+ transactionQueue.add(operation, false);
}
- HMILevel oldHmiLevel = currentHMILevel;
- currentHMILevel = onHMIStatus.getHmiLevel();
+ }
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
+ softButtonCapabilities = null;
- // Auto-send an updated show if we were in NONE and now we are not
- if (oldHmiLevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE) {
- if (waitingOnHMILevelUpdateToSetButtons) {
- setSoftButtonObjects(softButtonObjects);
- } else {
- update(cachedListener);
- }
- }
+ // Update the queue's suspend state
+ updateTransactionQueueSuspended();
}
};
- this.internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
-
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
// Add OnButtonPressListener to notify SoftButtonObjects when there is a button press
this.onButtonPressListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
OnButtonPress onButtonPress = (OnButtonPress) notification;
- if (onButtonPress!= null && onButtonPress.getButtonName() == ButtonName.CUSTOM_BUTTON) {
+ if (onButtonPress != null && onButtonPress.getButtonName() == ButtonName.CUSTOM_BUTTON) {
Integer buttonId = onButtonPress.getCustomButtonID();
if (getSoftButtonObjects() != null) {
for (SoftButtonObject softButtonObject : getSoftButtonObjects()) {
@@ -185,13 +183,12 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
};
this.internalInterface.addOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
-
// Add OnButtonEventListener to notify SoftButtonObjects when there is a button event
this.onButtonEventListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
OnButtonEvent onButtonEvent = (OnButtonEvent) notification;
- if (onButtonEvent!= null && onButtonEvent.getButtonName() == ButtonName.CUSTOM_BUTTON) {
+ if (onButtonEvent != null && onButtonEvent.getButtonName() == ButtonName.CUSTOM_BUTTON) {
Integer buttonId = onButtonEvent.getCustomButtonID();
if (getSoftButtonObjects() != null) {
for (SoftButtonObject softButtonObject : getSoftButtonObjects()) {
@@ -214,31 +211,46 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
}
/**
- * Get the SoftButtonObject that has the provided name
- * @param name a String value that represents the name
- * @return a SoftButtonObject
+ * Clean up everything after the manager is no longer needed
*/
- protected SoftButtonObject getSoftButtonObjectByName(String name) {
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- if (softButtonObject.getName().equals(name)) {
- return softButtonObject;
- }
+ @Override
+ public void dispose() {
+ super.dispose();
+
+ softButtonObjects = new CopyOnWriteArrayList<>();
+ currentMainField1 = null;
+ currentHMILevel = null;
+ softButtonCapabilities = null;
+
+ // Cancel the operations
+ if (transactionQueue != null) {
+ transactionQueue.close();
+ transactionQueue = null;
}
- return null;
+
+ // Remove listeners
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, onButtonEventListener);
+ internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
}
- /**
- * Get the SoftButtonObject that has the provided buttonId
- * @param buttonId a int value that represents the id of the button
- * @return a SoftButtonObject
- */
- protected SoftButtonObject getSoftButtonObjectById(int buttonId) {
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- if (softButtonObject.getButtonId() == buttonId) {
- return softButtonObject;
- }
+ private Queue newTransactionQueue() {
+ Queue queue = internalInterface.getTaskmaster().createQueue("SoftButtonManager", 2, false);
+ queue.pause();
+ return queue;
+ }
+
+ // Suspend the queue if the soft button capabilities are null (we assume that soft buttons are not supported)
+ // OR if the HMI level is NONE since we want to delay sending RPCs until we're in non-NONE
+ private void updateTransactionQueueSuspended() {
+ if (softButtonCapabilities == null || HMILevel.HMI_NONE.equals(currentHMILevel)) {
+ DebugTool.logInfo(TAG, String.format("Suspending the transaction queue. Current HMI level is NONE: %b, soft button capabilities are null: %b", HMILevel.HMI_NONE.equals(currentHMILevel), softButtonCapabilities == null));
+ transactionQueue.pause();
+ } else {
+ DebugTool.logInfo(TAG, "Starting the transaction queue");
+ transactionQueue.resume();
}
- return null;
}
/**
@@ -256,118 +268,64 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
protected void setSoftButtonObjects(@NonNull List<SoftButtonObject> list) {
// Convert the List to CopyOnWriteArrayList
CopyOnWriteArrayList<SoftButtonObject> softButtonObjects;
- if(list instanceof CopyOnWriteArrayList){
+ if (list instanceof CopyOnWriteArrayList) {
softButtonObjects = (CopyOnWriteArrayList<SoftButtonObject>) list;
- }else{
+ } else {
softButtonObjects = new CopyOnWriteArrayList<>(list);
}
+ // Only update if something changed. This prevents, for example, an empty array being reset
+ if (softButtonObjects.equals(this.softButtonObjects)) {
+ DebugTool.logInfo(TAG, "New soft button objects are equivalent to existing soft button objects, skipping...");
+ return;
+ }
// Check if two soft button objects have the same name
if (hasTwoSoftButtonObjectsOfSameName(softButtonObjects)) {
this.softButtonObjects = new CopyOnWriteArrayList<>();
- Log.e(TAG, "Attempted to set soft button objects, but two buttons had the same name");
+ DebugTool.logError(TAG, "Attempted to set soft button objects, but two buttons had the same name");
return;
}
+ if (!checkAndAssignButtonIds(softButtonObjects)) {
+ DebugTool.logError(TAG, "Attempted to set soft button objects, but multiple buttons had the same id");
+ return;
+ }
// Set updateListeners for soft button objects
for (SoftButtonObject softButtonObject : softButtonObjects) {
softButtonObject.setUpdateListener(updateListener);
}
-
- if (!checkAndAssignButtonIds(softButtonObjects)) {
- Log.e(TAG, "Attempted to set soft button objects, but multiple buttons had the same id");
- return;
- }
-
-
this.softButtonObjects = softButtonObjects;
+ // We only need to pass the first softButtonCapabilities in the array due to the fact that all soft button capabilities are the same (i.e. there is no way to assign a softButtonCapabilities to a specific soft button).
+ SoftButtonReplaceOperation operation = new SoftButtonReplaceOperation(internalInterface, fileManager.get(), softButtonCapabilities, softButtonObjects, currentMainField1);
- if (currentHMILevel == null || currentHMILevel == HMILevel.HMI_NONE) {
- waitingOnHMILevelUpdateToSetButtons = true;
- return;
- }
-
-
- // End any in-progress update
- inProgressShowRPC = null;
- if (inProgressListener != null) {
- inProgressListener.onComplete(false);
- inProgressListener = null;
- }
-
-
- // End any queued update
- hasQueuedUpdate = false;
- if (queuedUpdateListener != null) {
- queuedUpdateListener.onComplete(false);
- queuedUpdateListener = null;
+ if (batchUpdates) {
+ batchQueue.clear();
+ batchQueue.add(operation);
+ } else {
+ transactionQueue.clear();
+ transactionQueue.add(operation, false);
}
+ }
-
- // Prepare soft button images to be uploaded to the head unit.
- // we will prepare a list for initial state images and another list for other state images
- // so we can upload the initial state images first, then the other states images.
- List<SdlArtwork> initialStatesToBeUploaded = new ArrayList<>();
- List<SdlArtwork> otherStatesToBeUploaded = new ArrayList<>();
- if (softButtonImagesSupported() && fileManager.get() != null) {
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- SoftButtonState initialState = null;
- if (softButtonObject != null) {
- initialState = softButtonObject.getCurrentState();
- }
- if (initialState != null && softButtonObject.getStates() != null) {
- for (SoftButtonState softButtonState : softButtonObject.getStates()) {
- if (softButtonState != null && softButtonState.getName() != null && sdlArtworkNeedsUpload(softButtonState.getArtwork())) {
- if (softButtonState.getName().equals(initialState.getName())) {
- initialStatesToBeUploaded.add(softButtonObject.getCurrentState().getArtwork());
- } else{
- otherStatesToBeUploaded.add(softButtonState.getArtwork());
- }
- }
- }
+ /**
+ * Check if two SoftButtonObject have the same name
+ * @param softButtonObjects a list of SoftButton objects that will be iterated through
+ * @return true if two buttons exist that are the same in the list, false if not
+ */
+ private boolean hasTwoSoftButtonObjectsOfSameName(List<SoftButtonObject> softButtonObjects) {
+ for (int i = 0; i < softButtonObjects.size(); i++) {
+ String buttonName = softButtonObjects.get(i).getName();
+ for (int j = (i + 1); j < softButtonObjects.size(); j++) {
+ if (softButtonObjects.get(j).getName().equals(buttonName)) {
+ return true;
}
}
}
-
-
- // Upload initial state images
- if (initialStatesToBeUploaded.size() > 0 && fileManager.get() != null) {
- DebugTool.logInfo( "Uploading soft button initial state artworks");
- fileManager.get().uploadArtworks(initialStatesToBeUploaded, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- if (errors != null && errors.size() > 0) {
- Log.e(TAG, "Error uploading soft button artworks");
- }
- DebugTool.logInfo( "Soft button initial artworks uploaded");
- update(cachedListener);
- }
- });
- }
-
-
- // Upload other state images
- if (otherStatesToBeUploaded.size() > 0 && fileManager.get() != null) {
- DebugTool.logInfo("Uploading soft button other state artworks");
- fileManager.get().uploadArtworks(otherStatesToBeUploaded, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- if (errors != null && errors.size() > 0) {
- Log.e(TAG, "Error uploading soft button artworks");
- }
- DebugTool.logInfo("Soft button other state artworks uploaded");
- // In case our soft button states have changed in the meantime
- update(cachedListener);
- }
- });
- }
-
- // This is necessary because there may be no images needed to be uploaded
- update(cachedListener);
+ return false;
}
/**
@@ -383,13 +341,13 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
currentSoftButtonId = softButtonObject.getButtonId();
if (currentSoftButtonId != SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE) {
numberOfButtonIdsSetByDev++;
- if (currentSoftButtonId > maxButtonIdsSetByDev){
+ if (currentSoftButtonId > maxButtonIdsSetByDev) {
maxButtonIdsSetByDev = currentSoftButtonId;
}
buttonIdsSetByDevHashSet.add(softButtonObject.getButtonId());
}
}
- if (numberOfButtonIdsSetByDev != buttonIdsSetByDevHashSet.size()){
+ if (numberOfButtonIdsSetByDev != buttonIdsSetByDevHashSet.size()) {
return false;
}
@@ -399,9 +357,9 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
for (SoftButtonObject softButtonObject : softButtonObjects) {
// If the dev did not set the buttonId, the manager should set an id on the dev's behalf
currentSoftButtonId = softButtonObject.getButtonId();
- if (currentSoftButtonId == SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE){
+ if (currentSoftButtonId == SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE) {
do {
- if (generatedSoftButtonId >= SoftButtonObject.SOFT_BUTTON_ID_MAX_VALUE){
+ if (generatedSoftButtonId >= SoftButtonObject.SOFT_BUTTON_ID_MAX_VALUE) {
generatedSoftButtonId = SoftButtonObject.SOFT_BUTTON_ID_MIN_VALUE;
}
generatedSoftButtonId++;
@@ -412,133 +370,62 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
return true;
}
- /**
- * Update the SoftButtonManger by sending a new Show RPC to reflect the changes
- * @param listener a CompletionListener
- */
- protected void update(CompletionListener listener) {
- cachedListener = listener;
+ private void transitionSoftButton() {
+ SoftButtonTransitionOperation operation = new SoftButtonTransitionOperation(internalInterface, softButtonObjects, currentMainField1);
if (batchUpdates) {
- return;
- }
-
- // Don't send if we're in HMI NONE
- if (currentHMILevel == null || currentHMILevel == HMILevel.HMI_NONE) {
- return;
- }
-
- DebugTool.logInfo("Updating soft buttons");
-
- cachedListener = null;
-
-
- // Check if we have update already in progress
- if (inProgressShowRPC != null) {
- DebugTool.logInfo("In progress update exists, queueing update");
- // If we already have a pending update, we're going to tell the old listener that it was superseded by a new update and then return
- if (queuedUpdateListener != null) {
- DebugTool.logInfo("Queued update already exists, superseding previous queued update");
- queuedUpdateListener.onComplete(false);
- queuedUpdateListener = null;
- }
-
- // Note: the queued update will be started after the in-progress one finishes
- if (listener != null) {
- queuedUpdateListener = listener;
- }
- hasQueuedUpdate = true;
- return;
- }
-
-
- // Send Show RPC with soft buttons representing the current state for the soft button objects
- inProgressListener = listener;
- inProgressShowRPC = new Show();
- inProgressShowRPC.setMainField1(getCurrentMainField1());
- if (softButtonObjects == null) {
- DebugTool.logInfo("Soft button objects are null, sending an empty array");
- inProgressShowRPC.setSoftButtons(new ArrayList<SoftButton>());
- } else if ((currentStateHasImages() && !allCurrentStateImagesAreUploaded()) || !softButtonImagesSupported()) {
- // The images don't yet exist on the head unit, or we cannot use images, send a text update if possible, otherwise, don't send anything yet
- List<SoftButton> textOnlySoftButtons = createTextSoftButtonsForCurrentState();
- if (textOnlySoftButtons != null) {
- DebugTool.logInfo( "Soft button images unavailable, sending text buttons");
- inProgressShowRPC.setSoftButtons(textOnlySoftButtons);
-
- } else {
- DebugTool.logInfo( "Soft button images unavailable, text buttons unavailable");
- inProgressShowRPC = null;
- return;
+ for (Task task : batchQueue) {
+ if (task instanceof SoftButtonTransitionOperation) {
+ batchQueue.remove(task);
+ }
}
-
+ batchQueue.add(operation);
} else {
- DebugTool.logInfo( "Sending soft buttons with images");
- inProgressShowRPC.setSoftButtons(createSoftButtonsForCurrentState());
+ transactionQueue.add(operation, false);
}
+ }
-
- inProgressShowRPC.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- DebugTool.logInfo("Soft button update completed");
- handleResponse(true);
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
-
- Log.e(TAG, "Soft button update error. resultCode: " + resultCode + ". info: " + info);
- handleResponse(false);
- }
-
- private void handleResponse(boolean success){
-
- inProgressShowRPC = null;
- CompletionListener currentListener;
- if (inProgressListener != null) {
- currentListener = inProgressListener;
- inProgressListener = null;
- currentListener.onComplete(success);
- }
-
-
- if (hasQueuedUpdate) {
- DebugTool.logInfo("Queued update exists, sending another update");
- currentListener = queuedUpdateListener;
- queuedUpdateListener = null;
- hasQueuedUpdate = false;
- update(currentListener);
- }
+ /**
+ * Get the SoftButtonObject that has the provided name
+ * @param name a String value that represents the name
+ * @return a SoftButtonObject
+ */
+ protected SoftButtonObject getSoftButtonObjectByName(String name) {
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ if (softButtonObject.getName().equals(name)) {
+ return softButtonObject;
}
- });
-
-
- internalInterface.sendRPC(inProgressShowRPC);
+ }
+ return null;
}
- private boolean softButtonImagesSupported() {
- return defaultMainWindowCapability == null
- || defaultMainWindowCapability.getSoftButtonCapabilities() == null
- || (!defaultMainWindowCapability.getSoftButtonCapabilities().isEmpty() && defaultMainWindowCapability.getSoftButtonCapabilities().get(0).getImageSupported());
+ /**
+ * Get the SoftButtonObject that has the provided buttonId
+ * @param buttonId a int value that represents the id of the button
+ * @return a SoftButtonObject
+ */
+ protected SoftButtonObject getSoftButtonObjectById(int buttonId) {
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ if (softButtonObject.getButtonId() == buttonId) {
+ return softButtonObject;
+ }
+ }
+ return null;
}
/**
- * Check if two SoftButtonObject have the same name
- * @param softButtonObjects a list of SoftButton objects that will be iterated through
- * @return true if two buttons exist that are the same in the list, false if not
+ * Set the batchUpdates flag that represents whether the manager should wait until commit() is called to send the updated show RPC
+ * @param batchUpdates Set true if the manager should batch updates together, or false if it should send them as soon as they happen
*/
- private boolean hasTwoSoftButtonObjectsOfSameName(List<SoftButtonObject> softButtonObjects) {
- for (int i = 0; i < softButtonObjects.size(); i++) {
- String buttonName = softButtonObjects.get(i).getName();
- for (int j = (i + 1); j < softButtonObjects.size(); j++) {
- if (softButtonObjects.get(j).getName().equals(buttonName)) {
- return true;
- }
+ protected void setBatchUpdates(boolean batchUpdates) {
+ this.batchUpdates = batchUpdates;
+
+ if (!this.batchUpdates) {
+ for (Task task : batchQueue) {
+ transactionQueue.add(task, false);
}
+ batchQueue.clear();
}
- return false;
}
/**
@@ -546,7 +433,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
* @return the string that is currently used for MainField1
*/
protected String getCurrentMainField1() {
- if (currentMainField1 == null){
+ if (currentMainField1 == null) {
return "";
}
return currentMainField1;
@@ -558,95 +445,28 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
*/
protected void setCurrentMainField1(String currentMainField1) {
this.currentMainField1 = currentMainField1;
- }
- /**
- * Sets the batchUpdates flag that represents whether the manager should wait until commit() is called to send the updated show RPC
- * @param batchUpdates Set true if the manager should batch updates together, or false if it should send them as soon
- * as they happen
- */
- protected void setBatchUpdates(boolean batchUpdates) {
- this.batchUpdates = batchUpdates;
- }
-
- /**
- * Clean up everything after the manager is no longer needed
- */
- @Override
- public void dispose() {
- super.dispose();
-
- // Remove listeners
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, onButtonEventListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
- }
-
- /**
- * Check if the current state for any SoftButtonObject has images
- * @return a boolean value
- */
- private boolean currentStateHasImages() {
- for (SoftButtonObject softButtonObject : this.softButtonObjects) {
- if (softButtonObject.getCurrentState() != null && softButtonObject.getCurrentState().getArtwork() != null) {
- return true;
+ for (Task task : transactionQueue.getTasksAsList()) {
+ if (task instanceof SoftButtonReplaceOperation) {
+ SoftButtonReplaceOperation operation = (SoftButtonReplaceOperation) task;
+ operation.setCurrentMainField1(currentMainField1);
+ } else if (task instanceof SoftButtonTransitionOperation) {
+ SoftButtonTransitionOperation operation = (SoftButtonTransitionOperation) task;
+ operation.setCurrentMainField1(currentMainField1);
}
}
- return false;
}
- /**
- * Check if the current state for any SoftButtonObject has images that are not uploaded yet
- * @return a boolean value
- */
- private boolean allCurrentStateImagesAreUploaded() {
- if (fileManager.get() != null) {
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- SoftButtonState currentState = softButtonObject.getCurrentState();
- if (currentState != null && sdlArtworkNeedsUpload(currentState.getArtwork())) {
- return false;
- }
- }
+ private boolean softButtonCapabilitiesEquals(SoftButtonCapabilities capabilities1, SoftButtonCapabilities capabilities2) {
+ if (capabilities1 == capabilities2) {
+ return true;
+ } else if (capabilities1 == null || capabilities2 == null) {
+ return false;
+ } else if (capabilities1.getImageSupported() != capabilities2.getImageSupported()) {
+ return false;
+ } else if (capabilities1.getTextSupported() != capabilities2.getTextSupported()) {
+ return false;
}
return true;
}
-
- private boolean sdlArtworkNeedsUpload(SdlArtwork artwork){
- if (fileManager.get() != null) {
- return artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon();
- }
- return false;
- }
-
- /**
- * Returns text soft buttons representing the initial states of the button objects, or null if _any_ of the buttons' current states are image only buttons.
- * @return The text soft buttons
- */
- private List<SoftButton> createTextSoftButtonsForCurrentState() {
- List<SoftButton> textButtons = new ArrayList<>();
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- SoftButton softButton = softButtonObject.getCurrentStateSoftButton();
- if (softButton.getText() == null) {
- return null;
- }
- // We should create a new softButtonObject rather than modifying the original one
- SoftButton textOnlySoftButton = new SoftButton(SoftButtonType.SBT_TEXT, softButton.getSoftButtonID());
- textOnlySoftButton.setText(softButton.getText());
- textButtons.add(textOnlySoftButton);
- }
- return textButtons;
- }
-
- /**
- * Returns a list of the SoftButton for the SoftButtonObjects' current state
- * @return a List<SoftButton>
- */
- protected List<SoftButton> createSoftButtonsForCurrentState() {
- List<SoftButton> softButtons = new ArrayList<>();
- for (SoftButtonObject softButtonObject : softButtonObjects) {
- softButtons.add(softButtonObject.getCurrentStateSoftButton());
- }
- return softButtons;
- }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
new file mode 100644
index 000000000..7d9bf26e1
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
@@ -0,0 +1,193 @@
+package com.smartdevicelink.managers.screen;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.managers.BaseSubManager;
+import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
+import com.smartdevicelink.proxy.rpc.SubscribeButton;
+import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.DebugTool;
+
+import java.util.HashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * <strong>SubscribeButtonManager</strong> <br>
+ * <p>
+ * Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
+ */
+abstract class BaseSubscribeButtonManager extends BaseSubManager {
+
+ private static final String TAG = "SubscribeButtonManager";
+ HashMap<ButtonName, CopyOnWriteArrayList<OnButtonListener>> onButtonListeners;
+ private OnRPCNotificationListener onButtonPressListener;
+ private OnRPCNotificationListener onButtonEventListener;
+
+ BaseSubscribeButtonManager(@NonNull ISdl internalInterface) {
+ super(internalInterface);
+ setRpcNotificationListeners();
+ onButtonListeners = new HashMap<>();
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ transitionToState(READY);
+ super.start(listener);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (onButtonListeners != null) {
+ onButtonListeners.clear();
+ }
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, onButtonEventListener);
+ }
+
+ /***
+ * Checks to see if Button is already subscribed and adds listener to hashmap.
+ * If button is not already subscribed to, it call method:
+ * subscribeButtonRequest to send RPC request
+ * @param buttonName - Is the button that the developer wants to subscribe to
+ * @param listener - Is the listener that was sent by developer
+ */
+ void addButtonListener(ButtonName buttonName, OnButtonListener listener) {
+ if (listener == null) {
+ DebugTool.logError(TAG, "OnButtonListener cannot be null");
+ return;
+ }
+ if (buttonName == null) {
+ listener.onError("ButtonName cannot be null");
+ return;
+ }
+
+ if (onButtonListeners.get(buttonName) == null) {
+ subscribeButtonRequest(buttonName, listener);
+ return;
+ }
+
+ if (onButtonListeners.get(buttonName).contains(listener)) {
+ DebugTool.logWarning(TAG, "Already subscribed to button named: " + buttonName);
+ return;
+ }
+ onButtonListeners.get(buttonName).add(listener);
+ }
+
+ /**
+ * Unsubscribe form button and/or listener sent by developer
+ *
+ * @param buttonName Is the button that the developer wants to unsubscribe from
+ * @param listener - the listener that was sent by developer
+ */
+ void removeButtonListener(final ButtonName buttonName, final OnButtonListener listener) {
+ if (listener == null) {
+ DebugTool.logError(TAG, "OnButtonListener cannot be null: ");
+ return;
+ }
+
+ if (buttonName == null) {
+ listener.onError("ButtonName cannot be null");
+ return;
+ }
+
+ if (onButtonListeners.get(buttonName) == null || !onButtonListeners.get(buttonName).contains(listener)) {
+ listener.onError("Attempting to unsubscribe to the " + buttonName + " button failed because it is not currently subscribed");
+ return;
+ }
+
+ if (onButtonListeners.get(buttonName).size() > 1) {
+ onButtonListeners.get(buttonName).remove(listener);
+ return;
+ }
+ unsubscribeButtonRequest(buttonName, listener);
+ }
+
+ /**
+ * Send the UnsubscribeButton RPC
+ *
+ * @param buttonName - ButtonName - name of button
+ * @param listener - OnButtonListener - listener to get notified
+ */
+ private void unsubscribeButtonRequest(final ButtonName buttonName, final OnButtonListener listener) {
+ UnsubscribeButton unsubscribeButtonRequest = new UnsubscribeButton(buttonName);
+ unsubscribeButtonRequest.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ onButtonListeners.remove(buttonName);
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ listener.onError("Attempt to unsubscribe to button named " + buttonName + " Failed. ResultCode: " + resultCode + " info: " + info);
+ }
+ });
+ internalInterface.sendRPC(unsubscribeButtonRequest);
+ }
+
+ /**
+ * Send the SubscribeButton RPC
+ *
+ * @param buttonName - ButtonName - name of button
+ * @param listener - OnButtonListener - listener to get notified
+ */
+ private void subscribeButtonRequest(final ButtonName buttonName, final OnButtonListener listener) {
+ SubscribeButton subscribeButtonRequest = new SubscribeButton(buttonName);
+ subscribeButtonRequest.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ onButtonListeners.put(buttonName, new CopyOnWriteArrayList<OnButtonListener>());
+ onButtonListeners.get(buttonName).add(listener);
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ listener.onError("Attempt to subscribe to button named " + buttonName + " Failed . ResultCode: " + resultCode + " info: " + info);
+ }
+ });
+ internalInterface.sendRPC(subscribeButtonRequest);
+ }
+
+ /**
+ * Sets up RpcNotificationListeners for button presses and events, is setup when manager is created
+ */
+ private void setRpcNotificationListeners() {
+ onButtonPressListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnButtonPress onButtonPressNotification = (OnButtonPress) notification;
+ CopyOnWriteArrayList<OnButtonListener> listeners = onButtonListeners.get(onButtonPressNotification.getButtonName());
+ if (listeners != null && listeners.size() > 0) {
+ for (OnButtonListener listener : listeners) {
+ listener.onPress(onButtonPressNotification.getButtonName(), onButtonPressNotification);
+ }
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
+
+ onButtonEventListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnButtonEvent onButtonEvent = (OnButtonEvent) notification;
+ CopyOnWriteArrayList<OnButtonListener> listeners = onButtonListeners.get(onButtonEvent.getButtonName());
+ if (listeners != null && listeners.size() > 0) {
+ for (OnButtonListener listener : listeners) {
+ listener.onEvent(onButtonEvent.getButtonName(), onButtonEvent);
+ }
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, onButtonEventListener);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
index 491111b2b..096bb4d62 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.managers.screen;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -168,7 +167,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_FULL){
if (pendingHMIFull){
- DebugTool.logInfo( "Acquired HMI_FULL with pending update. Sending now");
+ DebugTool.logInfo(TAG, "Acquired HMI_FULL with pending update. Sending now");
pendingHMIFull = false;
sdlUpdate(pendingHMIListener);
pendingHMIListener = null;
@@ -185,7 +184,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
// instead of using the parameter it's more safe to use the convenience method
List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError("TextAndGraphic Manager - Capabilities sent here are null or empty");
+ DebugTool.logError(TAG, "TextAndGraphic Manager - Capabilities sent here are null or empty");
}else {
DisplayCapability display = capabilities.get(0);
for (WindowCapability windowCapability : display.getWindowCapabilities()) {
@@ -199,7 +198,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
@Override
public void onError(String info) {
- DebugTool.logError("Display Capability cannot be retrieved");
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
defaultMainWindowCapability = null;
}
};
@@ -284,7 +283,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
@Override
public void onComplete(boolean success) {
if (!success){
- Log.e(TAG, "Error uploading image");
+ DebugTool.logError(TAG, "Error uploading image");
inProgressUpdate = extractTextFromShow(inProgressUpdate);
sendShow();
}
@@ -358,7 +357,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
}
if (artworksToUpload.size() == 0 && (primaryGraphic.isStaticIcon() || secondaryGraphic.isStaticIcon())){
- DebugTool.logInfo("Upload attempted on static icons, sending them without upload instead");
+ DebugTool.logInfo(TAG, "Upload attempted on static icons, sending them without upload instead");
listener.onComplete(true);
}
@@ -368,7 +367,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
@Override
public void onComplete(Map<String, String> errors) {
if (errors != null) {
- Log.e(TAG, "Error Uploading Artworks. Error: " + errors.toString());
+ DebugTool.logError(TAG, "Error Uploading Artworks. Error: " + errors.toString());
listener.onComplete(false);
} else {
listener.onComplete(true);
@@ -648,7 +647,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
private void updateCurrentScreenDataState(Show show){
if (show == null){
- Log.e(TAG, "can not updateCurrentScreenDataFromShow from null show");
+ DebugTool.logError(TAG, "can not updateCurrentScreenDataFromShow from null show");
return;
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java
new file mode 100644
index 000000000..ba2910307
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java
@@ -0,0 +1,32 @@
+package com.smartdevicelink.managers.screen;
+
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+
+/**
+ * OnButtonListener is a listener used for notifying when events have happened with SubscribeButtons
+ */
+public interface OnButtonListener {
+
+ /**
+ * Returns when a Subscribed button is pressed
+ * @param buttonName - Name of Button
+ * @param buttonPress - OnButtonPress
+ */
+ void onPress(ButtonName buttonName, OnButtonPress buttonPress);
+
+ /**
+ * Returns when a Subscribed button Event has occurred
+ * @param buttonName - Name of Button
+ * @param buttonEvent - OnButtonEvent
+ */
+ void onEvent(ButtonName buttonName, OnButtonEvent buttonEvent);
+
+ /**
+ * Returns when there is an error with subscribing to button
+ * @param info - Error info
+ */
+ void onError(String info);
+}
+
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
index 76eb98b1e..76c2622a6 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
@@ -32,8 +32,8 @@
package com.smartdevicelink.managers.screen;
import android.support.annotation.NonNull;
-import android.util.Log;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.SoftButton;
@@ -44,13 +44,12 @@ import java.util.List;
/**
* <strong>SoftButtonObject</strong> <br>
- * SoftButtonObject define a button that can have multiple SoftButtonState values.<br>
+ * SoftButtonObject defines a button that can have multiple SoftButtonState values.<br>
* The states of SoftButtonObject allow the developer to not have to manage multiple SoftButtons that have very similar functionality.<br>
* For example, a repeat button in a music app can be thought of as one SoftButtonObject with three typical states: repeat off, repeat 1, and repeat on.<br>
* @see SoftButtonState
*/
public class SoftButtonObject {
-
private static final String TAG = "SoftButtonObject";
static int SOFT_BUTTON_ID_NOT_SET_VALUE = -1;
static int SOFT_BUTTON_ID_MIN_VALUE = 0;
@@ -74,13 +73,13 @@ public class SoftButtonObject {
// Make sure there aren't two states with the same name
if (hasTwoStatesOfSameName(states)) {
- Log.e(TAG, "Two states have the same name in states list for soft button object");
+ DebugTool.logError(TAG, "Two states have the same name in states list for soft button object");
return;
}
this.name = name;
this.states = states;
- currentStateName = initialStateName;
+ this.currentStateName = initialStateName;
this.buttonId = SOFT_BUTTON_ID_NOT_SET_VALUE;
this.onEventListener = onEventListener;
}
@@ -96,6 +95,16 @@ public class SoftButtonObject {
}
/**
+ * Create a new instance of the SoftButtonObject with one state
+ * @param name a String value represents name of the object
+ * @param artwork a SdlArtwork to be displayed on the button
+ * @param onEventListener a listener that has a callback that will be triggered when a button event happens
+ */
+ public SoftButtonObject(@NonNull String name, @NonNull String text, SdlArtwork artwork, OnEventListener onEventListener) {
+ this(name, Collections.singletonList(new SoftButtonState(name, text, artwork)), name, onEventListener);
+ }
+
+ /**
* Transition the SoftButtonObject to a specific state
* @param newStateName a String value represents the name fo the state that we want to transition the SoftButtonObject to
* @return a boolean value that represents whether the transition succeeded or failed
@@ -103,17 +112,23 @@ public class SoftButtonObject {
public boolean transitionToStateByName(@NonNull String newStateName) {
SoftButtonState newState = getStateByName(newStateName);
if (newState == null) {
- Log.e(TAG, String.format("Attempted to transition to state: %s on soft button object: %s but no state with that name was found", newStateName, this.name));
+ DebugTool.logError(TAG, String.format("Attempted to transition to state: %s on soft button object: %s but no state with that name was found", newStateName, this.name));
+ return false;
+ }
+
+ if (states.size() == 1) {
+ DebugTool.logWarning(TAG, "There's only one state, so no transitioning is possible!");
return false;
}
- DebugTool.logInfo(String.format("Transitioning soft button object %s to state %s", this.name, newStateName));
+
+ DebugTool.logInfo(TAG, String.format("Transitioning soft button object %s to state %s", this.name, newStateName));
currentStateName = newStateName;
// Send a new Show RPC because the state has changed which means the actual SoftButton has changed
if (updateListener != null) {
updateListener.onUpdate();
} else {
- Log.e(TAG, String.format("SoftButtonManager is not set for soft button object: %s. Update cannot be triggered", this.name));
+ DebugTool.logError(TAG, String.format("SoftButtonManager is not set for soft button object: %s. Update cannot be triggered", this.name));
}
return true;
@@ -126,16 +141,13 @@ public class SoftButtonObject {
String nextStateName = null;
for (int i = 0; i < states.size(); i++) {
if (states.get(i).getName().equals(currentStateName)) {
- if (i == (states.size() - 1)) {
- nextStateName = states.get(0).getName();
- } else {
- nextStateName = states.get(i + 1).getName();
- }
+ int nextStateNumber = (i == states.size() - 1) ? 0 : (i + 1);
+ nextStateName = states.get(nextStateNumber).getName();
break;
}
}
if (nextStateName == null) {
- Log.e(TAG, String.format("Current state name : %s cannot be found for soft button object %s", currentStateName, this.name));
+ DebugTool.logError(TAG, String.format("Current state name : %s cannot be found for soft button object %s", currentStateName, this.name));
return;
}
transitionToStateByName(nextStateName);
@@ -148,7 +160,7 @@ public class SoftButtonObject {
public SoftButtonState getCurrentState() {
SoftButtonState state = getStateByName(currentStateName);
if (state == null) {
- Log.e(TAG, String.format("Current state name : %s cannot be found for soft button object %s", currentStateName, this.name));
+ DebugTool.logError(TAG, String.format("Current state name : %s cannot be found for soft button object %s", currentStateName, this.name));
}
return state;
}
@@ -273,7 +285,7 @@ public class SoftButtonObject {
*/
public void setButtonId(int buttonId) {
if (buttonId < SOFT_BUTTON_ID_MIN_VALUE){
- Log.e(TAG, "buttonId has to be equal or more than " + SOFT_BUTTON_ID_MIN_VALUE);
+ DebugTool.logError(TAG, "buttonId has to be equal or more than " + SOFT_BUTTON_ID_MIN_VALUE);
return;
}
this.buttonId = buttonId;
@@ -303,7 +315,7 @@ public class SoftButtonObject {
/**
* A listener interface that is used by SoftButtonObject to request an update from SoftButtonManager
*/
- interface UpdateListener{
+ interface UpdateListener {
/**
* Requests an update from SoftButtonManager
*/
@@ -319,9 +331,8 @@ public class SoftButtonObject {
int result = 1;
result += ((getName() == null) ? 0 : Integer.rotateLeft(getName().hashCode(), 1));
result += ((getCurrentStateName() == null) ? 0 : Integer.rotateLeft(getCurrentStateName().hashCode(), 2));
- result += Integer.rotateLeft(Integer.valueOf(getButtonId()).hashCode(), 3);
for (int i = 0; i < this.states.size(); i++) {
- result += ((getStates().get(i) == null) ? 0 : Integer.rotateLeft(getStates().get(i).hashCode(), i + 4));
+ result += ((getStates().get(i) == null) ? 0 : Integer.rotateLeft(getStates().get(i).hashCode(), i + 3));
}
return result;
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java
new file mode 100644
index 000000000..106806562
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java
@@ -0,0 +1,338 @@
+package com.smartdevicelink.managers.screen;
+
+import com.livio.taskmaster.Task;
+import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.file.FileManager;
+import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * Created by Bilal Alsharifi on 6/15/20.
+ */
+class SoftButtonReplaceOperation extends Task {
+ private static final String TAG = "SoftButtonReplaceOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final WeakReference<FileManager> fileManager;
+ private final SoftButtonCapabilities softButtonCapabilities;
+ private final CopyOnWriteArrayList<SoftButtonObject> softButtonObjects;
+ private String currentMainField1;
+
+ SoftButtonReplaceOperation(ISdl internalInterface, FileManager fileManager, SoftButtonCapabilities softButtonCapabilities, CopyOnWriteArrayList<SoftButtonObject> softButtonObjects, String currentMainField1) {
+ super("SoftButtonReplaceOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.fileManager = new WeakReference<>(fileManager);
+ this.softButtonCapabilities = softButtonCapabilities;
+ this.softButtonObjects = softButtonObjects;
+ this.currentMainField1 = currentMainField1;
+ }
+
+ @Override
+ public void onExecute() {
+ start();
+ }
+
+ private void start() {
+ if (getState() == Task.CANCELED) {
+ return;
+ }
+
+ // Check the state of our images
+ if (!supportsSoftButtonImages()) {
+ // We don't support images at all
+ DebugTool.logWarning(TAG, "Soft button images are not supported. Attempting to send text-only soft buttons. If any button does not contain text, no buttons will be sent.");
+
+ // Send text buttons if all the soft buttons have text
+ sendCurrentStateTextOnlySoftButtons(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (!success) {
+ DebugTool.logError(TAG, "Head unit does not support images and some of the soft buttons do not have text, so none of the buttons will be sent.");
+ }
+ onFinished();
+ }
+ });
+ } else if (currentStateHasImages() && !allCurrentStateImagesAreUploaded()) {
+ // If there are images that aren't uploaded
+ // Send text buttons if all the soft buttons have text
+ sendCurrentStateTextOnlySoftButtons(null);
+
+ // Upload initial images
+ uploadInitialStateImages(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ // Send initial soft buttons w/ images
+ sendCurrentStateSoftButtons(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ // Upload other images
+ uploadOtherStateImages(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ DebugTool.logInfo(TAG, "Finished sending other images for soft buttons");
+ onFinished();
+ }
+ });
+ }
+ });
+ }
+ });
+ } else {
+ // All the images are already uploaded. Send initial soft buttons w/ images.
+ sendCurrentStateSoftButtons(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ DebugTool.logInfo(TAG, "Finished sending soft buttons with images");
+ // Upload other images
+ uploadOtherStateImages(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (success) {
+ DebugTool.logInfo(TAG, "Finished sending other images for soft buttons");
+ }
+ onFinished();
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private void uploadInitialStateImages(final CompletionListener completionListener) {
+ // Upload all soft button images, the initial state images first, then the other states. We need to send updates when the initial state is ready.
+ List<SdlArtwork> initialStatesToBeUploaded = new ArrayList<>();
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ SoftButtonState softButtonState = softButtonObject.getCurrentState();
+ if (softButtonState != null && artworkNeedsUpload(softButtonState.getArtwork())) {
+ initialStatesToBeUploaded.add(softButtonState.getArtwork());
+ }
+ }
+
+ if (initialStatesToBeUploaded.isEmpty()) {
+ DebugTool.logInfo(TAG, "No initial state artworks to upload");
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ return;
+ }
+
+ DebugTool.logInfo(TAG, "Uploading soft button initial artworks");
+ if (fileManager.get() != null) {
+ fileManager.get().uploadArtworks(initialStatesToBeUploaded, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ if (errors != null) {
+ DebugTool.logError(TAG, "Error uploading soft button artworks: " + errors.keySet());
+ } else {
+ DebugTool.logInfo(TAG, "Soft button initial state artworks uploaded");
+ }
+
+ if (getState() == Task.CANCELED) {
+ onFinished();
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ return;
+ }
+ if (completionListener != null) {
+ completionListener.onComplete(true);
+ }
+ }
+ });
+ }
+ }
+
+ private void uploadOtherStateImages(final CompletionListener completionListener) {
+ // Upload all soft button images, the initial state images first, then the other states. We need to send updates when the initial state is ready.
+ List<SdlArtwork> otherStatesToBeUploaded = new ArrayList<>();
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ for (SoftButtonState softButtonState : softButtonObject.getStates()) {
+ if (softButtonState.getName().equals(softButtonObject.getCurrentState().getName())) {
+ continue;
+ }
+ if (artworkNeedsUpload(softButtonState.getArtwork())) {
+ otherStatesToBeUploaded.add(softButtonState.getArtwork());
+ }
+ }
+ }
+
+ if (otherStatesToBeUploaded.isEmpty()) {
+ DebugTool.logInfo(TAG, "No other state artworks to upload");
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ return;
+ }
+
+ DebugTool.logInfo(TAG, "Uploading soft button other state artworks");
+ if (fileManager.get() != null) {
+ fileManager.get().uploadArtworks(otherStatesToBeUploaded, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ if (errors != null) {
+ DebugTool.logError(TAG, "Error uploading soft button artworks: " + errors.keySet());
+ } else {
+ DebugTool.logInfo(TAG, "Soft button other state artworks uploaded");
+ }
+
+ if (getState() == Task.CANCELED) {
+ onFinished();
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ return;
+ }
+
+ if (completionListener != null) {
+ completionListener.onComplete(true);
+ }
+ }
+ });
+ }
+ }
+
+ private void sendCurrentStateSoftButtons(final CompletionListener completionListener) {
+ if (getState() == Task.CANCELED) {
+ onFinished();
+ }
+
+ DebugTool.logInfo(TAG, "Preparing to send full soft buttons");
+ List<SoftButton> softButtons = new ArrayList<>();
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ softButtons.add(softButtonObject.getCurrentStateSoftButton());
+ }
+
+ Show show = new Show();
+ show.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ DebugTool.logInfo(TAG, "Finished sending text only soft buttons");
+ } else {
+ DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
+ }
+ if (completionListener != null) {
+ completionListener.onComplete(response.getSuccess());
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ }
+ });
+ show.setMainField1(currentMainField1);
+ show.setSoftButtons(softButtons);
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(show);
+ }
+ }
+
+
+ // Returns text soft buttons representing the current states of the button objects, or returns if _any_ of the buttons' current states are image only buttons.
+ private void sendCurrentStateTextOnlySoftButtons(final CompletionListener completionListener) {
+ if (getState() == Task.CANCELED) {
+ onFinished();
+ }
+
+ DebugTool.logInfo(TAG, "Preparing to send text-only soft buttons");
+ List<SoftButton> textButtons = new ArrayList<>();
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ SoftButton softButton = softButtonObject.getCurrentStateSoftButton();
+ if (softButton.getText() == null) {
+ DebugTool.logWarning(TAG, "Attempted to create text buttons, but some buttons don't support text, so no text-only soft buttons will be sent");
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ return;
+ }
+
+ // We should create a new softButtonObject rather than modifying the original one
+ SoftButton textOnlySoftButton = new SoftButton(SoftButtonType.SBT_TEXT, softButton.getSoftButtonID());
+ textOnlySoftButton.setText(softButton.getText());
+ textOnlySoftButton.setSystemAction(softButton.getSystemAction());
+ textOnlySoftButton.setIsHighlighted(softButton.getIsHighlighted());
+ textButtons.add(textOnlySoftButton);
+ }
+
+ Show show = new Show();
+ show.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ DebugTool.logInfo(TAG, "Finished sending text only soft buttons");
+ } else {
+ DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
+ }
+ if (completionListener != null) {
+ completionListener.onComplete(response.getSuccess());
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ }
+ });
+ show.setMainField1(currentMainField1);
+ show.setSoftButtons(textButtons);
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(show);
+ }
+ }
+
+ private boolean artworkNeedsUpload(SdlArtwork artwork) {
+ return (artwork != null
+ && fileManager.get() != null
+ && !fileManager.get().hasUploadedFile(artwork)
+ && softButtonCapabilities.getImageSupported()
+ && !artwork.isStaticIcon());
+ }
+
+ private boolean currentStateHasImages() {
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ if (softButtonObject.getCurrentState().getArtwork() != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean allCurrentStateImagesAreUploaded() {
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ SdlArtwork artwork = softButtonObject.getCurrentState().getArtwork();
+ if (artworkNeedsUpload(artwork)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean supportsSoftButtonImages() {
+ return softButtonCapabilities.getImageSupported();
+ }
+
+ void setCurrentMainField1(String currentMainField1) {
+ this.currentMainField1 = currentMainField1;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
index bd6f104d1..a2272c461 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
@@ -32,12 +32,12 @@
package com.smartdevicelink.managers.screen;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
+import com.smartdevicelink.util.DebugTool;
/**
* <strong>SoftButtonState</strong> <br>
@@ -47,7 +47,6 @@ import com.smartdevicelink.proxy.rpc.enums.SystemAction;
* @see SoftButtonObject
*/
public class SoftButtonState {
-
private static final String TAG = "SoftButtonState";
private String name;
private SdlArtwork artwork;
@@ -62,7 +61,7 @@ public class SoftButtonState {
*/
public SoftButtonState(@NonNull String name, String text, SdlArtwork artwork) {
if (text == null && artwork == null) {
- Log.e(TAG, "Attempted to create an invalid soft button state: text and artwork are both null");
+ DebugTool.logError(TAG, "Attempted to create an invalid soft button state: text and artwork are both null");
softButton = null;
return;
}
@@ -84,13 +83,15 @@ public class SoftButtonState {
// Set the SoftButton's image
if (artwork != null) {
- softButton.setImage(artwork.getImageRPC());
+ this.softButton.setImage(artwork.getImageRPC());
}
// Set the SoftButton's text
if (text != null) {
- softButton.setText(text);
+ this.softButton.setText(text);
}
+
+ this.softButton.setSystemAction(SystemAction.DEFAULT_ACTION);
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java
new file mode 100644
index 000000000..355c6aeaf
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.managers.screen;
+
+import com.livio.taskmaster.Task;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * Created by Bilal Alsharifi on 6/15/20.
+ */
+class SoftButtonTransitionOperation extends Task {
+ private static final String TAG = "SoftButtonTransitionOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final CopyOnWriteArrayList<SoftButtonObject> softButtonObjects;
+ private String currentMainField1;
+
+ SoftButtonTransitionOperation(ISdl internalInterface, CopyOnWriteArrayList<SoftButtonObject> softButtonObjects, String currentMainField1) {
+ super("SoftButtonReplaceOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.softButtonObjects = softButtonObjects;
+ this.currentMainField1 = currentMainField1;
+ }
+
+ @Override
+ public void onExecute() {
+ start();
+ }
+
+ private void start() {
+ if (getState() == Task.CANCELED) {
+ return;
+ }
+
+ sendNewSoftButtons();
+ }
+
+ private void sendNewSoftButtons() {
+ Show show = new Show();
+ show.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ DebugTool.logWarning(TAG, "Failed to transition soft button to new state");
+ }
+ onFinished();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ super.onError(correlationId, resultCode, info);
+ DebugTool.logWarning(TAG, "Failed to transition soft button to new state. " + info);
+ onFinished();
+ }
+ });
+ show.setMainField1(currentMainField1);
+ show.setSoftButtons(currentStateSoftButtonsForObjects(softButtonObjects));
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(show);
+ }
+ }
+
+ private List<SoftButton> currentStateSoftButtonsForObjects(List<SoftButtonObject> softButtonObjects) {
+ List<SoftButton> softButtons = new ArrayList<>();
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ softButtons.add(softButtonObject.getCurrentStateSoftButton());
+ }
+ return softButtons;
+ }
+
+ void setCurrentMainField1(String currentMainField1) {
+ this.currentMainField1 = currentMainField1;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
deleted file mode 100644
index c0a1dbb25..000000000
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2019 Livio, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Livio Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Created by Nicole Yarroch on 7/25/19 8:43 AM
- */
-
-package com.smartdevicelink.managers.screen.choiceset;
-
-import com.smartdevicelink.util.DebugTool;
-
-class AsynchronousOperation implements Runnable {
- private static final String TAG = "AsynchronousOperation - ";
- private Thread thread;
- private final Object lock;
- private boolean blocked;
- private boolean executing;
- private boolean finished;
- private boolean cancelled;
-
- AsynchronousOperation() {
- lock = new Object();
- blocked = false;
- executing = false;
- finished = false;
- cancelled = false;
- }
-
- @Override
- public void run() {
- thread = Thread.currentThread();
- DebugTool.logInfo(TAG + "Starting: " + toString());
- if (isCancelled()) {
- finished = true;
- DebugTool.logInfo(TAG + "Operation was cancelled: " + toString());
- return;
- }
-
- executing = true;
- }
-
- void finishOperation() {
- unblock();
- executing = false;
- finished = true;
- cancelled = false;
- DebugTool.logInfo(TAG + "Finishing: " + toString());
- }
-
- boolean isExecuting() {
- return executing;
- }
-
- boolean isFinished() {
- return finished;
- }
-
- void cancel(){
- cancelled = true;
- }
-
- boolean isCancelled() {
- return cancelled;
- }
-
- void block(){
- if (!blocked && !finished) {
- blocked = true;
- DebugTool.logInfo(TAG + "Blocking: " + toString());
- try {
- synchronized (lock) {
- lock.wait();
- }
- } catch (InterruptedException e) {
- DebugTool.logWarning(TAG + "InterruptedException: " + toString());
- finishOperation();
- }
- }
- }
-
- void unblock(){
- if (blocked) {
- blocked = false;
- DebugTool.logInfo(TAG + "Unblocking: " + toString());
- synchronized (lock) {
- lock.notify();
- }
- }
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + " (OpId: " + System.identityHashCode(this) + ", OpThread:" + (thread != null ? thread.getName() : "no operating thread") + ", currentThread:" + Thread.currentThread().getName() + ", blocked:" + blocked + ", executing:" + executing + ", finished:" + finished + ", cancelled:" + cancelled + ")";
- }
-}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
index 2e590f406..1a5023133 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
@@ -37,6 +37,8 @@ package com.smartdevicelink.managers.screen.choiceset;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import com.livio.taskmaster.Queue;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.FileManager;
@@ -64,9 +66,6 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
/**
* <strong>ChoiceSetManager</strong> <br>
@@ -74,7 +73,7 @@ import java.util.concurrent.TimeUnit;
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
*/
abstract class BaseChoiceSetManager extends BaseSubManager {
-
+ private static final String TAG = "BaseChoiceSetManager";
// additional state
private static final int CHECKING_VOICE = 0xA0;
private KeyboardProperties keyboardConfiguration;
@@ -90,9 +89,8 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
ChoiceSet pendingPresentationSet;
// We will pass operations into this to be completed
- PausableThreadPoolExecutor executor;
- LinkedBlockingQueue<Runnable> operationQueue;
- Future pendingPresentOperation;
+ Queue transactionQueue;
+ Task pendingPresentOperation;
PresentKeyboardOperation currentlyPresentedKeyboardOperation;
@@ -105,6 +103,10 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
BaseChoiceSetManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
super(internalInterface);
+ // prepare operations queue
+ transactionQueue = internalInterface.getTaskmaster().createQueue("ChoiceSetManagerQueue", 1, false);
+ transactionQueue.pause(); // pause until HMI ready
+
// capabilities
currentSystemContext = SystemContext.SYSCTXT_MAIN;
currentHMILevel = HMILevel.HMI_NONE;
@@ -118,9 +120,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
nextCancelId = choiceCellCancelIdMin;
isVROptional = false;
keyboardConfiguration = defaultKeyboardConfiguration();
- operationQueue = new LinkedBlockingQueue<>();
- executor = new PausableThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors(), 10, TimeUnit.SECONDS, operationQueue);
- executor.pause(); // pause until HMI ready
currentlyPresentedKeyboardOperation = null;
}
@@ -136,8 +135,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
public void dispose(){
// cancel the operations
- operationQueue.clear();
- executor.shutdownNow();
+ transactionQueue.close();
currentHMILevel = null;
currentSystemContext = null;
@@ -163,22 +161,22 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
public void onCheckChoiceVROperationComplete(boolean vrOptional) {
isVROptional = vrOptional;
transitionToState(READY);
- DebugTool.logInfo("VR is optional: "+ isVROptional);
+ DebugTool.logInfo(TAG, "VR is optional: "+ isVROptional);
}
@Override
public void onError(String error) {
// At this point, there were errors trying to send a test PICS
// If we reach this state, we cannot use the manager
- DebugTool.logError(error);
+ DebugTool.logError(TAG, error);
transitionToState(ERROR);
// checking VR will always be first in the queue.
// If pre-load operations were added while this was in progress
// clear it from the queue onError.
- operationQueue.clear();
+ transactionQueue.clear();
}
});
- executor.submit(checkChoiceVR);
+ transactionQueue.add(checkChoiceVR, false);
}
/**
@@ -219,7 +217,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
listener.onComplete(true);
}
}else {
- DebugTool.logError("There was an error pre loading choice cells");
+ DebugTool.logError(TAG, "There was an error pre loading choice cells");
if (listener != null) {
listener.onComplete(false);
}
@@ -227,9 +225,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
});
- executor.submit(preloadChoicesOperation);
+ transactionQueue.add(preloadChoicesOperation, false);
} else {
- DebugTool.logError("File Manager was null in preload choice operation");
+ DebugTool.logError(TAG, "File Manager was null in preload choice operation");
}
}
@@ -240,7 +238,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
public void deleteChoices(@NonNull List<ChoiceCell> choices){
if (getState() == ERROR) {
- DebugTool.logWarning("Choice Manager In Error State");
+ DebugTool.logWarning(TAG, "Choice Manager In Error State");
return;
}
@@ -253,22 +251,22 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
pendingPresentationChoices.addAll(pendingPresentationSet.getChoices());
}
- if (pendingPresentOperation != null && !pendingPresentOperation.isCancelled() && !pendingPresentOperation.isDone() && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
- pendingPresentOperation.cancel(false);
- DebugTool.logWarning("Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
+ if (pendingPresentOperation != null && pendingPresentOperation.getState() != Task.CANCELED && pendingPresentOperation.getState() != Task.FINISHED && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
+ pendingPresentOperation.cancelTask();
+ DebugTool.logWarning(TAG, "Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
pendingPresentOperation = null;
}
// Remove cells from pending and delete choices
pendingPresentationChoices.removeAll(cellsToBeRemovedFromPending);
- for (Runnable operation : operationQueue){
+ for (Task operation : transactionQueue.getTasksAsList()){
if (!(operation instanceof PreloadChoicesOperation)){ continue; }
((PreloadChoicesOperation) operation).removeChoicesFromUpload(cellsToBeRemovedFromPending);
}
// Find Choices to delete
if (cellsToBeDeleted.size() == 0){
- DebugTool.logInfo("Cells to be deleted size == 0");
+ DebugTool.logInfo(TAG, "Cells to be deleted size == 0");
return;
}
findIdsOnChoices(cellsToBeDeleted);
@@ -277,13 +275,13 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onComplete(boolean success) {
if (!success){
- DebugTool.logError("Failed to delete choices");
+ DebugTool.logError(TAG, "Failed to delete choices");
return;
}
preloadedChoices.removeAll(cellsToBeDeleted);
}
});
- executor.submit(deleteChoicesOperation);
+ transactionQueue.add(deleteChoicesOperation, false);
}
/**
@@ -295,7 +293,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
if (getState() == ERROR) {
- DebugTool.logWarning("Choice Manager In Error State");
+ DebugTool.logWarning(TAG, "Choice Manager In Error State");
return;
}
@@ -303,8 +301,8 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (!setUpChoiceSet(choiceSet)){ return; }
if (this.pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(false);
- DebugTool.logWarning("Presenting a choice set while one is currently presented. Cancelling previous and continuing");
+ pendingPresentOperation.cancelTask();
+ DebugTool.logWarning(TAG, "Presenting a choice set while one is currently presented. Cancelling previous and continuing");
}
this.pendingPresentationSet = choiceSet;
@@ -349,15 +347,16 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (keyboardListener == null){
// Non-searchable choice set
- DebugTool.logInfo("Creating non-searchable choice set");
+ DebugTool.logInfo(TAG, "Creating non-searchable choice set");
presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener, nextCancelId++);
} else {
// Searchable choice set
- DebugTool.logInfo("Creating searchable choice set");
+ DebugTool.logInfo(TAG, "Creating searchable choice set");
presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener, nextCancelId++);
}
- pendingPresentOperation = executor.submit(presentOp);
+ transactionQueue.add(presentOp, false);
+ pendingPresentOperation = presentOp;
}
/**
@@ -369,19 +368,19 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
if (initialText == null || initialText.length() == 0){
- DebugTool.logError("initialText cannot be an empty string.");
+ DebugTool.logError(TAG, "initialText cannot be an empty string.");
return null;
}
if (getState() == ERROR) {
- DebugTool.logWarning("Choice Manager In Error State");
+ DebugTool.logWarning(TAG, "Choice Manager In Error State");
return null;
}
if (pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(false);
+ pendingPresentOperation.cancelTask();
pendingPresentationSet = null;
- DebugTool.logWarning("There is a current or pending choice set, cancelling and continuing.");
+ DebugTool.logWarning(TAG, "There is a current or pending choice set, cancelling and continuing.");
}
if (customKeyboardConfig == null){
@@ -393,11 +392,12 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
// Present a keyboard with the choice set that we used to test VR's optional state
- DebugTool.logInfo("Presenting Keyboard - Choice Set Manager");
+ DebugTool.logInfo(TAG, "Presenting Keyboard - Choice Set Manager");
Integer keyboardCancelID = nextCancelId++;
PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener, keyboardCancelID);
currentlyPresentedKeyboardOperation = keyboardOp;
- pendingPresentOperation = executor.submit(keyboardOp);
+ transactionQueue.add(keyboardOp, false);
+ pendingPresentOperation = keyboardOp;
return keyboardCancelID;
}
@@ -410,7 +410,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void dismissKeyboard(@NonNull Integer cancelID) {
if (getState() == ERROR) {
- DebugTool.logWarning("Choice Manager In Error State");
+ DebugTool.logWarning(TAG, "Choice Manager In Error State");
return;
}
@@ -421,7 +421,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
// Next, attempt to cancel keyboard operations that have not yet started
- for (Runnable operation : operationQueue){
+ for (Task operation : transactionQueue.getTasksAsList()){
if (!(operation instanceof PresentKeyboardOperation)){ continue; }
PresentKeyboardOperation pendingOp = (PresentKeyboardOperation) operation;
@@ -518,7 +518,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// instead of using the parameter it's more safe to use the convenience method
List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
+ DebugTool.logError(TAG, "SoftButton Manager - Capabilities sent here are null or empty");
}else {
DisplayCapability display = capabilities.get(0);
displayName = display.getDisplayName();
@@ -533,7 +533,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onError(String info) {
- DebugTool.logError("Unable to retrieve display capabilities. Many things will probably break. Info: "+ info);
+ DebugTool.logError(TAG, "Unable to retrieve display capabilities. Many things will probably break. Info: "+ info);
defaultMainWindowCapability = null;
}
};
@@ -551,21 +551,21 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_NONE){
- executor.pause();
+ transactionQueue.pause();
}
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
- executor.resume();
+ transactionQueue.resume();
}
currentSystemContext = onHMIStatus.getSystemContext();
if (currentSystemContext == SystemContext.SYSCTXT_HMI_OBSCURED || currentSystemContext == SystemContext.SYSCTXT_ALERT){
- executor.pause();
+ transactionQueue.pause();
}
if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE){
- executor.resume();
+ transactionQueue.resume();
}
}
@@ -581,13 +581,13 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Choices are not optional here
if (choices == null || choices.size() == 0) {
- DebugTool.logError("Cannot initiate a choice set with no choices");
+ DebugTool.logError(TAG, "Cannot initiate a choice set with no choices");
return false;
}
if (choiceSet.getTimeout() != null) {
if (choiceSet.getTimeout() < 5 || choiceSet.getTimeout() > 100) {
- DebugTool.logWarning("Attempted to create a choice set with a " + choiceSet.getTimeout() + " second timeout; Only 5 - 100 seconds is valid. When using the choice set manager, setTimeout() uses seconds.");
+ DebugTool.logWarning(TAG, "Attempted to create a choice set with a " + choiceSet.getTimeout() + " second timeout; Only 5 - 100 seconds is valid. When using the choice set manager, setTimeout() uses seconds.");
return false;
}
}
@@ -610,19 +610,19 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Cell text MUST be unique
if (choiceTextSet.size() < choices.size()) {
- DebugTool.logError("Attempted to create a choice set with duplicate cell text. Cell text must be unique. The choice set will not be set.");
+ DebugTool.logError(TAG, "Attempted to create a choice set with duplicate cell text. Cell text must be unique. The choice set will not be set.");
return false;
}
// All or none of the choices MUST have VR Commands
if (choiceCellWithVoiceCommandCount > 0 && choiceCellWithVoiceCommandCount < choices.size()) {
- DebugTool.logError("If using voice recognition commands, all of the choice set cells must have unique VR commands. There are " + uniqueVoiceCommands.size() + " cells with unique voice commands and " + choices.size() + " total cells. The choice set will not be set.");
+ DebugTool.logError(TAG, "If using voice recognition commands, all of the choice set cells must have unique VR commands. There are " + uniqueVoiceCommands.size() + " cells with unique voice commands and " + choices.size() + " total cells. The choice set will not be set.");
return false;
}
// All VR Commands MUST be unique
if (uniqueVoiceCommands.size() < allVoiceCommandsCount) {
- DebugTool.logError("If using voice recognition commands, all VR commands must be unique. There are " + uniqueVoiceCommands.size() + " unique VR commands and " + allVoiceCommandsCount + " VR commands. The choice set will not be set.");
+ DebugTool.logError(TAG, "If using voice recognition commands, all VR commands must be unique. There are " + uniqueVoiceCommands.size() + " unique VR commands and " + allVoiceCommandsCount + " VR commands. The choice set will not be set.");
return false;
}
return true;
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
index 1c427c16b..6e606b62d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
@@ -35,6 +35,7 @@
package com.smartdevicelink.managers.screen.choiceset;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Choice;
@@ -47,24 +48,22 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.Collections;
-class CheckChoiceVROptionalOperation extends AsynchronousOperation {
-
+class CheckChoiceVROptionalOperation extends Task {
+ private static final String TAG = "CheckChoiceVROptionalOperation";
private CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
private WeakReference<ISdl> internalInterface;
private boolean isVROptional;
CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface){
- super();
+ super("CheckChoiceVROptionalOperation");
this.internalInterface = new WeakReference<>(internalInterface);
this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
}
@Override
- public void run() {
- CheckChoiceVROptionalOperation.super.run();
- DebugTool.logInfo("Choice Operation: Executing check vr optional operation");
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing check vr optional operation");
sendTestChoiceNoVR();
- block();
}
/**
@@ -78,19 +77,19 @@ class CheckChoiceVROptionalOperation extends AsynchronousOperation {
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
// The request was successful, now send the SDLPerformInteraction RPC
- DebugTool.logInfo("Connected head unit supports choice cells without voice commands. " +
+ DebugTool.logInfo(TAG, "Connected head unit supports choice cells without voice commands. " +
"Cells without voice will be sent without voice from now on (no placeholder voice).");
isVROptional = true;
deleteTestChoiceSet();
}else{
- DebugTool.logWarning("Head unit doesn't support choices with no VR.");
+ DebugTool.logWarning(TAG, "Head unit doesn't support choices with no VR.");
sendTestChoiceWithVR();
}
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logWarning("Head unit doesn't support choices with no VR. Error: " + info + " resultCode: " + resultCode);
+ DebugTool.logWarning(TAG, "Head unit doesn't support choices with no VR. Error: " + info + " resultCode: " + resultCode);
sendTestChoiceWithVR();
}
});
@@ -110,30 +109,30 @@ class CheckChoiceVROptionalOperation extends AsynchronousOperation {
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
// The request was successful, now send the SDLPerformInteraction RPC
- DebugTool.logWarning("Connected head unit does not support choice cells without voice commands. " +
+ DebugTool.logWarning(TAG, "Connected head unit does not support choice cells without voice commands. " +
"Cells without voice will be sent with placeholder voices from now on.");
isVROptional = false;
deleteTestChoiceSet();
}else{
- DebugTool.logError("Connected head unit has rejected all choice cells, choice manager disabled. Error: " + response.getInfo());
+ DebugTool.logError(TAG, "Connected head unit has rejected all choice cells, choice manager disabled. Error: " + response.getInfo());
isVROptional = false;
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(response.getInfo());
}
- CheckChoiceVROptionalOperation.super.finishOperation();
+ CheckChoiceVROptionalOperation.super.onFinished();
}
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("There was an error in the check choice vr optional operation. Send test choice with VR failed. Error: " + info + " resultCode: " + resultCode);
+ DebugTool.logError(TAG, "There was an error in the check choice vr optional operation. Send test choice with VR failed. Error: " + info + " resultCode: " + resultCode);
isVROptional = false;
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
- CheckChoiceVROptionalOperation.super.finishOperation();
+ CheckChoiceVROptionalOperation.super.onFinished();
}
});
@@ -148,24 +147,24 @@ class CheckChoiceVROptionalOperation extends AsynchronousOperation {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess() != null){
- DebugTool.logInfo("Delete choice test set: "+ response.getSuccess());
+ DebugTool.logInfo(TAG, "Delete choice test set: "+ response.getSuccess());
}
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
}
- CheckChoiceVROptionalOperation.super.finishOperation();
+ CheckChoiceVROptionalOperation.super.onFinished();
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
- CheckChoiceVROptionalOperation.super.finishOperation();
+ CheckChoiceVROptionalOperation.super.onFinished();
}
});
if (internalInterface.get() != null){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
index 34bdbd6a4..7009c89b1 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
@@ -46,6 +46,7 @@ import java.util.Hashtable;
import java.util.List;
public class ChoiceSet {
+ private static final String TAG = "ChoiceSet";
private String title;
private List<TTSChunk> initialPrompt, timeoutPrompt, helpPrompt;
private ChoiceSetLayout layout;
@@ -361,17 +362,17 @@ public class ChoiceSet {
if (DebugTool.isDebugEnabled()) {
if (getTitle() != null) {
if (getTitle().length() == 0 || getTitle().length() > 500) {
- DebugTool.logWarning("Attempted to create a choice set with a title of " + getTitle().length() + " length. Only 500 characters are supported.");
+ DebugTool.logWarning(TAG, "Attempted to create a choice set with a title of " + getTitle().length() + " length. Only 500 characters are supported.");
}
}
if (getTimeout() != null) {
if (getTimeout() < 5 || getTimeout() > 100) {
- DebugTool.logWarning("Attempted to create a choice set with a " + getTimeout() + " second timeout; Only 5 - 100 seconds is valid");
+ DebugTool.logWarning(TAG, "Attempted to create a choice set with a " + getTimeout() + " second timeout; Only 5 - 100 seconds is valid");
}
}
if (getChoices() != null) {
if (getChoices().size() == 0 || getChoices().size() > 100) {
- DebugTool.logWarning("Attempted to create a choice set with "+getChoices().size()+" choices; Only 1 - 100 choices are valid");
+ DebugTool.logWarning(TAG, "Attempted to create a choice set with "+getChoices().size()+" choices; Only 1 - 100 choices are valid");
}
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
index 2fc6c314d..de328b8eb 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
@@ -35,6 +35,7 @@
package com.smartdevicelink.managers.screen.choiceset;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
@@ -48,25 +49,23 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-class DeleteChoicesOperation extends AsynchronousOperation {
-
+class DeleteChoicesOperation extends Task {
+ private static final String TAG = "DeleteChoicesOperation";
private WeakReference<ISdl> internalInterface;
private HashSet<ChoiceCell> cellsToDelete;
private CompletionListener completionListener;
DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener){
- super();
+ super("DeleteChoicesOperation");
this.internalInterface = new WeakReference<>(internalInterface);
this.cellsToDelete = cellsToDelete;
this.completionListener = completionListener;
}
@Override
- public void run() {
- DeleteChoicesOperation.super.run();
- DebugTool.logInfo("Choice Operation: Executing delete choices operation");
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing delete choices operation");
sendDeletions();
- block();
}
private void sendDeletions(){
@@ -86,9 +85,9 @@ class DeleteChoicesOperation extends AsynchronousOperation {
if (completionListener != null) {
completionListener.onComplete(true);
}
- DebugTool.logInfo("Successfully deleted choices");
+ DebugTool.logInfo(TAG, "Successfully deleted choices");
- DeleteChoicesOperation.super.finishOperation();
+ DeleteChoicesOperation.super.onFinished();
}
@Override
@@ -96,9 +95,9 @@ class DeleteChoicesOperation extends AsynchronousOperation {
if (completionListener != null) {
completionListener.onComplete(false);
}
- DebugTool.logError("Failed to delete choice: " + info + " | Corr ID: " + correlationId);
+ DebugTool.logError(TAG, "Failed to delete choice: " + info + " | Corr ID: " + correlationId);
- DeleteChoicesOperation.super.finishOperation();
+ DeleteChoicesOperation.super.onFinished();
}
@Override
@@ -110,7 +109,7 @@ class DeleteChoicesOperation extends AsynchronousOperation {
if (completionListener != null) {
completionListener.onComplete(true);
}
- DebugTool.logInfo("No Choices to delete, continue");
+ DebugTool.logInfo(TAG, "No Choices to delete, continue");
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PausableThreadPoolExecutor.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PausableThreadPoolExecutor.java
deleted file mode 100644
index 74f1cd85a..000000000
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PausableThreadPoolExecutor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Note: This file has been modified from its original form.
- * Site with example code: https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor
- */
-
-package com.smartdevicelink.managers.screen.choiceset;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-class PausableThreadPoolExecutor extends ThreadPoolExecutor {
-
- private boolean isPaused;
- private ReentrantLock threadLock;
- private Condition condition;
-
- PausableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
- threadLock = new ReentrantLock();
- condition = threadLock.newCondition();
- }
-
- protected void beforeExecute(Thread t, Runnable r) {
- super.beforeExecute(t, r);
- threadLock.lock();
- try {
- while (isPaused) condition.await();
- } catch (InterruptedException ie) {
- t.interrupt();
- } finally {
- threadLock.unlock();
- }
- }
-
- void pause() {
- threadLock.lock();
- try {
- isPaused = true;
- } finally {
- threadLock.unlock();
- }
- }
-
- void resume() {
- threadLock.lock();
- try {
- isPaused = false;
- condition.signalAll();
- } finally {
- threadLock.unlock();
- }
- }
-
-}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
index 04f0b7d7f..6d8423027 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
@@ -37,6 +37,7 @@ package com.smartdevicelink.managers.screen.choiceset;
import android.support.annotation.NonNull;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
@@ -62,8 +63,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
-class PreloadChoicesOperation extends AsynchronousOperation {
-
+class PreloadChoicesOperation extends Task {
+ private static final String TAG = "PreloadChoicesOperation";
private WeakReference<ISdl> internalInterface;
private WeakReference<FileManager> fileManager;
private WindowCapability defaultMainWindowCapability;
@@ -75,7 +76,7 @@ class PreloadChoicesOperation extends AsynchronousOperation {
PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, String displayName, WindowCapability defaultMainWindowCapability,
Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener){
- super();
+ super("PreloadChoicesOperation");
this.internalInterface = new WeakReference<>(internalInterface);
this.fileManager = new WeakReference<>(fileManager);
this.displayName = displayName;
@@ -86,16 +87,14 @@ class PreloadChoicesOperation extends AsynchronousOperation {
}
@Override
- public void run() {
- PreloadChoicesOperation.super.run();
- DebugTool.logInfo("Choice Operation: Executing preload choices operation");
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing preload choices operation");
preloadCellArtworks(new CompletionListener() {
@Override
public void onComplete(boolean success) {
preloadCells();
}
});
- block();
}
void removeChoicesFromUpload(HashSet<ChoiceCell> choices){
@@ -109,7 +108,7 @@ class PreloadChoicesOperation extends AsynchronousOperation {
List<SdlArtwork> artworksToUpload = artworksToUpload();
if (artworksToUpload.size() == 0){
- DebugTool.logInfo("Choice Preload: No Choice Artworks to upload");
+ DebugTool.logInfo(TAG, "Choice Preload: No Choice Artworks to upload");
listener.onComplete(true);
isRunning = false;
return;
@@ -120,18 +119,18 @@ class PreloadChoicesOperation extends AsynchronousOperation {
@Override
public void onComplete(Map<String, String> errors) {
if (errors != null && errors.size() > 0){
- DebugTool.logError("Error uploading choice cell Artworks: "+ errors.toString());
+ DebugTool.logError(TAG, "Error uploading choice cell Artworks: "+ errors.toString());
listener.onComplete(false);
isRunning = false;
}else{
- DebugTool.logInfo("Choice Artworks Uploaded");
+ DebugTool.logInfo(TAG, "Choice Artworks Uploaded");
listener.onComplete(true);
isRunning = false;
}
}
});
}else{
- DebugTool.logError("File manager is null in choice preload operation");
+ DebugTool.logError(TAG, "File manager is null in choice preload operation");
listener.onComplete(false);
isRunning = false;
}
@@ -148,7 +147,7 @@ class PreloadChoicesOperation extends AsynchronousOperation {
}
if (choiceRPCs.size() == 0){
- DebugTool.logError(" All Choice cells to send are null, so the choice set will not be shown");
+ DebugTool.logError(TAG, " All Choice cells to send are null, so the choice set will not be shown");
completionListener.onComplete(true);
isRunning = false;
return;
@@ -164,17 +163,17 @@ class PreloadChoicesOperation extends AsynchronousOperation {
@Override
public void onFinished() {
isRunning = false;
- DebugTool.logInfo("Finished pre loading choice cells");
+ DebugTool.logInfo(TAG, "Finished pre loading choice cells");
completionListener.onComplete(true);
- PreloadChoicesOperation.super.finishOperation();
+ PreloadChoicesOperation.super.onFinished();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
+ DebugTool.logError(TAG, "There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
- PreloadChoicesOperation.super.finishOperation();
+ PreloadChoicesOperation.super.onFinished();
}
@Override
@@ -183,7 +182,7 @@ class PreloadChoicesOperation extends AsynchronousOperation {
}
});
}else{
- DebugTool.logError("Internal Interface null in preload choice operation");
+ DebugTool.logError(TAG, "Internal Interface null in preload choice operation");
isRunning = false;
completionListener.onComplete(false);
}
@@ -201,7 +200,7 @@ class PreloadChoicesOperation extends AsynchronousOperation {
String menuName = shouldSendChoiceText() ? cell.getText() : null;
if (menuName == null){
- DebugTool.logError("Could not convert Choice Cell to CreateInteractionChoiceSet. It will not be shown. Cell: "+ cell.toString());
+ DebugTool.logError(TAG, "Could not convert Choice Cell to CreateInteractionChoiceSet. It will not be shown. Cell: "+ cell.toString());
return null;
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
index 10137b68b..7038a48ab 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
@@ -35,6 +35,7 @@
package com.smartdevicelink.managers.screen.choiceset;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
@@ -60,8 +61,8 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-class PresentChoiceSetOperation extends AsynchronousOperation {
-
+class PresentChoiceSetOperation extends Task {
+ private static final String TAG = "PresentChoiceSetOperation";
private WeakReference<ISdl> internalInterface;
private ChoiceSet choiceSet;
private Integer cancelID;
@@ -78,7 +79,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID){
- super();
+ super("PresentChoiceSetOperation");
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.choiceSet = choiceSet;
@@ -98,16 +99,14 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
}
@Override
- public void run() {
- PresentChoiceSetOperation.super.run();
- DebugTool.logInfo("Choice Operation: Executing present choice set operation");
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing present choice set operation");
addListeners();
start();
- block();
}
private void start(){
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
@@ -121,7 +120,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
@@ -149,7 +148,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(false);
}
- DebugTool.logError("Error Setting keyboard properties in present choice set operation");
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present choice set operation");
return;
}
@@ -158,7 +157,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(true);
}
- DebugTool.logInfo("Success Setting keyboard properties in present choice set operation");
+ DebugTool.logInfo(TAG, "Success Setting keyboard properties in present choice set operation");
}
@Override
@@ -166,13 +165,13 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(false);
}
- DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
}
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(setGlobalProperties);
} else {
- DebugTool.logError("Internal interface null - present choice set op - choice");
+ DebugTool.logError(TAG, "Internal interface null - present choice set op - choice");
}
}
@@ -182,7 +181,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (!response.getSuccess()){
- DebugTool.logError("Presenting Choice set failed: "+ response.getInfo());
+ DebugTool.logError(TAG, "Presenting Choice set failed: "+ response.getInfo());
if (choiceSetSelectionListener != null){
choiceSetSelectionListener.onError(response.getInfo());
@@ -203,7 +202,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Presenting Choice set failed: " + resultCode + ", " + info);
+ DebugTool.logError(TAG, "Presenting Choice set failed: " + resultCode + ", " + info);
if (choiceSetSelectionListener != null){
choiceSetSelectionListener.onError(resultCode + ", " + info);
@@ -214,7 +213,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
if (internalInterface.get() != null){
internalInterface.get().sendRPC(pi);
}else {
- DebugTool.logError("Internal Interface null when presenting choice set in operation");
+ DebugTool.logError(TAG, "Internal Interface null when presenting choice set in operation");
}
}
@@ -227,14 +226,14 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
@Override
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
- DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
- PresentChoiceSetOperation.super.finishOperation();
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ PresentChoiceSetOperation.super.onFinished();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
- PresentChoiceSetOperation.super.finishOperation();
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentChoiceSetOperation.super.onFinished();
}
});
@@ -242,10 +241,10 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
internalInterface.get().sendRPC(setGlobalProperties);
internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
} else {
- DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
+ DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
}
} else {
- PresentChoiceSetOperation.super.finishOperation();
+ PresentChoiceSetOperation.super.onFinished();
}
}
@@ -253,41 +252,41 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
* Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be dismissed using the `CancelInteraction` RPC.
*/
private void cancelInteraction() {
- if (isFinished()) {
- DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ if ((getState() == Task.FINISHED)) {
+ DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
return;
- } else if (isCancelled()) {
- DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ } else if (getState() == Task.CANCELED) {
+ DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
return;
- } else if (isExecuting()) {
+ } else if ((getState() == Task.IN_PROGRESS)) {
if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Canceling a presented choice set is not supported on this head unit");
+ DebugTool.logWarning(TAG, "Canceling a presented choice set is not supported on this head unit");
return;
}
- DebugTool.logInfo("Canceling the presented choice set interaction.");
+ DebugTool.logInfo(TAG, "Canceling the presented choice set interaction.");
CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- DebugTool.logInfo("Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ DebugTool.logInfo(TAG, "Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("Error canceling the presented choice set " + resultCode + " " + info);
+ DebugTool.logError(TAG, "Error canceling the presented choice set " + resultCode + " " + info);
}
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(cancelInteraction);
} else {
- DebugTool.logError("Internal interface null - could not send cancel interaction for choice set");
+ DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for choice set");
}
} else {
- DebugTool.logInfo("Canceling a choice set that has not yet been sent to Core");
- this.cancel();
+ DebugTool.logInfo(TAG, "Canceling a choice set that has not yet been sent to Core");
+ this.cancelTask();
}
}
@@ -346,13 +345,13 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
if (keyboardListener == null){
- DebugTool.logError("Received Keyboard Input But Listener is null");
+ DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
return;
}
@@ -396,7 +395,7 @@ class PresentChoiceSetOperation extends AsynchronousOperation {
if (internalInterface.get() != null) {
internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
} else {
- DebugTool.logError("Present Choice Set Keyboard Listener Not Added");
+ DebugTool.logError(TAG, "Present Choice Set Keyboard Listener Not Added");
}
}
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
index 5089d0c92..446826616 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
@@ -35,6 +35,7 @@
package com.smartdevicelink.managers.screen.choiceset;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
@@ -59,8 +60,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-class PresentKeyboardOperation extends AsynchronousOperation {
-
+class PresentKeyboardOperation extends Task {
+ private static final String TAG = "PresentKeyboardOperation";
private WeakReference<ISdl> internalInterface;
private KeyboardListener keyboardListener;
private KeyboardProperties originalKeyboardProperties, keyboardProperties, customConfig;
@@ -71,7 +72,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
SdlMsgVersion sdlMsgVersion;
PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID){
- super();
+ super("PresentKeyboardOperation");
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.originalKeyboardProperties = originalKeyboardProperties;
@@ -83,18 +84,16 @@ class PresentKeyboardOperation extends AsynchronousOperation {
}
@Override
- public void run() {
- PresentKeyboardOperation.super.run();
- DebugTool.logInfo("Keyboard Operation: Executing present keyboard operation");
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Keyboard Operation: Executing present keyboard operation");
addListeners();
start();
- block();
}
private void start(){
- DebugTool.logInfo("Choice Operation: Executing present keyboard operation");
+ DebugTool.logInfo(TAG, "Choice Operation: Executing present keyboard operation");
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
@@ -107,7 +106,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
@@ -130,7 +129,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
finishOperation();
}
});
@@ -138,7 +137,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
internalInterface.get().sendRPC(pi);
}else{
- DebugTool.logError("Internal Interface null in present keyboard operation - choice");
+ DebugTool.logError(TAG, "Internal Interface null in present keyboard operation - choice");
}
}
@@ -148,40 +147,40 @@ class PresentKeyboardOperation extends AsynchronousOperation {
* This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
*/
void dismissKeyboard() {
- if (isFinished()) {
- DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ if ((getState() == Task.FINISHED)) {
+ DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
return;
- } else if (isCancelled()) {
- DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ } else if (getState() == Task.CANCELED) {
+ DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
return;
- } else if (isExecuting()) {
+ } else if (getState() == Task.IN_PROGRESS) {
if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Canceling a keyboard is not supported on this head unit");
+ DebugTool.logWarning(TAG, "Canceling a keyboard is not supported on this head unit");
return;
}
- DebugTool.logInfo("Canceling the presented keyboard.");
+ DebugTool.logInfo(TAG, "Canceling the presented keyboard.");
CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- DebugTool.logInfo("Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ DebugTool.logInfo(TAG, "Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("Error canceling the presented keyboard " + resultCode + " " + info);
+ DebugTool.logError(TAG, "Error canceling the presented keyboard " + resultCode + " " + info);
}
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(cancelInteraction);
} else {
- DebugTool.logError("Internal interface null - could not send cancel interaction for keyboard.");
+ DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for keyboard.");
}
} else {
- DebugTool.logInfo("Canceling a keyboard that has not yet been sent to Core.");
- this.cancel();
+ DebugTool.logInfo(TAG, "Canceling a keyboard that has not yet been sent to Core.");
+ this.cancelTask();
}
}
@@ -203,7 +202,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(false);
}
- DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager");
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager");
return;
}
@@ -212,7 +211,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(true);
}
- DebugTool.logInfo("Success Setting keyboard properties in present keyboard operation - choice manager");
+ DebugTool.logInfo(TAG, "Success Setting keyboard properties in present keyboard operation - choice manager");
}
@Override
@@ -220,7 +219,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
if (listener != null){
listener.onComplete(false);
}
- DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
super.onError(correlationId, resultCode, info);
}
});
@@ -228,7 +227,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
if (internalInterface.get() != null){
internalInterface.get().sendRPC(setGlobalProperties);
} else {
- DebugTool.logError("Internal interface null - present keyboard op - choice");
+ DebugTool.logError(TAG, "Internal interface null - present keyboard op - choice");
}
}
@@ -241,14 +240,14 @@ class PresentKeyboardOperation extends AsynchronousOperation {
@Override
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
- DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
- PresentKeyboardOperation.super.finishOperation();
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ PresentKeyboardOperation.super.onFinished();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
- PresentKeyboardOperation.super.finishOperation();
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentKeyboardOperation.super.onFinished();
}
});
@@ -256,10 +255,10 @@ class PresentKeyboardOperation extends AsynchronousOperation {
internalInterface.get().sendRPC(setGlobalProperties);
internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
} else {
- DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
+ DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
}
} else {
- PresentKeyboardOperation.super.finishOperation();
+ PresentKeyboardOperation.super.onFinished();
}
}
@@ -286,13 +285,13 @@ class PresentKeyboardOperation extends AsynchronousOperation {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- if (isCancelled()) {
+ if (getState() == Task.CANCELED) {
finishOperation();
return;
}
if (keyboardListener == null){
- DebugTool.logError("Received Keyboard Input But Listener is null");
+ DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
return;
}
@@ -337,7 +336,7 @@ class PresentKeyboardOperation extends AsynchronousOperation {
if (internalInterface.get() != null) {
internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
} else {
- DebugTool.logError("Present Keyboard Listener Not Added - choice manager");
+ DebugTool.logError(TAG, "Present Keyboard Listener Not Added - choice manager");
}
}
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index 48ed19b40..7d7649e9c 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -80,7 +80,7 @@ import java.util.List;
import java.util.Map;
abstract class BaseMenuManager extends BaseSubManager {
-
+ private static final String TAG = "BaseMenuManager";
private static final int KEEP = 0;
private static final int MARKED_FOR_ADDITION = 1;
private static final int MARKED_FOR_DELETION = 2;
@@ -208,13 +208,13 @@ abstract class BaseMenuManager extends BaseSubManager {
}
// Check for duplicate titles
if (titleCheckSet.size() != menuCells.size()){
- DebugTool.logError("Not all cell titles are unique. The menu will not be set");
+ DebugTool.logError(TAG, "Not all cell titles are unique. The menu will not be set");
return;
}
// Check for duplicate voice commands
if (allMenuVoiceCommands.size() != voiceCommandCount){
- DebugTool.logError("Attempted to create a menu with duplicate voice commands. Voice commands must be unique. The menu will not be set");
+ DebugTool.logError(TAG, "Attempted to create a menu with duplicate voice commands. Voice commands must be unique. The menu will not be set");
return;
}
@@ -226,9 +226,9 @@ abstract class BaseMenuManager extends BaseSubManager {
public void onComplete(Map<String, String> errors) {
if (errors != null && errors.size() > 0){
- DebugTool.logError("Error uploading Menu Artworks: "+ errors.toString());
+ DebugTool.logError(TAG, "Error uploading Menu Artworks: "+ errors.toString());
}else{
- DebugTool.logInfo("Menu Artworks Uploaded");
+ DebugTool.logInfo(TAG, "Menu Artworks Uploaded");
}
// proceed
updateMenuAndDetermineBestUpdateMethod();
@@ -271,7 +271,7 @@ abstract class BaseMenuManager extends BaseSubManager {
public boolean openMenu(){
if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ DebugTool.logWarning(TAG, "Menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
return false;
}
@@ -280,15 +280,15 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()){
- DebugTool.logInfo("Open Main Menu Request Successful");
+ DebugTool.logInfo(TAG, "Open Main Menu Request Successful");
} else {
- DebugTool.logError("Open Main Menu Request Failed");
+ DebugTool.logError(TAG, "Open Main Menu Request Failed");
}
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
+ DebugTool.logError(TAG, "Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
}
});
internalInterface.sendRPC(showAppMenu);
@@ -302,12 +302,12 @@ abstract class BaseMenuManager extends BaseSubManager {
public boolean openSubMenu(@NonNull MenuCell cell){
if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Sub menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ DebugTool.logWarning(TAG, "Sub menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
return false;
}
if (oldMenuCells == null){
- DebugTool.logError("open sub menu called, but no Menu cells have been set");
+ DebugTool.logError(TAG, "open sub menu called, but no Menu cells have been set");
return false;
}
// We must see if we have a copy of this cell, since we clone the objects
@@ -329,15 +329,15 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()){
- DebugTool.logInfo("Open Sub Menu Request Successful");
+ DebugTool.logInfo(TAG, "Open Sub Menu Request Successful");
} else {
- DebugTool.logError("Open Sub Menu Request Failed");
+ DebugTool.logError(TAG, "Open Sub Menu Request Failed");
}
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
+ DebugTool.logError(TAG, "Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
}
});
@@ -354,18 +354,18 @@ abstract class BaseMenuManager extends BaseSubManager {
public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
if (sdlMsgVersion == null) {
- DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
+ DebugTool.logError(TAG, "SDL Message Version is null. Cannot set Menu Configuration");
return;
}
if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ DebugTool.logWarning(TAG, "Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
return;
}
if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
// We are in NONE or the menu is in use, bail out of here
- DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
+ DebugTool.logError(TAG, "Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
return;
}
@@ -380,18 +380,18 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
- DebugTool.logInfo("Menu Configuration successfully set: " + menuConfiguration.toString());
+ DebugTool.logInfo(TAG, "Menu Configuration successfully set: " + menuConfiguration.toString());
}
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("onError: " + resultCode + " | Info: " + info);
+ DebugTool.logError(TAG, "onError: " + resultCode + " | Info: " + info);
}
});
internalInterface.sendRPC(setGlobalProperties);
} else {
- DebugTool.logInfo("Menu Layout is null, not sending setGlobalProperties");
+ DebugTool.logInfo(TAG, "Menu Layout is null, not sending setGlobalProperties");
}
}
@@ -406,7 +406,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
// We are in NONE or the menu is in use, bail out of here
- DebugTool.logInfo("HMI in None or System Context Menu, returning");
+ DebugTool.logInfo(TAG, "HMI in None or System Context Menu, returning");
waitingOnHMIUpdate = true;
waitingUpdateMenuCells = menuCells;
return;
@@ -414,7 +414,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (inProgressUpdate != null && inProgressUpdate.size() > 0){
// there's an in-progress update so this needs to wait
- DebugTool.logInfo("There is an in progress Menu Update, returning");
+ DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
hasQueuedUpdate = true;
return;
}
@@ -428,14 +428,14 @@ abstract class BaseMenuManager extends BaseSubManager {
if (rootScore == null) {
// send initial menu (score will return null)
// make a copy of our current cells
- DebugTool.logInfo("Creating initial Menu");
+ DebugTool.logInfo(TAG, "Creating initial Menu");
// Set the IDs if needed
lastMenuId = menuCellIdMin;
updateIdsOnMenuCells(menuCells, parentIdNotFound);
this.oldMenuCells = new ArrayList<>(menuCells);
createAndSendEntireMenu();
} else {
- DebugTool.logInfo("Dynamically Updating Menu");
+ DebugTool.logInfo(TAG, "Dynamically Updating Menu");
if (menuCells.size() == 0 && (oldMenuCells != null && oldMenuCells.size() > 0)) {
// the dev wants to clear the menu. We have old cells and an empty array of new ones.
deleteMenuWhenNewCellsEmpty();
@@ -446,7 +446,7 @@ abstract class BaseMenuManager extends BaseSubManager {
}
} else {
// we are in compatibility mode
- DebugTool.logInfo("Updating menus in compatibility mode");
+ DebugTool.logInfo(TAG, "Updating menus in compatibility mode");
lastMenuId = menuCellIdMin;
updateIdsOnMenuCells(menuCells, parentIdNotFound);
// if the old cell array is not null, we want to delete the entire thing, else copy the new array
@@ -481,9 +481,9 @@ abstract class BaseMenuManager extends BaseSubManager {
inProgressUpdate = null;
if (!success){
- DebugTool.logError("Error Sending Current Menu");
+ DebugTool.logError(TAG, "Error Sending Current Menu");
}else{
- DebugTool.logInfo("Successfully Cleared Menu");
+ DebugTool.logInfo(TAG, "Successfully Cleared Menu");
}
oldMenuCells = null;
if (hasQueuedUpdate){
@@ -533,10 +533,10 @@ abstract class BaseMenuManager extends BaseSubManager {
transferIdsToKeptCells(keepsNew);
if (adds.size() > 0){
- DebugTool.logInfo("Sending root menu updates");
+ DebugTool.logInfo(TAG, "Sending root menu updates");
sendDynamicRootMenuRPCs(deleteCommands, adds);
}else{
- DebugTool.logInfo("All root menu items are kept. Check the sub menus");
+ DebugTool.logInfo(TAG, "All root menu items are kept. Check the sub menus");
runSubMenuCompareAlgorithm();
}
}
@@ -553,7 +553,7 @@ abstract class BaseMenuManager extends BaseSubManager {
inProgressUpdate = null;
if (!success){
- DebugTool.logError("Error Sending Current Menu");
+ DebugTool.logError(TAG, "Error Sending Current Menu");
}
if (hasQueuedUpdate){
@@ -588,7 +588,7 @@ abstract class BaseMenuManager extends BaseSubManager {
RunScore subScore = compareOldAndNewLists(oldKeptCell.getSubCells(), keptCell.getSubCells());
if (subScore != null){
- DebugTool.logInfo("Sub menu Run Score: "+ oldKeptCell.getTitle()+ " Score: "+ subScore.getScore());
+ DebugTool.logInfo(TAG, "Sub menu Run Score: "+ oldKeptCell.getTitle()+ " Score: "+ subScore.getScore());
SubCellCommandList commandList = new SubCellCommandList(oldKeptCell.getTitle(), oldKeptCell.getCellId(), subScore, oldKeptCell.getSubCells(), keptCell.getSubCells());
commandLists.add(commandList);
}
@@ -606,17 +606,17 @@ abstract class BaseMenuManager extends BaseSubManager {
}
if (hasQueuedUpdate) {
- DebugTool.logInfo("Menu Manager has waiting updates, sending now");
+ DebugTool.logInfo(TAG, "Menu Manager has waiting updates, sending now");
setMenuCells(waitingUpdateMenuCells);
hasQueuedUpdate = false;
}
- DebugTool.logInfo("All menu updates, including sub menus - done.");
+ DebugTool.logInfo(TAG, "All menu updates, including sub menus - done.");
return;
}
final SubCellCommandList commandList = commandLists.remove(0);
- DebugTool.logInfo("Creating and Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
+ DebugTool.logInfo(TAG, "Creating and Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
// grab the scores
RunScore score = commandList.getListsScore();
@@ -667,13 +667,13 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onComplete(boolean success) {
// recurse through next sub list
- DebugTool.logInfo("Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
+ DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
createSubMenuDynamicCommands(commandLists);
}
});
} else{
// no add commands to send, recurse through next sub list
- DebugTool.logInfo("Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
+ DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
createSubMenuDynamicCommands(commandLists);
}
}
@@ -691,7 +691,7 @@ abstract class BaseMenuManager extends BaseSubManager {
}
RunScore bestScore = compareOldAndNewLists(oldCells, newCells);
- DebugTool.logInfo("Best menu run score: "+ bestScore.getScore());
+ DebugTool.logInfo(TAG, "Best menu run score: "+ bestScore.getScore());
return bestScore;
}
@@ -962,7 +962,11 @@ abstract class BaseMenuManager extends BaseSubManager {
AddCommand command = new AddCommand(cell.getCellId());
command.setMenuParams(params);
- command.setVrCommands(cell.getVoiceCommands());
+ if (cell.getVoiceCommands() != null && !cell.getVoiceCommands().isEmpty()) {
+ command.setVrCommands(cell.getVoiceCommands());
+ } else {
+ command.setVrCommands(null);
+ }
command.setCmdIcon((cell.getIcon() != null && shouldHaveArtwork) ? cell.getIcon().getImageRPC() : null);
return command;
@@ -1011,7 +1015,7 @@ abstract class BaseMenuManager extends BaseSubManager {
// instead of using the parameter it's more safe to use the convenience method
List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
+ DebugTool.logError(TAG, "SoftButton Manager - Capabilities sent here are null or empty");
}else {
DisplayCapability display = capabilities.get(0);
displayType = display.getDisplayName();
@@ -1026,7 +1030,7 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onError(String info) {
- DebugTool.logError("Display Capability cannot be retrieved");
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
defaultMainWindowCapability = null;
}
};
@@ -1046,7 +1050,7 @@ abstract class BaseMenuManager extends BaseSubManager {
// Auto-send an updated menu if we were in NONE and now we are not, and we need an update
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE && currentSystemContext != SystemContext.SYSCTXT_MENU){
if (waitingOnHMIUpdate){
- DebugTool.logInfo("We now have proper HMI, sending waiting update");
+ DebugTool.logInfo(TAG, "We now have proper HMI, sending waiting update");
setMenuCells(waitingUpdateMenuCells);
waitingUpdateMenuCells.clear();
return;
@@ -1060,7 +1064,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (oldContext == SystemContext.SYSCTXT_MENU && currentSystemContext != SystemContext.SYSCTXT_MENU && currentHMILevel != HMILevel.HMI_NONE){
if (waitingOnHMIUpdate){
- DebugTool.logInfo("We now have a proper system context, sending waiting update");
+ DebugTool.logInfo(TAG, "We now have a proper system context, sending waiting update");
setMenuCells(waitingUpdateMenuCells);
waitingUpdateMenuCells.clear();
}
@@ -1086,7 +1090,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
// We are in NONE or the menu is in use, bail out of here
- DebugTool.logInfo("HMI in None or System Context Menu, returning");
+ DebugTool.logInfo(TAG, "HMI in None or System Context Menu, returning");
waitingOnHMIUpdate = true;
waitingUpdateMenuCells = menuCells;
return;
@@ -1094,7 +1098,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (inProgressUpdate != null && inProgressUpdate.size() > 0){
// there's an in-progress update so this needs to wait
- DebugTool.logInfo("There is an in progress Menu Update, returning");
+ DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
hasQueuedUpdate = true;
return;
}
@@ -1108,7 +1112,7 @@ abstract class BaseMenuManager extends BaseSubManager {
inProgressUpdate = null;
if (!success) {
- DebugTool.logError("Error Sending Current Menu");
+ DebugTool.logError(TAG, "Error Sending Current Menu");
}
if (hasQueuedUpdate) {
@@ -1158,27 +1162,27 @@ abstract class BaseMenuManager extends BaseSubManager {
if (subMenuCommands.size() > 0) {
sendSubMenuCommandRPCs(subMenuCommands, listener);
- DebugTool.logInfo("Finished sending main menu commands. Sending sub menu commands.");
+ DebugTool.logInfo(TAG, "Finished sending main menu commands. Sending sub menu commands.");
} else {
if (keepsNew != null && keepsNew.size() > 0){
runSubMenuCompareAlgorithm();
}else {
inProgressUpdate = null;
- DebugTool.logInfo("Finished sending main menu commands.");
+ DebugTool.logInfo(TAG, "Finished sending main menu commands.");
}
}
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Result: " + resultCode.toString() + " Info: " + info);
+ DebugTool.logError(TAG, "Result: " + resultCode.toString() + " Info: " + info);
}
@Override
public void onResponse(int correlationId, RPCResponse response) {
try {
- DebugTool.logInfo("Main Menu response: " + response.serializeJSON().toString());
+ DebugTool.logInfo(TAG, "Main Menu response: " + response.serializeJSON().toString());
} catch (JSONException e) {
e.printStackTrace();
}
@@ -1200,7 +1204,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (keepsNew != null && keepsNew.size() > 0){
runSubMenuCompareAlgorithm();
}else {
- DebugTool.logInfo("Finished Updating Menu");
+ DebugTool.logInfo(TAG, "Finished Updating Menu");
inProgressUpdate = null;
if (listener != null) {
@@ -1211,7 +1215,7 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Failed to send sub menu commands: "+ info);
+ DebugTool.logError(TAG, "Failed to send sub menu commands: "+ info);
if (listener != null){
listener.onComplete(false);
}
@@ -1220,7 +1224,7 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
try {
- DebugTool.logInfo("Sub Menu response: "+ response.serializeJSON().toString());
+ DebugTool.logInfo(TAG, "Sub Menu response: "+ response.serializeJSON().toString());
} catch (JSONException e) {
e.printStackTrace();
}
@@ -1233,7 +1237,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (adds.size() == 0){
if (listener != null){
// This can be considered a success if the user was clearing out their menu
- DebugTool.logError("Called createAndSendDynamicSubMenuRPCs with empty menu");
+ DebugTool.logError(TAG, "Called createAndSendDynamicSubMenuRPCs with empty menu");
listener.onComplete(true);
}
return;
@@ -1264,13 +1268,13 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError("Result: " + resultCode.toString() + " Info: " + info);
+ DebugTool.logError(TAG, "Result: " + resultCode.toString() + " Info: " + info);
}
@Override
public void onResponse(int correlationId, RPCResponse response) {
try {
- DebugTool.logInfo("Dynamic Sub Menu response: " + response.serializeJSON().toString());
+ DebugTool.logInfo(TAG, "Dynamic Sub Menu response: " + response.serializeJSON().toString());
} catch (JSONException e) {
e.printStackTrace();
}
@@ -1285,7 +1289,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (oldMenuCells == null || oldMenuCells.size() == 0) {
if (listener != null){
// technically this method is successful if there's nothing to delete
- DebugTool.logInfo("No old cells to delete, returning");
+ DebugTool.logInfo(TAG, "No old cells to delete, returning");
listener.onComplete(true);
}
} else {
@@ -1297,7 +1301,7 @@ abstract class BaseMenuManager extends BaseSubManager {
if (oldMenuCells != null && oldMenuCells.size() == 0) {
if (listener != null){
// technically this method is successful if there's nothing to delete
- DebugTool.logInfo("No old cells to delete, returning");
+ DebugTool.logInfo(TAG, "No old cells to delete, returning");
listener.onComplete(true);
}
return;
@@ -1320,7 +1324,7 @@ abstract class BaseMenuManager extends BaseSubManager {
@Override
public void onFinished() {
- DebugTool.logInfo("Successfully deleted cells");
+ DebugTool.logInfo(TAG, "Successfully deleted cells");
if (listener != null){
listener.onComplete(true);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
index 731504735..8004413b7 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
@@ -55,7 +55,7 @@ import java.util.ArrayList;
import java.util.List;
abstract class BaseVoiceCommandManager extends BaseSubManager {
-
+ private static final String TAG = "BaseVoiceCommandManager";
List<VoiceCommand> voiceCommands, oldVoiceCommands;
List<AddCommand> inProgressUpdate;
@@ -111,7 +111,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
// we actually need voice commands to set.
if (voiceCommands == null || voiceCommands.size() == 0){
- DebugTool.logInfo("Trying to set empty list of voice commands, returning");
+ DebugTool.logInfo(TAG, "Trying to set empty list of voice commands, returning");
return;
}
@@ -169,7 +169,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
}
if (!success2){
- DebugTool.logError("Error sending voice commands");
+ DebugTool.logError(TAG, "Error sending voice commands");
}
}
});
@@ -199,7 +199,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
@Override
public void onFinished() {
- DebugTool.logInfo("Successfully deleted old voice commands");
+ DebugTool.logInfo(TAG, "Successfully deleted old voice commands");
if (listener != null){
listener.onComplete(true);
}
@@ -237,7 +237,7 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
@Override
public void onFinished() {
- DebugTool.logInfo("Sending Voice Commands Complete");
+ DebugTool.logInfo(TAG, "Sending Voice Commands Complete");
if (listener != null){
listener.onComplete(true);
}
diff --git a/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java b/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
index 1164ec58f..8f74fbdaa 100644
--- a/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
+++ b/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.marshal;
import com.smartdevicelink.proxy.RPCMessage;
@@ -52,7 +52,7 @@ import java.util.List;
*/
public class JsonRPCMarshaller {
-
+ private static final String TAG = "JsonRPCMarshaller";
private static final String SDL_LIB_PRIVATE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
/**
@@ -68,7 +68,7 @@ public class JsonRPCMarshaller {
SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Transmit, jsonBytes, SDL_LIB_PRIVATE_KEY);
} catch (JSONException e) {
- DebugTool.logError("Failed to encode messages to JSON.", e);
+ DebugTool.logError(TAG, "Failed to encode messages to JSON.", e);
}
return jsonBytes;
}
@@ -81,7 +81,7 @@ public class JsonRPCMarshaller {
JSONObject jsonObject = new JSONObject(jsonString);
ret = deserializeJSONObject(jsonObject);
} catch (JSONException e) {
- DebugTool.logError("Failed to parse JSON", e);
+ DebugTool.logError(TAG, "Failed to parse JSON", e);
}
return ret;
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
index edc860a42..21362b53e 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
@@ -31,13 +31,9 @@
*/
package com.smartdevicelink.protocol;
-import android.os.Parcel;
-import android.os.Parcelable;
-
import com.livio.BSON.BsonEncoder;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.transport.utl.TransportRecord;
-import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
import java.util.HashMap;
@@ -47,7 +43,7 @@ import java.util.HashMap;
* Any other binder transactions must include an additional int flag into their bundle or the parsing
* of this object will fail.
*/
-public class SdlPacket implements Parcelable{
+class BaseSdlPacket {
/**
* This is the amount of bytes added to the bundle from the router service for a specific int
@@ -122,9 +118,9 @@ public class SdlPacket implements Parcelable{
int messagingVersion = 1;
TransportRecord transportRecord;
- public SdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload) {
+ BaseSdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
this.version = version;
this.encryption = encryption;
this.frameType = frameType;
@@ -140,9 +136,9 @@ public class SdlPacket implements Parcelable{
}
}
- public SdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload, int offset,int bytesToWrite) {
+ BaseSdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
this.version = version;
this.encryption = encryption;
this.frameType = frameType;
@@ -166,7 +162,7 @@ public class SdlPacket implements Parcelable{
* <p>Frame Info
* <p>
*/
- protected SdlPacket(){
+ protected BaseSdlPacket(){
//Package only empty constructor
this.version = 1;
this.encryption = false;
@@ -183,7 +179,7 @@ public class SdlPacket implements Parcelable{
* Creates a new packet based on previous packet definitions. Will not copy payload.
* @param packet an instance of the packet that should be copied.
*/
- protected SdlPacket(SdlPacket packet){
+ protected BaseSdlPacket(BaseSdlPacket packet){
this.version = packet.version;
this.encryption = packet.encryption;
this.frameType = packet.frameType;
@@ -359,92 +355,6 @@ public class SdlPacket implements Parcelable{
public void setMessagingVersion(int version){
this.messagingVersion = version;
}
-
-
-
- /* ***************************************************************************************************************************************************
- * *********************************************************** Parceable Overrides *****************************************************************
- *****************************************************************************************************************************************************/
-
-
-
- //I think this is FIFO...right?
- public SdlPacket(Parcel p) {
- this.version = p.readInt();
- this.encryption = (p.readInt() == 0) ? false : true;
- this.frameType = p.readInt();
- this.serviceType = p.readInt();
- this.frameInfo = p.readInt();
- this.sessionId = p.readInt();
- this.dataSize = p.readInt();
- this.messageId = p.readInt();
- if(p.readInt() == 1){ //We should have a payload attached
- payload = new byte[dataSize];
- p.readByteArray(payload);
- }
-
- this.priorityCoefficient = p.readInt();
-
- if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0
- try {
- messagingVersion = p.readInt();
- if (messagingVersion >= 2) {
- if (p.readInt() == 1) { //We should have a transport type attached
- this.transportRecord = (TransportRecord) p.readParcelable(TransportRecord.class.getClassLoader());
- }
- }
- }catch (RuntimeException e){
- DebugTool.logError("Error creating packet from parcel", e);
- }
- }
- }
-
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
-
- dest.writeInt(version);
- dest.writeInt(encryption? 1 : 0);
- dest.writeInt(frameType);
- dest.writeInt(serviceType);
- dest.writeInt(frameInfo);
- dest.writeInt(sessionId);
- dest.writeInt(dataSize);
- dest.writeInt(messageId);
- dest.writeInt(payload!=null? 1 : 0);
- if(payload!=null){
- dest.writeByteArray(payload);
- }
- dest.writeInt(priorityCoefficient);
-
- ///Additions after initial creation
- if(messagingVersion > 1){
- dest.writeInt(messagingVersion);
-
- dest.writeInt(transportRecord!=null? 1 : 0);
- if(transportRecord != null){
- dest.writeParcelable(transportRecord,0);
- }
- }
-
- }
-
- public static final Parcelable.Creator<SdlPacket> CREATOR = new Parcelable.Creator<SdlPacket>() {
- public SdlPacket createFromParcel(Parcel in) {
- return new SdlPacket(in);
- }
-
- @Override
- public SdlPacket[] newArray(int size) {
- return new SdlPacket[size];
- }
-
- };
public void putTag(String tag, Object data){
if(bsonPayload == null){
diff --git a/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java b/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
index da6682918..ebf0353bc 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.protocol;
-import android.util.Log;
import com.smartdevicelink.util.BitConverter;
+import com.smartdevicelink.util.DebugTool;
public class BinaryFrameHeader {
private static final String TAG = "BinaryFrameHeader";
@@ -76,7 +76,7 @@ public class BinaryFrameHeader {
msg.setBulkData(_bulkData);
}
} catch (OutOfMemoryError|ArrayIndexOutOfBoundsException e){
- Log.e(TAG, "Unable to process data to form header");
+ DebugTool.logError(TAG, "Unable to process data to form header");
return null;
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
index db342de39..1468f9477 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.protocol;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
@@ -237,7 +236,7 @@ public class SdlProtocolBase {
activeTransportString.append("\n");
}
}
- Log.d(TAG, activeTransportString.toString());
+ DebugTool.logInfo(TAG, activeTransportString.toString());
}
protected void printSecondaryTransportDetails(List<String> secondary, List<Integer> audio, List<Integer> video){
@@ -251,7 +250,7 @@ public class SdlProtocolBase {
}
secondaryDetailsBldr.append("\n");
}else{
- Log.d(TAG, "Supported secondary transports list is empty!");
+ DebugTool.logInfo(TAG, "Supported secondary transports list is empty!");
}
if(audio != null){
secondaryDetailsBldr.append("Supported audio transports: ");
@@ -268,7 +267,7 @@ public class SdlProtocolBase {
secondaryDetailsBldr.append("\n");
}
- Log.d(TAG, secondaryDetailsBldr.toString());
+ DebugTool.logInfo(TAG, secondaryDetailsBldr.toString());
}
@@ -299,7 +298,7 @@ public class SdlProtocolBase {
private void handleSecondaryTransportRegistration(TransportRecord transportRecord, boolean registered){
if(registered) {
//Session has been registered on secondary transport
- Log.d(TAG, transportRecord.getType().toString() + " transport was registered!");
+ DebugTool.logInfo(TAG, transportRecord.getType().toString() + " transport was registered!");
if (supportedSecondaryTransports.contains(transportRecord.getType())) {
// If the transport type that is now available to be used it should be checked
// against the list of services that might be able to be started on it
@@ -325,7 +324,7 @@ public class SdlProtocolBase {
}
}
}else{
- Log.d(TAG, transportRecord.toString() + " transport was NOT registered!");
+ DebugTool.logInfo(TAG, transportRecord.toString() + " transport was NOT registered!");
}
//Notify any listeners for this secondary transport
List<ISecondaryTransportListener> listenerList = secondaryTransportListeners.remove(transportRecord.getType());
@@ -345,7 +344,7 @@ public class SdlProtocolBase {
}
private void onTransportsConnectedUpdate(List<TransportRecord> transports){
- //Log.d(TAG, "Connected transport update");
+ //DebugTool.logInfo(TAG, "Connected transport update");
//Temporary: this logic should all be changed to handle multiple transports of the same type
ArrayList<TransportType> connectedTransports = new ArrayList<>();
@@ -783,7 +782,7 @@ public class SdlProtocolBase {
header.setTransportRecord(connectedPrimaryTransport);
handlePacketToSend(header);
}else{
- Log.d(TAG, "Failed to connect secondary transport, threw away StartService");
+ DebugTool.logInfo(TAG, "Failed to connect secondary transport, threw away StartService");
}
}
};
@@ -799,13 +798,13 @@ public class SdlProtocolBase {
listenerList.add(secondaryListener);
transportManager.requestSecondaryTransportConnection(sessionID, secondaryTransportParams.get(secondaryTransportType));
} else {
- Log.w(TAG, "No params to connect to secondary transport");
+ DebugTool.logWarning(TAG, "No params to connect to secondary transport");
//Unable to register or start a secondary connection. Use the callback in case
//there is a chance to use the primary transport for this service.
secondaryListener.onConnectionFailure();
}
} else {
- Log.e(TAG, "transportManager is null");
+ DebugTool.logError(TAG, "transportManager is null");
}
}
@@ -877,7 +876,7 @@ public class SdlProtocolBase {
builder.append(rejectedParam);
builder.append(" ");
}
- DebugTool.logWarning(builder.toString());
+ DebugTool.logWarning(TAG, builder.toString());
}
}
@@ -999,7 +998,7 @@ public class SdlProtocolBase {
notifyDevTransportListener();
} else {
- DebugTool.logInfo("Received a start service ack for RPC service while already active on a different transport.");
+ DebugTool.logInfo(TAG, "Received a start service ack for RPC service while already active on a different transport.");
iSdlProtocol.onProtocolSessionStarted(serviceType, (byte) packet.getSessionId(), (byte)protocolVersion.getMajor(), "", hashID, packet.isEncrypted());
return;
}
@@ -1098,7 +1097,7 @@ public class SdlProtocolBase {
builder.append(rejectedParam);
builder.append(" ");
}
- DebugTool.logWarning(builder.toString());
+ DebugTool.logWarning(TAG, builder.toString());
}
}
@@ -1145,7 +1144,7 @@ public class SdlProtocolBase {
@Override
public void onTransportConnected(List<TransportRecord> connectedTransports) {
- Log.d(TAG, "onTransportConnected");
+ DebugTool.logInfo(TAG, "onTransportConnected");
//In the future we should move this logic into the Protocol Layer
TransportRecord transportRecord = getTransportForSession(SessionType.RPC);
if(transportRecord == null && !requestedSession){ //There is currently no transport registered
@@ -1163,14 +1162,14 @@ public class SdlProtocolBase {
@Override
public void onTransportDisconnected(String info, TransportRecord disconnectedTransport, List<TransportRecord> connectedTransports) {
if (disconnectedTransport == null) {
- Log.d(TAG, "onTransportDisconnected");
+ DebugTool.logInfo(TAG, "onTransportDisconnected");
if (transportManager != null) {
transportManager.close(iSdlProtocol.getSessionId());
}
iSdlProtocol.shutdown("No transports left connected");
return;
} else {
- Log.d(TAG, "onTransportDisconnected - " + disconnectedTransport.getType().name());
+ DebugTool.logInfo(TAG, "onTransportDisconnected - " + disconnectedTransport.getType().name());
}
//In the future we will actually compare the record but at this point we can assume only
@@ -1193,7 +1192,7 @@ public class SdlProtocolBase {
boolean primaryTransportAvailable = false;
if(requestedPrimaryTransports != null && requestedPrimaryTransports.size() > 1){
for (TransportType transportType: requestedPrimaryTransports){
- DebugTool.logInfo( "Checking " + transportType.name());
+ DebugTool.logInfo(TAG, "Checking " + transportType.name());
if(!disconnectedTransport.getType().equals(transportType)
&& transportManager != null
@@ -1210,7 +1209,7 @@ public class SdlProtocolBase {
&& requestedSecondaryTransports != null
&& supportedSecondaryTransports != null) {
for (TransportType secondaryTransport : requestedSecondaryTransports) {
- DebugTool.logInfo("Checking secondary " + secondaryTransport.name());
+ DebugTool.logInfo(TAG, "Checking secondary " + secondaryTransport.name());
if (supportedSecondaryTransports.contains(secondaryTransport)) {
//Should only be USB or TCP
highBandwidthAvailable = true;
@@ -1258,11 +1257,11 @@ public class SdlProtocolBase {
//Await a connection from the legacy transport
if(requestedPrimaryTransports!= null && requestedPrimaryTransports.contains(TransportType.BLUETOOTH)
&& !SdlProtocolBase.this.requiresHighBandwidth){
- Log.d(TAG, "Entering legacy mode; creating new protocol instance");
+ DebugTool.logInfo(TAG, "Entering legacy mode; creating new protocol instance");
reset();
return true;
}else{
- Log.d(TAG, "Bluetooth is not an acceptable transport; not moving to legacy mode");
+ DebugTool.logInfo(TAG, "Bluetooth is not an acceptable transport; not moving to legacy mode");
return false;
}
}
@@ -1283,7 +1282,7 @@ public class SdlProtocolBase {
try {
accumulator = new ByteArrayOutputStream(totalSize);
}catch(OutOfMemoryError e){
- DebugTool.logError("OutOfMemory error", e); //Garbled bits were received
+ DebugTool.logError(TAG, "OutOfMemory error", e); //Garbled bits were received
accumulator = null;
}
}
@@ -1321,7 +1320,7 @@ public class SdlProtocolBase {
try {
iSdlProtocol.onProtocolMessageReceived(message);
} catch (Exception excp) {
- DebugTool.logError(FailurePropagating_Msg + "onProtocolMessageReceived: " + excp.toString(), excp);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "onProtocolMessageReceived: " + excp.toString(), excp);
} // end-catch
accumulator = null;
@@ -1374,7 +1373,7 @@ public class SdlProtocolBase {
private void handleProtocolHeartbeatACK(SdlPacket packet) {
//Heartbeat is not supported in the SdlProtocol class beyond responding with ACKs to
//heartbeat messages. Receiving this ACK is suspicious and should be logged
- DebugTool.logInfo("Received HeartbeatACK - " + packet.toString());
+ DebugTool.logInfo(TAG, "Received HeartbeatACK - " + packet.toString());
}
private void handleProtocolHeartbeat(SdlPacket packet) {
@@ -1427,7 +1426,7 @@ public class SdlProtocolBase {
} else if (frameInfo == FrameDataControlFrameType.RegisterSecondaryTransportNACK.getValue()) {
String reason = (String) packet.getTag(ControlFrameTags.RPC.RegisterSecondaryTransportNAK.REASON);
- DebugTool.logWarning(reason);
+ DebugTool.logWarning(TAG, reason);
handleSecondaryTransportRegistration(packet.getTransportRecord(),false);
} else if (frameInfo == FrameDataControlFrameType.TransportEventUpdate.getValue()) {
@@ -1492,7 +1491,7 @@ public class SdlProtocolBase {
try {
iSdlProtocol.onProtocolMessageReceived(message);
} catch (Exception ex) {
- DebugTool.logError(FailurePropagating_Msg + "onProtocolMessageReceived: " + ex.toString(), ex);
+ DebugTool.logError(TAG, FailurePropagating_Msg + "onProtocolMessageReceived: " + ex.toString(), ex);
handleProtocolError(FailurePropagating_Msg + "onProtocolMessageReceived: ", ex);
} // end-catch
} // end-method
diff --git a/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java b/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
index 26e9c1e1a..357d26799 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
@@ -74,6 +74,7 @@ import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
public class SystemCapabilityManager {
+ private static final String TAG = "SystemCapabilityManager";
private final HashMap<SystemCapabilityType, Object> cachedSystemCapabilities;
private final HashMap<SystemCapabilityType, Boolean> systemCapabilitiesSubscriptionStatus;
private final HashMap<SystemCapabilityType, CopyOnWriteArrayList<OnSystemCapabilityListener>> onSystemCapabilityListeners;
@@ -180,7 +181,7 @@ public class SystemCapabilityManager {
private void updateCachedDisplayCapabilityList(List<DisplayCapability> newCapabilities) {
if (newCapabilities == null || newCapabilities.size() == 0) {
- DebugTool.logWarning("Received invalid display capability list");
+ DebugTool.logWarning(TAG, "Received invalid display capability list");
return;
}
@@ -563,7 +564,7 @@ public class SystemCapabilityManager {
if (currentHMILevel != null && currentHMILevel.equals(HMILevel.HMI_NONE)) {
String message = String.format("Attempted to update type: %s in HMI level NONE, which is not allowed. " +
"Please wait until you are in HMI BACKGROUND, LIMITED, or FULL before attempting to update any SystemCapabilityType", systemCapabilityType);
- DebugTool.logError(message);
+ DebugTool.logError(TAG, message);
if (scListener != null) {
scListener.onError(message);
}
@@ -571,7 +572,7 @@ public class SystemCapabilityManager {
}
if (!systemCapabilityType.isQueryable() || systemCapabilityType == SystemCapabilityType.DISPLAYS) {
String message = "This systemCapabilityType cannot be queried for";
- DebugTool.logError(message);
+ DebugTool.logError(TAG, message);
if (scListener != null) {
scListener.onError(message);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
index 9464cc296..a3e1da573 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -2,6 +2,7 @@ package com.smartdevicelink.proxy.interfaces;
import android.support.annotation.NonNull;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
@@ -302,4 +303,6 @@ public interface ISdl {
* Start encrypted RPC service
*/
void startRPCEncryption();
+
+ Taskmaster getTaskmaster();
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
index 819ab95fc..c542e98e4 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
@@ -1,38 +1,37 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
-import android.util.Log;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -40,6 +39,7 @@ import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
+import com.smartdevicelink.util.DebugTool;
import org.json.JSONException;
import org.json.JSONObject;
@@ -121,6 +121,7 @@ import java.util.List;
* @since SmartDeviceLink 2.3.2
*/
public class OnSystemRequest extends RPCNotification {
+ private static final String TAG = "OnSystemRequest";
public static final String KEY_URL_V1 = "URL";
public static final String KEY_URL = "url";
public static final String KEY_TIMEOUT_V1 = "Timeout";
@@ -177,10 +178,10 @@ public class OnSystemRequest extends RPCNotification {
tempBody = getBody(httpJson);
tempHeaders = getHeaders(httpJson);
}catch(JSONException e){
- Log.e("OnSystemRequest", "HTTPRequest in bulk data was malformed.");
+ DebugTool.logError(TAG, "HTTPRequest in bulk data was malformed.");
e.printStackTrace();
}catch(NullPointerException e){
- Log.e("OnSystemRequest", "Invalid HTTPRequest object in bulk data.");
+ DebugTool.logError(TAG, "Invalid HTTPRequest object in bulk data.");
e.printStackTrace();
}
}else if(RequestType.HTTP.equals(this.getRequestType())){
@@ -207,7 +208,7 @@ public class OnSystemRequest extends RPCNotification {
try{
result = httpJson.getString("body");
}catch(JSONException e){
- Log.e("OnSystemRequest", "\"body\" key doesn't exist in bulk data.");
+ DebugTool.logError(TAG, "\"body\" key doesn't exist in bulk data.");
e.printStackTrace();
}
@@ -222,7 +223,7 @@ public class OnSystemRequest extends RPCNotification {
Hashtable<String, Object> httpHeadersHash = JsonRPCMarshaller.deserializeJSONObject(httpHeadersJson);
result = new Headers(httpHeadersHash);
}catch(JSONException e){
- Log.e("OnSystemRequest", "\"headers\" key doesn't exist in bulk data.");
+ DebugTool.logError(TAG, "\"headers\" key doesn't exist in bulk data.");
e.printStackTrace();
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java b/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
index 7c2a61090..a031defec 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -118,7 +118,7 @@ public class StreamPacketizer extends AbstractPacketizer implements IVideoStream
mPauseLock.wait();
}
catch (InterruptedException e) {
- DebugTool.logError("Streaming thread has been interrupted", e);
+ DebugTool.logError(TAG, "Streaming thread has been interrupted", e);
}
}
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index e689fb817..d66b75ed4 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -43,6 +43,7 @@ import java.util.List;
@SuppressWarnings("FieldCanBeLocal")
public class VideoStreamingParameters {
+ private static final String TAG = "VideoStreamingParameters";
private final VideoStreamingProtocol DEFAULT_PROTOCOL = VideoStreamingProtocol.RAW;
private final VideoStreamingCodec DEFAULT_CODEC = VideoStreamingCodec.H264;
private final VideoStreamingFormat[] CURRENTLY_SUPPORTED_FORMATS = { new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H264),
@@ -163,7 +164,7 @@ public class VideoStreamingParameters {
}
}
}
- DebugTool.logWarning("The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
+ DebugTool.logWarning(TAG, "The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
//TODO In the future we should set format to null, but might be a breaking change
// For now, format will remain whatever was set prior to this update
@@ -201,7 +202,7 @@ public class VideoStreamingParameters {
}
}
}
- DebugTool.logWarning("The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
+ DebugTool.logWarning(TAG, "The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
//TODO In the future we should set format to null, but might be a breaking change
// For now, format will remain whatever was set prior to this update
diff --git a/base/src/main/java/com/smartdevicelink/trace/SdlTrace.java b/base/src/main/java/com/smartdevicelink/trace/SdlTrace.java
index c02d5b8c8..4e654603b 100644
--- a/base/src/main/java/com/smartdevicelink/trace/SdlTrace.java
+++ b/base/src/main/java/com/smartdevicelink/trace/SdlTrace.java
@@ -419,7 +419,7 @@ public class SdlTrace {
try {
localTraceListener.logXmlMsg(msg, SDL_LIB_TRACE_KEY);
} catch (Exception ex) {
- DebugTool.logError("Failure calling ISTListener: " + ex.toString(), ex);
+ DebugTool.logError(SYSTEM_LOG_TAG,"Failure calling ISTListener: " + ex.toString(), ex);
return false;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/CustomTransport.java b/base/src/main/java/com/smartdevicelink/transport/CustomTransport.java
index 4e604ecf9..ad02f96d2 100644
--- a/base/src/main/java/com/smartdevicelink/transport/CustomTransport.java
+++ b/base/src/main/java/com/smartdevicelink/transport/CustomTransport.java
@@ -138,7 +138,7 @@ public abstract class CustomTransport implements TransportInterface{
try {
onWrite(bytes, 0, bytes.length);
} catch (Exception exc) {
- DebugTool.logError("Error attempting to write packet", exc);
+ DebugTool.logError(TAG, "Error attempting to write packet", exc);
}
}
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java b/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
index c7c749cb2..d9dbb54e9 100644
--- a/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
+++ b/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.transport;
import com.smartdevicelink.util.BitConverter;
@@ -42,6 +42,7 @@ import java.net.ServerSocket;
import java.net.Socket;
public class SiphonServer {
+ private static final String TAG = "SiphonServer";
// Prohibit use of no-arg ctor
private SiphonServer() {}
@@ -379,7 +380,7 @@ public class SiphonServer {
m_siphonSocketOutputStream = m_siphonSocket.getOutputStream();
// Output version number to the Siphon upon connection (version number prepending to logInfo)
- DebugTool.logInfo("Siphon connected.");
+ DebugTool.logInfo(TAG, "Siphon connected.");
} // end-lock
} // end-method
diff --git a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
index cd34d626a..9b2eba9ed 100644
--- a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
+++ b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
@@ -43,6 +43,7 @@ public class TransportConstants {
public static final String START_ROUTER_SERVICE_ACTION ="sdl.router.startservice";
public static final String ROUTER_SERVICE_ACTION = "com.smartdevicelink.router.service";
public static final String FOREGROUND_EXTRA = "foreground";
+ public static final String CONFIRMED_SDL_DEVICE = "confirmed_sdl_device";
public static final String BIND_LOCATION_PACKAGE_NAME_EXTRA = "BIND_LOCATION_PACKAGE_NAME_EXTRA";
public static final String BIND_LOCATION_CLASS_NAME_EXTRA = "BIND_LOCATION_CLASS_NAME_EXTRA";
diff --git a/base/src/main/java/com/smartdevicelink/transport/TransportManager.java b/base/src/main/java/com/smartdevicelink/transport/TransportManager.java
index 377266e4b..c8a07a1cc 100644
--- a/base/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/base/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -33,11 +33,10 @@
package com.smartdevicelink.transport;
-import android.util.Log;
-
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import java.util.Collections;
import java.util.List;
@@ -181,7 +180,7 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onError() {
- Log.e(TAG, "Error in the transport manager from the web socket server");
+ DebugTool.logError(TAG, "Error in the transport manager from the web socket server");
if(transportListener != null){
transportListener.onError("");
}
@@ -190,9 +189,9 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onConnectionTerminated(String reason) {
if(record != null){
- Log.d(TAG, "Transport disconnected - " + record);
+ DebugTool.logInfo(TAG, "Transport disconnected - " + record);
}else{
- Log.d(TAG, "Transport disconnected");
+ DebugTool.logInfo(TAG, "Transport disconnected");
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/WebSocketServer.java b/base/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
index 884afaa9c..8f5411ce0 100644
--- a/base/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
+++ b/base/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.transport;
-import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.SSLWebSocketFactoryGenerator;
@@ -67,7 +66,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
if(factory!=null){
this.setWebSocketFactory(factory);
}else{
- DebugTool.logError("WebSocketServer: Unable to generate SSL Web Socket Server Factory");
+ DebugTool.logError(TAG, "WebSocketServer: Unable to generate SSL Web Socket Server Factory");
}
}
@@ -88,7 +87,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void write(SdlPacket packet){
- //Log.i(TAG, "Atttempt to write packet " + packet);
+ //DebugTool.logInfo(TAG, "Atttempt to write packet " + packet);
if(packet != null
&& this.webSocket != null
&& this.webSocket.isOpen()) {
@@ -104,7 +103,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onOpen(WebSocket webSocket, ClientHandshake clientHandshake) {
- Log.i(TAG, "onOpen");
+ DebugTool.logInfo(TAG, "onOpen");
this.webSocket = webSocket;
if(callback!=null){
@@ -114,11 +113,11 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onClose(WebSocket webSocket, int i, String s, boolean b) {
- Log.i(TAG, "onClose");
+ DebugTool.logInfo(TAG, "onClose");
try{
- DebugTool.logInfo("Closing id - " + i);
- DebugTool.logInfo("Closing string - " + s);
- DebugTool.logInfo("Closing from remote? " + b);
+ DebugTool.logInfo(TAG, "Closing id - " + i);
+ DebugTool.logInfo(TAG, "Closing string - " + s);
+ DebugTool.logInfo(TAG, "Closing from remote? " + b);
}catch (Exception e){
e.printStackTrace();
}
@@ -133,19 +132,19 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
public void onWebsocketCloseInitiated(WebSocket conn, int code, String reason) {
super.onWebsocketCloseInitiated(conn, code, reason);
try{
- DebugTool.logInfo("Code - " + code + " Reason - " + reason);
+ DebugTool.logInfo(TAG, "Code - " + code + " Reason - " + reason);
}catch (Exception e){}
}
@Override
public void onMessage(WebSocket webSocket, String s) {
- DebugTool.logError("Incorrect message type received, dropping. - String: " + s);
+ DebugTool.logError(TAG, "Incorrect message type received, dropping. - String: " + s);
}
@Override
public void onMessage(WebSocket conn, ByteBuffer message) {
super.onMessage(conn, message);
- //Log.i(TAG, "on Message - ByteBuffer");
+ //DebugTool.logInfo(TAG, "on Message - ByteBuffer");
byte input;
if(message != null){
@@ -156,7 +155,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
stateProgress = psm.handleByte(input);
if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
- //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ //DebugTool.logWarning("Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
psm.reset();
}
@@ -164,7 +163,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
synchronized (WebSocketServer.this) {
SdlPacket packet = psm.getFormedPacket();
if (callback != null && packet != null) {
- /// Log.i(TAG, "Read a packet: " + packet);
+ /// DebugTool.logInfo(TAG, "Read a packet: " + packet);
packet.setTransportRecord(transportRecord);
callback.onPacketReceived(packet);
}
@@ -183,7 +182,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onError(WebSocket webSocket, Exception e) {
- Log.e(TAG, "bad", e);
+ DebugTool.logError(TAG, "bad", e);
if(callback!=null) {
callback.onError();
}
@@ -191,7 +190,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onStart() {
- Log.i(TAG, "onStart");
+ DebugTool.logInfo(TAG, "onStart");
psm = new SdlPsm();
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java b/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
index bcfc2e373..b0099581e 100644
--- a/base/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
+++ b/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
@@ -32,17 +32,16 @@
package com.smartdevicelink.transport.utl;
-import android.os.Parcel;
-import android.os.Parcelable;
-
import com.smartdevicelink.transport.enums.TransportType;
-public class TransportRecord implements Parcelable{
+class BaseTransportRecord{
+
+ protected TransportType type;
+ protected String address;
- private TransportType type;
- private String address;
+ BaseTransportRecord(){}
- public TransportRecord(TransportType transportType, String address){
+ BaseTransportRecord(TransportType transportType, String address){
this.type = transportType;
this.address = address;
}
@@ -61,8 +60,8 @@ public class TransportRecord implements Parcelable{
return false;
}
- if (obj instanceof TransportRecord) {
- TransportRecord record = (TransportRecord) obj;
+ if (obj instanceof BaseTransportRecord) {
+ BaseTransportRecord record = (BaseTransportRecord) obj;
return record.type != null && record.type.equals(type) //Transport type is the same
&& ((record.address == null && address == null) //Both addresses are null
|| (record.address != null && record.address.equals(address))); //Or they match
@@ -80,47 +79,4 @@ public class TransportRecord implements Parcelable{
builder.append(address);
return builder.toString();
}
-
- public TransportRecord(Parcel p){
- if (p.readInt() == 1) { //We should have a transport type attached
- String transportName = p.readString();
- if(transportName != null){
- this.type = TransportType.valueOf(transportName);
- }
- }
-
- if (p.readInt() == 1) { //We should have a transport address attached
- address = p.readString();
- }
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(type!=null? 1 : 0);
- if(type != null){
- dest.writeString(type.name());
- }
-
- dest.writeInt(address !=null? 1 : 0);
- if(address != null){
- dest.writeString(address);
- }
- }
-
- public static final Parcelable.Creator<TransportRecord> CREATOR = new Parcelable.Creator<TransportRecord>() {
- public TransportRecord createFromParcel(Parcel in) {
- return new TransportRecord(in);
- }
-
- @Override
- public TransportRecord[] newArray(int size) {
- return new TransportRecord[size];
- }
-
- };
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java b/base/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
index a0bc592f6..95d0ceac2 100644
--- a/base/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
+++ b/base/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
@@ -55,7 +55,7 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
public class SSLWebSocketFactoryGenerator {
-
+ private static final String TAG = "SSLWebSocketFactoryGenerator";
private static final String JAVA_KEY_STORE = "JKS";
private static final String TLS = "TLS";
private static final String SUNX509 = "SunX509";
@@ -70,13 +70,13 @@ public class SSLWebSocketFactoryGenerator {
context = getSSLContextFromPem(config);
break;
default:
- DebugTool.logError("Unable to generateWebSocketServer. Unsupported cert type.");
+ DebugTool.logError(TAG, "Unable to generateWebSocketServer. Unsupported cert type.");
return null;
}
if(context != null) {
return new DefaultSSLWebSocketServerFactory(context);
}else{
- DebugTool.logError("SSLWebSocketFactoryGenerator: Unable to create SSL Context");
+ DebugTool.logError(TAG, "SSLWebSocketFactoryGenerator: Unable to create SSL Context");
return null;
}
}
@@ -101,7 +101,7 @@ public class SSLWebSocketFactoryGenerator {
return sslContext;
}
catch(Exception e){
- DebugTool.logError("Issue creating SSLContext with JKS : " , e);
+ DebugTool.logError(TAG, "Issue creating SSLContext with JKS : " , e);
}
return null;
}
@@ -133,7 +133,7 @@ public class SSLWebSocketFactoryGenerator {
context.init( km, null, null );
} catch ( Exception e ) {
context = null;
- DebugTool.logError("Issue creating SSLContext with PEM Cert : " , e);
+ DebugTool.logError(TAG, "Issue creating SSLContext with PEM Cert : " , e);
}
return context;
}
diff --git a/base/src/main/java/com/smartdevicelink/util/DebugTool.java b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
index dbf9185a8..d073fc654 100644
--- a/base/src/main/java/com/smartdevicelink/util/DebugTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
@@ -31,8 +31,6 @@
*/
package com.smartdevicelink.util;
-import android.util.Log;
-
import com.smartdevicelink.BuildConfig;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
@@ -52,7 +50,7 @@ import java.util.Vector;
public class DebugTool {
- public static final String TAG = "SdlProxy";
+ public static final String TAG = "SDL";
private static boolean isErrorEnabled = false;
private static boolean isWarningEnabled = false;
@@ -86,71 +84,100 @@ public class DebugTool {
return string;
}
- public static void logError(String msg) {
-
+ public static void logError(String tag, String msg) {
Boolean wasWritten = false;
-
+
msg = prependProxyVersionNumberToString(msg);
-
+
wasWritten = logToSiphon(msg);
-
+
if (isErrorEnabled && !wasWritten) {
- NativeLogTool.logError(TAG, msg);
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logError(tag, msg);
}
}
- public static void logError(String msg, Throwable ex) {
+ @Deprecated
+ public static void logError(String msg) {
+ logError(TAG, msg);
+ }
+
+ public static void logError(String tag, String msg, Throwable ex) {
Boolean wasWritten = false;
-
+
msg = prependProxyVersionNumberToString(msg);
-
+
if (ex != null) {
wasWritten = logToSiphon(msg + " Exception String: " + ex.toString());
} else {
wasWritten = logToSiphon(msg);
}
-
+
if (isErrorEnabled && !wasWritten) {
- NativeLogTool.logError(TAG, msg, ex);
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logError(tag, msg, ex);
}
}
-
- public static void logWarning(String msg) {
+
+ @Deprecated
+ public static void logError(String msg, Throwable ex) {
+ logError(TAG, msg, ex);
+ }
+
+ public static void logWarning(String tag, String msg) {
Boolean wasWritten = false;
-
+
msg = prependProxyVersionNumberToString(msg);
-
+
wasWritten = logToSiphon(msg);
-
+
if (isWarningEnabled && !wasWritten) {
- NativeLogTool.logWarning(TAG, msg);
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logWarning(tag, msg);
}
}
- public static void logInfo(String msg) {
+ @Deprecated
+ public static void logWarning(String msg) {
+ logWarning(TAG, msg);
+ }
+
+ public static void logInfo(String tag, String msg) {
Boolean wasWritten = false;
-
+
msg = prependProxyVersionNumberToString(msg);
-
+
wasWritten = logToSiphon(msg);
-
+
if (isInfoEnabled && !wasWritten) {
- NativeLogTool.logInfo(TAG, msg);
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logInfo(tag, msg);
}
}
- public static void logInfo(String msg, boolean bPrependVersion) {
+ @Deprecated
+ public static void logInfo(String msg) {
+ logInfo(TAG, msg);
+ }
+
+ public static void logInfo(String tag, String msg, Boolean bPrependVersion) {
Boolean wasWritten = false;
-
+
if (bPrependVersion) msg = prependProxyVersionNumberToString(msg);
-
+
wasWritten = logToSiphon(msg);
-
+
if (isInfoEnabled && !wasWritten) {
- NativeLogTool.logInfo(TAG, msg);
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logInfo(tag, msg);
}
}
-
+
+ @Deprecated
+ public static void logInfo(String msg, boolean bPrependVersion) {
+ logInfo(TAG, msg, bPrependVersion);
+ }
+
protected static Boolean logToSiphon(String msg) {
if (SiphonServer.getSiphonEnabledStatus()) {
// Initialize the SiphonServer, will be ignored if already initialized
@@ -207,21 +234,21 @@ public class DebugTool {
public static void logTransport(String msg) {
if (isTransportEnabled) {
- Log.d(TAG, msg);
+ Log.i(TAG, msg);
logInfoToConsole(msg);
}
}
public static void logRPCSend(String rpcMsg) {
if (isRPCEnabled) {
- Log.d(TAG, "Sending RPC message: " + rpcMsg);
+ Log.i(TAG, "Sending RPC message: " + rpcMsg);
logRPCSendToConsole(rpcMsg);
}
}
public static void logRPCReceive(String rpcMsg) {
if (isRPCEnabled) {
- Log.d(TAG, "Received RPC message: " + rpcMsg);
+ Log.i(TAG, "Received RPC message: " + rpcMsg);
logRPCSendToConsole(rpcMsg);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/util/FileUtls.java b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
index 5f317340b..6c5e955eb 100644
--- a/base/src/main/java/com/smartdevicelink/util/FileUtls.java
+++ b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
@@ -42,7 +42,7 @@ import java.net.URLConnection;
import java.nio.file.Files;
public class FileUtls {
-
+ private static final String TAG = "FileUtls";
/**
* When using on Android, this method should only be used for Android Oreo and newer
@@ -94,7 +94,7 @@ public class FileUtls {
}
return buffer.toByteArray();
}catch (Exception e){
- DebugTool.logError("Unable to download file - " + urlStr, e);
+ DebugTool.logError(TAG, "Unable to download file - " + urlStr, e);
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
index f125fb5ac..61d3932c8 100644
--- a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
@@ -31,8 +31,6 @@
*/
package com.smartdevicelink.util;
-import android.util.Log;
-
public class NativeLogTool {
private static String TAG = "NativeLogTool";
static private boolean logToSystemEnabled = true;
@@ -61,7 +59,7 @@ public class NativeLogTool {
} // end-method
public static boolean logInfo(String message) {
- return logInfo(TAG, message);
+ return logInfo(TAG, message);
}
public static boolean logInfo(String tag, String message) {
@@ -72,7 +70,7 @@ public class NativeLogTool {
}
public static boolean logWarning(String message) {
- return logWarning(TAG, message);
+ return logWarning(TAG, message);
}
public static boolean logWarning(String tag, String message) {
@@ -83,7 +81,7 @@ public class NativeLogTool {
}
public static boolean logError(String message) {
- return logError(TAG, message);
+ return logError(TAG, message);
}
public static boolean logError(String tag, String message) {
@@ -94,7 +92,7 @@ public class NativeLogTool {
}
public static boolean logError(String message, Throwable t) {
- return logError(TAG, message, t);
+ return logError(TAG, message, t);
}
public static boolean logError(String tag, String message, Throwable t) {
@@ -126,15 +124,15 @@ public class NativeLogTool {
bytesWritten = Log.w(source, chunk);
break;
case Error:
- bytesWritten = Log.e(source, chunk);
+ bytesWritten = Log.e(source, chunk, null);
break;
}
if (bytesWritten < chunk.length()) {
- Log.e(TAG, "Calling Log.e: msg length=" + chunk.length() + ", bytesWritten=" + bytesWritten);
+ Log.w(TAG, "Calling Log.e: msg length=" + chunk.length() + ", bytesWritten=" + bytesWritten);
}
}
} catch (Exception ex) {
- Log.e(TAG, "Failure writing " + ltarg.name() + " fragments to android log:" + ex.toString());
+ Log.e(TAG, "Failure writing " + ltarg.name() + " fragments to android log:" + ex.toString(), null);
return false;
}
return true;
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle
new file mode 120000
index 000000000..d72cada51
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle
@@ -0,0 +1 @@
+../../../../../../../base/src/main/java/com/smartdevicelink/managers/lifecycle/ \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
deleted file mode 120000
index 62dacca1e..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../../base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
deleted file mode 120000
index 88f7feccc..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../../base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java b/baseAndroid/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
new file mode 120000
index 000000000..2fec10c84
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
@@ -0,0 +1 @@
+../../../../../../../base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/baseAndroid/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
deleted file mode 120000
index 8408c2728..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java b/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
new file mode 120000
index 000000000..067c6a17a
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
@@ -0,0 +1 @@
+../../../../../../../../base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java b/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
deleted file mode 120000
index 6fec751ec..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../../base/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/util/HttpRequestTask.java b/baseAndroid/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
deleted file mode 120000
index 1733992ae..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java \ No newline at end of file
diff --git a/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java b/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java
index 446c267ee..daa94f21a 100644
--- a/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java
+++ b/hello_sdl_java/src/main/java/com/smartdevicelink/java/Main.java
@@ -36,7 +36,7 @@ import com.smartdevicelink.transport.WebSocketServerConfig;
import com.smartdevicelink.util.DebugTool;
public class Main {
-
+ private static final String TAG = "Main";
static Thread thread = null, mainThread;
static Object LOCK;
@@ -54,9 +54,9 @@ public class Main {
}
System.gc();
Thread.sleep(500);
- DebugTool.logInfo( "Attempting to start SDL Service again");
+ DebugTool.logInfo(TAG, "Attempting to start SDL Service again");
startSdlService();
- DebugTool.logInfo("SdlService started");
+ DebugTool.logInfo(TAG, "SdlService started");
} catch (InterruptedException e) {
e.printStackTrace();
@@ -68,8 +68,10 @@ public class Main {
static SdlService.SdlServiceCallback serviceCallback = new SdlService.SdlServiceCallback() {
@Override
public void onEnd() {
- thread.interrupt();
- thread = null;
+ if (thread != null) {
+ thread.interrupt();
+ thread = null;
+ }
synchronized (LOCK) {
LOCK.notify();
}
@@ -83,7 +85,7 @@ public class Main {
@Override
public void run() {
- DebugTool.logInfo("Starting SDL Service");
+ DebugTool.logInfo(TAG, "Starting SDL Service");
sdlService = new SdlService(new WebSocketServerConfig(5432, -1), serviceCallback);
sdlService.start();
diff --git a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
index 2bc02fa2f..0c1b87c6a 100644
--- a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
+++ b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
@@ -32,8 +32,8 @@
package com.smartdevicelink.java;
-import android.util.Log;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.screen.OnButtonListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
@@ -76,22 +76,19 @@ public class SdlService {
private static final String IMAGE_DIR = "assets/images/";
-
-
// variable to create and call functions of the SyncProxy
private SdlManager sdlManager = null;
private List<ChoiceCell> choiceCellList;
private SdlServiceCallback callback;
-
public SdlService(BaseTransportConfig config, SdlServiceCallback callback){
this.callback = callback;
buildSdlManager(config);
}
public void start() {
- DebugTool.logInfo("SdlService start() ");
+ DebugTool.logInfo(TAG, "SdlService start() ");
if(sdlManager != null){
sdlManager.start();
}
@@ -109,7 +106,7 @@ public class SdlService {
// Build flavors are selected by the "build variants" tab typically located in the bottom left of Android Studio
// Typically in your app, you will only set one of these.
if (sdlManager == null) {
- DebugTool.logInfo("Creating SDL Manager");
+ DebugTool.logInfo(TAG, "Creating SDL Manager");
//FIXME add the transport type
// The app type to be used
@@ -121,15 +118,16 @@ public class SdlService {
SdlManagerListener listener = new SdlManagerListener() {
@Override
public void onStart(SdlManager sdlManager) {
- DebugTool.logInfo("SdlManager onStart");
+ DebugTool.logInfo(TAG, "SdlManager onStart");
}
@Override
public void onDestroy(SdlManager sdlManager) {
- DebugTool.logInfo("SdlManager onDestroy ");
+ DebugTool.logInfo(TAG, "SdlManager onDestroy ");
SdlService.this.sdlManager = null;
if(SdlService.this.callback != null){
SdlService.this.callback.onEnd();
+ stop();
}
}
@@ -138,20 +136,44 @@ public class SdlService {
}
@Override
- public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
- String appName;
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language) {
+ return null;
+ }
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
+ boolean isNeedUpdate = false;
+ String appName = APP_NAME;
+ String ttsName = APP_NAME;
switch (language) {
case ES_MX:
+ isNeedUpdate = true;
+ ttsName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ isNeedUpdate = true;
+ ttsName = APP_NAME_FR;
+ break;
+ default:
+ break;
+ }
+ switch (hmiLanguage) {
+ case ES_MX:
+ isNeedUpdate = true;
appName = APP_NAME_ES;
break;
case FR_CA:
+ isNeedUpdate = true;
appName = APP_NAME_FR;
break;
default:
- return null;
+ break;
+ }
+ if (isNeedUpdate) {
+ return new LifecycleConfigurationUpdate(appName, null, TTSChunkFactory.createSimpleTTSChunks(ttsName), null);
+ } else {
+ return null;
}
-
- return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
}
};
@@ -167,6 +189,7 @@ public class SdlService {
performWelcomeSpeak();
performWelcomeShow();
preloadChoices();
+ subscribeToButtons();
}
}
});
@@ -195,14 +218,14 @@ public class SdlService {
VoiceCommand voiceCommand1 = new VoiceCommand(list1, new VoiceCommandSelectionListener() {
@Override
public void onVoiceCommandSelected() {
- Log.i(TAG, "Voice Command 1 triggered");
+ DebugTool.logInfo(TAG, "Voice Command 1 triggered");
}
});
VoiceCommand voiceCommand2 = new VoiceCommand(list2, new VoiceCommandSelectionListener() {
@Override
public void onVoiceCommandSelected() {
- Log.i(TAG, "Voice Command 2 triggered");
+ DebugTool.logInfo(TAG, "Voice Command 2 triggered");
}
});
@@ -223,7 +246,7 @@ public class SdlService {
MenuCell mainCell1 = new MenuCell("Test Cell 1 (speak)", livio, null, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
- Log.i(TAG, "Test cell 1 triggered. Source: "+ trigger.toString());
+ DebugTool.logInfo(TAG, "Test cell 1 triggered. Source: "+ trigger.toString());
showTest();
}
});
@@ -231,7 +254,7 @@ public class SdlService {
MenuCell mainCell2 = new MenuCell("Test Cell 2", null, voice2, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
- Log.i(TAG, "Test cell 2 triggered. Source: "+ trigger.toString());
+ DebugTool.logInfo(TAG, "Test cell 2 triggered. Source: "+ trigger.toString());
}
});
@@ -240,14 +263,14 @@ public class SdlService {
MenuCell subCell1 = new MenuCell("SubCell 1",null, null, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
- Log.i(TAG, "Sub cell 1 triggered. Source: "+ trigger.toString());
+ DebugTool.logInfo(TAG, "Sub cell 1 triggered. Source: "+ trigger.toString());
}
});
MenuCell subCell2 = new MenuCell("SubCell 2",null, null, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
- Log.i(TAG, "Sub cell 2 triggered. Source: "+ trigger.toString());
+ DebugTool.logInfo(TAG, "Sub cell 2 triggered. Source: "+ trigger.toString());
}
});
@@ -264,7 +287,7 @@ public class SdlService {
MenuCell mainCell5 = new MenuCell("Clear the menu",null, null, new MenuSelectionListener() {
@Override
public void onTriggered(TriggerSource trigger) {
- Log.i(TAG, "Clearing Menu. Source: "+ trigger.toString());
+ DebugTool.logInfo(TAG, "Clearing Menu. Source: "+ trigger.toString());
// Clear this thing
sdlManager.getScreenManager().setMenu(Collections.<MenuCell>emptyList());
showAlert("Menu Cleared");
@@ -296,13 +319,44 @@ public class SdlService {
@Override
public void onComplete(boolean success) {
if (success){
- Log.i(TAG, "welcome show successful");
+ DebugTool.logInfo(TAG, "welcome show successful");
}
}
});
}
/**
+ * Attempts to Subscribe to all preset buttons
+ */
+ private void subscribeToButtons() {
+ ButtonName[] buttonNames = {ButtonName.PLAY_PAUSE, ButtonName.SEEKLEFT, ButtonName.SEEKRIGHT, ButtonName.AC_MAX, ButtonName.AC, ButtonName.RECIRCULATE,
+ ButtonName.FAN_UP, ButtonName.FAN_DOWN, ButtonName.TEMP_UP, ButtonName.TEMP_DOWN, ButtonName.FAN_DOWN, ButtonName.DEFROST_MAX, ButtonName.DEFROST_REAR, ButtonName.DEFROST,
+ ButtonName.UPPER_VENT, ButtonName.LOWER_VENT, ButtonName.VOLUME_UP, ButtonName.VOLUME_DOWN, ButtonName.EJECT, ButtonName.SOURCE, ButtonName.SHUFFLE, ButtonName.REPEAT};
+
+ OnButtonListener onButtonListener = new OnButtonListener() {
+ @Override
+ public void onPress(ButtonName buttonName, OnButtonPress buttonPress) {
+ sdlManager.getScreenManager().setTextField1(buttonName + " pressed");
+ DebugTool.logInfo(TAG, "onPress: " + buttonName);
+ }
+
+ @Override
+ public void onEvent(ButtonName buttonName, OnButtonEvent buttonEvent) {
+ sdlManager.getScreenManager().setTextField2(buttonName + " " + buttonEvent.getButtonEventMode());
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logInfo(TAG, "onError: " + info);
+ }
+ };
+
+ for (ButtonName buttonName : buttonNames) {
+ sdlManager.getScreenManager().addButtonListener(buttonName, onButtonListener);
+ }
+ }
+
+ /**
* Will show a sample test message on screen as well as speak a sample test message
*/
private void showTest(){
@@ -345,7 +399,7 @@ public class SdlService {
@Override
public void onError(String error) {
- Log.e(TAG, "There was an error showing the perform interaction: "+ error);
+ DebugTool.logError(TAG, "There was an error showing the perform interaction: "+ error);
}
});
sdlManager.getScreenManager().presentChoiceSet(choiceSet, InteractionMode.MANUAL_ONLY);
diff --git a/javaEE/build.gradle b/javaEE/build.gradle
index 08a6bcf1e..39b6f0956 100644
--- a/javaEE/build.gradle
+++ b/javaEE/build.gradle
@@ -30,6 +30,7 @@ dependencies {
extraLibs 'org.mongodb:bson:3.10.1'
extraLibs 'com.android.support:support-annotations:28.0.0'
extraLibs 'org.java-websocket:Java-WebSocket:1.3.9'
+ extraLibs 'com.livio.taskmaster:taskmaster:0.3.0'
configurations.api.extendsFrom(configurations.extraLibs)
}
diff --git a/javaSE/build.gradle b/javaSE/build.gradle
index c6a393e8a..1f4dcc048 100644
--- a/javaSE/build.gradle
+++ b/javaSE/build.gradle
@@ -31,6 +31,7 @@ dependencies {
extraLibs 'org.mongodb:bson:3.10.1'
extraLibs 'com.android.support:support-annotations:28.0.0'
extraLibs 'org.java-websocket:Java-WebSocket:1.3.9'
+ extraLibs 'com.livio.taskmaster:taskmaster:0.3.0'
configurations.api.extendsFrom(configurations.extraLibs)
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
index 690c2fe71..37c8ae14e 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -33,798 +33,151 @@
package com.smartdevicelink.managers;
import android.support.annotation.NonNull;
-import android.util.Log;
+import com.smartdevicelink.util.Log;
import com.smartdevicelink.managers.file.FileManager;
-import com.smartdevicelink.managers.file.FileManagerConfig;
-import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
-import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
-import com.smartdevicelink.managers.lifecycle.LifecycleManager;
import com.smartdevicelink.managers.permission.PermissionManager;
import com.smartdevicelink.managers.screen.ScreenManager;
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.RPCMessage;
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SystemCapabilityManager;
-import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.rpc.ChangeRegistration;
-import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
-import com.smartdevicelink.proxy.rpc.SetAppIcon;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
-import com.smartdevicelink.util.Version;
-
-import org.json.JSONException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
/**
* <strong>SDLManager</strong> <br>
- *
+ * <p>
* This is the main point of contact between an application and SDL <br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. SDLManagerBuilder <br>
* 2. ISdl Interface along with its overridden methods - This can be passed into attached managers <br>
* 3. Sending Requests <br>
* 4. Helper methods
*/
-public class SdlManager extends BaseSdlManager{
-
- private static final String TAG = "SdlManager";
-
- private SdlArtwork appIcon;
- private SdlManagerListener managerListener;
- private List<Class<? extends SdlSecurityBase>> sdlSecList;
- private ServiceEncryptionListener serviceEncryptionListener;
- private FileManagerConfig fileManagerConfig;
-
- // Managers
- private LifecycleManager lifecycleManager;
- private PermissionManager permissionManager;
- private FileManager fileManager;
- private ScreenManager screenManager;
-
-
- // INTERNAL INTERFACE
- /**
- * This is from the LifeCycleManager directly. In the future if there is a reason to be a man in the middle
- * the SdlManager could create it's own, however right now it was only a duplication of logic tied to the LCM.
- */
- private ISdl _internalInterface;
-
-
- // Initialize proxyBridge with anonymous lifecycleListener
- private final LifecycleManager.LifecycleListener lifecycleListener = new LifecycleManager.LifecycleListener() {
- boolean initStarted = false;
- @Override
- public void onProxyConnected(LifecycleManager lifeCycleManager) {
- Log.i(TAG,"Proxy is connected. Now initializing.");
- synchronized (this){
- if(!initStarted){
- changeRegistrationRetry = 0;
- checkLifecycleConfiguration();
- initialize();
- initStarted = true;
- }
- }
- }
- @Override
- public void onServiceStarted(SessionType sessionType){
-
- }
-
- @Override
- public void onServiceEnded(SessionType sessionType){
-
- }
-
- @Override
- public void onProxyClosed(LifecycleManager lifeCycleManager, String info, Exception e, SdlDisconnectedReason reason) {
- Log.i(TAG,"Proxy is closed.");
- if(managerListener != null){
- managerListener.onDestroy(SdlManager.this);
- }
-
- }
-
-
- @Override
- public void onError(LifecycleManager lifeCycleManager, String info, Exception e) {
-
- }
- };
-
- // Sub manager listener
- private final CompletionListener subManagerListener = new CompletionListener() {
- @Override
- public synchronized void onComplete(boolean success) {
- if(!success){
- Log.e(TAG, "Sub manager failed to initialize");
- }
- checkState();
- }
- };
-
- @Override
- void checkState() {
- if (permissionManager != null && fileManager != null && screenManager != null ){
- if (permissionManager.getState() == BaseSubManager.READY && fileManager.getState() == BaseSubManager.READY && screenManager.getState() == BaseSubManager.READY){
- DebugTool.logInfo("Starting sdl manager, all sub managers are in ready state");
- transitionToState(BaseSubManager.READY);
- handleQueuedNotifications();
- notifyDevListener(null);
- onReady();
- } else if (permissionManager.getState() == BaseSubManager.ERROR && fileManager.getState() == BaseSubManager.ERROR && screenManager.getState() == BaseSubManager.ERROR){
- String info = "ERROR starting sdl manager, all sub managers are in error state";
- Log.e(TAG, info);
- transitionToState(BaseSubManager.ERROR);
- notifyDevListener(info);
- } else if (permissionManager.getState() == BaseSubManager.SETTING_UP || fileManager.getState() == BaseSubManager.SETTING_UP || screenManager.getState() == BaseSubManager.SETTING_UP) {
- DebugTool.logInfo("SETTING UP sdl manager, some sub managers are still setting up");
- transitionToState(BaseSubManager.SETTING_UP);
- // No need to notify developer here!
- } else {
- Log.w(TAG, "LIMITED starting sdl manager, some sub managers are in error or limited state and the others finished setting up");
- transitionToState(BaseSubManager.LIMITED);
- handleQueuedNotifications();
- notifyDevListener(null);
- onReady();
- }
- } else {
- // We should never be here, but somehow one of the sub-sub managers is null
- String info = "ERROR one of the sdl sub managers is null";
- Log.e(TAG, info);
- transitionToState(BaseSubManager.ERROR);
- notifyDevListener(info);
- }
- }
-
- private void notifyDevListener(String info) {
- if (managerListener != null) {
- if (getState() == BaseSubManager.ERROR){
- managerListener.onError(this, info, null);
- } else {
- managerListener.onStart(this);
- }
- }
- }
-
- private void onReady(){
- // Set the app icon
- if (SdlManager.this.appIcon != null && SdlManager.this.appIcon.getName() != null) {
- if (fileManager != null && fileManager.getState() == BaseSubManager.READY && !fileManager.hasUploadedFile(SdlManager.this.appIcon)) {
- fileManager.uploadArtwork(SdlManager.this.appIcon, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (success) {
- SetAppIcon msg = new SetAppIcon(SdlManager.this.appIcon.getName());
- _internalInterface.sendRPCRequest(msg);
- }
- }
- });
- } else {
- SetAppIcon msg = new SetAppIcon(SdlManager.this.appIcon.getName());
- _internalInterface.sendRPCRequest(msg);
- }
- }
- }
-
- @Override
- protected void checkLifecycleConfiguration() {
- final Language actualLanguage = lifecycleManager.getRegisterAppInterfaceResponse().getLanguage();
-
- if (actualLanguage != null && !actualLanguage.equals(hmiLanguage)) {
-
- final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
-
- if (lcu != null) {
- ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
- changeRegistration.setAppName(lcu.getAppName());
- changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
- changeRegistration.setTtsName(lcu.getTtsName());
- changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
- changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- // go through and change sdlManager properties that were changed via the LCU update
- hmiLanguage = actualLanguage;
-
- if (lcu.getAppName() != null) {
- appName = lcu.getAppName();
- }
-
- if (lcu.getShortAppName() != null) {
- shortAppName = lcu.getShortAppName();
- }
-
- if (lcu.getTtsName() != null) {
- ttsChunks = lcu.getTtsName();
- }
-
- if (lcu.getVoiceRecognitionCommandNames() != null) {
- vrSynonyms = lcu.getVoiceRecognitionCommandNames();
- }
- }
- try {
- Log.v(TAG, response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- Log.e(TAG, "Change Registration onError: " + resultCode + " | Info: " + info);
- }
- });
- _internalInterface.sendRPC(changeRegistration);
- }
- }
- }
-
- @Override
- protected void initialize(){
- // Instantiate sub managers
- this.permissionManager = new PermissionManager(_internalInterface);
- this.fileManager = new FileManager(_internalInterface, fileManagerConfig);
- this.screenManager = new ScreenManager(_internalInterface, this.fileManager);
-
- // Start sub managers
- this.permissionManager.start(subManagerListener);
- this.fileManager.start(subManagerListener);
- this.screenManager.start(subManagerListener);
- }
-
- @Override
- public void dispose() {
- if (this.permissionManager != null) {
- this.permissionManager.dispose();
- }
-
- if (this.fileManager != null) {
- this.fileManager.dispose();
- }
-
- if (this.screenManager != null) {
- this.screenManager.dispose();
- }
-
- if (this.lifecycleManager != null) {
- this.lifecycleManager.stop();
- }
-
- if(managerListener != null){
- managerListener.onDestroy(this);
- managerListener = null;
- }
-
- transitionToState(BaseSubManager.SHUTDOWN);
- }
-
-
- // MANAGER GETTERS
- /**
- * Gets the PermissionManager. <br>
- * <strong>Note: PermissionManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a PermissionManager object
- */
- public PermissionManager getPermissionManager() {
- if (permissionManager.getState() != BaseSubManager.READY && permissionManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG,"PermissionManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return permissionManager;
- }
-
- /**
- * Gets the FileManager. <br>
- * <strong>Note: FileManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a FileManager object
- */
- public FileManager getFileManager() {
- if (fileManager.getState() != BaseSubManager.READY && fileManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "FileManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return fileManager;
- }
-
- /**
- * Gets the ScreenManager. <br>
- * <strong>Note: ScreenManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a ScreenManager object
- */
- public ScreenManager getScreenManager() {
- if (screenManager.getState() != BaseSubManager.READY && screenManager.getState() != BaseSubManager.LIMITED){
- Log.e(TAG, "ScreenManager should not be accessed because it is not in READY/LIMITED state");
- }
- checkSdlManagerState();
- return screenManager;
- }
-
- /**
- * Gets the SystemCapabilityManager. <br>
- * <strong>Note: SystemCapabilityManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
- * @return a SystemCapabilityManager object
- */
- public SystemCapabilityManager getSystemCapabilityManager(){
- return lifecycleManager.getSystemCapabilityManager(this);
- }
-
- /**
- * Method to retrieve the RegisterAppInterface Response message that was sent back from the
- * module. It contains various attributes about the connected module and can be used to adapt
- * to different module types and their supported features.
- *
- * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
- * registered with the module.
- */
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse(){
- if(lifecycleManager != null){
- return lifecycleManager.getRegisterAppInterfaceResponse();
- }
- return null;
- }
-
- /**
- * Get the current OnHMIStatus
- * @return OnHMIStatus object represents the current OnHMIStatus
- */
- @Override
- public OnHMIStatus getCurrentHMIStatus(){
- if(this.lifecycleManager !=null ){
- return lifecycleManager.getCurrentHMIStatus();
- }
- return null;
- }
-
- // PROTECTED GETTERS
-
- protected FileManagerConfig getFileManagerConfig() { return fileManagerConfig; }
-
- /**
- * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
- * service from the module. For example, this should be used to login to a user account.
- * @return the string representation of the auth token
- */
- @Override
- public String getAuthToken(){
- return this.lifecycleManager.getAuthToken();
- }
-
- // SENDING REQUESTS
-
- /**
- * Send RPC Message <br>
- * @param message RPCMessage
- */
- @Override
- public void sendRPC(RPCMessage message) {
- _internalInterface.sendRPC(message);
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests asynchronously, use sendRequests <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong><br>
- *
- * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- */
- @Override
- public void sendSequentialRPCs(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener){
-
- List<RPCRequest> rpcRequestList = new ArrayList<>();
- for (int i = 0; i < rpcs.size(); i++) {
- if (rpcs.get(i) instanceof RPCRequest){
- rpcRequestList.add((RPCRequest)rpcs.get(i));
- }
- }
-
- if (rpcRequestList.size() > 0) {
- _internalInterface.sendSequentialRPCs(rpcRequestList, listener);
- }
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests synchronously, use sendSequentialRPCs <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong> <br>
- *
- * <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- */
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) {
-
- List<RPCRequest> rpcRequestList = new ArrayList<>();
- for (int i = 0; i < rpcs.size(); i++) {
- if (rpcs.get(i) instanceof RPCRequest){
- rpcRequestList.add((RPCRequest)rpcs.get(i));
- }
- }
-
- if (rpcRequestList.size() > 0) {
- _internalInterface.sendRequests(rpcRequestList,listener);
- }
- }
-
- /**
- * Add an OnRPCNotificationListener
- * @param listener listener that will be called when a notification is received
- */
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- _internalInterface.addOnRPCNotificationListener(notificationId,listener);
- }
-
- /**
- * Remove an OnRPCNotificationListener
- * @param listener listener that was previously added
- */
- @Override
- public void removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- _internalInterface.removeOnRPCNotificationListener(notificationId, listener);
- }
-
- /**
- * Add an OnRPCRequestListener
- * @param listener listener that will be called when a request is received
- */
- @Override
- public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- _internalInterface.addOnRPCRequestListener(requestId,listener);
- }
-
- /**
- * Remove an OnRPCRequestListener
- * @param listener listener that was previously added
- */
- @Override
- public void removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- _internalInterface.removeOnRPCRequestListener(requestId, listener);
- }
-
- // LIFECYCLE / OTHER
-
- // STARTUP
-
- /**
- * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up
- */
- @SuppressWarnings("unchecked")
- @Override
- public void start(){
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- dispose();
- }
- });
-
- Log.i(TAG, "start");
- if (lifecycleManager == null) {
- if (transport != null
- && (transport.getTransportType().equals(TransportType.WEB_SOCKET_SERVER) || transport.getTransportType().equals(TransportType.CUSTOM))) {
- //Do the thing
-
- LifecycleManager.AppConfig appConfig = new LifecycleManager.AppConfig();
- appConfig.setAppName(appName);
- //short app name
- appConfig.setMediaApp(isMediaApp);
- appConfig.setHmiDisplayLanguageDesired(hmiLanguage);
- appConfig.setLanguageDesired(hmiLanguage);
- appConfig.setAppType(hmiTypes);
- appConfig.setVrSynonyms(vrSynonyms);
- appConfig.setTtsName(ttsChunks);
- appConfig.setDayColorScheme(dayColorScheme);
- appConfig.setNightColorScheme(nightColorScheme);
- appConfig.setAppID(appId);
- appConfig.setMinimumProtocolVersion(minimumProtocolVersion);
- appConfig.setMinimumRPCVersion(minimumRPCVersion);
-
- lifecycleManager = new LifecycleManager(appConfig, transport, lifecycleListener);
- _internalInterface = lifecycleManager.getInternalInterface(SdlManager.this);
-
- if (sdlSecList != null && !sdlSecList.isEmpty()) {
- lifecycleManager.setSdlSecurity(sdlSecList, serviceEncryptionListener);
- }
-
- //Setup the notification queue
- initNotificationQueue();
-
- lifecycleManager.start();
-
-
- }else{
- throw new RuntimeException("No transport provided");
- }
- }
- }
-
-
- // BUILDER
- public static class Builder {
- SdlManager sdlManager;
-
- /**
- * Builder for the SdlManager. Parameters in the constructor are required.
- * @param appId the app's ID
- * @param appName the app's name
- * @param listener a SdlManagerListener object
- */
- public Builder(@NonNull final String appId, @NonNull final String appName, @NonNull final SdlManagerListener listener){
- sdlManager = new SdlManager();
- setAppId(appId);
- setAppName(appName);
- setManagerListener(listener);
- }
-
- /**
- * Sets the App ID
- * @param appId String representation of the App ID retreived from the SDL Developer Portal
- */
- public Builder setAppId(@NonNull final String appId){
- sdlManager.appId = appId;
- return this;
- }
-
- /**
- * Sets the Application Name
- * @param appName String that will be associated as the app's name
- */
- public Builder setAppName(@NonNull final String appName){
- sdlManager.appName = appName;
- return this;
- }
-
- /**
- * Sets the Short Application Name
- * @param shortAppName a shorter representation of the app's name for smaller displays
- */
- public Builder setShortAppName(final String shortAppName) {
- sdlManager.shortAppName = shortAppName;
- return this;
- }
-
- /**
- * Sets the minimum protocol version that will be permitted to connect.
- * If the protocol version of the head unit connected is below this version,
- * the app will disconnect with an EndService protocol message and will not register.
- * @param minimumProtocolVersion the minimum Protocol spec version that should be accepted
- */
- public Builder setMinimumProtocolVersion(final Version minimumProtocolVersion) {
- sdlManager.minimumProtocolVersion = minimumProtocolVersion;
- return this;
- }
-
- /**
- * The minimum RPC version that will be permitted to connect.
- * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
- * @param minimumRPCVersion the minimum RPC spec version that should be accepted
- */
- public Builder setMinimumRPCVersion(final Version minimumRPCVersion) {
- sdlManager.minimumRPCVersion = minimumRPCVersion;
- return this;
- }
-
- /**
- * Sets the Language of the App
- * @param hmiLanguage the desired language to be used on the display/HMI of the connected module
- */
- public Builder setLanguage(final Language hmiLanguage){
- sdlManager.hmiLanguage = hmiLanguage;
- return this;
- }
-
- /**
- * Sets the TemplateColorScheme for daytime
- * @param dayColorScheme color scheme that will be used (if supported) when the display is in a "Day Mode" or
- * similar. Should comprise of colors that contrast well during the day under sunlight.
- */
- public Builder setDayColorScheme(final TemplateColorScheme dayColorScheme){
- sdlManager.dayColorScheme = dayColorScheme;
- return this;
- }
-
- /**
- * Sets the TemplateColorScheme for nighttime
- * @param nightColorScheme color scheme that will be used (if supported) when the display is in a "Night Mode"
- * or similar. Should comprise of colors that contrast well during the night and are not
- * brighter than average.
- */
- public Builder setNightColorScheme(final TemplateColorScheme nightColorScheme){
- sdlManager.nightColorScheme = nightColorScheme;
- return this;
- }
-
- /**
- * Sets the icon for the app on head unit / In-Vehicle-Infotainment system <br>
- * @param sdlArtwork the icon that will be used to represent this application on the connected module
- */
- public Builder setAppIcon(final SdlArtwork sdlArtwork){
- sdlManager.appIcon = sdlArtwork;
- return this;
- }
-
- /**
- * Sets the vector of AppHMIType <br>
- * <strong>Note: This should be an ordered list from most -> least relevant</strong>
- * @param hmiTypes HMI types that represent this application. For example, if the app is a music player, the
- * MEDIA HMIType should be included.
- */
- public Builder setAppTypes(final Vector<AppHMIType> hmiTypes){
-
- sdlManager.hmiTypes = hmiTypes;
-
- if (hmiTypes != null) {
- sdlManager.isMediaApp = hmiTypes.contains(AppHMIType.MEDIA);
- }
-
- return this;
- }
-
- /**
- * Sets the FileManagerConfig for the session.<br>
- * <strong>Note: If not set, the default configuration value of 1 will be set for
- * artworkRetryCount and fileRetryCount in FileManagerConfig</strong>
- * @param fileManagerConfig - configuration options
- */
- public Builder setFileManagerConfig (final FileManagerConfig fileManagerConfig){
- sdlManager.fileManagerConfig = fileManagerConfig;
- return this;
- }
-
- /**
- * Sets the voice recognition synonyms that can be used to identify this application.
- * @param vrSynonyms a vector of Strings that can be associated with this app. For example the app's name should
- * be included as well as any phonetic spellings of the app name that might help the on-board
- * VR system associated a users spoken word with the supplied synonyms.
- */
- public Builder setVrSynonyms(final Vector<String> vrSynonyms) {
- sdlManager.vrSynonyms = vrSynonyms;
- return this;
- }
-
- /**
- * Sets the Text-To-Speech Name of the application. These TTSChunks might be used by the module as an audio
- * representation of the app's name.
- * @param ttsChunks the TTS chunks that can represent this app's name
- */
- public Builder setTtsName(final Vector<TTSChunk> ttsChunks) {
- sdlManager.ttsChunks = ttsChunks;
- return this;
- }
-
- /**
- * This Object type may change with the transport refactor
- * Sets the BaseTransportConfig
- * @param transport the type of transport that should be used for this SdlManager instance.
- */
- public Builder setTransportType(BaseTransportConfig transport){
- sdlManager.transport = transport;
- return this;
- }
-
- /**
- * Sets the Security libraries
- * @param secList The list of security class(es)
- */
- @Deprecated
- public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> secList) {
- sdlManager.sdlSecList = secList;
- return this;
- }
-
- /**
- * Sets the security libraries and a callback to notify caller when there is update to encryption service
- * @param secList The list of security class(es)
- * @param listener The callback object
- */
- public Builder setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
- sdlManager.sdlSecList = secList;
- sdlManager.serviceEncryptionListener = listener;
- return this;
- }
-
- /**
- * Set the SdlManager Listener
- * @param listener the listener
- */
- public Builder setManagerListener(@NonNull final SdlManagerListener listener){
- sdlManager.managerListener = listener;
- return this;
- }
-
- /**
- * Set RPCNotification listeners. SdlManager will preload these listeners before any RPCs are sent/received.
- * @param listeners a map of listeners that will be called when a notification is received.
- * Key represents the FunctionID of the notification and value represents the listener
- */
- public Builder setRPCNotificationListeners(Map<FunctionID, OnRPCNotificationListener> listeners){
- sdlManager.onRPCNotificationListeners = listeners;
- return this;
- }
-
- public SdlManager build() {
-
- if (sdlManager.appName == null) {
- throw new IllegalArgumentException("You must specify an app name by calling setAppName");
- }
-
- if (sdlManager.appId == null) {
- throw new IllegalArgumentException("You must specify an app ID by calling setAppId");
- }
-
- if (sdlManager.managerListener == null) {
- throw new IllegalArgumentException("You must set a SdlManagerListener object");
- }
-
- if (sdlManager.hmiTypes == null) {
- Vector<AppHMIType> hmiTypesDefault = new Vector<>();
- hmiTypesDefault.add(AppHMIType.DEFAULT);
- sdlManager.hmiTypes = hmiTypesDefault;
- sdlManager.isMediaApp = false;
- }
- if(sdlManager.fileManagerConfig == null){
- //if FileManagerConfig is not set use default
- sdlManager.fileManagerConfig = new FileManagerConfig();
- }
-
- if (sdlManager.hmiLanguage == null){
- sdlManager.hmiLanguage = Language.EN_US;
- }
-
- if (sdlManager.minimumProtocolVersion == null){
- sdlManager.minimumProtocolVersion = new Version("1.0.0");
- }
-
- if (sdlManager.minimumRPCVersion == null){
- sdlManager.minimumRPCVersion = new Version("1.0.0");
- }
-
- sdlManager.transitionToState(BaseSubManager.SETTING_UP);
-
- return sdlManager;
- }
- }
-
- /**
- * Start a secured RPC service
- */
- public void startRPCEncryption() {
- if (lifecycleManager != null) {
- lifecycleManager.startRPCEncryption();
- }
- }
+public class SdlManager extends BaseSdlManager {
+
+ /**
+ * Starts up a SdlManager, and calls provided callback called once all BaseSubManagers are done setting up
+ */
+ @Override
+ public void start() {
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ dispose();
+ }
+ });
+
+ DebugTool.logInfo(TAG, "start");
+ if (lifecycleManager == null) {
+ if (transport != null && (transport.getTransportType().equals(TransportType.WEB_SOCKET_SERVER) || transport.getTransportType().equals(TransportType.CUSTOM))) {
+ super.start();
+ lifecycleManager.start();
+ } else {
+ throw new RuntimeException("No transport provided");
+ }
+ }
+ }
+
+ @Override
+ protected void initialize() {
+ // Instantiate sub managers
+ this.permissionManager = new PermissionManager(_internalInterface);
+ this.fileManager = new FileManager(_internalInterface, fileManagerConfig);
+ this.screenManager = new ScreenManager(_internalInterface, this.fileManager);
+
+ // Start sub managers
+ this.permissionManager.start(subManagerListener);
+ this.fileManager.start(subManagerListener);
+ this.screenManager.start(subManagerListener);
+ }
+
+ @Override
+ void checkState() {
+ if (permissionManager != null && fileManager != null && screenManager != null) {
+ if (permissionManager.getState() == BaseSubManager.READY && fileManager.getState() == BaseSubManager.READY && screenManager.getState() == BaseSubManager.READY) {
+ DebugTool.logInfo(TAG, "Starting sdl manager, all sub managers are in ready state");
+ transitionToState(BaseSubManager.READY);
+ handleQueuedNotifications();
+ notifyDevListener(null);
+ onReady();
+ } else if (permissionManager.getState() == BaseSubManager.ERROR && fileManager.getState() == BaseSubManager.ERROR && screenManager.getState() == BaseSubManager.ERROR) {
+ String info = "ERROR starting sdl manager, all sub managers are in error state";
+ DebugTool.logError(TAG, info);
+ transitionToState(BaseSubManager.ERROR);
+ notifyDevListener(info);
+ } else if (permissionManager.getState() == BaseSubManager.SETTING_UP || fileManager.getState() == BaseSubManager.SETTING_UP || screenManager.getState() == BaseSubManager.SETTING_UP) {
+ DebugTool.logInfo(TAG, "SETTING UP sdl manager, some sub managers are still setting up");
+ transitionToState(BaseSubManager.SETTING_UP);
+ // No need to notify developer here!
+ } else {
+ DebugTool.logWarning(TAG, "LIMITED starting sdl manager, some sub managers are in error or limited state and the others finished setting up");
+ transitionToState(BaseSubManager.LIMITED);
+ handleQueuedNotifications();
+ notifyDevListener(null);
+ onReady();
+ }
+ } else {
+ // We should never be here, but somehow one of the sub-sub managers is null
+ String info = "ERROR one of the sdl sub managers is null";
+ DebugTool.logError(TAG, info);
+ transitionToState(BaseSubManager.ERROR);
+ notifyDevListener(info);
+ }
+ }
+
+ private void notifyDevListener(String info) {
+ if (managerListener != null) {
+ if (getState() == BaseSubManager.ERROR) {
+ managerListener.onError((SdlManager) this, info, null);
+ } else {
+ managerListener.onStart((SdlManager) this);
+ }
+ }
+ }
+
+ @Override
+ void retryChangeRegistration() {
+ // Do nothing
+ }
+
+ @Override
+ public void dispose() {
+ if (this.permissionManager != null) {
+ this.permissionManager.dispose();
+ }
+
+ if (this.fileManager != null) {
+ this.fileManager.dispose();
+ }
+
+ if (this.screenManager != null) {
+ this.screenManager.dispose();
+ }
+
+ if (this.lifecycleManager != null) {
+ this.lifecycleManager.stop();
+ }
+
+ if (managerListener != null) {
+ managerListener.onDestroy((SdlManager) this);
+ managerListener = null;
+ }
+
+ transitionToState(BaseSubManager.SHUTDOWN);
+ }
+
+ // BUILDER
+ public static class Builder extends BaseSdlManager.Builder {
+ /**
+ * Builder for the SdlManager. Parameters in the constructor are required.
+ *
+ * @param appId the app's ID
+ * @param appName the app's name
+ * @param listener a SdlManagerListener object
+ */
+ public Builder(@NonNull final String appId, @NonNull final String appName, @NonNull final SdlManagerListener listener) {
+ super(appId, appName, listener);
+ }
+ }
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index 44d1e091a..8118a9c93 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -63,6 +63,22 @@ public interface SdlManagerListener extends BaseSdlManagerListener {
* @param language The language of the connected head unit the manager is trying to update the configuration.
* @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
* otherwise null to indicate that the language is not supported.
+ * @deprecated use {@link #managerShouldUpdateLifecycle(Language language, Language hmiLanguage)} instead
*/
+ @Deprecated
LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The VR+TTS language of the connected head unit the manager is trying to update the configuration.
+ * @param hmiLanguage The HMI display language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage);
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index 0beb1da0e..4cfadf611 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -32,74 +32,13 @@
package com.smartdevicelink.managers.lifecycle;
-import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
-import android.util.Log;
+import com.smartdevicelink.util.Log;
-import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.managers.SdlManager;
-import com.smartdevicelink.managers.ServiceEncryptionListener;
-import com.smartdevicelink.marshal.JsonRPCMarshaller;
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.protocol.enums.MessageType;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.RPCMessage;
-import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SystemCapabilityManager;
-import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
-import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
-import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
-import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
-import com.smartdevicelink.proxy.rpc.OnButtonEvent;
-import com.smartdevicelink.proxy.rpc.OnButtonPress;
-import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.OnSystemRequest;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SubscribeButton;
-import com.smartdevicelink.proxy.rpc.SystemRequest;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
-import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
-import com.smartdevicelink.proxy.rpc.VehicleType;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
-import com.smartdevicelink.proxy.rpc.enums.ButtonName;
-import com.smartdevicelink.proxy.rpc.enums.FileType;
-import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.RequestType;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
-import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
-import com.smartdevicelink.streaming.audio.AudioStreamingParams;
-import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.util.CorrelationIdGenerator;
-import com.smartdevicelink.util.DebugTool;
-import com.smartdevicelink.util.FileUtls;
-import com.smartdevicelink.util.Version;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Vector;
-import java.util.concurrent.CopyOnWriteArrayList;
/**
* The lifecycle manager creates a central point for all SDL session logic to converge. It should only be used by
@@ -107,394 +46,20 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class LifecycleManager extends BaseLifecycleManager {
-
- private static final String TAG = "Lifecycle Manager";
-
- public static final Version MAX_SUPPORTED_RPC_VERSION = new Version(6, 0, 0);
-
- // Protected Correlation IDs
- private final int REGISTER_APP_INTERFACE_CORRELATION_ID = 65529,
- UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
-
-
- // Sdl Synchronization Objects
- private static final Object RPC_LISTENER_LOCK = new Object(),
- ON_UPDATE_LISTENER_LOCK = new Object(),
- ON_REQUEST_LISTENER_LOCK = new Object(),
- ON_NOTIFICATION_LISTENER_LOCK = new Object();
-
-
-
- SdlSession session;
- AppConfig appConfig;
-
- //protected Version protocolVersion = new Version(1,0,0);
- protected Version rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
-
-
- private final HashMap<Integer,CopyOnWriteArrayList<OnRPCListener>> rpcListeners;
- private final HashMap<Integer, OnRPCResponseListener> rpcResponseListeners;
- private final HashMap<Integer, CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners;
- private final HashMap<Integer, CopyOnWriteArrayList<OnRPCRequestListener>> rpcRequestListeners;
-
- protected final SystemCapabilityManager systemCapabilityManager;
- private EncryptionLifecycleManager encryptionLifecycleManager;
-
- protected RegisterAppInterfaceResponse raiResponse = null;
-
- private OnHMIStatus currentHMIStatus;
- protected boolean firstTimeFull = true;
-
- final LifecycleListener lifecycleListener;
-
- private List<Class<? extends SdlSecurityBase>> _secList = null;
- private String authToken;
- private Version minimumProtocolVersion;
- private Version minimumRPCVersion;
-
- public LifecycleManager(AppConfig appConfig, BaseTransportConfig config, LifecycleListener listener){
-
- this.lifecycleListener = listener;
-
- this.rpcListeners = new HashMap<>();
- this.rpcResponseListeners = new HashMap<>();
- this.rpcNotificationListeners = new HashMap<>();
- this.rpcRequestListeners = new HashMap<>();
-
- this.appConfig = appConfig;
- this.minimumProtocolVersion = appConfig.minimumProtocolVersion;
- this.minimumRPCVersion = appConfig.minimumRPCVersion;
- this.session = new SdlSession(sdlConnectionListener, config);
-
- this.systemCapabilityManager = new SystemCapabilityManager(internalInterface);
+ public LifecycleManager(AppConfig appConfig, BaseTransportConfig config, LifecycleListener listener) {
+ super(appConfig, config, listener);
}
- public void start(){
- try {
- setupInternalRpcListeners();
- session.startSession();
- } catch (SdlException e) {
- e.printStackTrace();
- }
-
+ @Override
+ void initialize() {
+ super.initialize();
+ this.session = new SdlSession(sdlConnectionListener, _transportConfig);
}
- /**
- * Start a secured RPC service
- */
- public void startRPCEncryption() {
+ @Override
+ void cycle(SdlDisconnectedReason disconnectedReason) {
+ clean();
if (session != null) {
- session.startService(SessionType.RPC, session.getSessionId(), true);
- }
- }
-
- public void stop(){
- session.close();
- }
-
- private Version getProtocolVersion(){
- if (session != null){
- return session.getProtocolVersion();
- }
- return new Version(1,0,0);
- }
-
- private void sendRPCs(List<? extends RPCMessage> messages, final OnMultipleRequestListener listener){
- if(messages != null ){
- for(RPCMessage message : messages){
- // Request Specifics
- if(message instanceof RPCRequest){
- RPCRequest request = ((RPCRequest) message);
- final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
- request.setCorrelationID(CorrelationIdGenerator.generateId());
- if (listener != null) {
- listener.addCorrelationId(request.getCorrelationID());
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onResponse(correlationId, response);
- }
- if (listener.getSingleRpcResponseListener() != null) {
- listener.getSingleRpcResponseListener().onResponse(correlationId, response);
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener.getSingleRpcResponseListener() != null) {
- listener.getSingleRpcResponseListener().onError(correlationId, resultCode, info);
- }
- }
- });
- }
- sendRPCMessagePrivate(request);
- }else {
- // Notifications and Responses
- sendRPCMessagePrivate(message);
- if (listener != null){
- listener.onUpdate(messages.size());
- if (messages.size() == 0){
- listener.onFinished();
- }
- }
- }
- }
- }
- }
-
- private void sendSequentialRPCs(final List<? extends RPCMessage> messages, final OnMultipleRequestListener listener){
- if (messages != null){
- // Break out of recursion, we have finished the requests
- if (messages.size() == 0) {
- if(listener != null){
- listener.onFinished();
- }
- return;
- }
-
- RPCMessage rpc = messages.remove(0);
-
- // Request Specifics
- if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) rpc;
- request.setCorrelationID(CorrelationIdGenerator.generateId());
-
- final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
-
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onResponse(correlationId, response);
- }
- if (listener != null) {
- listener.onResponse(correlationId, response);
- listener.onUpdate(messages.size());
- }
- // recurse after onResponse
- sendSequentialRPCs(messages, listener);
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener != null) {
- listener.onError(correlationId, resultCode, info);
- listener.onUpdate(messages.size());
-
- }
- // recurse after onError
- sendSequentialRPCs(messages, listener);
- }
- });
- sendRPCMessagePrivate(request);
- } else {
- // Notifications and Responses
- sendRPCMessagePrivate(rpc);
- if (listener != null) {
- listener.onUpdate(messages.size());
- }
- // recurse after sending a notification or response as there is no response.
- sendSequentialRPCs(messages, listener);
- }
- }
- }
-
- /**
- * This method is used to ensure all of the methods in this class can remain private and no grantees can be made
- * to the developer what methods are available or not.
- *
- * <b>NOTE: THERE IS NO GURANTEE THIS WILL BE A VALID SYSTEM CAPABILITY MANAGER</b>
- *
- * @param sdlManager this must be a working manager instance
- * @return the system capability manager.
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public SystemCapabilityManager getSystemCapabilityManager(SdlManager sdlManager){
- if(sdlManager != null){
- return systemCapabilityManager;
- }
- return null;
- }
-
- private boolean isConnected(){
- if(session != null){
- return session.getIsConnected();
- }else{
- return false;
- }
- }
-
- /**
- * Method to retrieve the RegisterAppInterface Response message that was sent back from the
- * module. It contains various attributes about the connected module and can be used to adapt
- * to different module types and their supported features.
- *
- * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
- * registered with the module.
- */
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse(){
- return this.raiResponse;
- }
-
-
- /**
- * Get the current OnHMIStatus
- * @return OnHMIStatus object represents the current OnHMIStatus
- */
- public OnHMIStatus getCurrentHMIStatus() {
- return currentHMIStatus;
- }
-
- private void onClose(String info, Exception e){
- Log.i(TAG, "onClose");
- if(lifecycleListener != null){
- lifecycleListener.onProxyClosed(this, info,e,null);
- }
- }
-
- /**
- * This method is used to ensure all of the methods in this class can remain private and no grantees can be made
- * to the developer what methods are available or not.
- *
- * @param sdlManager this must be a working manager instance
- * @return the internal interface that hooks into this manager
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public ISdl getInternalInterface(SdlManager sdlManager) {
- if (sdlManager != null) {
- return internalInterface;
- }
- return null;
- }
-
-
- /* *******************************************************************************************************
- ********************************** INTERNAL - RPC LISTENERS !! START !! *********************************
- *********************************************************************************************************/
-
- private void setupInternalRpcListeners(){
- addRpcListener(FunctionID.REGISTER_APP_INTERFACE, rpcListener);
- addRpcListener(FunctionID.ON_HMI_STATUS, rpcListener);
- addRpcListener(FunctionID.ON_HASH_CHANGE, rpcListener);
- addRpcListener(FunctionID.ON_SYSTEM_REQUEST, rpcListener);
- addRpcListener(FunctionID.ON_APP_INTERFACE_UNREGISTERED, rpcListener);
- addRpcListener(FunctionID.UNREGISTER_APP_INTERFACE, rpcListener);
- }
-
-
- private OnRPCListener rpcListener = new OnRPCListener() {
- @Override
- public void onReceived(RPCMessage message) {
- //Make sure this is a response as expected
- FunctionID functionID = message.getFunctionID();
- if (functionID != null) {
- switch (functionID) {
- case REGISTER_APP_INTERFACE:
- //We have begun
- Log.i(TAG, "RAI Response");
- raiResponse = (RegisterAppInterfaceResponse) message;
- SdlMsgVersion rpcVersion = ((RegisterAppInterfaceResponse) message).getSdlMsgVersion();
- if (rpcVersion != null) {
- LifecycleManager.this.rpcSpecVersion = new Version(rpcVersion.getMajorVersion(), rpcVersion.getMinorVersion(), rpcVersion.getPatchVersion());
- } else {
- LifecycleManager.this.rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
- }
- if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
- Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
- UnregisterAppInterface msg = new UnregisterAppInterface();
- msg.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
- sendRPCMessagePrivate(msg);
- cleanProxy();
- return;
- }
- processRaiResponse(raiResponse);
- systemCapabilityManager.parseRAIResponse(raiResponse);
- break;
- case ON_HMI_STATUS:
- Log.i(TAG, "on hmi status");
- boolean shouldInit = currentHMIStatus == null;
- currentHMIStatus = (OnHMIStatus) message;
- if (lifecycleListener != null && shouldInit) {
- lifecycleListener.onProxyConnected(LifecycleManager.this);
- }
- break;
- case ON_HASH_CHANGE:
- break;
- case ON_SYSTEM_REQUEST:
- final OnSystemRequest onSystemRequest = (OnSystemRequest) message;
- if ((onSystemRequest.getUrl() != null) &&
- (((onSystemRequest.getRequestType() == RequestType.PROPRIETARY) && (onSystemRequest.getFileType() == FileType.JSON))
- || ((onSystemRequest.getRequestType() == RequestType.HTTP) && (onSystemRequest.getFileType() == FileType.BINARY)))) {
- Thread handleOffboardTransmissionThread = new Thread() {
- @Override
- public void run() {
- RPCRequest request = PoliciesFetcher.fetchPolicies(onSystemRequest);
- if (request != null && isConnected()) {
- sendRPCMessagePrivate(request);
- }
- }
- };
- handleOffboardTransmissionThread.start();
- }else if (onSystemRequest.getRequestType() == RequestType.ICON_URL && onSystemRequest.getUrl() != null) {
- //Download the icon file and send SystemRequest RPC
- Thread handleOffBoardTransmissionThread = new Thread() {
- @Override
- public void run() {
- final String urlHttps = onSystemRequest.getUrl().replaceFirst("http://", "https://");
- byte[] file = FileUtls.downloadFile(urlHttps);
- if (file != null) {
- SystemRequest systemRequest = new SystemRequest();
- systemRequest.setFileName(onSystemRequest.getUrl());
- systemRequest.setBulkData(file);
- systemRequest.setRequestType(RequestType.ICON_URL);
- if (isConnected()) {
- sendRPCMessagePrivate(systemRequest);
- }
- } else {
- DebugTool.logError("File was null at: " + urlHttps);
- }
- }
- };
- handleOffBoardTransmissionThread.start();
- }
- break;
- case ON_APP_INTERFACE_UNREGISTERED:
-
- OnAppInterfaceUnregistered onAppInterfaceUnregistered = (OnAppInterfaceUnregistered) message;
-
- if (!onAppInterfaceUnregistered.getReason().equals(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE)) {
- Log.v(TAG, "on app interface unregistered");
- cleanProxy();
- }else{
- Log.v(TAG, "re-registering for language change");
- processLanguageChange();
- }
- break;
- case UNREGISTER_APP_INTERFACE:
- Log.v(TAG, "unregister app interface");
- cleanProxy();
- break;
- }
- }
- }
-
-
-
- };
-
- private void processLanguageChange(){
- if (session != null) {
- if (session.getIsConnected()) {
- session.close();
- }
try {
session.startSession();
} catch (SdlException e) {
@@ -503,1002 +68,11 @@ public class LifecycleManager extends BaseLifecycleManager {
}
}
- /* *******************************************************************************************************
- ********************************** INTERNAL - RPC LISTENERS !! END !! *********************************
- *********************************************************************************************************/
-
-
- /* *******************************************************************************************************
- ********************************** METHODS - RPC LISTENERS !! START !! **********************************
- *********************************************************************************************************/
-
- private boolean onRPCReceived(final RPCMessage message){
- synchronized(RPC_LISTENER_LOCK){
- if(message == null || message.getFunctionID() == null){
- return false;
- }
-
- final int id = message.getFunctionID().getId();
- CopyOnWriteArrayList<OnRPCListener> listeners = rpcListeners.get(id);
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCListener listener : listeners) {
- listener.onReceived(message);
- }
- return true;
- }
- return false;
- }
- }
-
- private void addRpcListener(FunctionID id, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if (id != null && listener != null) {
- if (!rpcListeners.containsKey(id.getId())) {
- rpcListeners.put(id.getId(), new CopyOnWriteArrayList<OnRPCListener>());
- }
-
- rpcListeners.get(id.getId()).add(listener);
- }
- }
- }
-
- private boolean removeOnRPCListener(FunctionID id, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(rpcListeners!= null
- && id != null
- && listener != null
- && rpcListeners.containsKey(id.getId())){
- return rpcListeners.get(id.getId()).remove(listener);
- }
- }
- return false;
- }
-
- /**
- * Only call this method for a PutFile response. It will cause a class cast exception if not.
- * @param correlationId correlation id of the packet being updated
- * @param bytesWritten how many bytes were written
- * @param totalSize the total size in bytes
- */
- @SuppressWarnings("unused")
- private void onPacketProgress(int correlationId, long bytesWritten, long totalSize){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- if(rpcResponseListeners !=null
- && rpcResponseListeners.containsKey(correlationId)){
- ((OnPutFileUpdateListener)rpcResponseListeners.get(correlationId)).onUpdate(correlationId, bytesWritten, totalSize);
- }
- }
-
- }
-
- /**
- * Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
- * <p>Will automatically remove the listener for the list of listeners on completion.
- * @param msg The RPCResponse message that was received
- * @return if a listener was called or not
- */
- @SuppressWarnings("UnusedReturnValue")
- private boolean onRPCResponseReceived(RPCResponse msg){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- int correlationId = msg.getCorrelationID();
- if(rpcResponseListeners !=null
- && rpcResponseListeners.containsKey(correlationId)){
- OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
- if(msg.getSuccess()){
- listener.onResponse(correlationId, msg);
- }else{
- listener.onError(correlationId, msg.getResultCode(), msg.getInfo());
- }
- rpcResponseListeners.remove(correlationId);
- return true;
- }
- return false;
- }
- }
-
- /**
- * Add a listener that will receive the response to the specific RPCRequest sent with the corresponding correlation id
- * @param listener that will get called back when a response is received
- * @param correlationId of the RPCRequest that was sent
- * @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
- */
- private void addOnRPCResponseListener(OnRPCResponseListener listener,int correlationId, int totalSize){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- if(rpcResponseListeners!=null
- && listener !=null){
- if(listener.getListenerType() == OnRPCResponseListener.UPDATE_LISTENER_TYPE_PUT_FILE){
- ((OnPutFileUpdateListener)listener).setTotalSize(totalSize);
- }
- listener.onStart(correlationId);
- rpcResponseListeners.put(correlationId, listener);
- }
- }
- }
-
- @SuppressWarnings("unused")
- private HashMap<Integer, OnRPCResponseListener> getResponseListeners(){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- return this.rpcResponseListeners;
- }
- }
-
- /**
- * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
- * service from the module. For example, this should be used to login to a user account.
- * @return the string representation of the auth token
- */
- public String getAuthToken(){
- return this.authToken;
- }
-
- @SuppressWarnings("UnusedReturnValue")
- private boolean onRPCNotificationReceived(RPCNotification notification){
- if(notification == null){
- DebugTool.logError("onRPCNotificationReceived - Notification was null");
- return false;
- }
- DebugTool.logInfo("onRPCNotificationReceived - " + notification.getFunctionName() );
-
- //Before updating any listeners, make sure to do any final updates to the notification RPC now
- if(FunctionID.ON_HMI_STATUS.toString().equals(notification.getFunctionName())){
- OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
- onHMIStatus.setFirstRun(firstTimeFull);
- if (onHMIStatus.getHmiLevel() == HMILevel.HMI_FULL) {
- firstTimeFull = false;
- }
- }
-
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- CopyOnWriteArrayList<OnRPCNotificationListener> listeners = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCNotificationListener listener : listeners) {
- listener.onNotified(notification);
- }
- return true;
- }
- return false;
- }
- }
-
- /**
- * This will add a listener for the specific type of notification. As of now it will only allow
- * a single listener per notification function id
- * @param notificationId The notification type that this listener is designated for
- * @param listener The listener that will be called when a notification of the provided type is received
- */
- @SuppressWarnings("unused")
- private void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(notificationId != null && listener != null){
- if(!rpcNotificationListeners.containsKey(notificationId.getId())){
- rpcNotificationListeners.put(notificationId.getId(),new CopyOnWriteArrayList<OnRPCNotificationListener>());
- }
- rpcNotificationListeners.get(notificationId.getId()).add(listener);
- }
- }
- }
-
- private boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(rpcNotificationListeners!= null
- && notificationId != null
- && listener != null
- && rpcNotificationListeners.containsKey(notificationId.getId())){
- return rpcNotificationListeners.get(notificationId.getId()).remove(listener);
- }
- }
- return false;
- }
-
- @SuppressWarnings("UnusedReturnValue")
- private boolean onRPCRequestReceived(RPCRequest request){
- if(request == null){
- DebugTool.logError("onRPCRequestReceived - request was null");
- return false;
- }
- DebugTool.logInfo("onRPCRequestReceived - " + request.getFunctionName() );
-
- synchronized(ON_REQUEST_LISTENER_LOCK){
- CopyOnWriteArrayList<OnRPCRequestListener> listeners = rpcRequestListeners.get(FunctionID.getFunctionId(request.getFunctionName()));
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCRequestListener listener : listeners) {
- listener.onRequest(request);
- }
- return true;
- }
- return false;
- }
- }
-
- /**
- * This will add a listener for the specific type of request. As of now it will only allow
- * a single listener per request function id
- * @param requestId The request type that this listener is designated for
- * @param listener The listener that will be called when a request of the provided type is received
- */
- @SuppressWarnings("unused")
- private void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- synchronized(ON_REQUEST_LISTENER_LOCK){
- if(requestId != null && listener != null){
- if(!rpcRequestListeners.containsKey(requestId.getId())){
- rpcRequestListeners.put(requestId.getId(),new CopyOnWriteArrayList<OnRPCRequestListener>());
- }
- rpcRequestListeners.get(requestId.getId()).add(listener);
- }
- }
- }
-
- @SuppressWarnings("UnusedReturnValue")
- private boolean removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- synchronized(ON_REQUEST_LISTENER_LOCK){
- if(rpcRequestListeners!= null
- && requestId != null
- && listener != null
- && rpcRequestListeners.containsKey(requestId.getId())){
- return rpcRequestListeners.get(requestId.getId()).remove(listener);
- }
- }
- return false;
- }
-
- /* *******************************************************************************************************
- **************************************** RPC LISTENERS !! END !! ****************************************
- *********************************************************************************************************/
-
-
-
- private void sendRPCMessagePrivate(RPCMessage message){
- try {
- //FIXME this is temporary until the next major release of the library where OK is removed
- if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) message;
- if(FunctionID.SUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.UNSUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.BUTTON_PRESS.toString().equals(request.getFunctionName())) {
-
- ButtonName buttonName = (ButtonName) request.getObject(ButtonName.class, SubscribeButton.KEY_BUTTON_NAME);
-
-
- if (rpcSpecVersion != null) {
- if (rpcSpecVersion.getMajor() < 5) {
-
- if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
- request.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.OK);
- }
- } else { //Newer than version 5.0.0
- if (ButtonName.OK.equals(buttonName)) {
- RPCRequest request2 = new RPCRequest(request);
- request2.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.PLAY_PAUSE);
- request2.setOnRPCResponseListener(request.getOnRPCResponseListener());
- sendRPCMessagePrivate(request2);
- return;
- }
- }
- }
-
- }
- }
-
-
- message.format(rpcSpecVersion,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte)getProtocolVersion().getMajor());
-
- final ProtocolMessage pm = new ProtocolMessage();
- pm.setData(msgBytes);
- if (session != null){
- pm.setSessionID(session.getSessionId());
- }
-
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
-
- if (encryptionLifecycleManager != null && encryptionLifecycleManager.isEncryptionReady() && encryptionLifecycleManager.getRPCRequiresEncryption(message.getFunctionID())) {
- pm.setPayloadProtected(true);
- } else {
- pm.setPayloadProtected(message.isPayloadProtected());
- }
- if (pm.getPayloadProtected() && (encryptionLifecycleManager == null || !encryptionLifecycleManager.isEncryptionReady())){
- String errorInfo = "Trying to send an encrypted message and there is no secured service";
- if (message.getMessageType().equals((RPCMessage.KEY_REQUEST))) {
- RPCRequest request = (RPCRequest) message;
- OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
- if (listener != null) {
- listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
- }
- }
- DebugTool.logWarning(errorInfo);
- return;
- }
-
- if(RPCMessage.KEY_REQUEST.equals(message.getMessageType())){ // Request Specifics
- pm.setRPCType((byte)0x00);
- Integer corrId = ((RPCRequest)message).getCorrelationID();
- if( corrId== null) {
- Log.e(TAG, "No correlation ID attached to request. Not sending");
- return;
- }else{
- pm.setCorrID(corrId);
-
- OnRPCResponseListener listener = ((RPCRequest)message).getOnRPCResponseListener();
- if(listener != null){
- addOnRPCResponseListener(listener, corrId, msgBytes.length);
- }
- }
- }else if (RPCMessage.KEY_RESPONSE.equals(message.getMessageType())){ // Response Specifics
- RPCResponse response = (RPCResponse) message;
- pm.setRPCType((byte)0x01);
- if (response.getCorrelationID() == null) {
- //Log error here
- //throw new SdlException("CorrelationID cannot be null. RPC: " + response.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
- Log.e(TAG, "No correlation ID attached to response. Not sending");
- return;
- } else {
- pm.setCorrID(response.getCorrelationID());
- }
- }else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) { // Notification Specifics
- pm.setRPCType((byte)0x02);
- }
-
- if (message.getBulkData() != null){
- pm.setBulkData(message.getBulkData());
- }
-
- if(message.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())){
- pm.setPriorityCoefficient(1);
- }
-
- session.sendMessage(pm);
-
- } catch (OutOfMemoryError e) {
- e.printStackTrace();
- }
- }
-
-
-
- /* *******************************************************************************************************
- *************************************** ISdlConnectionListener START ************************************
- *********************************************************************************************************/
-
- final ISdlConnectionListener sdlConnectionListener = new ISdlConnectionListener() {
- @Override
- public void onTransportDisconnected(String info) {
- onClose(info, null);
-
- }
-
- @Override
- public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
- if (!availablePrimary) {
- onClose(info, null);
- }
-
- }
-
- @Override
- public void onTransportError(String info, Exception e) {
- onClose(info, e);
-
- }
-
- @Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
- //Incoming message
- if (SessionType.RPC.equals(msg.getSessionType())
- || SessionType.BULK_DATA.equals(msg.getSessionType())) {
-
- RPCMessage rpc = RpcConverter.extractRpc(msg, session.getProtocolVersion());
- if (rpc != null) {
- String messageType = rpc.getMessageType();
- Log.v(TAG, "RPC received - " + messageType);
-
- rpc.format(rpcSpecVersion, true);
-
- onRPCReceived(rpc);
-
- if (RPCMessage.KEY_RESPONSE.equals(messageType)) {
-
- onRPCResponseReceived((RPCResponse) rpc);
-
- } else if (RPCMessage.KEY_NOTIFICATION.equals(messageType)) {
- FunctionID functionID = rpc.getFunctionID();
- if (functionID != null && (functionID.equals(FunctionID.ON_BUTTON_PRESS)) || functionID.equals(FunctionID.ON_BUTTON_EVENT)) {
- RPCNotification notificationCompat = handleButtonNotificationFormatting(rpc);
- if(notificationCompat != null){
- onRPCNotificationReceived((notificationCompat));
- }
- }
-
- onRPCNotificationReceived((RPCNotification) rpc);
-
- } else if (RPCMessage.KEY_REQUEST.equals(messageType)) {
-
- onRPCRequestReceived((RPCRequest) rpc);
-
- }
- } else {
- Log.w(TAG, "Shouldn't be here");
- }
- }
-
- }
-
- @Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- Log.w(TAG, "onProtocolSessionStartedNACKed " + sessionID);
- }
-
- @Override
- public void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
-
- Log.i(TAG, "on protocol session started");
- if (sessionType != null) {
- if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1) {
- Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
- session.endService(sessionType, session.getSessionId());
- cleanProxy();
- return;
- }
-
- if (sessionType.equals(SessionType.RPC)) {
- if (appConfig != null) {
-
- appConfig.prepare();
-
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion();
- sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
- sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
- sdlMsgVersion.setPatchVersion(MAX_SUPPORTED_RPC_VERSION.getPatch());
-
- RegisterAppInterface rai = new RegisterAppInterface(sdlMsgVersion,
- appConfig.getAppName(), appConfig.isMediaApp(), appConfig.getLanguageDesired(),
- appConfig.getHmiDisplayLanguageDesired(), appConfig.getAppID());
- rai.setCorrelationID(REGISTER_APP_INTERFACE_CORRELATION_ID);
-
- rai.setTtsName(appConfig.getTtsName());
- rai.setNgnMediaScreenAppName(appConfig.getNgnMediaScreenAppName());
- rai.setVrSynonyms(appConfig.getVrSynonyms());
- rai.setAppHMIType(appConfig.getAppType());
- rai.setDayColorScheme(appConfig.getDayColorScheme());
- rai.setNightColorScheme(appConfig.getNightColorScheme());
-
- //Add device/system info in the future
- //TODO attach previous hash id
-
- sendRPCMessagePrivate(rai);
- } else {
- Log.e(TAG, "App config was null, soo...");
- }
-
-
- } else {
- lifecycleListener.onServiceStarted(sessionType);
- }
- }
- }
-
- @Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID) {
-
- }
-
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID) {
-
- }
-
- @Override
- public void onProtocolError(String info, Exception e) {
- DebugTool.logError("Protocol Error - " + info, e);
- }
-
- @Override
- public void onHeartbeatTimedOut(byte sessionID) { /* Deprecated */ }
-
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID) {/* Unused */ }
-
-
- @Override
- public void onAuthTokenReceived(String token, byte sessionID) {
- LifecycleManager.this.authToken = token;
- }
-
- };
- /* *******************************************************************************************************
- *************************************** ISdlConnectionListener END ************************************
- *********************************************************************************************************/
-
-
- /* *******************************************************************************************************
- ******************************************** ISdl - START ***********************************************
- *********************************************************************************************************/
-
- final ISdl internalInterface = new ISdl() {
- @Override
- public void start() {
- LifecycleManager.this.start();
- }
-
- @Override
- public void stop() {
- LifecycleManager.this.stop();
- }
-
- @Override
- public boolean isConnected() {
- return LifecycleManager.this.session.getIsConnected();
- }
-
- @Override
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- LifecycleManager.this.session.addServiceListener(serviceType,sdlServiceListener);
- }
-
- @Override
- public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- LifecycleManager.this.session.removeServiceListener(serviceType,sdlServiceListener);
-
- }
-
- @Override
- public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
- DebugTool.logWarning("startVideoService is not currently implemented");
-
- }
-
- @Override
- public void stopVideoService() {
- DebugTool.logWarning("stopVideoService is not currently implemented");
-
- }
-
- @Override
- public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
- DebugTool.logWarning("startVideoStream is not currently implemented");
- return null;
- }
-
- @Override
- public void startAudioService(boolean encrypted, AudioStreamingCodec codec, AudioStreamingParams params) {
- DebugTool.logWarning("startAudioService is not currently implemented");
- }
-
- @Override
- public void startAudioService(boolean encrypted) {
- DebugTool.logWarning("startAudioService is not currently implemented");
-
- }
-
- @Override
- public void stopAudioService() {
- DebugTool.logWarning("stopAudioService is not currently implemented");
- }
-
- @Override
- public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec, AudioStreamingParams params) {
- DebugTool.logWarning("startAudioStream is not currently implemented");
- return null;
- }
-
- @Override
- public void sendRPCRequest(RPCRequest message) {
- LifecycleManager.this.sendRPCMessagePrivate(message);
-
- }
-
- @Override
- public void sendRPC(RPCMessage message) {
- if(isConnected()) {
- LifecycleManager.this.sendRPCMessagePrivate(message);
- }
- }
-
- @Override
- public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
- LifecycleManager.this.sendRPCs(rpcs,listener);
- }
-
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- LifecycleManager.this.sendRPCs(rpcs,listener);
- }
-
- @Override
- public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- LifecycleManager.this.sendSequentialRPCs(rpcs,listener);
- }
-
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- LifecycleManager.this.addOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- return LifecycleManager.this.removeOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public void addOnRPCRequestListener(FunctionID notificationId, OnRPCRequestListener listener) {
- LifecycleManager.this.addOnRPCRequestListener(notificationId, listener);
- }
-
- @Override
- public boolean removeOnRPCRequestListener(FunctionID notificationId, OnRPCRequestListener listener) {
- return LifecycleManager.this.removeOnRPCRequestListener(notificationId, listener);
- }
-
- @Override
- public void addOnRPCListener(FunctionID responseId, OnRPCListener listener) {
- LifecycleManager.this.addRpcListener(responseId,listener);
- }
-
- @Override
- public boolean removeOnRPCListener(FunctionID responseId, OnRPCListener listener) {
- return LifecycleManager.this.removeOnRPCListener(responseId,listener);
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- return LifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType);
- } else {
- return null;
- }
- }
-
- @Override
- public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- LifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType, scListener);
- }
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener, boolean forceUpdate) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- return LifecycleManager.this.systemCapabilityManager.getCapability(systemCapabilityType, scListener, forceUpdate);
- } else {
- return null;
- }
- }
-
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
- return raiResponse;
- }
-
- @Override
- public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- return LifecycleManager.this.systemCapabilityManager.isCapabilitySupported(systemCapabilityType);
- } else {
- return false;
- }
- }
-
- @Override
- public void addOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- LifecycleManager.this.systemCapabilityManager.addOnSystemCapabilityListener(systemCapabilityType, listener);
- }
- }
-
- @Override
- public boolean removeOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- if (LifecycleManager.this.systemCapabilityManager != null) {
- return LifecycleManager.this.systemCapabilityManager.removeOnSystemCapabilityListener(systemCapabilityType, listener);
- } else {
- return false;
- }
- }
-
- @Override
- public boolean isTransportForServiceAvailable(SessionType serviceType) {
- return LifecycleManager.this.session.isTransportForServiceAvailable(serviceType);
- }
-
- @Override
- public SdlMsgVersion getSdlMsgVersion() {
- SdlMsgVersion msgVersion = new SdlMsgVersion(rpcSpecVersion.getMajor(), rpcSpecVersion.getMinor());
- msgVersion.setPatchVersion(rpcSpecVersion.getPatch());
- return msgVersion;
- }
-
- @Override
- public Version getProtocolVersion() {
- return LifecycleManager.this.getProtocolVersion();
- }
-
- @Override
- public void startRPCEncryption() {
- LifecycleManager.this.startRPCEncryption();
- }
- };
-
- /* *******************************************************************************************************
- ********************************************* ISdl - END ************************************************
- *********************************************************************************************************/
-
- public interface LifecycleListener{
- void onProxyConnected(LifecycleManager lifeCycleManager);
- void onProxyClosed(LifecycleManager lifeCycleManager, String info, Exception e, SdlDisconnectedReason reason);
- void onServiceStarted(SessionType sessionType);
- void onServiceEnded(SessionType sessionType);
- void onError(LifecycleManager lifeCycleManager, String info, Exception e);
- }
-
- public static class AppConfig{
- private String appID, appName, ngnMediaScreenAppName;
- private Vector<TTSChunk> ttsName;
- private Vector<String> vrSynonyms;
- private boolean isMediaApp = false;
- private Language languageDesired, hmiDisplayLanguageDesired;
- private Vector<AppHMIType> appType;
- private TemplateColorScheme dayColorScheme, nightColorScheme;
- private Version minimumProtocolVersion;
- private Version minimumRPCVersion;
-
- private void prepare(){
- if (getNgnMediaScreenAppName() == null) {
- setNgnMediaScreenAppName(getAppName());
- }
-
- if (getLanguageDesired() == null) {
- setLanguageDesired(Language.EN_US);
- }
-
- if (getHmiDisplayLanguageDesired() == null) {
- setHmiDisplayLanguageDesired(Language.EN_US);
- }
-
- if (getVrSynonyms() == null) {
- setVrSynonyms(new Vector<String>());
- getVrSynonyms().add(getAppName());
- }
- }
-
- public String getAppID() {
- return appID;
- }
-
- public void setAppID(String appID) {
- this.appID = appID;
- }
-
- public String getAppName() {
- return appName;
- }
-
- public void setAppName(String appName) {
- this.appName = appName;
- }
-
- public String getNgnMediaScreenAppName() {
- return ngnMediaScreenAppName;
- }
-
- public void setNgnMediaScreenAppName(String ngnMediaScreenAppName) {
- this.ngnMediaScreenAppName = ngnMediaScreenAppName;
- }
-
- public Vector<TTSChunk> getTtsName() {
- return ttsName;
- }
-
- public void setTtsName(Vector<TTSChunk> ttsName) {
- this.ttsName = ttsName;
- }
-
- public Vector<String> getVrSynonyms() {
- return vrSynonyms;
- }
-
- public void setVrSynonyms(Vector<String> vrSynonyms) {
- this.vrSynonyms = vrSynonyms;
- }
-
- public boolean isMediaApp() {
- return isMediaApp;
- }
-
- public void setMediaApp(boolean mediaApp) {
- isMediaApp = mediaApp;
- }
-
- public Language getLanguageDesired() {
- return languageDesired;
- }
-
- public void setLanguageDesired(Language languageDesired) {
- this.languageDesired = languageDesired;
- }
-
- public Language getHmiDisplayLanguageDesired() {
- return hmiDisplayLanguageDesired;
- }
-
- public void setHmiDisplayLanguageDesired(Language hmiDisplayLanguageDesired) {
- this.hmiDisplayLanguageDesired = hmiDisplayLanguageDesired;
- }
-
- public Vector<AppHMIType> getAppType() {
- return appType;
- }
-
- public void setAppType(Vector<AppHMIType> appType) {
- this.appType = appType;
- }
-
- public TemplateColorScheme getDayColorScheme() {
- return dayColorScheme;
- }
-
- public void setDayColorScheme(TemplateColorScheme dayColorScheme) {
- this.dayColorScheme = dayColorScheme;
- }
-
- public TemplateColorScheme getNightColorScheme() {
- return nightColorScheme;
- }
-
- public void setNightColorScheme(TemplateColorScheme nightColorScheme) {
- this.nightColorScheme = nightColorScheme;
- }
-
- public Version getMinimumProtocolVersion() {
- return minimumProtocolVersion;
- }
-
- /**
- * Sets the minimum protocol version that will be permitted to connect.
- * If the protocol version of the head unit connected is below this version,
- * the app will disconnect with an EndService protocol message and will not register.
- *
- * @param minimumProtocolVersion a Version object with the minimally accepted Protocol version
- */
- public void setMinimumProtocolVersion(Version minimumProtocolVersion) {
- this.minimumProtocolVersion = minimumProtocolVersion;
- }
-
- public Version getMinimumRPCVersion() {
- return minimumRPCVersion;
- }
-
- /**
- * The minimum RPC version that will be permitted to connect.
- * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
- *
- * @param minimumRPCVersion a Version object with the minimally accepted RPC spec version
- */
- public void setMinimumRPCVersion(Version minimumRPCVersion) {
- this.minimumRPCVersion = minimumRPCVersion;
- }
- }
-
-
- /**
- * Temporary method to bridge the new PLAY_PAUSE and OKAY button functionality with the old
- * OK button name. This should be removed during the next major release
- * @param notification an RPC message object that should be either an ON_BUTTON_EVENT or ON_BUTTON_PRESS otherwise
- * it will be ignored
- */
- private RPCNotification handleButtonNotificationFormatting(RPCMessage notification){
- if(FunctionID.ON_BUTTON_EVENT.toString().equals(notification.getFunctionName())
- || FunctionID.ON_BUTTON_PRESS.toString().equals(notification.getFunctionName())){
-
- ButtonName buttonName = (ButtonName)notification.getObject(ButtonName.class, OnButtonEvent.KEY_BUTTON_NAME);
- ButtonName compatBtnName = null;
-
- if(rpcSpecVersion != null && rpcSpecVersion.getMajor() >= 5){
- if(ButtonName.PLAY_PAUSE.equals(buttonName)){
- compatBtnName = ButtonName.OK;
- }
- }else{ // rpc spec version is either null or less than 5
- if(ButtonName.OK.equals(buttonName)){
- compatBtnName = ButtonName.PLAY_PAUSE;
- }
- }
-
- try {
- if (compatBtnName != null) { //There is a button name that needs to be swapped out
- RPCNotification notification2;
- //The following is done because there is currently no way to make a deep copy
- //of an RPC. Since this code will be removed, it's ugliness is borderline acceptable.
- if (notification instanceof OnButtonEvent) {
- OnButtonEvent onButtonEvent = new OnButtonEvent();
- onButtonEvent.setButtonEventMode(((OnButtonEvent) notification).getButtonEventMode());
- onButtonEvent.setCustomButtonID(((OnButtonEvent) notification).getCustomButtonID());
- notification2 = onButtonEvent;
- } else if (notification instanceof OnButtonPress) {
- OnButtonPress onButtonPress = new OnButtonPress();
- onButtonPress.setButtonPressMode(((OnButtonPress) notification).getButtonPressMode());
- onButtonPress.setCustomButtonName(((OnButtonPress) notification).getCustomButtonName());
- notification2 = onButtonPress;
- } else {
- return null;
- }
-
- notification2.setParameters(OnButtonEvent.KEY_BUTTON_NAME, compatBtnName);
- return notification2;
- }
- }catch (Exception e){
- //Should never get here
- }
- }
- return null;
- }
-
- private void cleanProxy(){
- if (rpcListeners != null) {
- rpcListeners.clear();
- }
- if (rpcResponseListeners != null) {
- rpcResponseListeners.clear();
- }
- if (rpcNotificationListeners != null) {
- rpcNotificationListeners.clear();
- }
- if (rpcRequestListeners != null) {
- rpcRequestListeners.clear();
- }
- if (session != null && session.getIsConnected()) {
- session.close();
- }
- if (encryptionLifecycleManager != null){
- encryptionLifecycleManager.dispose();
- }
- }
-
- @Deprecated
- public void setSdlSecurityClassList(List<Class<? extends SdlSecurityBase>> list) {
- _secList = list;
- }
-
- /**
- * Sets the security libraries and a callback to notify caller when there is update to encryption service
- * @param secList The list of security class(es)
- * @param listener The callback object
- */
- public void setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
- this._secList = secList;
- this.encryptionLifecycleManager = new EncryptionLifecycleManager(internalInterface, listener);
- }
-
- private void processRaiResponse(RegisterAppInterfaceResponse rai) {
- if (rai == null) return;
-
- this.raiResponse = rai;
-
- VehicleType vt = rai.getVehicleType();
- if (vt == null) return;
-
- String make = vt.getMake();
- if (make == null) return;
-
- if (_secList == null) return;
-
- SdlSecurityBase sec;
-
- for (Class<? extends SdlSecurityBase> cls : _secList) {
- try {
- sec = cls.newInstance();
- } catch (Exception e) {
- continue;
- }
-
- if ((sec != null) && (sec.getMakeList() != null)) {
- if (sec.getMakeList().contains(make)) {
- sec.setAppId(appConfig.getAppID());
- if (session != null) {
- session.setSdlSecurity(sec);
- sec.handleSdlSession(session);
- }
- return;
- }
- }
+ @Override
+ void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
+ super.onTransportDisconnected(info, availablePrimary, transportConfig);
+ if (!availablePrimary) {
+ onClose(info, null, null);
}
}
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
new file mode 100644
index 000000000..c34b0775d
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
@@ -0,0 +1,11 @@
+package com.smartdevicelink.managers.screen;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+
+public class SubscribeButtonManager extends BaseSubscribeButtonManager {
+
+ public SubscribeButtonManager(@NonNull ISdl internalInterface) {
+ super(internalInterface);
+ }
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
new file mode 100644
index 000000000..d9a14b6f7
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.protocol;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class SdlPacket extends BaseSdlPacket {
+
+ public SdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload);
+ }
+
+ public SdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
+ super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload, offset, bytesToWrite);
+ }
+
+ protected SdlPacket() {
+ super();
+ }
+
+ protected SdlPacket(BaseSdlPacket packet) {
+ super(packet);
+ }
+
+ @Deprecated
+ public SdlPacket(Parcel p){}
+
+ @Deprecated
+ public int describeContents() {
+ return 0;
+ }
+
+ @Deprecated
+ public void writeToParcel(Parcel dest, int flags) {}
+
+ @Deprecated
+ public static final Parcelable.Creator<SdlPacket> CREATOR = new Parcelable.Creator<SdlPacket>() {
+ public SdlPacket createFromParcel(Parcel in) {
+ return new SdlPacket(in);
+ }
+
+ @Override
+ public SdlPacket[] newArray(int size) {
+ return new SdlPacket[size];
+ }
+
+ };
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java b/javaSE/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
new file mode 100644
index 000000000..7bc15e2ab
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.transport.utl;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import com.smartdevicelink.transport.enums.TransportType;
+
+public class TransportRecord extends BaseTransportRecord {
+
+ public TransportRecord(TransportType transportType, String address) {
+ super(transportType, address);
+ }
+
+ @Deprecated
+ public TransportRecord(Parcel p) {}
+
+ @Deprecated
+ public int describeContents() {
+ return 0;
+ };
+
+ @Deprecated
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(type!=null? 1 : 0);
+ if(type != null){
+ dest.writeString(type.name());
+ }
+
+ dest.writeInt(address !=null? 1 : 0);
+ if(address != null){
+ dest.writeString(address);
+ }
+ }
+
+ @Deprecated
+ public static final Parcelable.Creator<TransportRecord> CREATOR = new Parcelable.Creator<TransportRecord>() {
+ public TransportRecord createFromParcel(Parcel in) {
+ return new TransportRecord(in);
+ }
+
+ @Override
+ public TransportRecord[] newArray(int size) {
+ return new TransportRecord[size];
+ }
+
+ };
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/util/HttpRequestTask.java b/javaSE/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
new file mode 100644
index 000000000..77c9f4f7a
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
@@ -0,0 +1,183 @@
+package com.smartdevicelink.util;
+
+import android.os.AsyncTask;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+
+@Deprecated
+public class HttpRequestTask extends AsyncTask<String, String, String> {
+ private static final String TAG = "Http Request Task";
+
+ public static final String REQUEST_TYPE_POST = "POST";
+ public static final String REQUEST_TYPE_GET = "GET";
+ public static final String REQUEST_TYPE_DELETE = "DELETE";
+
+ HttpRequestTaskCallback cb;
+
+ /**
+ * @param hcb callback for when this task finishes
+ * <br><br><b> - When calling execute, params as followed: </b><br>
+ * 1. Url String<br>
+ * 2. Request type (Defined in this class) REQUEST_TYPE_POST, REQUEST_TYPE_GET, REQUEST_TYPE_DELETE<br>
+ * 3. (Optional) Data to be sent. <br>
+ * 4. (Optional) Content Type Default will be application/json<br>
+ * 5. (Optional) Accept Type default will be application/json
+ *
+ */
+ @Deprecated
+ public HttpRequestTask( HttpRequestTaskCallback hcb){
+ this.cb = hcb;
+ }
+
+ @Deprecated
+ protected String doInBackground(String... params) {
+ int length = params.length;
+ String urlString = params[0];
+ String request_type = params[1];
+
+ //Grab and set data to be written if included
+ String data;
+ if(length>2){
+ data = params[2];
+ }else{
+ data = null;
+ }
+
+ //Grab and set content type for the header if included
+ String contentType;
+ if(length>3){
+ contentType = params[3];
+ }else{
+ contentType = "application/json";
+ }
+ //Grab and set accept type for the header if included
+ String acceptType;
+ if(length>4){
+ acceptType = params[4];
+ }else{
+ acceptType = "application/json";
+ }
+
+ if(urlString == null || request_type == null){
+ DebugTool.logError(TAG, "Can't process request, param error");
+ if(cb!=null){
+ cb.httpFailure(-1);
+ cb = null;
+ }
+ return "Error";
+ }
+
+ HttpURLConnection urlConnection = null;
+ BufferedReader reader = null;
+ try {
+ URL url = new URL(urlString);
+ urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setDoOutput(true);
+ urlConnection.setRequestMethod(request_type);
+ urlConnection.setRequestProperty("Content-Type", contentType);
+ urlConnection.setRequestProperty("Accept", acceptType);
+ //If we have data, we should write it out
+ if(data !=null){
+ Writer writer = new BufferedWriter(new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8"));
+ writer.write(data);
+ writer.close();
+ }
+ InputStream inputStream = urlConnection.getInputStream();
+
+ int responseCode = urlConnection.getResponseCode();
+ if (responseCode == 200) { //Success
+ //input stream
+ StringBuffer buffer = new StringBuffer();
+ if (inputStream == null) {
+ // Nothing to do.
+ if(cb!=null){
+ cb.httpCallComplete(null);
+ cb = null;
+ }
+ return null;
+ }
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String inputLine;
+ while ((inputLine = reader.readLine()) != null)
+ buffer.append(inputLine).append("\n");
+ if (buffer.length() == 0) {
+ // Stream was empty. No point in parsing.
+ if(cb!=null){
+ cb.httpCallComplete(null);
+ cb = null;
+ }
+ return null;
+ }
+ String response = null;
+
+ response = buffer.toString();
+ //send to post execute
+ if(cb!=null){
+ cb.httpCallComplete(response);
+ cb = null;
+ }
+ return response;
+ }else{
+ if(cb!=null){
+ cb.httpFailure(responseCode);
+ cb = null;
+ }
+ DebugTool.logError(TAG, "Failed to download file - " + responseCode);
+ return null;
+ }
+
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e){ // Only to catch error in urlConnection.getOutputStream() - when servers are down
+ e.printStackTrace();
+ urlConnection = null;
+ }
+ finally {
+ if (urlConnection != null) {
+ urlConnection.disconnect();
+ }
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (final IOException e) {
+ DebugTool.logError(TAG, "Error closing stream", e);
+ }
+ }
+ if(cb!=null){
+ cb.httpFailure(-1);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Callback interface for HTTP requests.
+ * @author Joey Grover
+ *
+ */
+ @Deprecated
+ public interface HttpRequestTaskCallback{
+ /**
+ * Called when HTTP request is successfully completed.
+ * @param response The response to the HTTP request.
+ */
+ public abstract void httpCallComplete(String response);
+ /**
+ * Called when HTTP request failed.
+ * @param statusCode The HTTP failure code.
+ */
+ public abstract void httpFailure(int statusCode);
+ }
+
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/util/Log.java b/javaSE/src/main/java/com/smartdevicelink/util/Log.java
new file mode 100644
index 000000000..914ce6366
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/util/Log.java
@@ -0,0 +1,22 @@
+package com.smartdevicelink.util;
+
+public class Log {
+ public static int i(String tag, String message) {
+ System.out.print("\r\nINFO: " + tag + " - " + message);
+ return 10;
+ }
+
+ public static int w(String tag, String message) {
+ System.out.print("\r\nWARN: " + tag + " - " + message);
+ return 10;
+ }
+
+ public static int e(String tag, String message, Throwable t) {
+ if (t != null) {
+ System.out.print("\r\nERROR: " + tag + " - " + message + " - " + t.getMessage());
+ } else {
+ System.out.print("\r\nERROR: " + tag + " - " + message);
+ }
+ return 10;
+ }
+} \ No newline at end of file