当前位置: 首页>>代码示例>>Java>>正文


Java CreatePlatformApplicationRequest类代码示例

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


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

示例1: createNewApplication

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
private static PlatformApplication createNewApplication() {
    String applicationName = "java-sns-resources-api-app-" + System.currentTimeMillis();

    PlatformApplication application = sns.createPlatformApplication(
            new CreatePlatformApplicationRequest()
                .withName(applicationName)
                .withPlatform("GCM")
                .addAttributesEntry("PlatformCredential", GCM_API_ID)
                );

    try {
        Thread.sleep(6000);
    } catch (InterruptedException e) {}

    return application;
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:17,代码来源:PlatformApplicationIntegrationTest.java

示例2: createPlatformApplication

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
private CreatePlatformApplicationResult createPlatformApplication(
		String applicationName, Platform platform, String principal,
		String credential) {
	CreatePlatformApplicationRequest platformApplicationRequest = new CreatePlatformApplicationRequest();
	Map<String, String> attributes = new HashMap<String, String>();
	attributes.put("PlatformPrincipal", principal);
	attributes.put("PlatformCredential", credential);
	platformApplicationRequest.setAttributes(attributes);
	platformApplicationRequest.setName(applicationName);
	platformApplicationRequest.setPlatform(platform.name());
	return snsClient.createPlatformApplication(platformApplicationRequest);
}
 
开发者ID:tonchidot,项目名称:aws-java-sns-mobile-push-sample,代码行数:13,代码来源:AmazonSNSClientWrapper.java

示例3: createPlatformApplication

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
private CreatePlatformApplicationResult createPlatformApplication(
		String applicationName, Platform platform, String principal,
		String credential) {
	
	
	/*Creates a platform application object for one of the supported push notification services, such as APNS and GCM, 
	 * to which devices and mobile apps may register. You must specify PlatformPrincipal and PlatformCredential attributes 
	 * when using the CreatePlatformApplication action. 
	 * 
	 * The PlatformPrincipal is received from the notification service. 
	 * ---------------------------------------------------------------------
	 * For APNS/APNS_SANDBOX, PlatformPrincipal is "SSL certificate". 
	 * For GCM, PlatformPrincipal is not applicable. 
	 * For ADM, PlatformPrincipal is "client id". The PlatformCredential is also received from the notification service.
	 * ----------------------------------------------------------------------- 
	 * For APNS/APNS_SANDBOX, PlatformCredential is "private key". 
	 * For GCM, PlatformCredential is "API key". 
	 * For ADM, PlatformCredential is "client secret".
	 * -------------------------------------------------------------------------- 
	 * The PlatformApplicationArn that is returned when using CreatePlatformApplication is then used as 
	 * an attribute for the CreatePlatformEndpoint action. 
	 * For more information, see Using Amazon SNS Mobile Push Notifications .
	 * */
	
	
	
	CreatePlatformApplicationRequest platformApplicationRequest = new CreatePlatformApplicationRequest();
	Map<String, String> attributes = new HashMap<String, String>();
	attributes.put("PlatformPrincipal", principal);
	attributes.put("PlatformCredential", credential);
	platformApplicationRequest.setAttributes(attributes);
	platformApplicationRequest.setName(applicationName);
	platformApplicationRequest.setPlatform(platform.name());
	return snsClient.createPlatformApplication(platformApplicationRequest);
}
 
开发者ID:krito19,项目名称:DenunciaMXBackEnd,代码行数:36,代码来源:AmazonSNSClientWrapper.java

示例4: createPlatformApplication

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Override
public PlatformApplication createPlatformApplication(
        CreatePlatformApplicationRequest request,
        ResultCapture<CreatePlatformApplicationResult> extractor) {

    ActionResult result = service.performAction("CreatePlatformApplication",
            request, extractor);

    if (result == null) return null;
    return new PlatformApplicationImpl(result.getResource());
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:12,代码来源:SNSImpl.java

示例5: testPlatform_String_String_Constructor

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPlatform_String_String_Constructor() throws Exception {
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(Platform.GCM, "n1", "p1").getRequest();
    assertEquals("GCM", r.getPlatform());
    assertEquals("n1", r.getName());
    assertEquals("p1", r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例6: testPlatform_InputStream_CharArray_Constructor

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPlatform_InputStream_CharArray_Constructor() throws Exception {
    Pkcs12 actualP12 = Pkcs12.from(getClass().getResourceAsStream("/unittest.p12"), p12Password);
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(Platform.APNS, getClass().getResourceAsStream("/unittest.p12"), p12Password).getRequest();
    assertEquals("APNS", r.getPlatform());
    assertEquals(actualP12.getAlias(), r.getName());
    assertEquals(Pem.from(actualP12.getCertificate()), r.getAttributes().get("PlatformPrincipal"));
    assertEquals(Pem.from(actualP12.getPrivateKey()), r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:10,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例7: testRequestCredentials

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testRequestCredentials() throws Exception {
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    final AWSCredentials mockCredentials = mock(AWSCredentials.class);
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key)
            .requestCredentials(mockCredentials)
            .getRequest();

    assertEquals(mockCredentials, r.getRequestCredentials());
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:16,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例8: testPlatform

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPlatform() throws Exception {
    final Platform p1 = Platform.APNS;
    final Platform p2 = Platform.GCM;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p1, name, key)
            .platform(p2.name())
            .getRequest();
    assertEquals(p2.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:14,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例9: testPlatformObj

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPlatformObj() throws Exception {
    final Platform p1 = Platform.APNS;
    final Platform p2 = Platform.GCM;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p1, name, key)
            .platform(p2)
            .getRequest();
    assertEquals(p2.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:14,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例10: testAttribute

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testAttribute() throws Exception {
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    final String attrName = UUID.randomUUID().toString();
    final String attrValue = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key)
            .attribute(attrName, attrValue)
            .getRequest();
    assertEquals(attrValue, r.getAttributes().get(attrName));
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:16,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例11: testName

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testName() throws Exception {
    final Platform p = Platform.APNS;
    final String name1 = UUID.randomUUID().toString();
    final String name2 = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name1, key)
            .name(name2)
            .getRequest();
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name2, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:14,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例12: testPrincipal

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPrincipal() throws Exception {
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    final String principal = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key)
            .principal(principal)
            .getRequest();
    assertEquals(principal, r.getAttributes().get("PlatformPrincipal"));
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:15,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例13: testPrincipalObj

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testPrincipalObj() throws Exception {
    final Pkcs12 p12 = Pkcs12.from(getClass().getResourceAsStream("/unittest.p12"), p12Password);
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key = UUID.randomUUID().toString();
    final Certificate principal = p12.getCertificate();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key)
            .principal(principal)
            .getRequest();
    assertEquals(Pem.from(principal), r.getAttributes().get("PlatformPrincipal"));
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:16,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例14: testCredential

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testCredential() throws Exception {
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key1 = UUID.randomUUID().toString();
    final String key2 = UUID.randomUUID().toString();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key1)
            .credential(key2)
            .getRequest();
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(key2, r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:14,代码来源:CreatePlatformApplicationRequestBuilderTest.java

示例15: testCredentialObj

import com.amazonaws.services.sns.model.CreatePlatformApplicationRequest; //导入依赖的package包/类
@Test
public void testCredentialObj() throws Exception {
    final Pkcs12 p12 = Pkcs12.from(getClass().getResourceAsStream("/unittest.p12"), p12Password);
    final Platform p = Platform.APNS;
    final String name = UUID.randomUUID().toString();
    final String key1 = UUID.randomUUID().toString();
    final PrivateKey key2 = p12.getPrivateKey();
    CreatePlatformApplicationRequest r = new CreatePlatformApplicationRequestBuilder(p, name, key1)
            .credential(key2)
            .getRequest();
    assertEquals(p.name(), r.getPlatform());
    assertEquals(name, r.getName());
    assertEquals(Pem.from(key2), r.getAttributes().get("PlatformCredential"));
}
 
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:15,代码来源:CreatePlatformApplicationRequestBuilderTest.java


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