Skip to content

Commit 6993eb9

Browse files
committed
Remove fast-uuid as a dependency
1 parent 7f3be32 commit 6993eb9

9 files changed

Lines changed: 15 additions & 30 deletions

File tree

pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@
8989
<artifactId>netty-tcnative-boringssl-static</artifactId>
9090
<version>2.0.77.Final</version>
9191
</dependency>
92-
<dependency>
93-
<groupId>com.eatthepath</groupId>
94-
<artifactId>fast-uuid</artifactId>
95-
<version>0.2.0</version>
96-
</dependency>
9792
<dependency>
9893
<groupId>org.slf4j</groupId>
9994
<artifactId>slf4j-bom</artifactId>

pushy/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
<groupId>io.netty</groupId>
4848
<artifactId>netty-resolver-dns</artifactId>
4949
</dependency>
50-
<dependency>
51-
<groupId>com.eatthepath</groupId>
52-
<artifactId>fast-uuid</artifactId>
53-
</dependency>
5450
<dependency>
5551
<groupId>org.slf4j</groupId>
5652
<artifactId>slf4j-api</artifactId>

pushy/src/main/java/com/eatthepath/pushy/apns/ApnsClientHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import com.eatthepath.json.JsonParser;
2626
import com.eatthepath.pushy.apns.util.concurrent.PushNotificationFuture;
27-
import com.eatthepath.uuid.FastUUID;
2827
import io.netty.buffer.ByteBuf;
2928
import io.netty.buffer.Unpooled;
3029
import io.netty.channel.Channel;
@@ -236,7 +235,7 @@ protected Http2Headers getHeadersForPushNotification(final ApnsPushNotification
236235
}
237236

238237
if (pushNotification.getApnsId() != null) {
239-
headers.add(APNS_ID_HEADER, FastUUID.toString(pushNotification.getApnsId()));
238+
headers.add(APNS_ID_HEADER, pushNotification.getApnsId().toString());
240239
}
241240

242241
return headers;
@@ -338,7 +337,7 @@ private static UUID getUUIDFromHeaders(final Http2Headers headers, final AsciiSt
338337
final CharSequence uuidSequence = headers.get(header);
339338

340339
try {
341-
return uuidSequence != null ? FastUUID.parseUUID(uuidSequence) : null;
340+
return uuidSequence != null ? UUID.fromString(uuidSequence.toString()) : null;
342341
} catch (final IllegalArgumentException e) {
343342
log.error("Failed to parse `{}` header: {}", header, uuidSequence, e);
344343
return null;

pushy/src/main/java/com/eatthepath/pushy/apns/SimplePushNotificationResponse.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
package com.eatthepath.pushy.apns;
2424

25-
import com.eatthepath.uuid.FastUUID;
26-
2725
import java.time.Instant;
2826
import java.util.Optional;
2927
import java.util.UUID;
@@ -92,8 +90,8 @@ public String toString() {
9290
return "SimplePushNotificationResponse{" +
9391
"pushNotification=" + pushNotification +
9492
", success=" + success +
95-
", apnsId=" + (apnsId != null ? FastUUID.toString(apnsId) : null) +
96-
", apnsUniqueId=" + getApnsUniqueId().map(FastUUID::toString).orElse(null) +
93+
", apnsId=" + apnsId +
94+
", apnsUniqueId=" + getApnsUniqueId() +
9795
", rejectionReason='" + rejectionReason + '\'' +
9896
", tokenExpirationTimestamp=" + tokenExpirationTimestamp +
9997
'}';

pushy/src/main/java/com/eatthepath/pushy/apns/server/MockApnsServerHandler.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package com.eatthepath.pushy.apns.server;
2424

2525
import com.eatthepath.json.JsonSerializer;
26-
import com.eatthepath.uuid.FastUUID;
2726
import io.netty.buffer.ByteBuf;
2827
import io.netty.buffer.Unpooled;
2928
import io.netty.channel.ChannelFuture;
@@ -277,7 +276,7 @@ private void handleEndOfStream(final ChannelHandlerContext context, final Http2S
277276
UUID apnsIdFromHeaders;
278277

279278
try {
280-
apnsIdFromHeaders = apnsIdSequence != null ? FastUUID.parseUUID(apnsIdSequence) : UUID.randomUUID();
279+
apnsIdFromHeaders = apnsIdSequence != null ? UUID.fromString(apnsIdSequence.toString()) : UUID.randomUUID();
281280
} catch (final IllegalArgumentException e) {
282281
log.error("Failed to parse `apns-id` header: {}", apnsIdSequence, e);
283282
apnsIdFromHeaders = UUID.randomUUID();
@@ -318,10 +317,10 @@ public void write(final ChannelHandlerContext context, final Object message, fin
318317

319318
final Http2Headers headers = new DefaultHttp2Headers()
320319
.status(HttpResponseStatus.OK.codeAsText())
321-
.add(APNS_ID_HEADER, FastUUID.toString(acceptNotificationResponse.getApnsId()));
320+
.add(APNS_ID_HEADER, acceptNotificationResponse.getApnsId().toString());
322321

323322
acceptNotificationResponse.getApnsUniqueId()
324-
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, FastUUID.toString(apnsUniqueId)));
323+
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, apnsUniqueId.toString()));
325324

326325
this.encoder().writeHeaders(context, acceptNotificationResponse.getStreamId(), headers, 0, true, writePromise);
327326

@@ -332,10 +331,10 @@ public void write(final ChannelHandlerContext context, final Object message, fin
332331
final Http2Headers headers = new DefaultHttp2Headers()
333332
.status(rejectNotificationResponse.getErrorReason().getHttpResponseStatus().codeAsText())
334333
.add(HttpHeaderNames.CONTENT_TYPE, "application/json")
335-
.add(APNS_ID_HEADER, FastUUID.toString(rejectNotificationResponse.getApnsId()));
334+
.add(APNS_ID_HEADER, rejectNotificationResponse.getApnsId().toString());
336335

337336
rejectNotificationResponse.getApnsUniqueId()
338-
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, FastUUID.toString(apnsUniqueId)));
337+
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, apnsUniqueId.toString()));
339338

340339
final byte[] payloadBytes;
341340
{

pushy/src/main/java/com/eatthepath/pushy/apns/server/ParsingMockApnsServerListenerAdapter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.eatthepath.pushy.apns.ApnsPushNotification;
2626
import com.eatthepath.pushy.apns.DeliveryPriority;
2727
import com.eatthepath.pushy.apns.PushType;
28-
import com.eatthepath.uuid.FastUUID;
2928
import io.netty.buffer.ByteBuf;
3029
import io.netty.handler.codec.http2.Http2Headers;
3130
import io.netty.util.AsciiString;
@@ -173,7 +172,7 @@ private static ApnsPushNotification parsePushNotification(final Http2Headers hea
173172
UUID apnsIdFromHeaders;
174173

175174
try {
176-
apnsIdFromHeaders = apnsIdSequence != null ? FastUUID.parseUUID(apnsIdSequence) : null;
175+
apnsIdFromHeaders = apnsIdSequence != null ? UUID.fromString(apnsIdSequence.toString()) : null;
177176
} catch (final IllegalArgumentException e) {
178177
log.error("Failed to parse `apns-id` header: {}", apnsIdSequence, e);
179178
apnsIdFromHeaders = null;

pushy/src/main/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import com.eatthepath.pushy.apns.DeliveryPriority;
2626
import com.eatthepath.pushy.apns.PushType;
27-
import com.eatthepath.uuid.FastUUID;
2827
import io.netty.buffer.ByteBuf;
2928
import io.netty.handler.codec.http.HttpMethod;
3029
import io.netty.handler.codec.http2.Http2Headers;
@@ -34,6 +33,7 @@
3433
import java.time.Instant;
3534
import java.util.Map;
3635
import java.util.Set;
36+
import java.util.UUID;
3737
import java.util.regex.Matcher;
3838
import java.util.regex.Pattern;
3939

@@ -66,7 +66,7 @@ public void handlePushNotification(final Http2Headers headers, final ByteBuf pay
6666
final CharSequence apnsIdSequence = headers.get(APNS_ID_HEADER);
6767

6868
if (apnsIdSequence != null) {
69-
FastUUID.parseUUID(apnsIdSequence);
69+
UUID.fromString(apnsIdSequence.toString());
7070
}
7171
} catch (final IllegalArgumentException e) {
7272
throw new RejectedNotificationException(RejectionReason.BAD_MESSAGE_ID);

pushy/src/main/java/com/eatthepath/pushy/apns/util/SimpleApnsPushNotification.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.eatthepath.pushy.apns.ApnsPushNotification;
2626
import com.eatthepath.pushy.apns.DeliveryPriority;
2727
import com.eatthepath.pushy.apns.PushType;
28-
import com.eatthepath.uuid.FastUUID;
2928

3029
import java.time.Duration;
3130
import java.time.Instant;
@@ -325,7 +324,7 @@ public String toString() {
325324
", pushType=" + pushType +
326325
", topic='" + topic + '\'' +
327326
", collapseId='" + collapseId + '\'' +
328-
", apnsId=" + (apnsId != null ? FastUUID.toString(apnsId) : null) +
327+
", apnsId=" + apnsId +
329328
'}';
330329
}
331330
}

pushy/src/test/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package com.eatthepath.pushy.apns.server;
2424

2525
import com.eatthepath.pushy.apns.DeliveryPriority;
26-
import com.eatthepath.uuid.FastUUID;
2726
import io.netty.buffer.ByteBuf;
2827
import io.netty.buffer.UnpooledByteBufAllocator;
2928
import io.netty.handler.codec.http.HttpMethod;
@@ -38,7 +37,8 @@
3837
import java.time.Instant;
3938
import java.util.*;
4039

41-
import static org.junit.jupiter.api.Assertions.*;
40+
import static org.junit.jupiter.api.Assertions.assertEquals;
41+
import static org.junit.jupiter.api.Assertions.assertThrows;
4242

4343
public abstract class ValidatingPushNotificationHandlerTest {
4444

0 commit comments

Comments
 (0)