@Test public void testSetGetSubscriptionAttributes_shouldSetAndRespondSubscriptionAttributes() { mockSns(new MockParameters()); // create topic and subscription CreateTopicResult topicResult = sns.createTopic(new CreateTopicRequest().withName("important-topic")); SubscribeResult subscribeResult = sns.subscribe(new SubscribeRequest().withTopicArn(topicResult.getTopicArn()) .withProtocol("sqs").withEndpoint("arn:aws:sqs:us-east-1:123456789012:queue1")); // set subscription attribute SetSubscriptionAttributesResult setAttrResult = sns.setSubscriptionAttributes(new SetSubscriptionAttributesRequest() .withAttributeName("unicorns-exist").withAttributeValue("only in scotland").withSubscriptionArn(subscribeResult.getSubscriptionArn())); assertNotNull("verify setting attributes result", setAttrResult); // get subscription attribute GetSubscriptionAttributesResult subAttributes = sns.getSubscriptionAttributes(new GetSubscriptionAttributesRequest() .withSubscriptionArn(subscribeResult.getSubscriptionArn())); assertEquals("verify subscription attribute","only in scotland",subAttributes.getAttributes().get("unicorns-exist")); }
@Test public void testGetSubscriptionAttributes_withNoRequestParams_shouldWork() { mockSns(new MockParameters()); assertNotNull(sns.getSubscriptionAttributes(new GetSubscriptionAttributesRequest())); }
@Override public boolean load(GetSubscriptionAttributesRequest request) { return load(request, null); }
@Override public boolean load(GetSubscriptionAttributesRequest request, ResultCapture<GetSubscriptionAttributesResult> extractor) { return resource.load(request, extractor); }
/** * Makes a call to the service to load this resource's attributes if they * are not loaded yet. * The following request parameters will be populated from the data of this * <code>Subscription</code> resource, and any conflicting parameter value * set in the request will be overridden: * <ul> * <li> * <b><code>SubscriptionArn</code></b> * - mapped from the <code>Arn</code> identifier. * </li> * </ul> * * <p> * * @return Returns {@code true} if the resource is not yet loaded when this * method was invoked, which indicates that a service call has been * made to retrieve the attributes. * @see GetSubscriptionAttributesRequest */ boolean load(GetSubscriptionAttributesRequest request);
/** * Makes a call to the service to load this resource's attributes if they * are not loaded yet, and use a ResultCapture to retrieve the low-level * client response * The following request parameters will be populated from the data of this * <code>Subscription</code> resource, and any conflicting parameter value * set in the request will be overridden: * <ul> * <li> * <b><code>SubscriptionArn</code></b> * - mapped from the <code>Arn</code> identifier. * </li> * </ul> * * <p> * * @return Returns {@code true} if the resource is not yet loaded when this * method was invoked, which indicates that a service call has been * made to retrieve the attributes. * @see GetSubscriptionAttributesRequest */ boolean load(GetSubscriptionAttributesRequest request, ResultCapture<GetSubscriptionAttributesResult> extractor);