Java 类com.amazonaws.services.sns.model.ConfirmSubscriptionRequest 实例源码

项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public Subscription confirmSubscription(ConfirmSubscriptionRequest request,
        ResultCapture<ConfirmSubscriptionResult> extractor) {

    ActionResult result = resource.performAction("ConfirmSubscription",
            request, extractor);

    if (result == null) return null;
    return new SubscriptionImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public Subscription confirmSubscription(String token,
        ResultCapture<ConfirmSubscriptionResult> extractor) {

    ConfirmSubscriptionRequest request = new ConfirmSubscriptionRequest()
        .withToken(token);
    return confirmSubscription(request, extractor);
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public Subscription confirmSubscription(String authenticateOnUnsubscribe,
        String token, ResultCapture<ConfirmSubscriptionResult> extractor) {

    ConfirmSubscriptionRequest request = new ConfirmSubscriptionRequest()
        .withAuthenticateOnUnsubscribe(authenticateOnUnsubscribe)
        .withToken(token);
    return confirmSubscription(request, extractor);
}
项目:aws-sdk-java-resources    文件:TopicIntegrationTest.java   
@Test
@Ignore
public void testActions() throws InterruptedException {

    // publish
    topic.publish("subject", "message");

    // setAttribute
    topic.setAttributes(DISPLAY_NAME, MY_FANCY_TOPIC_NAME);
    refreshTopic();
    Assert.assertEquals(MY_FANCY_TOPIC_NAME, topic.getAttributes().get(DISPLAY_NAME));

    // addPermission
    topic.addPermission("New Publish Permission", Arrays.asList("599169622985"), Arrays.asList("Publish"));

    // removePermission
    topic.removePermission("New Publish Permission");

    PlatformEndpoint endpoint =
            PlatformEndpointIntegrationTest.getOrCreateEndpoint();

    // subscribe
    Subscription subscription = topic.subscribe(endpoint.getArn(), "application");
    SubscriptionIntegrationTest.assertValidSubscription(subscription);

    // confirmSubscription
    // send a null token and expect a ValidationError
    try {
        topic.confirmSubscription(new ConfirmSubscriptionRequest());
        Assert.fail("ValidationError is expected.");
    } catch (AmazonServiceException ase) {
        Assert.assertEquals("ValidationError", ase.getErrorCode());
    }

}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testSubscribeConfirmListUnsubscribe_shouldCreateVerifyListAndRemoveSubscription() {
  mockSns(new MockParameters());
  // create topic
  CreateTopicResult topicResult = sns.createTopic(new CreateTopicRequest().withName("important-topic"));

  // subscribe to first topic
  SubscribeResult subscribeResult = sns.subscribe(new SubscribeRequest().withTopicArn(topicResult.getTopicArn())
      .withProtocol("sqs").withEndpoint("arn:aws:sqs:us-east-1:123456789012:queue1"));
  assertNotNull("verify subscription ARN is created", subscribeResult.getSubscriptionArn());

  // create second topic and subscribe to that one
  CreateTopicResult secondTopicResult = sns.createTopic(new CreateTopicRequest().withName("someOther-topic"));
  sns.subscribe(new SubscribeRequest().withTopicArn(secondTopicResult.getTopicArn())
      .withProtocol("sqs").withEndpoint("arn:aws:sqs:us-east-1:564654654:queue7"));

  // confirm first subscription
  ConfirmSubscriptionResult confirmResultAuth = sns.confirmSubscription(new ConfirmSubscriptionRequest()
      .withAuthenticateOnUnsubscribe("true").withToken("gold-token").withTopicArn(topicResult.getTopicArn()));
  assertNotNull("verify auth confirmation with responded topic arn", confirmResultAuth.getSubscriptionArn());
  ConfirmSubscriptionResult confirmResultNoAuth = sns.confirmSubscription(new ConfirmSubscriptionRequest()
      .withAuthenticateOnUnsubscribe("false").withToken("gold-token").withTopicArn(topicResult.getTopicArn()));
  assertNotNull("verify no auth confirmation with responded topic arn", confirmResultNoAuth.getSubscriptionArn());

  // list all subscriptions
  ListSubscriptionsResult allSubs = sns.listSubscriptions();
  assertEquals("verify correct total subscription count", 2, allSubs.getSubscriptions().size());
  com.amazonaws.services.sns.model.Subscription firstSub = allSubs.getSubscriptions().stream().filter(sub -> sub.getTopicArn().equals(topicResult.getTopicArn())).findFirst().get();
  assertEquals("verify the correct subscription arn", subscribeResult.getSubscriptionArn(), firstSub.getSubscriptionArn());
  assertEquals("verify the correct subscription topic", topicResult.getTopicArn(), firstSub.getTopicArn());
  assertEquals("verify the correct subscription protocol", "sqs", firstSub.getProtocol());
  assertEquals("verify the correct subscription endpoint", "arn:aws:sqs:us-east-1:123456789012:queue1", firstSub.getEndpoint());
  assertNotNull("verify the correct subscription owner", firstSub.getOwner());

  // list subscriptions of first topic
  ListSubscriptionsByTopicResult topicsSubscriptions = sns.listSubscriptionsByTopic(new ListSubscriptionsByTopicRequest(topicResult.getTopicArn()));
  assertEquals("verify that the one subscription is contained in list", 1, topicsSubscriptions.getSubscriptions().size());
  assertEquals("verify the correct subscription arn", subscribeResult.getSubscriptionArn(), topicsSubscriptions.getSubscriptions().get(0).getSubscriptionArn());
  assertEquals("verify the correct subscription topic", topicResult.getTopicArn(), topicsSubscriptions.getSubscriptions().get(0).getTopicArn());
  assertEquals("verify the correct subscription protocol", "sqs", topicsSubscriptions.getSubscriptions().get(0).getProtocol());
  assertEquals("verify the correct subscription endpoint", "arn:aws:sqs:us-east-1:123456789012:queue1", topicsSubscriptions.getSubscriptions().get(0).getEndpoint());
  assertNotNull("verify the correct subscription owner", topicsSubscriptions.getSubscriptions().get(0).getOwner());

  // unsubscribe first topic
  assertNotNull(sns.unsubscribe(subscribeResult.getSubscriptionArn()));

  // check if really unsubscribed
  ListSubscriptionsByTopicResult subsToFirstTopicAfterUnsubscribe = sns.listSubscriptionsByTopic(new ListSubscriptionsByTopicRequest(topicResult.getTopicArn()));
  assertEquals("topic should be gone", 0, subsToFirstTopicAfterUnsubscribe.getSubscriptions().size());

  // cleanup
  sns.deleteTopic(topicResult.getTopicArn());
  sns.deleteTopic(secondTopicResult.getTopicArn());
}
项目:unitstack    文件:MockSnsTest.java   
@Test
public void testConfirmSubscription_withNoRequestParams_shouldWork() {
  mockSns(new MockParameters());
  assertNotNull(sns.confirmSubscription(new ConfirmSubscriptionRequest()));
}
项目:Camel    文件:AmazonSNSClientMock.java   
@Override
public ConfirmSubscriptionResult confirmSubscription(ConfirmSubscriptionRequest confirmSubscriptionRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException();
}
项目:aws-sdk-java-resources    文件:TopicImpl.java   
@Override
public Subscription confirmSubscription(ConfirmSubscriptionRequest request)
        {

    return confirmSubscription(request, null);
}
项目:aws-sdk-java-resources    文件:Topic.java   
/**
 * Performs the <code>ConfirmSubscription</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Topic</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>TopicArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The <code>Subscription</code> resource object associated with the
 *         result of this action.
 * @see ConfirmSubscriptionRequest
 */
com.amazonaws.resources.sns.Subscription confirmSubscription(
        ConfirmSubscriptionRequest request);
项目:aws-sdk-java-resources    文件:Topic.java   
/**
 * Performs the <code>ConfirmSubscription</code> action and use a
 * ResultCapture to retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Topic</code> resource, and any conflicting parameter value set in
 * the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>TopicArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The <code>Subscription</code> resource object associated with the
 *         result of this action.
 * @see ConfirmSubscriptionRequest
 */
com.amazonaws.resources.sns.Subscription confirmSubscription(
        ConfirmSubscriptionRequest request,
        ResultCapture<ConfirmSubscriptionResult> extractor);