本文整理汇总了Java中com.notnoop.apns.EnhancedApnsNotification.MAXIMUM_EXPIRY属性的典型用法代码示例。如果您正苦于以下问题:Java EnhancedApnsNotification.MAXIMUM_EXPIRY属性的具体用法?Java EnhancedApnsNotification.MAXIMUM_EXPIRY怎么用?Java EnhancedApnsNotification.MAXIMUM_EXPIRY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.notnoop.apns.EnhancedApnsNotification
的用法示例。
在下文中一共展示了EnhancedApnsNotification.MAXIMUM_EXPIRY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testProducerWithoutTokenHeader
@Test(timeout = 5000)
public void testProducerWithoutTokenHeader() throws Exception {
String message = "Hello World";
String messagePayload = APNS.newPayload().alertBody(message).build();
EnhancedApnsNotification apnsNotification = new EnhancedApnsNotification(1, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
server.stopAt(apnsNotification.length());
template.sendBody("direct:test", message);
server.getMessages().acquire();
assertArrayEquals(apnsNotification.marshall(), server.getReceived().toByteArray());
}
示例2: testProducer
@Test(timeout = 5000)
public void testProducer() throws Exception {
String message = "Hello World";
String messagePayload = APNS.newPayload().alertBody(message).build();
EnhancedApnsNotification apnsNotification = new EnhancedApnsNotification(1, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
server.stopAt(apnsNotification.length());
template.sendBody("direct:test", message);
server.getMessages().acquire();
assertArrayEquals(apnsNotification.marshall(), server.getReceived().toByteArray());
}
示例3: testProducerWithApnsNotification
@Test(timeout = 5000)
public void testProducerWithApnsNotification() throws InterruptedException {
String message = "Hello World";
String messagePayload = APNS.newPayload().alertBody(message).build();
final EnhancedApnsNotification apnsNotification =
new EnhancedApnsNotification(14, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
server.stopAt(apnsNotification.length());
template.sendBody("direct:testWithApnsNotification", apnsNotification);
server.getMessages().acquire();
assertArrayEquals(apnsNotification.marshall(), server.getReceived().toByteArray());
}
示例4: push
public Collection<EnhancedApnsNotification> push(Collection<String> deviceTokens, String payload) throws NetworkIOException {
byte[] messageBytes = Utilities.toUTF8Bytes(payload);
List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
for (String deviceToken : deviceTokens) {
byte[] dtbytes = Utilities.decodeHex(deviceToken);
EnhancedApnsNotification notification =
new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, dtbytes, messageBytes);
notifications.add(notification);
push(notification);
}
return notifications;
}
示例5: push
public Collection<EnhancedApnsNotification> push(Collection<String> deviceTokens, String payload) throws NetworkIOException {
byte[] messageBytes = Utilities.toUTF8Bytes(payload);
List<EnhancedApnsNotification> notifications = new ArrayList<EnhancedApnsNotification>(deviceTokens.size());
for (String deviceToken : deviceTokens) {
byte[] dtBytes = Utilities.decodeHex(deviceToken);
EnhancedApnsNotification notification =
new EnhancedApnsNotification(c.incrementAndGet(), EnhancedApnsNotification.MAXIMUM_EXPIRY, dtBytes, messageBytes);
notifications.add(notification);
push(notification);
}
return notifications;
}
示例6: testApnsProducer
@Test
public void testApnsProducer() throws Exception {
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.setHeader(HEADER_TOKENS, constant(FAKE_TOKEN))
.to("apns:notify");
}
});
int gatewayPort = getPortNumber("apns-feedback-port.txt");
int feedbackPort = getPortNumber("apns-gateway-port.txt");
ApnsServiceFactory apnsServiceFactory = ApnsUtils.createDefaultTestConfiguration(camelctx);
apnsServiceFactory.setFeedbackHost("localhost");
apnsServiceFactory.setFeedbackPort(gatewayPort);
apnsServiceFactory.setGatewayHost("localhost");
apnsServiceFactory.setGatewayPort(feedbackPort);
ApnsService apnsService = apnsServiceFactory.getApnsService();
ApnsComponent apnsComponent = new ApnsComponent(apnsService);
camelctx.addComponent("apns", apnsComponent);
camelctx.start();
try {
String message = "Hello World";
String messagePayload = APNS.newPayload().alertBody(message).build();
EnhancedApnsNotification apnsNotification = new EnhancedApnsNotification(1, EnhancedApnsNotification.MAXIMUM_EXPIRY, FAKE_TOKEN, messagePayload);
server.stopAt(apnsNotification.length());
ProducerTemplate template = camelctx.createProducerTemplate();
template.sendBody("direct:start", message);
server.getMessages().acquire();
Assert.assertArrayEquals(apnsNotification.marshall(), server.getReceived().toByteArray());
} finally {
camelctx.stop();
}
}