Update to Pushy 0.15.0
This commit is contained in:
parent
f2c6ca182d
commit
a9339b7037
2
pom.xml
2
pom.xml
|
@ -49,7 +49,7 @@
|
||||||
<opentest4j.version>1.2.0</opentest4j.version>
|
<opentest4j.version>1.2.0</opentest4j.version>
|
||||||
<postgresql.version>9.4-1201-jdbc41</postgresql.version>
|
<postgresql.version>9.4-1201-jdbc41</postgresql.version>
|
||||||
<protobuf.version>3.17.1</protobuf.version>
|
<protobuf.version>3.17.1</protobuf.version>
|
||||||
<pushy.version>0.14.2</pushy.version>
|
<pushy.version>0.15.0</pushy.version>
|
||||||
<resilience4j.version>1.5.0</resilience4j.version>
|
<resilience4j.version>1.5.0</resilience4j.version>
|
||||||
<semver4j.version>3.1.0</semver4j.version>
|
<semver4j.version>3.1.0</semver4j.version>
|
||||||
<slf4j.version>1.7.30</slf4j.version>
|
<slf4j.version>1.7.30</slf4j.version>
|
||||||
|
|
|
@ -88,12 +88,15 @@ public class RetryingApnsClient {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
if (response.isAccepted()) {
|
if (response.isAccepted()) {
|
||||||
future.set(new ApnResult(ApnResult.Status.SUCCESS, null));
|
future.set(new ApnResult(ApnResult.Status.SUCCESS, null));
|
||||||
} else if ("Unregistered".equals(response.getRejectionReason()) ||
|
|
||||||
"BadDeviceToken".equals(response.getRejectionReason())) {
|
|
||||||
future.set(new ApnResult(ApnResult.Status.NO_SUCH_USER, response.getRejectionReason()));
|
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Got APN failure: " + response.getRejectionReason());
|
final String rejectionReason = response.getRejectionReason().orElse(null);
|
||||||
future.set(new ApnResult(ApnResult.Status.GENERIC_FAILURE, response.getRejectionReason()));
|
|
||||||
|
if ("Unregistered".equals(rejectionReason) || "BadDeviceToken".equals(rejectionReason)) {
|
||||||
|
future.set(new ApnResult(ApnResult.Status.NO_SUCH_USER, rejectionReason));
|
||||||
|
} else {
|
||||||
|
logger.warn("Got APN failure: {}", rejectionReason);
|
||||||
|
future.set(new ApnResult(ApnResult.Status.GENERIC_FAILURE, rejectionReason));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Execution exception", cause);
|
logger.warn("Execution exception", cause);
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class APNSenderTest {
|
||||||
|
|
||||||
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
||||||
when(response.isAccepted()).thenReturn(false);
|
when(response.isAccepted()).thenReturn(false);
|
||||||
when(response.getRejectionReason()).thenReturn("Unregistered");
|
when(response.getRejectionReason()).thenReturn(Optional.of("Unregistered"));
|
||||||
|
|
||||||
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
||||||
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
||||||
|
@ -232,7 +232,7 @@ public class APNSenderTest {
|
||||||
|
|
||||||
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
||||||
when(response.isAccepted()).thenReturn(false);
|
when(response.isAccepted()).thenReturn(false);
|
||||||
when(response.getRejectionReason()).thenReturn("Unregistered");
|
when(response.getRejectionReason()).thenReturn(Optional.of("Unregistered"));
|
||||||
|
|
||||||
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
||||||
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
||||||
|
@ -327,7 +327,7 @@ public class APNSenderTest {
|
||||||
|
|
||||||
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
PushNotificationResponse<SimpleApnsPushNotification> response = mock(PushNotificationResponse.class);
|
||||||
when(response.isAccepted()).thenReturn(false);
|
when(response.isAccepted()).thenReturn(false);
|
||||||
when(response.getRejectionReason()).thenReturn("BadTopic");
|
when(response.getRejectionReason()).thenReturn(Optional.of("BadTopic"));
|
||||||
|
|
||||||
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
when(apnsClient.sendNotification(any(SimpleApnsPushNotification.class)))
|
||||||
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
.thenAnswer((Answer) invocationOnMock -> new MockPushNotificationFuture<>(invocationOnMock.getArgument(0), response));
|
||||||
|
|
Loading…
Reference in New Issue