Skip to content

Commit df788c2

Browse files
authored
Merge pull request #2839 from bbirman/version-66
Update default REST API version to v66.0
2 parents 8c57824 + c4e2e61 commit df788c2

6 files changed

Lines changed: 24 additions & 39 deletions

File tree

libs/SalesforceSDK/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
<string name="oauth_display_type">touch</string>
1414

1515
<!-- Default API version used by the SDK and sample apps -->
16-
<string name="api_version">v63.0</string>
16+
<string name="api_version">v66.0</string>
1717
</resources>

libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/ApiVersionStrings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
public class ApiVersionStrings {
4141

42-
public static final String VERSION_NUMBER = "v63.0";
42+
public static final String VERSION_NUMBER = "v66.0";
4343

4444
/** A version number override exclusively to support unit tests */
4545
@VisibleForTesting

libs/SalesforceSDK/src/com/salesforce/androidsdk/rest/NotificationsApiClient.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class NotificationsApiClient(
5959
val apiVersion = ApiVersionStrings.getVersionNumber(context)
6060

6161
// Submit the request.
62-
if (apiVersion < "v64.0") { // TODO: Remove once MSDK default API version is 64 or greater.
62+
if (apiVersion < "v64.0") {
6363
SalesforceSDKLogger.w(TAG, "Cannot request Salesforce push notifications types with API less than v64.0")
6464
return null
6565
}
@@ -98,7 +98,7 @@ class NotificationsApiClient(
9898
val apiVersion = ApiVersionStrings.getVersionNumber(context)
9999

100100
// Submit the request.
101-
if (apiVersion < "v64.0") { // TODO: Remove once MSDK default API version is 64 or greater.
101+
if (apiVersion < "v64.0") {
102102
SalesforceSDKLogger.w(TAG, "Cannot submit Salesforce Notifications API action with API less than v64.0")
103103
return null
104104
}

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushMessagingTest.kt

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ class PushMessagingTest {
208208
notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON)
209209
)
210210

211-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
212-
213211
// Test once for coverage only with the default REST client.
214212
assertThrows(SSLPeerUnverifiedException::class.java) {
215213
salesforceSdkManager.invokeServerNotificationAction(
@@ -231,24 +229,12 @@ class PushMessagingTest {
231229
fun testInvokeServerNotificationActionViaSdkManager_WithoutAccount() {
232230
val salesforceSdkManager = SalesforceSDKManager.getInstance()
233231

234-
val restResponse = mockk<RestResponse>()
235-
every { restResponse.asString() } returns encodeToString(
236-
NotificationsActionsResponseBody.serializer(),
237-
NotificationsActionsResponseBody(
238-
message = "test_message"
232+
assertThrows(NullPointerException::class.java) {
233+
salesforceSdkManager.invokeServerNotificationAction(
234+
notificationId = "test_notification_id",
235+
actionKey = "test_action_key",
239236
)
240-
)
241-
every { restResponse.isSuccess } returns true
242-
val restClient = mockk<RestClient>()
243-
every { restClient.sendSync(any()) } returns restResponse
244-
245-
val notificationsActionsResponseBody = salesforceSdkManager.invokeServerNotificationAction(
246-
notificationId = "test_notification_id",
247-
actionKey = "test_action_key",
248-
restClient = restClient
249-
)
250-
251-
assertNull(notificationsActionsResponseBody)
237+
}
252238
}
253239

254240
@Test
@@ -273,6 +259,8 @@ class PushMessagingTest {
273259
notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON)
274260
)
275261

262+
ApiVersionStrings.VERSION_NUMBER_TEST = "v63.0"
263+
276264
val notificationsActionsResponseBody = salesforceSdkManager.invokeServerNotificationAction(
277265
notificationId = "test_notification_id",
278266
actionKey = "test_action_key",
@@ -299,8 +287,6 @@ class PushMessagingTest {
299287
notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON)
300288
)
301289

302-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
303-
304290
assertThrows(NotificationsApiException::class.java) {
305291
salesforceSdkManager.invokeServerNotificationAction(
306292
notificationId = "test_notification_id",
@@ -330,8 +316,6 @@ class PushMessagingTest {
330316
notificationsTypes = fromJson(NOTIFICATIONS_TYPES_JSON)
331317
)
332318

333-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
334-
335319
assertThrows(NotificationsApiException::class.java) {
336320
salesforceSdkManager.invokeServerNotificationAction(
337321
notificationId = "test_notification_id",
@@ -368,9 +352,6 @@ class PushMessagingTest {
368352
every { restClient.clientInfo } returns clientInfo
369353
every { restClient.sendSync(any()) } returns restResponse
370354

371-
// Setup.
372-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
373-
374355
assertThrows(NotificationsApiException::class.java) {
375356
salesforceSdkManager.invokeServerNotificationAction(
376357
notificationId = "test_notification_id",
@@ -396,9 +377,6 @@ class PushMessagingTest {
396377
every { restClient.clientInfo } returns clientInfo
397378
every { restClient.sendSync(any()) } returns restResponse
398379

399-
// Setup.
400-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
401-
402380
assertThrows(NotificationsApiException::class.java) {
403381
salesforceSdkManager.invokeServerNotificationAction(
404382
notificationId = "test_notification_id",
@@ -431,9 +409,6 @@ class PushMessagingTest {
431409
every { restClient.clientInfo } returns clientInfo
432410
every { restClient.sendSync(any()) } returns restResponse
433411

434-
// Setup.
435-
ApiVersionStrings.VERSION_NUMBER_TEST = "v64.0"
436-
437412
assertThrows(NotificationsApiException::class.java) {
438413
salesforceSdkManager.invokeServerNotificationAction(
439414
notificationId = "test_notification_id",

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/app/PushServiceTest.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class PushServiceTest {
129129
val restClient = mockk<RestClient>()
130130
every { restClient.sendSync(any()) } returns restResponse
131131

132+
// Setup.
133+
VERSION_NUMBER_TEST = "v63.0"
134+
132135
val notificationsTypesResponseBody = PushService().fetchNotificationsTypes(
133136
restClient = restClient,
134137
userAccount = createTestAccount()
@@ -285,6 +288,7 @@ class PushServiceTest {
285288
every { restResponse.asString() } returns NOTIFICATIONS_TYPES_JSON
286289
every { restResponse.isSuccess } returns true
287290
val restClient = mockk<RestClient>()
291+
every { restClient.clientInfo } returns clientInfo
288292
every { restClient.sendSync(any()) } returns restResponse
289293

290294
var result = false
@@ -746,6 +750,7 @@ class PushServiceTest {
746750
every { restResponse.statusCode } returns HTTP_CREATED
747751
every { restResponse.asJSONObject() } returns JSONObject("{\"id\": \"test_id\"}")
748752
val restClient = mockk<RestClient>()
753+
every { restClient.clientInfo } returns clientInfo
749754
every { restClient.sendSync(any()) } returns restResponse
750755

751756
val account = createTestAccount()
@@ -765,9 +770,14 @@ class PushServiceTest {
765770
restClient = restClient
766771
)
767772

768-
verify(exactly = 1) {
773+
verify(atLeast = 1) {
769774
restClient.sendSync(withArg {
770-
assertEquals("test_community_id", it.requestBodyAsJson.get("NetworkId"))
775+
assertEquals(
776+
"test_community_id",
777+
runCatching {
778+
it.requestBodyAsJson.get("NetworkId")
779+
}.getOrDefault("Default Value")
780+
)
771781
})
772782
}
773783

0 commit comments

Comments
 (0)