• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EnhancedApnsNotification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.notnoop.apns.EnhancedApnsNotification的典型用法代码示例。如果您正苦于以下问题:Java EnhancedApnsNotification类的具体用法?Java EnhancedApnsNotification怎么用?Java EnhancedApnsNotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnhancedApnsNotification类属于com.notnoop.apns包,在下文中一共展示了EnhancedApnsNotification类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testProducerWithoutTokenHeader

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
@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());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:ApnsProducerWithoutTokensHeaderTest.java


示例2: testProducer

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
@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());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:ApnsProducerTest.java


示例3: testProducerWithApnsNotification

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
@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());

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:ApnsProducerTest.java


示例4: push

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
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;
}
 
开发者ID:East196,项目名称:maker,代码行数:13,代码来源:AbstractApnsService.java


示例5: push

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
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;
}
 
开发者ID:dzh,项目名称:jframe,代码行数:13,代码来源:AbstractApnsService.java


示例6: sendApnsNotification

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
public void sendApnsNotification() {
	 String registrationId = "ab4fa0c794688dca7c149cbac1001ed2f451d02e4c55cc25be45e7693ad3aae3";
	 String message = "Hello";
	 ApnsServiceBuilder sb = APNS.newService();
	 
	 sb.withCert("/tmp/apns-dev.p12", "Enterprisy").withSandboxDestination();
	 
	 PayloadBuilder pb = APNS.newPayload();
	 pb.alertBody(message);
	 pb.sound("default");
	 pb.badge(1);
	 		 
	 sb.build().push(new EnhancedApnsNotification(1, 900, registrationId, pb.build()));
}
 
开发者ID:MinHalsoplan,项目名称:netcare-healthplan,代码行数:15,代码来源:OtherTests.java


示例7: testApnsProducer

import com.notnoop.apns.EnhancedApnsNotification; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:43,代码来源:ApnsIntegrationTest.java



注:本文中的com.notnoop.apns.EnhancedApnsNotification类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractAuthenticationToken类代码示例发布时间:2022-05-23
下一篇:
Java OAuth2AuthenticationProcessingFilter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap