Skip to content

Commit f8d2c4e

Browse files
Check classes deprecation status
1 parent 578b54f commit f8d2c4e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private Map<String, RPC> getRPCsMap(String fileName, boolean includeMandatoryPar
178178
boolean isDeprecated = Boolean.valueOf(myParser.getAttributeValue(null, "deprecated"));
179179

180180
// Store the RPC name in the map
181-
if (elementType.equals("function") || elementType.equals("struct")) {
181+
if ((elementType.equals("function") || elementType.equals("struct") || elementType.equals("enum")) && myParser.getAttributeValue(null, "until") == null) {
182182
rpcName = myParser.getAttributeValue(null, "name");
183183
skipRPC = false;
184184
if (elementType.equals("function") && myParser.getAttributeValue(null, "messagetype").equals("response") && !rpcName.contains("Response")) {
@@ -400,7 +400,7 @@ public void testMandatoryParamsMatch() {
400400
// Loop through all RPCs that were loaded from RPC spec XML file
401401
// and make sure that every RPC has a constructor that has all mandatory params
402402
for (String rpcName : rpcMandatoryParamsMapFromXml.keySet()) {
403-
if (rpcMandatoryParamsMapFromXml.get(rpcName).skip) {
403+
if (rpcMandatoryParamsMapFromXml.get(rpcName).skip || rpcMandatoryParamsMapFromXml.get(rpcName).type.equals("enum")) {
404404
continue;
405405
}
406406

@@ -535,7 +535,7 @@ public void testMandatoryParamsValues() {
535535
// Loop through all RPCs that were loaded from RPC spec XML file
536536
// and make sure that the constructor that has the mandatory params is setting the values correctly
537537
for (String rpcName : rpcMandatoryParamsMapFromXml.keySet()) {
538-
if (rpcMandatoryParamsMapFromXml.get(rpcName).skip) {
538+
if (rpcMandatoryParamsMapFromXml.get(rpcName).skip || rpcMandatoryParamsMapFromXml.get(rpcName).type.equals("enum")) {
539539
continue;
540540
}
541541

@@ -629,7 +629,7 @@ public void testParamsSettersAndGetters() {
629629

630630
// Loop through all RPCs that were loaded from RPC spec XML file
631631
for (String rpcName : rpcAllParamsMapFromXml.keySet()) {
632-
if (rpcAllParamsMapFromXml.get(rpcName).skip) {
632+
if (rpcAllParamsMapFromXml.get(rpcName).skip || rpcAllParamsMapFromXml.get(rpcName).type.equals("enum")) {
633633
continue;
634634
}
635635

@@ -642,6 +642,11 @@ public void testParamsSettersAndGetters() {
642642
continue;
643643
}
644644

645+
if (aClass != null && isDeprecated(aClass) != rpcAllParamsMapFromXml.get(rpcName).isDeprecated) {
646+
String errMsg = rpcName + " deprecation status does not match RPC spec" + ". \n";
647+
errors.add(errMsg);
648+
}
649+
645650
// Loop through all params for the current RPC and make sure everyone has a a setter and a getter
646651
List<Parameter> parameters = rpcAllParamsMapFromXml.get(rpcName).parameters;
647652
for (int i = 0; i < parameters.size(); i++) {

0 commit comments

Comments
 (0)