Package com.amazonaws.services.sns.model

Examples of com.amazonaws.services.sns.model.GetSubscriptionAttributesRequest


      if (subArn != null) {
       
        Map<String, String> attributes = null;
       
        try {
          GetSubscriptionAttributesRequest getSubscriptionAttributesRequest = new GetSubscriptionAttributesRequest(subArn);
          GetSubscriptionAttributesResult getSubscriptionAttributesResult = sns.getSubscriptionAttributes(getSubscriptionAttributesRequest);
          attributes = getSubscriptionAttributesResult.getAttributes();
          String rawMessageDeliveryStr = attributes.get("RawMessageDelivery");
          if(rawMessageDeliveryStr != null && !rawMessageDeliveryStr.isEmpty()){
            rawMessageDelivery = Boolean.parseBoolean(rawMessageDeliveryStr);
View Full Code Here


       
        Map<String, String> attributes = null;
        CNSSubscriptionDeliveryPolicy deliveryPolicy = null;
       
        try {
          GetSubscriptionAttributesRequest getSubscriptionAttributesRequest = new GetSubscriptionAttributesRequest(subArn);
          GetSubscriptionAttributesResult getSubscriptionAttributesResult = sns.getSubscriptionAttributes(getSubscriptionAttributesRequest);
          attributes = getSubscriptionAttributesResult.getAttributes();
          deliveryPolicy = new CNSSubscriptionDeliveryPolicy(new JSONObject(attributes.get("DeliveryPolicy")));
        } catch (Exception ex) {
          logger.error("event=get_subscription_attributes sub_arn=" + subArn + " user_id= " + userId, ex);
View Full Code Here

        resp = CNSTestingUtils.sendHttpMessage(subscriptionUrl, "");
        logger.info(resp);
        subscriptionArn = XmlUtil.getCurrentLevelTextValue(XmlUtil.getChildNodes(XmlUtil.buildDoc(resp)).get(0), "SubscriptionArn");
      }

      GetSubscriptionAttributesResult result = cns1.getSubscriptionAttributes(new GetSubscriptionAttributesRequest(subscriptionArn));

      JSONObject effectiveDeliveryPolicy = new JSONObject(result.getAttributes().get("EffectiveDeliveryPolicy"));
     
      assertTrue(effectiveDeliveryPolicy.has("healthyRetryPolicy"));
     
View Full Code Here

      "}" +
      "}";
     
      cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));

      GetSubscriptionAttributesResult result = cns1.getSubscriptionAttributes(new GetSubscriptionAttributesRequest(subscriptionArn));

      JSONObject effectiveDeliveryPolicy = new JSONObject(result.getAttributes().get("EffectiveDeliveryPolicy"));
     
      assertTrue(effectiveDeliveryPolicy.has("healthyRetryPolicy"));
     
View Full Code Here

      "}" +
      "}";

      cns2.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn1, attributeName2, attributeValue2));

      GetSubscriptionAttributesResult result = cns3.getSubscriptionAttributes(new GetSubscriptionAttributesRequest(subscriptionArn2));

      {
        JSONObject effectiveDeliveryPolicy = new JSONObject(result.getAttributes().get("EffectiveDeliveryPolicy"));
        assertTrue(effectiveDeliveryPolicy.has("healthyRetryPolicy"));
        JSONObject healthyRetryPolicy = effectiveDeliveryPolicy.getJSONObject("healthyRetryPolicy");       
        assertTrue(healthyRetryPolicy != null);
        assertTrue("healthyRetryPolicy.numRetries returns incorrect value", healthyRetryPolicy.getInt("numRetries") == 30);
        assertTrue("healthyRetryPolicy.minDelayTarget returns incorrect value", healthyRetryPolicy.getInt("minDelayTarget") == 10);
        assertTrue("healthyRetryPolicy.maxDelayTarget returns incorrect value", healthyRetryPolicy.getInt("maxDelayTarget") == 10);
        assertTrue("healthyRetryPolicy.numMinDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numMinDelayRetries") == 11);
        assertTrue("healthyRetryPolicy.numMaxDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numMaxDelayRetries") == 11);
        assertTrue("healthyRetryPolicy.numNoDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numNoDelayRetries") == 0);
        assertTrue("healthyRetryPolicy.backoffFunction returns incorrect value", healthyRetryPolicy.getString("backoffFunction").equals("geometric"));

        assertTrue(effectiveDeliveryPolicy.has("sicklyRetryPolicy"));
        JSONObject sicklyRetryPolicy = effectiveDeliveryPolicy.getJSONObject("sicklyRetryPolicy")
        assertTrue(sicklyRetryPolicy != null);
        assertTrue("sicklyRetryPolicy.numRetries returns incorrect value", sicklyRetryPolicy.getInt("numRetries") == 16);
        assertTrue("sicklyRetryPolicy.minDelayTarget returns incorrect value", sicklyRetryPolicy.getInt("minDelayTarget") == 1);
        assertTrue("sicklyRetryPolicy.maxDelayTarget returns incorrect value", sicklyRetryPolicy.getInt("maxDelayTarget") == 3);
        assertTrue("sicklyRetryPolicy.numMinDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numMinDelayRetries") == 1);
        assertTrue("sicklyRetryPolicy.numMaxDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numMaxDelayRetries") == 3);
        assertTrue("sicklyRetryPolicy.numNoDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numNoDelayRetries") == 3);
        assertTrue("sicklyRetryPolicy.backoffFunction returns incorrect value", sicklyRetryPolicy.getString("backoffFunction").equals("exponential"));

        assertTrue(effectiveDeliveryPolicy.has("throttlePolicy"));
        JSONObject throttlePolicy = effectiveDeliveryPolicy.getJSONObject("throttlePolicy");               
        assertTrue(throttlePolicy.getInt("maxReceivesPerSecond") == 3);

        assertTrue(result.getAttributes().get("ConfirmationWasAuthenticated").equals("false"));

        JSONObject deliveryPolicy = new JSONObject(result.getAttributes().get("DeliveryPolicy"));
        assertTrue(deliveryPolicy.has("healthyRetryPolicy"));
        healthyRetryPolicy = deliveryPolicy.getJSONObject("healthyRetryPolicy");       
        assertTrue(healthyRetryPolicy != null);
        assertTrue("healthyRetryPolicy.numRetries returns incorrect value", healthyRetryPolicy.getInt("numRetries") == 30);
        assertTrue("healthyRetryPolicy.minDelayTarget returns incorrect value", healthyRetryPolicy.getInt("minDelayTarget") == 10);
        assertTrue("healthyRetryPolicy.maxDelayTarget returns incorrect value", healthyRetryPolicy.getInt("maxDelayTarget") == 10);
        assertTrue("healthyRetryPolicy.numMinDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numMinDelayRetries") == 11);
        assertTrue("healthyRetryPolicy.numMaxDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numMaxDelayRetries") == 11);
        assertTrue("healthyRetryPolicy.numNoDelayRetries returns incorrect value", healthyRetryPolicy.getInt("numNoDelayRetries") == 0);
        assertTrue("healthyRetryPolicy.backoffFunction returns incorrect value", healthyRetryPolicy.getString("backoffFunction").equals("geometric"));

        assertTrue(deliveryPolicy.has("sicklyRetryPolicy"));

        assertTrue(deliveryPolicy.has("throttlePolicy"));
        throttlePolicy = deliveryPolicy.getJSONObject("throttlePolicy");   
        assertTrue(throttlePolicy.getInt("maxReceivesPerSecond") == 3);

        sicklyRetryPolicy = deliveryPolicy.getJSONObject("sicklyRetryPolicy")
        assertTrue(sicklyRetryPolicy != null);
        assertTrue("sicklyRetryPolicy.numRetries returns incorrect value", sicklyRetryPolicy.getInt("numRetries") == 16);
        assertTrue("sicklyRetryPolicy.minDelayTarget returns incorrect value", sicklyRetryPolicy.getInt("minDelayTarget") == 1);
        assertTrue("sicklyRetryPolicy.maxDelayTarget returns incorrect value", sicklyRetryPolicy.getInt("maxDelayTarget") == 3);
        assertTrue("sicklyRetryPolicy.numMinDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numMinDelayRetries") == 1);
        assertTrue("sicklyRetryPolicy.numMaxDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numMaxDelayRetries") == 3);
        assertTrue("sicklyRetryPolicy.numNoDelayRetries returns incorrect value", sicklyRetryPolicy.getInt("numNoDelayRetries") == 3);
        assertTrue("sicklyRetryPolicy.backoffFunction returns incorrect value", sicklyRetryPolicy.getString("backoffFunction").equals("exponential"));

        assertTrue(result.getAttributes().get("TopicArn").equals(topicArn));
        assertTrue(result.getAttributes().get("SubscriptionArn").equals(subscriptionArn2));
      }

      result = cns2.getSubscriptionAttributes(new GetSubscriptionAttributesRequest(subscriptionArn1));

      {
        JSONObject effectiveDeliveryPolicy = new JSONObject(result.getAttributes().get("EffectiveDeliveryPolicy"));

        assertTrue(effectiveDeliveryPolicy.has("healthyRetryPolicy"));
View Full Code Here

  public void testBadGetAttributes() {

    try {

      try {
        GetSubscriptionAttributesResult result = cns1.getSubscriptionAttributes(new GetSubscriptionAttributesRequest(null));
        fail("exception expected");
      } catch (Exception ex) {
        logger.info("expected exception", ex);
      }
     
View Full Code Here

    try {
      SetSubscriptionAttributesRequest setSubscriptionAttributesRequest = new SetSubscriptionAttributesRequest(rawEndPointsubscriptionArn, "RawMessageDelivery", rawMessageDelivery.toString());
      cns1.setSubscriptionAttributes(setSubscriptionAttributesRequest);
     
      Map<String, String> attributes = null;
      GetSubscriptionAttributesRequest getSubscriptionAttributesRequest = new GetSubscriptionAttributesRequest(rawEndPointsubscriptionArn);
      GetSubscriptionAttributesResult getSubscriptionAttributesResult = cns1.getSubscriptionAttributes(getSubscriptionAttributesRequest);
      attributes = getSubscriptionAttributesResult.getAttributes();
      String rawMessageDeliveryStr = attributes.get("RawMessageDelivery");
      if (rawMessageDeliveryStr != null && !rawMessageDeliveryStr.isEmpty()) {
        rawMessageDelivery = Boolean.parseBoolean(rawMessageDeliveryStr);
View Full Code Here

TOP

Related Classes of com.amazonaws.services.sns.model.GetSubscriptionAttributesRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.