summaryrefslogtreecommitdiff
path: root/sdl_android/src/androidTest/java/com
diff options
context:
space:
mode:
authorBilal Alsharifi <599206+bilal-alsharifi@users.noreply.github.com>2019-03-01 14:30:37 -0500
committerGitHub <noreply@github.com>2019-03-01 14:30:37 -0500
commite59b00f4443f7d3e90c86bae562cde3decd95127 (patch)
tree3bce93fb9ae41eb67df9b9de8b6b098cc9b0cf91 /sdl_android/src/androidTest/java/com
parent7acb07521d9fdd2829bd3d8a4087a55ddfa6a435 (diff)
parent56377c76a5dedffdd9a01f605725d17da73ef8e2 (diff)
downloadsdl_android-e59b00f4443f7d3e90c86bae562cde3decd95127.tar.gz
Merge pull request #971 from smartdevicelink/feature/app_services_base
App Services - Base, Media, Weather, and Navigation
Diffstat (limited to 'sdl_android/src/androidTest/java/com')
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java7
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java38
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java154
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java672
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java43
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java3
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java118
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java148
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java121
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java30
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java134
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java143
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java64
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java18
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java112
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java184
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java142
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java84
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java75
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java71
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java77
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java92
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java95
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java84
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java6
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java132
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java6
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java128
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java107
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java85
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java118
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java101
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java103
39 files changed, 4000 insertions, 14 deletions
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index 2aa42517f..b1a1df0ed 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -6,10 +6,13 @@ import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.exception.SdlException;
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.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
@@ -303,7 +306,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
}
};
try {
- doAnswer(answer).when(sdlProxyBase).sendRPCRequest(any(RPCRequest.class));
+ doAnswer(answer).when(sdlProxyBase).sendRPC(any(RPCMessage.class));
} catch (SdlException e) {
e.printStackTrace();
}
@@ -360,7 +363,7 @@ public class SdlManagerTests extends AndroidTestCase2 {
// Test send RPC requests
- List<RPCRequest> rpcsList = Arrays.asList(new GetVehicleData(), new Show());
+ List<RPCMessage> rpcsList = Arrays.asList(new GetVehicleData(), new Show(), new OnAppServiceData(), new GetAppServiceDataResponse());
OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
@Override
public void onUpdate(int remainingRequests) { }
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
index 35ce94192..ce302e5d6 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
@@ -7,7 +7,10 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
public final class JsonUtils {
@@ -115,6 +118,41 @@ public final class JsonUtils {
return null;
}
+
+ public static List<AppServiceType> readAppServiceTypeListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<AppServiceType> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ AppServiceType serviceType = (AppServiceType) jsonArray.get(i);
+ result.add(serviceType);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<AppServiceCapability> readAppServiceCapabilityListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<AppServiceCapability> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ AppServiceCapability serviceCapability = (AppServiceCapability) jsonArray.getJSONArray(0).get(i);
+ result.add(serviceCapability);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
public static List<Integer> readIntegerListFromJsonObject(JSONObject json, String key){
JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 853dc02cc..cc8842aea 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -4,7 +4,13 @@ import android.graphics.Color;
import android.util.Log;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.TTSChunkFactory;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlData;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
@@ -15,6 +21,7 @@ import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.CloudAppProperties;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
+import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
@@ -34,10 +41,15 @@ import com.smartdevicelink.proxy.rpc.LightState;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
import com.smartdevicelink.proxy.rpc.MassageModeData;
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
@@ -74,9 +86,14 @@ import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingIndicator;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
import com.smartdevicelink.proxy.rpc.enums.AudioType;
@@ -91,6 +108,7 @@ import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus;
import com.smartdevicelink.proxy.rpc.enums.Dimension;
+import com.smartdevicelink.proxy.rpc.enums.Direction;
import com.smartdevicelink.proxy.rpc.enums.DisplayMode;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.DistanceUnit;
@@ -121,8 +139,11 @@ import com.smartdevicelink.proxy.rpc.enums.MassageCushion;
import com.smartdevicelink.proxy.rpc.enums.MassageMode;
import com.smartdevicelink.proxy.rpc.enums.MassageZone;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
@@ -133,6 +154,7 @@ import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.SeatMemoryActionType;
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SupportedSeat;
@@ -304,10 +326,31 @@ public class Test {
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";
- public static final Version GENERAL_VERSION = new Version("4.0.0");
- public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
+ public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
public static final CloudAppProperties GENERAL_CLOUD_APP_PROPERTIES = new CloudAppProperties();
-
+ public static final AppServiceType GENERAL_APP_SERVICE_TYPE = AppServiceType.MEDIA;
+ public static final List<Integer> GENERAL_FUNCTION_ID_LIST = Arrays.asList(FunctionID.GET_VEHICLE_DATA.getId(), FunctionID.SEND_HAPTIC_DATA.getId());
+ public static final AppServiceManifest GENERAL_APP_SERVICE_MANIFEST = new AppServiceManifest();
+ public static final MediaServiceManifest GENERAL_MEDIA_SERVICE_MANIFEST = new MediaServiceManifest();
+ public static final WeatherServiceManifest GENERAL_WEATHER_SERVICE_MANIFEST = new WeatherServiceManifest();
+ public static final NavigationServiceManifest GENERAL_NAVIGATION_SERVICE_MANIFEST = new NavigationServiceManifest();
+ public static final AppServiceRecord GENERAL_APP_SERVICE_RECORD = new AppServiceRecord();
+ public static final AppServiceCapability GENERAL_APP_SERVICE_CAPABILITY = new AppServiceCapability();
+ public static final AppServicesCapabilities GENERAL_APP_SERVICE_CAPABILITIES = new AppServicesCapabilities();
+ public static final ServiceUpdateReason GENERAL_SERVICE_UPDATE_REASON = ServiceUpdateReason.MANIFEST_UPDATE;
+ public static final DateTime GENERAL_DATETIME = new DateTime();
+ public static final WeatherData GENERAL_WEATHERDATA = new WeatherData();
+ public static final WeatherAlert GENERAL_WEATHERALERT = new WeatherAlert();
+ public static final MediaType GENERAL_MEDIATYPE = MediaType.MUSIC;
+ public static final MediaServiceData GENERAL_MEDIASERVICE_DATA = new MediaServiceData();
+ public static final WeatherServiceData GENERAL_WEATHERSERVICE_DATA = new WeatherServiceData();
+ public static final NavigationServiceData GENERAL_NAVIGATIONSERVICE_DATA = new NavigationServiceData();
+ public static final AppServiceData GENERAL_APPSERVICE_DATA = new AppServiceData();
+ public static final NavigationAction GENERAL_NAVIGATION_ACTION = NavigationAction.STAY;
+ public static final NavigationJunction GENERAL_NAVIGATION_JUNCTION = NavigationJunction.BIFURCATION;
+ public static final Direction GENERAL_DIRECTION = Direction.RIGHT;
+ public static final NavigationInstruction GENERAL_NAVIGATION_INSTRUCTION = new NavigationInstruction();
+ public static final Version GENERAL_VERSION = new Version("4.0.0");
public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE;
public static final Temperature GENERAL_TEMPERATURE = new Temperature();
public static final TemperatureUnit GENERAL_TEMPERATUREUNIT = TemperatureUnit.CELSIUS;
@@ -389,6 +432,12 @@ public class Test {
public static final List<LightState> GENERAL_LIGHTSTATE_LIST = new ArrayList<LightState>(1);
public static final List<AudioControlCapabilities> GENERAL_AUDIOCONTROLCAPABILITIES_LIST = new ArrayList<AudioControlCapabilities>(1);
public static final List<ModuleData> GENERAL_MODULEDATA_LIST = Collections.singletonList(GENERAL_MODULEDATA);
+ public static final List<AppServiceType> GENERAL_APPSERVICETYPE_LIST = Arrays.asList(AppServiceType.MEDIA, AppServiceType.NAVIGATION);
+ public static final List<AppServiceCapability> GENERAL_APPSERVICECAPABILITY_LIST = Arrays.asList(GENERAL_APP_SERVICE_CAPABILITY);
+ public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA);
+ public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
+ public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
+
public static final JSONArray JSON_TURNS = new JSONArray();
public static final JSONArray JSON_CHOICES = new JSONArray();
@@ -848,7 +897,6 @@ public class Test {
GENERAL_LOCKSCREENCONFIG.setBackgroundColor(Color.BLUE);
GENERAL_LOCKSCREENCONFIG.setEnabled(true);
GENERAL_LOCKSCREENCONFIG.setCustomView(R.layout.activity_sdllock_screen);
-
GENERAL_CLOUD_APP_PROPERTIES.setAppName(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setAppID(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setEnabled(GENERAL_BOOLEAN);
@@ -856,6 +904,104 @@ public class Test {
GENERAL_CLOUD_APP_PROPERTIES.setCloudTransportType(GENERAL_STRING);
GENERAL_CLOUD_APP_PROPERTIES.setHybridAppPreference(GENERAL_HYBRID_APP_PREFERENCE);
GENERAL_CLOUD_APP_PROPERTIES.setEndpoint(GENERAL_STRING);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setWeatherForLocationSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setCurrentForecastSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMultidayForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMinutelyForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxHourlyForecastAmount(GENERAL_INTEGER);
+
+ GENERAL_APP_SERVICE_MANIFEST.setWeatherServiceManifest(GENERAL_WEATHER_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceName(GENERAL_STRING);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceIcon(GENERAL_IMAGE);
+ GENERAL_APP_SERVICE_MANIFEST.setRpcSpecVersion(GENERAL_SDLMSGVERSION);
+ GENERAL_APP_SERVICE_MANIFEST.setMediaServiceManifest(GENERAL_MEDIA_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_MANIFEST.setHandledRpcs(GENERAL_FUNCTION_ID_LIST);
+ GENERAL_APP_SERVICE_MANIFEST.setAllowAppConsumers(GENERAL_BOOLEAN);
+ GENERAL_APP_SERVICE_MANIFEST.setServiceType(GENERAL_STRING);
+
+ GENERAL_NAVIGATION_SERVICE_MANIFEST.setAcceptsWayPoints(GENERAL_BOOLEAN);
+
+ GENERAL_APP_SERVICE_RECORD.setServiceId(GENERAL_STRING);
+ GENERAL_APP_SERVICE_RECORD.setServiceManifest(GENERAL_APP_SERVICE_MANIFEST);
+ GENERAL_APP_SERVICE_RECORD.setServiceActive(GENERAL_BOOLEAN);
+ GENERAL_APP_SERVICE_RECORD.setServicePublished(GENERAL_BOOLEAN);
+
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdatedAppServiceRecord(GENERAL_APP_SERVICE_RECORD);
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdateReason(GENERAL_SERVICE_UPDATE_REASON);
+
+ 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_WEATHERDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureHigh(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureLow(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setApparentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setWeatherSummary(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setTime(GENERAL_DATETIME);
+ GENERAL_WEATHERDATA.setHumidity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setCloudCover(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setMoonPhase(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setWindGust(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindSpeed(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setNearestStormBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setNearestStormDistance(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setPrecipAccumulation(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipIntensity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipProbability(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipType(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setVisibility(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWeatherIconImageName(GENERAL_STRING);
+
+ GENERAL_WEATHERALERT.setTitle(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setSummary(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setExpires(GENERAL_DATETIME);
+ GENERAL_WEATHERALERT.setRegions(GENERAL_STRING_LIST);
+ GENERAL_WEATHERALERT.setSeverity(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setTimeIssued(GENERAL_DATETIME);
+
+ GENERAL_WEATHERSERVICE_DATA.setLocation(GENERAL_LOCATIONDETAILS);
+ GENERAL_WEATHERSERVICE_DATA.setCurrentForecast(GENERAL_WEATHERDATA);
+ GENERAL_WEATHERSERVICE_DATA.setMinuteForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setHourlyForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setMultidayForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICE_DATA.setAlerts(GENERAL_WEATHERALERT_LIST);
+
+ GENERAL_MEDIASERVICE_DATA.setMediaType(GENERAL_MEDIATYPE);
+ GENERAL_MEDIASERVICE_DATA.setMediaTitle(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setMediaArtist(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setMediaAlbum(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setPlaylistName(GENERAL_STRING);
+ GENERAL_MEDIASERVICE_DATA.setIsExplicit(GENERAL_BOOLEAN);
+ GENERAL_MEDIASERVICE_DATA.setTrackPlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setTrackPlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueuePlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueuePlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueueCurrentTrackNumber(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICE_DATA.setQueueTotalTrackCount(GENERAL_INTEGER);
+
+ GENERAL_APPSERVICE_DATA.setServiceType(GENERAL_STRING);
+ GENERAL_APPSERVICE_DATA.setServiceId(GENERAL_STRING);
+ GENERAL_APPSERVICE_DATA.setWeatherServiceData(GENERAL_WEATHERSERVICE_DATA);
+ GENERAL_APPSERVICE_DATA.setMediaServiceData(GENERAL_MEDIASERVICE_DATA);
+
+ GENERAL_NAVIGATION_INSTRUCTION.setLocationDetails(GENERAL_LOCATIONDETAILS);
+ GENERAL_NAVIGATION_INSTRUCTION.setAction(GENERAL_NAVIGATION_ACTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setEta(GENERAL_DATETIME);
+ GENERAL_NAVIGATION_INSTRUCTION.setBearing(GENERAL_INTEGER);
+ GENERAL_NAVIGATION_INSTRUCTION.setJunctionType(GENERAL_NAVIGATION_JUNCTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
+ GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
try {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index b0bdd8008..595793049 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -1,14 +1,15 @@
package com.smartdevicelink.test;
-import java.util.Iterator;
-import java.util.List;
-
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.protocol.enums.FrameData;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.rpc.AirbagStatus;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
import com.smartdevicelink.proxy.rpc.AudioControlData;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
@@ -21,6 +22,7 @@ import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.ClusterModeStatus;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
+import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DeviceStatus;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
@@ -43,12 +45,18 @@ import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlData;
import com.smartdevicelink.proxy.rpc.LightState;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
import com.smartdevicelink.proxy.rpc.MassageModeData;
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+import com.smartdevicelink.proxy.rpc.NavigationServiceData;
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
@@ -85,6 +93,11 @@ import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.WeatherAlert;
+import com.smartdevicelink.proxy.rpc.WeatherData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceData;
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -92,6 +105,9 @@ import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import java.util.Iterator;
+import java.util.List;
+
public class Validator{
// TODO: This class could be (mostly) eliminated if all RPC classes implement their own .equals() and .hashCode() methods.
@@ -495,6 +511,236 @@ public class Validator{
return true;
}
+ public static boolean validateAppServiceTypeList(List<AppServiceType> list1, List<AppServiceType> list2){
+ if(list1 == null){
+ return ( list2 == null );
+ }
+ if(list2 == null){
+ return ( list1 == null );
+ }
+
+ Iterator<AppServiceType> iterator1 = list1.iterator();
+ Iterator<AppServiceType> iterator2 = list2.iterator();
+
+ while(iterator1.hasNext() && iterator2.hasNext()){
+ AppServiceType chunk1 = iterator1.next();
+ AppServiceType chunk2 = iterator2.next();
+
+ if(chunk1 != chunk2){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceCapabilities(AppServicesCapabilities params1, AppServicesCapabilities params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!validateAppServiceCapabilityList(params1.getAppServices(), params2.getAppServices())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2){
+ if(list1 == null){
+ return ( list2 == null );
+ }
+ if(list2 == null){
+ return ( list1 == null );
+ }
+
+ Iterator<AppServiceCapability> iterator1 = list1.iterator();
+ Iterator<AppServiceCapability> iterator2 = list2.iterator();
+
+ while(iterator1.hasNext() && iterator2.hasNext()){
+ AppServiceCapability chunk1 = iterator1.next();
+ AppServiceCapability chunk2 = iterator2.next();
+
+ if(!validateAppServiceRecord(chunk1.getUpdatedAppServiceRecord(), chunk2.getUpdatedAppServiceRecord())){
+ return false;
+ }
+
+ if (!chunk1.getUpdateReason().equals(chunk2.getUpdateReason())){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateMediaServiceManifest(MediaServiceManifest params1, MediaServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationServiceManifest(NavigationServiceManifest params1, NavigationServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getAcceptsWayPoints().equals(params2.getAcceptsWayPoints())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceRecord(AppServiceRecord params1, AppServiceRecord params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getServiceActive().equals(params2.getServiceActive())){
+ return false;
+ }
+
+ if (!params1.getServicePublished().equals(params2.getServicePublished())){
+ return false;
+ }
+
+ if (!params1.getServiceId().equals(params2.getServiceId())){
+ return false;
+ }
+
+ if (!validateAppServiceManifest(params1.getServiceManifest(), params2.getServiceManifest())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceManifest(AppServiceManifest params1, AppServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getAllowAppConsumers().equals(params2.getAllowAppConsumers())){
+ return false;
+ }
+
+ if (!validateImage(params1.getServiceIcon(), params2.getServiceIcon())){
+ return false;
+ }
+
+ if (!params1.getServiceName().equals(params2.getServiceName())){
+ return false;
+ }
+
+ if (!params1.getServiceType().equals(params2.getServiceType())){
+ return false;
+ }
+
+ if (!validateSdlMsgVersion(params1.getRpcSpecVersion(),params2.getRpcSpecVersion())){
+ return false;
+ }
+
+ if (!validateMediaServiceManifest(params1.getMediaServiceManifest(), params2.getMediaServiceManifest())) {
+ return false;
+ }
+
+ if (!validateWeatherServiceManifest(params1.getWeatherServiceManifest(), params2.getWeatherServiceManifest())){
+ return false;
+ }
+
+ if (!validateIntegerList(params1.getHandledRpcs(), params2.getHandledRpcs())){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherServiceManifest(WeatherServiceManifest params1, WeatherServiceManifest params2){
+ if(params1 == null){
+ return ( params2 == null );
+ }
+ if(params2 == null){
+ return ( params1 == null );
+ }
+
+ if (!params1.getMaxHourlyForecastAmount().equals(params2.getMaxHourlyForecastAmount())){
+ return false;
+ }
+
+ if (!params1.getMaxMinutelyForecastAmount().equals(params2.getMaxMinutelyForecastAmount())){
+ return false;
+ }
+
+ if (!params1.getMaxMultidayForecastAmount().equals(params2.getMaxMultidayForecastAmount())){
+ return false;
+ }
+
+ if (params1.getCurrentForecastSupported()!=params2.getCurrentForecastSupported()){
+ return false;
+ }
+
+ if (params1.getWeatherForLocationSupported()!=params2.getWeatherForLocationSupported()){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateLocationDetails(LocationDetails params1, LocationDetails params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getAddressLines().equals(params2.getAddressLines())) {
+ return false;
+ }
+
+ if (!validateCoordinate(params1.getCoordinate(), params2.getCoordinate())) {
+ return false;
+ }
+
+ if (!params1.getLocationDescription().equals(params2.getLocationDescription())) {
+ return false;
+ }
+
+ if (!params1.getPhoneNumber().equals(params2.getPhoneNumber())) {
+ return false;
+ }
+
+ if (!validateImage(params1.getLocationImage(), params2.getLocationImage())) {
+ return false;
+ }
+
+ if (!params1.getLocationName().equals(params2.getLocationName())) {
+ return false;
+ }
+
+ if (!validateOasisAddress(params1.getSearchAddress(), params2.getSearchAddress())) {
+ return false;
+ }
+ return true;
+ }
+
public static boolean validateChoice(Choice choice1, Choice choice2){
if(choice1 == null){
return ( choice2 == null );
@@ -1217,6 +1463,7 @@ public class Validator{
return ( item1 == null );
}
+
if(item1.getCharacterSet() != item2.getCharacterSet()){
return false;
}
@@ -1274,6 +1521,425 @@ public class Validator{
return true;
}
+ public static boolean validateWeatherDataList(List<WeatherData> item1Array, List<WeatherData> item2Array) {
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateWeatherData(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateWeatherData(WeatherData item1, WeatherData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateTemperature(item1.getCurrentTemperature(), item2.getCurrentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureHigh(), item2.getTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureLow(), item2.getTemperatureLow())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperature(), item2.getApparentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureHigh(), item2.getApparentTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureLow(), item2.getApparentTemperatureLow())) {
+ return false;
+ }
+
+ if (!item1.getWeatherSummary().equals(item2.getWeatherSummary())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getTime(), item2.getTime())) {
+ return false;
+ }
+
+ if (!item1.getHumidity().equals(item2.getHumidity())) {
+ return false;
+ }
+
+ if (!item1.getCloudCover().equals(item2.getCloudCover())) {
+ return false;
+ }
+
+ if (!item1.getMoonPhase().equals(item2.getMoonPhase())) {
+ return false;
+ }
+
+ if (!item1.getWindBearing().equals(item2.getWindBearing())) {
+ return false;
+ }
+
+ if (!item1.getWindGust().equals(item2.getWindGust())) {
+ return false;
+ }
+
+ if (!item1.getWindSpeed().equals(item2.getWindSpeed())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormBearing().equals(item2.getNearestStormBearing())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormDistance().equals(item2.getNearestStormDistance())) {
+ return false;
+ }
+
+ if (!item1.getPrecipAccumulation().equals(item2.getPrecipAccumulation())) {
+ return false;
+ }
+
+ if (!item1.getPrecipIntensity().equals(item2.getPrecipIntensity())) {
+ return false;
+ }
+
+ if (!item1.getPrecipProbability().equals(item2.getPrecipProbability())) {
+ return false;
+ }
+
+ if (!item1.getPrecipType().equals(item2.getPrecipType())) {
+ return false;
+ }
+
+ if (!item1.getVisibility().equals(item2.getVisibility())) {
+ return false;
+ }
+
+ if (!item1.getWeatherIconImageName().equals(item2.getWeatherIconImageName())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherAlertList(List<WeatherAlert> item1Array, List<WeatherAlert> item2Array) {
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateWeatherAlert(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateNavigationInstructionList(List<NavigationInstruction> item1Array, List<NavigationInstruction> item2Array) {
+ if (item1Array == null && item2Array == null){
+ return true;
+ }
+
+ if (item1Array == null || item2Array == null){
+ return false;
+ }
+
+ if(item1Array.size() != item2Array.size()){
+ return false;
+ }
+
+ for(int i = 0; i < item1Array.size(); i++){
+ if(!validateNavigationInstruction(item1Array.get(i), item2Array.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateNavigationInstruction(NavigationInstruction item1, NavigationInstruction item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateLocationDetails(item1.getLocationDetails(),item2.getLocationDetails())) {
+ return false;
+ }
+
+ if (!item1.getAction().equals(item2.getAction())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getEta(),item2.getEta())) {
+ return false;
+ }
+
+ if (!item1.getBearing().equals(item2.getBearing())) {
+ return false;
+ }
+
+ if (!item1.getJunctionType().equals(item2.getJunctionType())) {
+ return false;
+ }
+
+ if (!item1.getDrivingSide().equals(item2.getDrivingSide())) {
+ return false;
+ }
+
+ if (!item1.getDetails().equals(item2.getDetails())) {
+ return false;
+ }
+
+ if (!validateImage(item1.getImage(),item2.getImage())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateMediaServiceData(MediaServiceData item1, MediaServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!item1.getMediaType().equals(item2.getMediaType())) {
+ return false;
+ }
+
+ if (!item1.getMediaTitle().equals(item2.getMediaTitle())) {
+ return false;
+ }
+
+ if (!item1.getMediaArtist().equals(item2.getMediaArtist())) {
+ return false;
+ }
+
+ if (!item1.getMediaAlbum().equals(item2.getMediaAlbum())) {
+ return false;
+ }
+
+ if (!item1.getPlaylistName().equals(item2.getPlaylistName())) {
+ return false;
+ }
+
+ if (!item1.getIsExplicit().equals(item2.getIsExplicit())) {
+ return false;
+ }
+
+ if (!item1.getTrackPlaybackProgress().equals(item2.getTrackPlaybackProgress())) {
+ return false;
+ }
+
+ if (!item1.getTrackPlaybackDuration().equals(item2.getTrackPlaybackDuration())) {
+ return false;
+ }
+
+ if (!item1.getQueuePlaybackProgress().equals(item2.getQueuePlaybackProgress())) {
+ return false;
+ }
+
+ if (!item1.getQueueCurrentTrackNumber().equals(item2.getQueueCurrentTrackNumber())) {
+ return false;
+ }
+
+ if (!item1.getQueuePlaybackDuration().equals(item2.getQueuePlaybackDuration())) {
+ return false;
+ }
+
+ if (!item1.getQueueTotalTrackCount().equals(item2.getQueueTotalTrackCount())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherServiceData(WeatherServiceData item1, WeatherServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateLocationDetails(item1.getLocation(), item2.getLocation())) {
+ return false;
+ }
+
+ if (!validateWeatherData(item1.getCurrentForecast(), item2.getCurrentForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getHourlyForecast(), item2.getHourlyForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getMinuteForecast(), item2.getMinuteForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherDataList(item1.getMultidayForecast(), item2.getMultidayForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherAlertList(item1.getAlerts(), item2.getAlerts())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationServiceData(NavigationServiceData item1, NavigationServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateDateTime(item1.getTimeStamp(), item2.getTimeStamp())) {
+ return false;
+ }
+
+ if (!validateLocationDetails(item1.getOrigin(), item2.getOrigin())) {
+ return false;
+ }
+
+ if (!validateLocationDetails(item1.getDestination(), item2.getDestination())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getDestinationETA(), item2.getDestinationETA())) {
+ return false;
+ }
+
+ if (!validateNavigationInstructionList(item1.getInstructions(), item2.getInstructions())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getNextInstructionETA(), item2.getNextInstructionETA())) {
+ return false;
+ }
+
+ if (item1.getNextInstructionDistance() != null && item2.getNextInstructionDistance() != null && !item1.getNextInstructionDistance().equals(item2.getNextInstructionDistance())) {
+ return false;
+ }
+
+ if (item1.getNextInstructionDistanceScale() != null && item2.getNextInstructionDistanceScale() != null && !item1.getNextInstructionDistanceScale().equals(item2.getNextInstructionDistanceScale())) {
+ return false;
+ }
+
+ if (item1.getPrompt() != null && item1.getPrompt() != null && !item1.getPrompt().equals(item2.getPrompt())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherAlert(WeatherAlert item1, WeatherAlert item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateDateTime(item1.getExpires(), item2.getExpires())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getTimeIssued(), item2.getTimeIssued())) {
+ return false;
+ }
+
+ if (!item1.getTitle().equals(item2.getTitle())) {
+ return false;
+ }
+
+ if (!item1.getSummary().equals(item2.getSummary())) {
+ return false;
+ }
+
+ if (!item1.getSeverity().equals(item2.getSeverity())) {
+ return false;
+ }
+
+ if (!validateStringList(item1.getRegions(), item2.getRegions())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateDateTime(DateTime item1, DateTime item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if(item1.getDay() != item2.getDay()){
+ return false;
+ }
+
+ if(item1.getHour() != item2.getHour()){
+ return false;
+ }
+
+ if(item1.getMilliSecond() != item2.getMilliSecond()){
+ return false;
+ }
+
+ if(item1.getMinute() != item2.getMinute()){
+ return false;
+ }
+
+ if(item1.getMonth() != item2.getMonth()){
+ return false;
+ }
+
+ if(item1.getSecond() != item2.getSecond()){
+ return false;
+ }
+
+ if(item1.getTzHour() != item2.getTzHour()){
+ return false;
+ }
+
+ if(item1.getTzMinute() != item2.getTzMinute()){
+ return false;
+ }
+
+ if(item1.getYear() != item2.getYear()){
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateGpsData(GPSData item1, GPSData item2){
if(item1 == null){
return ( item2 == null );
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index 3797c648b..da48c692d 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -31,13 +31,16 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
+import com.smartdevicelink.proxy.rpc.OnAppServiceData;
import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
@@ -52,13 +55,17 @@ import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.OnRCStatus;
import com.smartdevicelink.proxy.rpc.OnStreamRPC;
+import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteraction;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
@@ -658,9 +665,39 @@ public class SdlProxyBaseTests extends AndroidTestCase2 {
}
- @Override
- public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
+ @Override
+ public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
- }
+ }
+
+ @Override
+ public void onPublishAppServiceResponse(PublishAppServiceResponse response) {
+
+ }
+
+ @Override
+ public void onGetAppServiceDataResponse(GetAppServiceDataResponse response) {
+
+ }
+
+ @Override
+ public void onGetFileResponse(GetFileResponse response) {
+
+ }
+
+ @Override
+ public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response) {
+
+ }
+
+ @Override
+ public void onOnAppServiceData(OnAppServiceData notification) {
+
+ }
+
+ @Override
+ public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification) {
+
+ }
}
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
index 91bd19d34..91fbf6dde 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
@@ -173,6 +173,9 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
public void sendRPCRequest(RPCRequest message) {}
@Override
+ public void sendRPC(RPCRequest message) {}
+
+ @Override
public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
new file mode 100644
index 000000000..6bd5fe01e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServiceRecord;
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceCapability}
+ */
+public class AppServiceCapabilityTest extends TestCase {
+
+ private AppServiceCapability msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServiceCapability();
+ msg.setUpdatedAppServiceRecord(Test.GENERAL_APP_SERVICE_RECORD);
+ msg.setUpdateReason(Test.GENERAL_SERVICE_UPDATE_REASON);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ ServiceUpdateReason updateReason = msg.getUpdateReason();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APP_SERVICE_RECORD);
+ assertEquals(Test.MATCH, updateReason, Test.GENERAL_SERVICE_UPDATE_REASON);
+
+ // Invalid/Null Tests
+ AppServiceCapability msg = new AppServiceCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getUpdatedAppServiceRecord());
+ assertNull(Test.NULL, msg.getUpdateReason());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceCapability(Test.GENERAL_APP_SERVICE_RECORD);
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ assertEquals(Test.MATCH, serviceRecord, Test.GENERAL_APP_SERVICE_RECORD);
+ }
+
+ 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_APP_SERVICE_RECORD);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ 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_APP_SERVICE_RECORD, new AppServiceRecord(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
new file mode 100644
index 000000000..9fec35631
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
@@ -0,0 +1,118 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceData}
+ */
+public class AppServiceDataTests extends TestCase {
+
+ private AppServiceData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppServiceData();
+ msg.setServiceType(Test.GENERAL_STRING);
+ msg.setServiceId(Test.GENERAL_STRING);
+ msg.setMediaServiceData(Test.GENERAL_MEDIASERVICE_DATA);
+ msg.setWeatherServiceData(Test.GENERAL_WEATHERSERVICE_DATA);
+ msg.setNavigationServiceData(Test.GENERAL_NAVIGATIONSERVICE_DATA);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceId();
+ MediaServiceData mediaServiceData = msg.getMediaServiceData();
+ WeatherServiceData weatherServiceData = msg.getWeatherServiceData();
+ NavigationServiceData navigationServiceData = msg.getNavigationServiceData();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(Test.GENERAL_STRING, serviceId);
+ assertEquals(Test.GENERAL_MEDIASERVICE_DATA, mediaServiceData);
+ assertEquals(Test.GENERAL_WEATHERSERVICE_DATA, weatherServiceData);
+ assertEquals(Test.GENERAL_NAVIGATIONSERVICE_DATA, navigationServiceData);
+
+ // Invalid/Null Tests
+ AppServiceData msg = new AppServiceData();
+ assertNotNull(Test.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());
+
+ }
+
+ public void testRequiredParamsConstructor(){
+
+ msg = new AppServiceData(Test.GENERAL_STRING, Test.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceId();
+ assertEquals(Test.GENERAL_STRING, appServiceType);
+ assertEquals(Test.GENERAL_STRING, serviceId);
+
+ }
+
+ public void testJson(){
+ 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_MEDIASERVICE_DATA);
+ reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, Test.GENERAL_WEATHERSERVICE_DATA);
+ reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, Test.GENERAL_NAVIGATIONSERVICE_DATA);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ 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_MEDIASERVICE_DATA, 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_WEATHERSERVICE_DATA, 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_NAVIGATIONSERVICE_DATA, new NavigationServiceData(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
new file mode 100644
index 000000000..99bd5b716
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
@@ -0,0 +1,148 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServiceManifest;
+import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceManifest}
+ */
+public class AppServiceManifestTests extends TestCase {
+
+ private AppServiceManifest msg;
+
+ @Override
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Image serviceIcon = msg.getServiceIcon();
+ String serviceName = msg.getServiceName();
+ String appServiceType = msg.getServiceType();
+ boolean allowAppConsumers = msg.getAllowAppConsumers();
+ SdlMsgVersion version = msg.getRpcSpecVersion();
+ List<Integer> handledRPCs = msg.getHandledRpcs();
+ WeatherServiceManifest weatherServiceManifestTest = msg.getWeatherServiceManifest();
+ MediaServiceManifest mediaServiceManifestTest = msg.getMediaServiceManifest();
+ 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);
+
+ // 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());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceManifest(Test.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ assertEquals(Test.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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(AppServiceManifest.KEY_RPC_SPEC_VERSION)){
+ 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.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> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
+ assertTrue(Test.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)));
+ }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)));
+ } 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)));
+ }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()));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
new file mode 100644
index 000000000..af58b12fb
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServiceRecord}
+ */
+public class AppServiceRecordTests extends TestCase {
+
+ private AppServiceRecord msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServiceRecord();
+ msg.setServicePublished(Test.GENERAL_BOOLEAN);
+ msg.setServiceActive(Test.GENERAL_BOOLEAN);
+ msg.setServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST);
+ msg.setServiceId(Test.GENERAL_STRING);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceId();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(Test.GENERAL_APP_SERVICE_MANIFEST, serviceManifest);
+ assertEquals(Test.GENERAL_STRING, serviceID);
+
+ // Invalid/Null Tests
+ AppServiceRecord msg = new AppServiceRecord();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getServicePublished());
+ assertNull(Test.NULL, msg.getServiceActive());
+ assertNull(Test.NULL, msg.getServiceManifest());
+ assertNull(Test.NULL, msg.getServiceId());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new AppServiceRecord(Test.GENERAL_STRING, Test.GENERAL_APP_SERVICE_MANIFEST, Test.GENERAL_BOOLEAN, Test.GENERAL_BOOLEAN);
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceId();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(Test.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(Test.GENERAL_APP_SERVICE_MANIFEST, serviceManifest);
+ assertEquals(Test.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_APP_SERVICE_MANIFEST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ 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_APP_SERVICE_MANIFEST, new AppServiceManifest(hashTest)));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
new file mode 100644
index 000000000..bb2d102f2
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.AppServiceCapability;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.AppServicesCapabilities}
+ */
+public class AppServicesCapabilitiesTests extends TestCase {
+
+ private AppServicesCapabilities msg;
+
+ @Override
+ public void setUp(){
+
+ msg = new AppServicesCapabilities();
+ msg.setAppServices(Test.GENERAL_APPSERVICECAPABILITY_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<AppServiceCapability> serviceCapabilityList = msg.getAppServices();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, serviceCapabilityList, Test.GENERAL_APPSERVICECAPABILITY_LIST);
+
+ // Invalid/Null Tests
+ AppServicesCapabilities msg = new AppServicesCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getAppServices());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(AppServicesCapabilities.KEY_APP_SERVICES, Test.GENERAL_APPSERVICETYPE_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.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> list2 = JsonUtils.readAppServiceCapabilityListFromJsonObject(underTest, key);
+ assertTrue(Test.TRUE, Validator.validateAppServiceCapabilityList(list1,list2));
+ }else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
new file mode 100644
index 000000000..2b4c352c5
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
@@ -0,0 +1,121 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MediaServiceData;
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MediaServiceData}
+ */
+public class MediaServiceDataTests extends TestCase {
+
+ private MediaServiceData msg;
+
+ @Override
+ 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.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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ MediaType mediaType = msg.getMediaType();
+ String mediaTitle = msg.getMediaTitle();
+ String mediaArtist = msg.getMediaArtist();
+ String mediaAlbum = msg.getMediaAlbum();
+ String playlistName = msg.getPlaylistName();
+ boolean isExplicit = msg.getIsExplicit();
+ Integer trackPlaybackProgress = msg.getTrackPlaybackProgress();
+ Integer trackPlaybackDuration = msg.getTrackPlaybackDuration();
+ Integer queuePlaybackProgress = msg.getQueuePlaybackProgress();
+ Integer queuePlaybackDuration = msg.getQueuePlaybackDuration();
+ Integer queueCurrentTrackNumber = msg.getQueueCurrentTrackNumber();
+ 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_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);
+
+ // 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.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());
+ }
+
+ 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_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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.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));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
new file mode 100644
index 000000000..85332bc0c
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
@@ -0,0 +1,30 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MediaServiceManifest}
+ */
+public class MediaServiceManifestTests extends TestCase {
+
+ @Override
+ public void setUp(){
+ // nothing to setup yet, this class doesn't contain anything
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+
+ // Invalid/Null Tests
+ MediaServiceManifest msg = new MediaServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+ }
+
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
new file mode 100644
index 000000000..38500561b
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
@@ -0,0 +1,134 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+import com.smartdevicelink.proxy.rpc.NavigationInstruction;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationInstruction}
+ */
+public class NavigationInstructionTests extends TestCase {
+
+ private NavigationInstruction msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationInstruction();
+
+ msg.setLocationDetails(Test.GENERAL_LOCATIONDETAILS);
+ msg.setAction(Test.GENERAL_NAVIGATION_ACTION);
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+ DateTime eta = msg.getEta();
+ Integer bearing = msg.getBearing();
+ NavigationJunction junctionType = msg.getJunctionType();
+ Direction drivingSide = msg.getDrivingSide();
+ String details = msg.getDetails();
+ Image image = msg.getImage();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(Test.GENERAL_NAVIGATION_ACTION, 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);
+
+ // 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());
+ }
+
+ public void testRequiredConstructor(){
+ NavigationInstruction msg = new NavigationInstruction(Test.GENERAL_LOCATIONDETAILS, Test.GENERAL_NAVIGATION_ACTION);
+ assertNotNull(Test.NOT_NULL, msg);
+
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+
+ assertEquals(Test.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(Test.GENERAL_NAVIGATION_ACTION, 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_NAVIGATION_ACTION);
+ 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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ 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()));
+ }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)));
+ }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)));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
new file mode 100644
index 000000000..9b59062d4
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
@@ -0,0 +1,143 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationServiceData}
+ */
+public class NavigationServiceDataTests extends TestCase {
+
+ private NavigationServiceData msg;
+
+ @Override
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ DateTime timestamp = msg.getTimeStamp();
+ LocationDetails origin = msg.getOrigin();
+ LocationDetails destination = msg.getDestination();
+ DateTime destinationETA = msg.getDestinationETA();
+ List<NavigationInstruction> instructions = msg.getInstructions();
+ DateTime nextInstructionETA = msg.getNextInstructionETA();
+ Float nextInstructionDistance = msg.getNextInstructionDistance();
+ Float nextInstructionDistanceScale = msg.getNextInstructionDistanceScale();
+ 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);
+
+ // 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());
+ }
+
+ public void testRequiredConstructor(){
+ NavigationServiceData msg = new NavigationServiceData(Test.GENERAL_DATETIME);
+ assertNotNull(Test.NOT_NULL, msg);
+
+ DateTime locationDetails = msg.getTimeStamp();
+
+ assertEquals(Test.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);
+
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ 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)));
+ }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)));
+ }else if (key.equals(NavigationServiceData.KEY_INSTRUCTIONS)){
+ JSONArray NavigationInstructionUnderTestListArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<NavigationInstruction> NavigationInstructionUnderTestList = new ArrayList<>();
+ for (int index = 0; index < NavigationInstructionUnderTestListArrayObjTest.length(); index++) {
+ NavigationInstruction NavigationInstructionData = new NavigationInstruction(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)NavigationInstructionUnderTestListArrayObjTest.get(index) ));
+ NavigationInstructionUnderTestList.add(NavigationInstructionData);
+ }
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateNavigationInstructionList(Test.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
+ }else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
new file mode 100644
index 000000000..de4144677
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
@@ -0,0 +1,64 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.NavigationServiceManifest}
+ */
+public class NavigationServiceManifestTests extends TestCase {
+
+ private NavigationServiceManifest msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationServiceManifest();
+
+ msg.setAcceptsWayPoints(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean acceptsWayPoints = msg.getAcceptsWayPoints();
+
+ // Valid Tests
+ assertEquals(Test.GENERAL_BOOLEAN, acceptsWayPoints);
+
+ // Invalid/Null Tests
+ NavigationServiceManifest msg = new NavigationServiceManifest();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getAcceptsWayPoints());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.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));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
index aa0d75c07..bc50907db 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -1,6 +1,9 @@
package com.smartdevicelink.test.rpc.datatypes;
+import android.util.Log;
+
import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
@@ -20,7 +23,7 @@ import java.util.Iterator;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SystemCapability}
+ * {@link com.smartdevicelink.proxy.rpc.SystemCapability}
*/
public class SystemCapabilityTests extends TestCase {
@@ -34,6 +37,7 @@ public class SystemCapabilityTests extends TestCase {
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);
}
@@ -46,12 +50,14 @@ public class SystemCapabilityTests extends TestCase {
NavigationCapability testNavigationCapability = (NavigationCapability) msg.getCapabilityForType(SystemCapabilityType.NAVIGATION);
PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL);
RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL);
+ AppServicesCapabilities testAppServicesCapabilities = (AppServicesCapabilities) msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES);
// 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));
// Invalid/Null Tests
SystemCapability msg = new SystemCapability();
@@ -61,6 +67,7 @@ public class SystemCapabilityTests extends TestCase {
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));
}
public void testJson() {
@@ -71,6 +78,7 @@ public class SystemCapabilityTests extends TestCase {
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()));
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -97,6 +105,14 @@ public class SystemCapabilityTests extends TestCase {
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)));
+ }else if(key.equals(SystemCapability.KEY_APP_SERVICES_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);
+ Log.i("TEST REF", hashReference.toString());
+ Log.i("TEST TEST", hashTest.toString());
+ assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
new file mode 100644
index 000000000..4a8ade572
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
@@ -0,0 +1,112 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherAlert}
+ */
+public class WeatherAlertTests extends TestCase {
+
+ private WeatherAlert msg;
+
+ @Override
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ DateTime expires = msg.getExpires();
+ DateTime issued = msg.getTimeIssued();
+ List<String> regions = msg.getRegions();
+ String severity = msg.getSeverity();
+ String summary = msg.getSummary();
+ 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);
+
+ // 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());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new WeatherAlert(Test.GENERAL_STRING_LIST);
+ List<String> regions = msg.getRegions();
+ assertEquals(Test.MATCH, regions, Test.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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ 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)));
+ } 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)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
new file mode 100644
index 000000000..70454f5c3
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
@@ -0,0 +1,184 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DateTime;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherData}
+ */
+public class WeatherDataTests extends TestCase {
+
+ private WeatherData msg;
+
+ @Override
+ 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.setWeatherIconImageName(Test.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Temperature currentTemperature = msg.getCurrentTemperature();
+ Temperature temperatureHigh = msg.getTemperatureHigh();
+ Temperature temperatureLow = msg.getTemperatureLow();
+ Temperature apparentTemperature = msg.getApparentTemperature();
+ Temperature apparentTemperatureHigh = msg.getApparentTemperatureHigh();
+ String weatherSummary = msg.getWeatherSummary();
+ DateTime time = msg.getTime();
+ Float humidity = msg.getHumidity();
+ Float cloudCover = msg.getCloudCover();
+ Float moonPhase = msg.getMoonPhase();
+ Integer windBearing = msg.getWindBearing();
+ Float windGust = msg.getWindGust();
+ Float windSpeed = msg.getWindSpeed();
+ Integer nearestStormBearing = msg.getNearestStormBearing();
+ Integer nearestStormDistance = msg.getNearestStormDistance();
+ Float precipAccumulation = msg.getPrecipAccumulation();
+ Float precipIntensity = msg.getPrecipIntensity();
+ Float precipProbability = msg.getPrecipProbability();
+ String precipType = msg.getPrecipType();
+ Float visibility = msg.getVisibility();
+ String weatherIconImageName = msg.getWeatherIconImageName();
+
+ // 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, weatherIconImageName, Test.GENERAL_STRING);
+
+ // 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.getWeatherIconImageName());
+ }
+
+ 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_IMAGE_NAME, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(WeatherData.KEY_CURRENT_TEMPERATURE) || key.equals(WeatherData.KEY_TEMPERATURE_HIGH)||
+ key.equals(WeatherData.KEY_TEMPERATURE_LOW) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE)||
+ 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)));
+ } 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)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
new file mode 100644
index 000000000..09c976538
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
@@ -0,0 +1,142 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.LocationDetails;
+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.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherServiceData}
+ */
+public class WeatherServiceDataTests extends TestCase {
+
+ private WeatherServiceData msg;
+
+ @Override
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ LocationDetails location = msg.getLocation();
+ WeatherData currentForecast = msg.getCurrentForecast();
+ List<WeatherData> minuteForecast = msg.getMinuteForecast();
+ List<WeatherData> hourlyForecast = msg.getHourlyForecast();
+ List<WeatherData> multidayForecast = msg.getMultidayForecast();
+ 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);
+
+ // 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());
+ }
+
+ public void testRequiredParamsConstructor(){
+ msg = new WeatherServiceData(Test.GENERAL_LOCATIONDETAILS);
+ LocationDetails location = msg.getLocation();
+ assertEquals(Test.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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(WeatherServiceData.KEY_LOCATION)){
+
+ 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)));
+
+ } 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)));
+
+ } else if(key.equals(WeatherServiceData.KEY_MINUTE_FORECAST) || key.equals(WeatherServiceData.KEY_HOURLY_FORECAST)
+ || key.equals(WeatherServiceData.KEY_MULTIDAY_FORECAST)){
+
+ JSONArray weatherDataArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherData> weatherDataUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherDataArrayObjTest.length(); index++) {
+ WeatherData weatherData1 = new WeatherData(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherDataArrayObjTest.get(index) ));
+ weatherDataUnderTestList.add(weatherData1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherDataList(Test.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
+
+ } else if(key.equals(WeatherServiceData.KEY_ALERTS)){
+
+ JSONArray weatherAlertArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherAlert> weatherAlertUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherAlertArrayObjTest.length(); index++) {
+ WeatherAlert weatherAlert1 = new WeatherAlert(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherAlertArrayObjTest.get(index) ));
+ weatherAlertUnderTestList.add(weatherAlert1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherAlertList(Test.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
new file mode 100644
index 000000000..cbd65fae7
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
@@ -0,0 +1,84 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WeatherServiceManifest}
+ */
+public class WeatherServiceManifestTests extends TestCase {
+
+ private WeatherServiceManifest msg;
+
+ @Override
+ 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);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean currentForecastSupported = msg.getCurrentForecastSupported();
+ boolean weatherForLocationSupported = msg.getWeatherForLocationSupported();
+ Integer getMaxHourlyForecastAmt = msg.getMaxHourlyForecastAmount();
+ Integer getMaxMinutelyForecastAmt = msg.getMaxMinutelyForecastAmount();
+ 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);
+
+ // Invalid/Null Tests
+ WeatherServiceManifest msg = new WeatherServiceManifest();
+ assertNotNull(Test.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());
+ }
+
+ 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);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.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));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
new file mode 100644
index 000000000..ce4867e41
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.AppServiceType}
+ */
+public class AppServiceTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "MEDIA";
+ AppServiceType enumMedia = AppServiceType.valueForString(example);
+ example = "WEATHER";
+ AppServiceType enumWeather = AppServiceType.valueForString(example);
+ example = "NAVIGATION";
+ AppServiceType enumNavigation = AppServiceType.valueForString(example);
+
+ assertNotNull("MEDIA returned null", enumMedia);
+ assertNotNull("WEATHER returned null", enumWeather);
+ assertNotNull("NAVIGATION returned null", enumNavigation);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "MedIas";
+ try {
+ AppServiceType temp = AppServiceType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ AppServiceType temp = AppServiceType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of AppServiceType.
+ */
+ public void testListEnum() {
+ List<AppServiceType> enumValueList = Arrays.asList(AppServiceType.values());
+
+ List<AppServiceType> enumTestList = new ArrayList<>();
+ enumTestList.add(AppServiceType.MEDIA);
+ enumTestList.add(AppServiceType.NAVIGATION);
+ enumTestList.add(AppServiceType.WEATHER);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
new file mode 100644
index 000000000..76492878d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
@@ -0,0 +1,71 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.Direction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.Direction}
+ */
+public class DirectionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "LEFT";
+ Direction enumLeft = Direction.valueForString(example);
+ example = "RIGHT";
+ Direction enumRight = Direction.valueForString(example);
+
+ assertNotNull("LEFT returned null", enumLeft);
+ assertNotNull("RIGHT returned null", enumRight);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ Direction temp = Direction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ Direction temp = Direction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of Direction.
+ */
+ public void testListEnum() {
+ List<Direction> enumValueList = Arrays.asList(Direction.values());
+
+ List<Direction> enumTestList = new ArrayList<>();
+ enumTestList.add(Direction.LEFT);
+ enumTestList.add(Direction.RIGHT);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
new file mode 100644
index 000000000..835045418
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
@@ -0,0 +1,77 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MediaType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.MediaType}
+ */
+public class MediaTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MUSIC";
+ MediaType enumMusic = MediaType.valueForString(example);
+ example = "PODCAST";
+ MediaType enumPodcast = MediaType.valueForString(example);
+ example = "AUDIOBOOK";
+ MediaType enumAudioBook = MediaType.valueForString(example);
+ example = "OTHER";
+ MediaType enumOther = MediaType.valueForString(example);
+
+ assertNotNull("MUSIC returned null", enumMusic);
+ assertNotNull("PODCAST returned null", enumPodcast);
+ assertNotNull("AUDIOBOOK returned null", enumAudioBook);
+ assertNotNull("OTHER returned null", enumOther);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "PudCAsT";
+ try {
+ MediaType temp = MediaType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MediaType temp = MediaType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of MediaType.
+ */
+ public void testListEnum() {
+ List<MediaType> enumValueList = Arrays.asList(MediaType.values());
+
+ List<MediaType> enumTestList = new ArrayList<MediaType>();
+ enumTestList.add(MediaType.MUSIC);
+ enumTestList.add(MediaType.PODCAST);
+ enumTestList.add(MediaType.AUDIOBOOK);
+ enumTestList.add(MediaType.OTHER);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
new file mode 100644
index 000000000..5051ef337
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
@@ -0,0 +1,92 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.NavigationAction}
+ */
+public class NavigationActionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "TURN";
+ NavigationAction enumTurn = NavigationAction.valueForString(example);
+ example = "EXIT";
+ NavigationAction enumExit = NavigationAction.valueForString(example);
+ example = "STAY";
+ NavigationAction enumStay = NavigationAction.valueForString(example);
+ example = "MERGE";
+ NavigationAction enumMerge = NavigationAction.valueForString(example);
+ example = "FERRY";
+ NavigationAction enumFerry = NavigationAction.valueForString(example);
+ example = "CAR_SHUTTLE_TRAIN";
+ NavigationAction enumCarShuttleTrain = NavigationAction.valueForString(example);
+ example = "WAYPOINT";
+ NavigationAction enumWaypoint = NavigationAction.valueForString(example);
+
+ assertNotNull("TURN returned null", enumTurn);
+ assertNotNull("EXIT returned null", enumExit);
+ assertNotNull("STAY returned null", enumStay);
+ assertNotNull("MERGE returned null", enumMerge);
+ assertNotNull("FERRY returned null", enumFerry);
+ assertNotNull("CAR_SHUTTLE_TRAIN returned null", enumCarShuttleTrain);
+ assertNotNull("WAYPOINT returned null", enumWaypoint);
+
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ NavigationAction temp = NavigationAction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ NavigationAction temp = NavigationAction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of NavigationAction.
+ */
+ public void testListEnum() {
+ List<NavigationAction> enumValueList = Arrays.asList(NavigationAction.values());
+
+ List<NavigationAction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationAction.TURN);
+ enumTestList.add(NavigationAction.EXIT);
+ enumTestList.add(NavigationAction.STAY);
+ enumTestList.add(NavigationAction.MERGE);
+ enumTestList.add(NavigationAction.FERRY);
+ enumTestList.add(NavigationAction.CAR_SHUTTLE_TRAIN);
+ enumTestList.add(NavigationAction.WAYPOINT);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
new file mode 100644
index 000000000..691480f78
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.NavigationJunction}
+ */
+public class NavigationJunctionTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "REGULAR";
+ NavigationJunction enumRegular = NavigationJunction.valueForString(example);
+ example = "BIFURCATION";
+ NavigationJunction enumBifurcation = NavigationJunction.valueForString(example);
+ example = "MULTI_CARRIAGEWAY";
+ NavigationJunction enumMultiCarriageway = NavigationJunction.valueForString(example);
+ example = "ROUNDABOUT";
+ NavigationJunction enumRoundabout = NavigationJunction.valueForString(example);
+ example = "TRAVERSABLE_ROUNDABOUT";
+ NavigationJunction enumTraversableRoundabout = NavigationJunction.valueForString(example);
+ example = "JUGHANDLE";
+ NavigationJunction enumJughandle = NavigationJunction.valueForString(example);
+ example = "ALL_WAY_YIELD";
+ NavigationJunction enumAllWayYield = NavigationJunction.valueForString(example);
+ example = "TURN_AROUND";
+ NavigationJunction enumTurnAround = NavigationJunction.valueForString(example);
+
+ assertNotNull("REGULAR returned null", enumRegular);
+ assertNotNull("BIFURCATION returned null", enumBifurcation);
+ assertNotNull("MULTI_CARRIAGEWAY returned null", enumMultiCarriageway);
+ assertNotNull("ROUNDABOUT returned null", enumRoundabout);
+ assertNotNull("TRAVERSABLE_ROUNDABOUT returned null", enumTraversableRoundabout);
+ assertNotNull("JUGHANDLE returned null", enumJughandle);
+ assertNotNull("ALL_WAY_YIELD returned null", enumAllWayYield);
+ assertNotNull("TURN_AROUND returned null", enumTurnAround);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "fRONT";
+ try {
+ NavigationJunction temp = NavigationJunction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ NavigationJunction temp = NavigationJunction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of NavigationJunction.
+ */
+ public void testListEnum() {
+ List<NavigationJunction> enumValueList = Arrays.asList(NavigationJunction.values());
+
+ List<NavigationJunction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationJunction.REGULAR);
+ enumTestList.add(NavigationJunction.BIFURCATION);
+ enumTestList.add(NavigationJunction.MULTI_CARRIAGEWAY);
+ enumTestList.add(NavigationJunction.ROUNDABOUT);
+ enumTestList.add(NavigationJunction.TRAVERSABLE_ROUNDABOUT);
+ enumTestList.add(NavigationJunction.JUGHANDLE);
+ enumTestList.add(NavigationJunction.ALL_WAY_YIELD);
+ enumTestList.add(NavigationJunction.TURN_AROUND);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
new file mode 100644
index 000000000..f2484ff9e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
@@ -0,0 +1,84 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason}
+ */
+public class ServiceUpdateReasonTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "PUBLISHED";
+ ServiceUpdateReason enumPublished = ServiceUpdateReason.valueForString(example);
+ example = "REMOVED";
+ ServiceUpdateReason enumRemoved = ServiceUpdateReason.valueForString(example);
+ example = "ACTIVATED";
+ ServiceUpdateReason enumActivated = ServiceUpdateReason.valueForString(example);
+ example = "DEACTIVATED";
+ ServiceUpdateReason enumDeactivated = ServiceUpdateReason.valueForString(example);
+ example = "MANIFEST_UPDATE";
+ ServiceUpdateReason enumManifestUpdate = ServiceUpdateReason.valueForString(example);
+
+
+ assertNotNull("PUBLISHED returned null", enumPublished);
+ assertNotNull("REMOVED returned null", enumRemoved);
+ assertNotNull("ACTIVATED returned null", enumActivated);
+ assertNotNull("DEACTIVATED returned null", enumDeactivated);
+ assertNotNull("MANIFEST_UPDATE returned null", enumManifestUpdate);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "HalFActIvAted";
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of ServiceUpdateReason.
+ */
+ public void testListEnum() {
+ List<ServiceUpdateReason> enumValueList = Arrays.asList(ServiceUpdateReason.values());
+
+ List<ServiceUpdateReason> enumTestList = new ArrayList<>();
+ enumTestList.add(ServiceUpdateReason.MANIFEST_UPDATE);
+ enumTestList.add(ServiceUpdateReason.ACTIVATED);
+ enumTestList.add(ServiceUpdateReason.DEACTIVATED);
+ enumTestList.add(ServiceUpdateReason.PUBLISHED);
+ enumTestList.add(ServiceUpdateReason.REMOVED);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
index 9bd68a2ad..f0f876d00 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -10,7 +10,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.SystemCapabilityType}
+ * {@link com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType}
*/
public class SystemCapabilityTypeTests extends TestCase {
@@ -46,6 +46,8 @@ public class SystemCapabilityTypeTests extends TestCase {
SystemCapabilityType enumVoiceRecognition = SystemCapabilityType.valueForString(example);
example = "PCM_STREAMING";
SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example);
+ example = "APP_SERVICES";
+ SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example);
assertNotNull("NAVIGATION returned null", enumNavigation);
assertNotNull("PHONE_CALL returned null", enumPhoneCall);
@@ -61,6 +63,7 @@ public class SystemCapabilityTypeTests extends TestCase {
assertNotNull("SPEECH returned null", enumSpeech);
assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition);
assertNotNull("PCM_STREAMING", enumPCM);
+ assertNotNull("APP_SERVICES", enumAppServices);
}
/**
@@ -112,6 +115,7 @@ public class SystemCapabilityTypeTests extends TestCase {
enumTestList.add(SystemCapabilityType.SPEECH);
enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION);
enumTestList.add(SystemCapabilityType.PCM_STREAMING);
+ enumTestList.add(SystemCapabilityType.APP_SERVICES);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
new file mode 100644
index 000000000..108ec930f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+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 org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.OnAppServiceData}
+ */
+public class OnAppServiceDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ OnAppServiceData msg = new OnAppServiceData();
+
+ msg.setServiceData(Test.GENERAL_APPSERVICE_DATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnAppServiceData.KEY_SERVICE_DATA, Test.GENERAL_APPSERVICE_DATA.serializeJSON());
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceData cmdId = ( (OnAppServiceData) msg ).getServiceData();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_APPSERVICE_DATA, cmdId);
+
+ // Invalid/Null Tests
+ OnAppServiceData msg = new OnAppServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceData());
+
+ // test constructor with param
+ msg = new OnAppServiceData(Test.GENERAL_APPSERVICE_DATA);
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(serviceData, Test.GENERAL_APPSERVICE_DATA);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
new file mode 100644
index 000000000..ca0fa5f02
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+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 org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated}
+ */
+public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+
+ msg.setSystemCapability(Test.GENERAL_SYSTEMCAPABILITY);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, Test.GENERAL_SYSTEMCAPABILITY.serializeJSON());
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ SystemCapability cmdId = ( (OnSystemCapabilityUpdated) msg ).getSystemCapability();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITY, cmdId);
+
+ // Invalid/Null Tests
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getSystemCapability());
+
+ // test constructor with param
+ msg = new OnSystemCapabilityUpdated(Test.GENERAL_SYSTEMCAPABILITY);
+ SystemCapability systemCapability = msg.getSystemCapability();
+ assertEquals(systemCapability, Test.GENERAL_SYSTEMCAPABILITY);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
new file mode 100644
index 000000000..abda43557
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class GetAppServiceDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetAppServiceData msg = new GetAppServiceData();
+ msg.setServiceType(Test.GENERAL_STRING);
+ msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetAppServiceData.KEY_SERVICE_TYPE, Test.GENERAL_STRING);
+ result.put(GetAppServiceData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ 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);
+
+ // Invalid/Null Tests
+ GetAppServiceData msg = new GetAppServiceData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(msg.getServiceType());
+ assertNull(msg.getSubscribe());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ GetAppServiceData msg = new GetAppServiceData(Test.GENERAL_STRING);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getServiceType());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ 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());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
new file mode 100644
index 000000000..48214373d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
@@ -0,0 +1,132 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+
+public class GetFileTests extends BaseRpcTests {
+
+ @Override
+ 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);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ 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);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String fileName = ( (GetFile) msg ).getFileName();
+ String appServiceId = ( (GetFile) msg ).getAppServiceId();
+ FileType fileType = ( (GetFile) msg ).getFileType();
+ Integer offset = ( (GetFile) msg ).getOffset();
+ 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);
+
+ // Invalid/Null Tests
+ GetFile msg = new GetFile();
+ assertNotNull(Test.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());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ GetFile msg = new GetFile(Test.GENERAL_STRING);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getFileName());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ 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());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
index 78d4507da..290a291d1 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
@@ -22,6 +22,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
GetSystemCapability msg = new GetSystemCapability();
msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ msg.setSubscribe(Test.GENERAL_BOOLEAN);
return msg;
}
@@ -42,6 +43,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
try{
result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ result.put(GetSystemCapability.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -55,9 +57,11 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
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);
// Invalid/Null Tests
GetSystemCapability msg = new GetSystemCapability();
@@ -65,6 +69,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
testNullBase(msg);
assertNull(Test.NULL, msg.getSystemCapabilityType());
+ assertNull(Test.NULL, msg.getSubscribe());
}
/**
@@ -88,6 +93,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
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());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
new file mode 100644
index 000000000..c5be9b14f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
@@ -0,0 +1,128 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+
+public class PerformAppServiceInteractionTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+
+ msg.setServiceUri(Test.GENERAL_STRING);
+ msg.setAppServiceId(Test.GENERAL_STRING);
+ msg.setOriginApp(Test.GENERAL_STRING);
+ msg.setRequestServiceActive(Test.GENERAL_BOOLEAN);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ 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);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String serviceUri = ( (PerformAppServiceInteraction) msg ).getServiceUri();
+ String appServiceId = ( (PerformAppServiceInteraction) msg ).getAppServiceId();
+ String originApp = ( (PerformAppServiceInteraction) msg ).getOriginApp();
+ 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);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceUri());
+ assertNull(Test.NULL, msg.getAppServiceId());
+ assertNull(Test.NULL, msg.getOriginApp());
+ assertNull(Test.NULL, msg.getRequestServiceActive());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+ // test with param in constructor
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction(Test.GENERAL_STRING,Test.GENERAL_STRING,Test.GENERAL_STRING);
+ String serviceUri = msg.getServiceUri();
+ String appServiceId = msg.getAppServiceId();
+ 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);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getAppServiceId());
+ 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());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
new file mode 100644
index 000000000..6d0d67490
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+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.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class PublishAppServiceTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ PublishAppService msg = new PublishAppService();
+ msg.setServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_MANIFEST.getStore()));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceManifest copy = ( (PublishAppService) msg ).getServiceManifest();
+
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST, copy));
+
+ // Invalid/Null Tests
+ PublishAppService msg = new PublishAppService();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getServiceManifest());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ PublishAppService msg = new PublishAppService(Test.GENERAL_APP_SERVICE_MANIFEST);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(Test.GENERAL_APP_SERVICE_MANIFEST, msg.getServiceManifest()));
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ 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.getServiceManifest()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
new file mode 100644
index 000000000..08a8f6536
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.AppServiceData;
+import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
+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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse}
+ */
+public class GetAppServiceDataResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new GetAppServiceDataResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ GetAppServiceDataResponse msg = new GetAppServiceDataResponse();
+ msg.setServiceData(Test.GENERAL_APPSERVICE_DATA);
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ // test getter
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(Test.GENERAL_APPSERVICE_DATA, serviceData);
+
+ // test constructor
+ msg = new GetAppServiceDataResponse(true, Result.SUCCESS, Test.GENERAL_APPSERVICE_DATA);
+ serviceData = msg.getServiceData();
+ assertEquals(Test.GENERAL_APPSERVICE_DATA, serviceData);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
new file mode 100644
index 000000000..25ba20949
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
@@ -0,0 +1,118 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.GetFileResponse}
+ */
+public class GetFileResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ GetFileResponse msg = new GetFileResponse();
+
+ msg.setCRC(Test.GENERAL_INT);
+ msg.setFileType(Test.GENERAL_FILETYPE);
+ msg.setOffset(Test.GENERAL_INT);
+ msg.setLength(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ 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);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer crc = ( (GetFileResponse) msg ).getCRC();
+ FileType fileType = ( (GetFileResponse) msg ).getFileType();
+ Integer offset = ( (GetFileResponse) msg ).getOffset();
+ 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);
+
+ // Invalid/Null Tests
+ GetFileResponse msg = new GetFileResponse();
+ assertNotNull(Test.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());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ 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());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
new file mode 100644
index 000000000..ac3be00c6
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
@@ -0,0 +1,101 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
+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.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse}
+ */
+public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+
+ msg.setServiceSpecificResult(Test.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, Test.GENERAL_STRING);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String serviceSpecificResult = ( (PerformAppServiceInteractionResponse) msg ).getServiceSpecificResult();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceSpecificResult);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceSpecificResult());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
new file mode 100644
index 000000000..f51a7945a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
@@ -0,0 +1,103 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.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.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.PublishAppServiceResponse}
+ */
+public class PublishAppServiceResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+
+ msg.setServiceRecord(Test.GENERAL_APP_SERVICE_RECORD);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_RECORD.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ AppServiceRecord testRecord = ( (PublishAppServiceResponse) msg ).getServiceRecord();
+
+ // Valid Tests
+ assertTrue(Test.TRUE, Validator.validateAppServiceRecord(Test.GENERAL_APP_SERVICE_RECORD, testRecord));
+
+ // Invalid/Null Tests
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getServiceRecord());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.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);
+
+ // 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());
+
+ 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()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}