Examples of CNSSubscriptionDeliveryPolicy


Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

     
      CNSSubscriptionAttributes subscriptionAttributes = new CNSSubscriptionAttributes();
     
      if (attributeName.equals("DeliveryPolicy")) {     
        JSONObject json = new JSONObject(attributeValue);      
        CNSSubscriptionDeliveryPolicy deliveryPolicy = new CNSSubscriptionDeliveryPolicy(json);
        subscriptionAttributes.setDeliveryPolicy(deliveryPolicy);
      } else if (attributeName.equals("RawMessageDelivery")){
        Boolean rawMessageDelivery = Boolean.parseBoolean(attributeValue);
        PersistenceFactory.getSubscriptionPersistence().setRawMessageDelivery(subscriptionArn, rawMessageDelivery);
      }
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

           
            if (subAttr == null) {
                throw new CMBException(CMBErrorCodes.InternalError, "Could not get subscription delivery policy for subscripiton " + subArn);
            }
           
            CNSSubscriptionDeliveryPolicy deliveryPolicy = subAttr.getEffectiveDeliveryPolicy();
            CNSRetryPolicy retryPolicy = deliveryPolicy.getHealthyRetryPolicy();

            logger.debug("retry_policy=" + retryPolicy + "sub_arn=" + subArn);
           
            while (numRetries < retryPolicy.getNumNoDelayRetries()) {
               
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

           
            if (subAttr == null) {
                throw new CMBException(CMBErrorCodes.InternalError, "Could not get subscription delivery policy for subscripiton " + subArn);
            }
           
            CNSSubscriptionDeliveryPolicy deliveryPolicy = subAttr.getEffectiveDeliveryPolicy();
            CNSRetryPolicy retryPolicy = deliveryPolicy.getHealthyRetryPolicy();

            logger.debug("retry_policy=" + retryPolicy + "sub_arn=" + subArn);
           
            while (numRetries < retryPolicy.getNumNoDelayRetries()) {
               
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

      String maxDelay = request.getParameter("maxDelay");
      String maxDelayRetries = request.getParameter("maxDelayRetries");
      String maxReceiveRate = request.getParameter("maxReceiveRate");
      String backoffFunc = request.getParameter("backoffFunc");
     
      CNSSubscriptionDeliveryPolicy effectiveDeliveryPolicy = new CNSSubscriptionDeliveryPolicy();
      CNSRetryPolicy defaultHealthyRetryPolicy = new CNSRetryPolicy();
     
      if (maxDelay.trim().length() > 0) {
        defaultHealthyRetryPolicy.setMaxDelayTarget(Integer.parseInt(maxDelay));
      }
     
      if (minDelay.trim().length() > 0) {
        defaultHealthyRetryPolicy.setMinDelayTarget(Integer.parseInt(minDelay));
      }
     
      if (maxDelayRetries.trim().length() > 0) {
        defaultHealthyRetryPolicy.setNumMaxDelayRetries(Integer.parseInt(maxDelayRetries));
      }
     
      if (minDelayRetries.trim().length() > 0) {
        defaultHealthyRetryPolicy.setNumMinDelayRetries(Integer.parseInt(minDelayRetries));
      }
     
      if (retriesNoDelay.trim().length() > 0) {
        defaultHealthyRetryPolicy.setNumNoDelayRetries(Integer.parseInt(retriesNoDelay));
      }
     
      if (numRetries.trim().length() > 0) {
        defaultHealthyRetryPolicy.setNumRetries(Integer.parseInt(numRetries));
      }
     
      defaultHealthyRetryPolicy.setBackOffFunction(CnsBackoffFunction.valueOf(backoffFunc));
      effectiveDeliveryPolicy.setHealthyRetryPolicy(defaultHealthyRetryPolicy);
      CNSThrottlePolicy defaultThrottlePolicy = new CNSThrottlePolicy();
     
      if (maxReceiveRate.trim().length() > 0) {
        defaultThrottlePolicy.setMaxReceivesPerSecond(Integer.parseInt(maxReceiveRate));
      }
     
      effectiveDeliveryPolicy.setThrottlePolicy(defaultThrottlePolicy);
     
      try {

        SetSubscriptionAttributesRequest setSubscriptionAttributesRequest = new SetSubscriptionAttributesRequest(subArn, "DeliveryPolicy", effectiveDeliveryPolicy.toString());
        sns.setSubscriptionAttributes(setSubscriptionAttributesRequest);
       
        logger.debug("event=set_delivery_policy sub_arn=" + subArn + " user_id= " + userId);

      } catch (Exception ex) {
        logger.error("event=set_subscription_attribute sub_arn=" + subArn + " user_id= " + userId, ex);
        throw new ServletException(ex);
      }
     
      out.println("<body onload='javascript:window.opener.location.reload();window.close();'>");
     
    } else {
     
      int numRetries=0, retriesNoDelay = 0, minDelay = 0, minDelayRetries = 0, maxDelay = 0, maxDelayRetries = 0, maxReceiveRate = 0;
      String retryBackoff = "linear";
     
      if (subArn != null) {
       
        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);
          throw new ServletException(ex);
        }

        if (deliveryPolicy != null) {
       
          CNSRetryPolicy healthyRetryPolicy = deliveryPolicy.getHealthyRetryPolicy();
         
          if (healthyRetryPolicy != null) {
            numRetries= healthyRetryPolicy.getNumRetries();
            retriesNoDelay = healthyRetryPolicy.getNumNoDelayRetries();
            minDelay = healthyRetryPolicy.getMinDelayTarget();
            minDelayRetries = healthyRetryPolicy.getNumMinDelayRetries();
            maxDelay = healthyRetryPolicy.getMaxDelayTarget();
            maxDelayRetries = healthyRetryPolicy.getNumMaxDelayRetries();
            retryBackoff = healthyRetryPolicy.getBackOffFunction().toString();
          }
         
          CNSThrottlePolicy throttlePolicy = deliveryPolicy.getThrottlePolicy();
         
          if (throttlePolicy != null) {
            if (throttlePolicy.getMaxReceivesPerSecond() != null) {
              maxReceiveRate = throttlePolicy.getMaxReceivesPerSecond().intValue();
            }
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

    subscriptionAttributes.setSubscriptionArn(subscription.getArn());
    subscriptionAttributes.setTopicArn(subscription.getTopicArn());
    subscriptionAttributes.setUserId(user.getUserId());
   
    CNSSubscriptionDeliveryPolicy deliveryPolicy = new CNSSubscriptionDeliveryPolicy();
    CNSRetryPolicy healthyRetryPolicy = new CNSRetryPolicy();
    healthyRetryPolicy.setBackOffFunction(CnsBackoffFunction.arithmetic);
    healthyRetryPolicy.setMaxDelayTarget(21);
    healthyRetryPolicy.setMinDelayTarget(19);
    healthyRetryPolicy.setNumMaxDelayRetries(1);
    healthyRetryPolicy.setNumMinDelayRetries(0);
    healthyRetryPolicy.setNumNoDelayRetries(2);
    healthyRetryPolicy.setNumRetries(97);
    deliveryPolicy.setHealthyRetryPolicy(healthyRetryPolicy);       
    CNSThrottlePolicy throttlePolicy = new CNSThrottlePolicy();
    throttlePolicy.setMaxReceivesPerSecond(2);
    deliveryPolicy.setThrottlePolicy(throttlePolicy);
    subscriptionAttributes.setDeliveryPolicy(deliveryPolicy);       
   
    attributeHandler.setSubscriptionAttributes(subscriptionAttributes , subscription.getArn());
   
    CNSSubscriptionAttributes subscriptionAttributes2 = attributeHandler.getSubscriptionAttributes(subscription.getArn());
   
    assertEquals("Subscription attributes do not match", subscriptionAttributes2.getDeliveryPolicy().toString(), deliveryPolicy.toString());
    assertEquals("Subscription attributes do not match", subscriptionAttributes2.getEffectiveDeliveryPolicy().toString(), deliveryPolicy.toString());
    assertEquals("Subscription attributes do not match", subscriptionAttributes2.getSubscriptionArn(), subscriptionAttributes.getSubscriptionArn());
    assertEquals("Subscription attributes do not match", subscriptionAttributes2.getTopicArn(), subscriptionAttributes.getTopicArn());
    assertEquals("Subscription attributes do not match", subscriptionAttributes2.getUserId(), subscriptionAttributes.getUserId());
  }
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

      if (slice.getColumnByName("confirmationWasAuthenticated") != null) {
        subscriptionAttributes.setConfirmationWasAuthenticated(Boolean.getBoolean(slice.getColumnByName("confirmationWasAuthenticated").getValue()));
      }
     
      if (slice.getColumnByName("deliveryPolicy") != null) {
        subscriptionAttributes.setDeliveryPolicy(new CNSSubscriptionDeliveryPolicy(new JSONObject(slice.getColumnByName("deliveryPolicy").getValue())));
      }
     
      // if "ignore subscription override" is checked, get effective delivery policy from topic delivery policy, otherwise
      // get effective delivery policy from subscription delivery policy
     
      CNSSubscription subscription = PersistenceFactory.getSubscriptionPersistence().getSubscription(subscriptionArn);
     
      if (subscription == null) {
        throw new SubscriberNotFoundException("Subscription not found. arn=" + subscriptionArn);
      }
     
      CNSTopicAttributes topicAttributes = getTopicAttributes(subscription.getTopicArn());
     
      if (topicAttributes != null) {
       
        CNSTopicDeliveryPolicy topicEffectiveDeliveryPolicy = topicAttributes.getEffectiveDeliveryPolicy();
       
        if (topicEffectiveDeliveryPolicy != null) {
         
          if (topicEffectiveDeliveryPolicy.isDisableSubscriptionOverrides() || subscriptionAttributes.getDeliveryPolicy() == null) {
            CNSSubscriptionDeliveryPolicy effectiveDeliveryPolicy = new CNSSubscriptionDeliveryPolicy();
            effectiveDeliveryPolicy.setHealthyRetryPolicy(topicEffectiveDeliveryPolicy.getDefaultHealthyRetryPolicy());
            effectiveDeliveryPolicy.setSicklyRetryPolicy(topicEffectiveDeliveryPolicy.getDefaultSicklyRetryPolicy());
            effectiveDeliveryPolicy.setThrottlePolicy(topicEffectiveDeliveryPolicy.getDefaultThrottlePolicy());
            subscriptionAttributes.setEffectiveDeliveryPolicy(effectiveDeliveryPolicy);
          } else {
            subscriptionAttributes.setEffectiveDeliveryPolicy(subscriptionAttributes.getDeliveryPolicy());
          }
        }
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

          
              "}";
    
     try {
       JSONObject json = new JSONObject(jsonStr);
       CNSSubscriptionDeliveryPolicy subpolicy = new CNSSubscriptionDeliveryPolicy(json);
       CNSRetryPolicy hRetryPolicy = subpolicy.getHealthyRetryPolicy();
       assertTrue(hRetryPolicy.getMinDelayTarget() == 1);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 2);
       assertTrue(hRetryPolicy.getNumRetries() == 10);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 4);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 6);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.linear);
       CNSThrottlePolicy tPolicy = subpolicy.getThrottlePolicy();
       assertTrue(tPolicy.getMaxReceivesPerSecond() == 5);
       assertTrue(subpolicy.getSicklyRetryPolicy() == null);
      
       //Test 2nd Json constructor
       JSONObject json2 = new JSONObject(jsonStr2);
       CNSSubscriptionDeliveryPolicy subpolicy3 = new CNSSubscriptionDeliveryPolicy(json2);
       hRetryPolicy = subpolicy3.getHealthyRetryPolicy();
       assertTrue(hRetryPolicy.getMinDelayTarget() == 20);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 20);
       assertTrue(hRetryPolicy.getNumRetries() == 3);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 0);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 0);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.linear);
       CNSThrottlePolicy tPolicy2 = subpolicy3.getThrottlePolicy();
       assertTrue(tPolicy2.getMaxReceivesPerSecond() == null);
       CNSRetryPolicy sRetryPolicy = subpolicy3.getSicklyRetryPolicy();
       assertTrue(sRetryPolicy.getMinDelayTarget() == 1);
       assertTrue(sRetryPolicy.getMaxDelayTarget() == 2);
       assertTrue(sRetryPolicy.getNumRetries() == 10);
       assertTrue(sRetryPolicy.getNumMaxDelayRetries() == 4);
       assertTrue(sRetryPolicy.getNumMinDelayRetries() == 6);
       assertTrue(sRetryPolicy.getBackOffFunction() == CnsBackoffFunction.exponential);
      
       //Test default constructor
       CNSSubscriptionDeliveryPolicy subpolicy2 = new CNSSubscriptionDeliveryPolicy();
       hRetryPolicy = subpolicy2.getHealthyRetryPolicy();
       assertTrue(hRetryPolicy.getMinDelayTarget() == 20);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 20);
       assertTrue(hRetryPolicy.getNumRetries() == 3);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 0);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 0);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.linear);
       tPolicy = subpolicy2.getThrottlePolicy();
       logger.debug("tPolicy: " + tPolicy.toString());
       assertTrue(tPolicy.getMaxReceivesPerSecond() == null);
       assertTrue(subpolicy.getSicklyRetryPolicy() == null);
      
      
       JSONObject json3 = new JSONObject(jsonStr3);
       CNSSubscriptionDeliveryPolicy subpolicy4 = new CNSSubscriptionDeliveryPolicy(json3);
       hRetryPolicy = subpolicy4.getHealthyRetryPolicy();
       assertTrue(hRetryPolicy.getMinDelayTarget() == 20);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 20);
       assertTrue(hRetryPolicy.getNumRetries() == 3);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 0);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 0);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.linear);
       tPolicy = subpolicy2.getThrottlePolicy();
       logger.debug("tPolicy: " + tPolicy.toString());
       assertTrue(tPolicy.getMaxReceivesPerSecond() == null);
       assertTrue(subpolicy.getSicklyRetryPolicy() == null);
      
       boolean exceptionOccured = false;
       json = new JSONObject(jsonStr4);
     
       try {
        new CNSSubscriptionDeliveryPolicy(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 1:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
       
       json = new JSONObject(jsonStr5);
       
       try {
        new CNSSubscriptionDeliveryPolicy(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 2:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
       json = new JSONObject(jsonStr6);
       
       try {
        new CNSSubscriptionDeliveryPolicy(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 3:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
       json = new JSONObject(jsonStr7);
       
       try {
        new CNSSubscriptionDeliveryPolicy(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 4:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
      
       json = new JSONObject(jsonStr8);
       try {
        new CNSSubscriptionDeliveryPolicy(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 4:");
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

            "\"backoffFunction\": \"linear\""+
            "}" +
            "}";
    
     try {
       CNSSubscriptionDeliveryPolicy subpolicy = new CNSSubscriptionDeliveryPolicy();
       JSONObject json = new JSONObject(jsonStr);
       subpolicy.update(json);
       CNSRetryPolicy hRetryPolicy = subpolicy.getHealthyRetryPolicy();
       logger.debug("hRetryPolicy is: " + hRetryPolicy.toString());
       assertTrue(hRetryPolicy.getMinDelayTarget() == 12);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 13);
       assertTrue(hRetryPolicy.getNumRetries() == 43);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 23);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 20);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.arithmetic);
       CNSThrottlePolicy tPolicy = subpolicy.getThrottlePolicy();
       assertTrue(tPolicy.getMaxReceivesPerSecond() == 7);
      
       CNSRetryPolicy sRetryPolicy = subpolicy.getSicklyRetryPolicy();
       assertTrue(sRetryPolicy == null);
      
       json = new JSONObject(jsonStr2);
       subpolicy.update(json);
       hRetryPolicy = subpolicy.getHealthyRetryPolicy();
       assertTrue(hRetryPolicy != null);
       logger.debug("hRetryPolicy is: " + hRetryPolicy.toString());
       assertTrue(hRetryPolicy.getMinDelayTarget() == 20);
       assertTrue(hRetryPolicy.getMaxDelayTarget() == 20);
       assertTrue(hRetryPolicy.getNumRetries() == 3);
       assertTrue(hRetryPolicy.getNumMaxDelayRetries() == 0);
       assertTrue(hRetryPolicy.getNumMinDelayRetries() == 0);
       assertTrue(hRetryPolicy.getBackOffFunction() == CnsBackoffFunction.linear);
       tPolicy = subpolicy.getThrottlePolicy();
       assertTrue(tPolicy.getMaxReceivesPerSecond() == null);
       sRetryPolicy = subpolicy.getSicklyRetryPolicy();
       logger.debug("sRetryPolicy is: " + sRetryPolicy.toString());
       assertTrue(sRetryPolicy.getMinDelayTarget() == 32);
       assertTrue(sRetryPolicy.getMaxDelayTarget() == 33);
       assertTrue(sRetryPolicy.getNumRetries() == 99);
       assertTrue(sRetryPolicy.getNumMaxDelayRetries() == 32);
       assertTrue(sRetryPolicy.getNumMinDelayRetries() == 31);
       assertTrue(sRetryPolicy.getNumNoDelayRetries() == 33);
       assertTrue(sRetryPolicy.getBackOffFunction() == CnsBackoffFunction.exponential);
      
       boolean exceptionOccured = false;
       json = new JSONObject(jsonStr4);
     
       try {
         subpolicy.update(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 1:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
       
       json = new JSONObject(jsonStr5);
       
       try {
         subpolicy.update(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 2:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
       json = new JSONObject(jsonStr6);
       
       try {
         subpolicy.update(json);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 3:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
       json = new JSONObject(jsonStr7);
       
       try {
         subpolicy.update(json);
         logger.debug("subpolicy: " + subpolicy);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
          logger.debug("Exception 4:");
          logger.debug(e.getMessage());
        } else {
          assertFalse(true);
        }
       }
       assertTrue(exceptionOccured);
       exceptionOccured = false;
      
       json = new JSONObject(jsonStr8);
       
       try {
         subpolicy.update(json);
         logger.debug("subpolicy: " + subpolicy);
       } catch (Exception e) {
        if(e instanceof CMBException) {
          assertTrue(true);
          exceptionOccured = true;
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

   }
  
   @Test
   public void testToStringToJSON() {
     try {
       CNSSubscriptionDeliveryPolicy subpolicy = new CNSSubscriptionDeliveryPolicy();
       JSONObject subpolicyJSON = subpolicy.toJSON();
       logger.info(subpolicy.toString());
       assertTrue(subpolicyJSON.has("healthyRetryPolicy"));
       JSONObject respJSON = subpolicyJSON.getJSONObject("healthyRetryPolicy");
      assertTrue(respJSON.has("backoffFunction"));
      assertTrue(respJSON.getString("backoffFunction").equals("linear"));
      assertTrue(respJSON.has("numMaxDelayRetries"));
      assertTrue(respJSON.getInt("numMaxDelayRetries") == 0);
      assertTrue(respJSON.has("numMinDelayRetries"));
      assertTrue(respJSON.getInt("numMinDelayRetries") == 0);
      assertTrue(respJSON.has("numRetries"));
      assertTrue(respJSON.getInt("numRetries") == 3);
      assertTrue(respJSON.has("minDelayTarget"));
      assertTrue(respJSON.getInt("minDelayTarget") == 20);
      assertTrue(respJSON.has("maxDelayTarget"));
      assertTrue(respJSON.getInt("maxDelayTarget") == 20);
     
      assertTrue(subpolicyJSON.get("sicklyRetryPolicy") == JSONObject.NULL);
      String jsonStr = "{\"sicklyRetryPolicy\":null,\"healthyRetryPolicy\":{\"backoffFunction\":\"linear\",\"numMinDelayRetries\":0,\"numMaxDelayRetries\":0,\"numRetries\":3,\"minDelayTarget\":20,\"numNoDelayRetries\":0,\"maxDelayTarget\":20},\"throttlePolicy\":{\"maxReceivesPerSecond\":null}}";
      assertTrue(subpolicy.toString().equals(jsonStr));
     
     } catch (Exception e) {
             logger.error("Exception occured", e);
             fail("exception: "+e);
     }
View Full Code Here

Examples of com.comcast.cns.model.CNSSubscriptionDeliveryPolicy

   }
  
   @Test
   public void testGettersSetters() {
     try {
       CNSSubscriptionDeliveryPolicy subpolicy = new CNSSubscriptionDeliveryPolicy();
       CNSRetryPolicy hrp = new CNSRetryPolicy();
       hrp.setBackOffFunction(CnsBackoffFunction.geometric);
      
       CNSRetryPolicy srp = new CNSRetryPolicy();
       srp.setBackOffFunction(CnsBackoffFunction.exponential);
      
       CNSThrottlePolicy tp = new CNSThrottlePolicy();
       tp.setMaxReceivesPerSecond(78);
      
       subpolicy.setHealthyRetryPolicy(hrp);
       subpolicy.setSicklyRetryPolicy(srp);
       subpolicy.setThrottlePolicy(tp);
      
       CNSRetryPolicy hrp2 = subpolicy.getHealthyRetryPolicy();
       CNSRetryPolicy srp2 = subpolicy.getSicklyRetryPolicy();
       CNSThrottlePolicy tp2 = subpolicy.getThrottlePolicy();
      
       assertTrue(hrp2 != null);
       assertTrue(srp2 != null);
       assertTrue(tp2 != null);
      
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.