Examples of CNSRetryPolicy


Examples of com.comcast.cns.model.CNSRetryPolicy

              "}";
    
     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);
View Full Code Here

Examples of com.comcast.cns.model.CNSRetryPolicy

    
     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 {
View Full Code Here

Examples of com.comcast.cns.model.CNSRetryPolicy

  
   @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);
      
       assertTrue(hrp2.getBackOffFunction() == CnsBackoffFunction.geometric);
       assertTrue(srp2.getBackOffFunction() == CnsBackoffFunction.exponential);
       assertTrue(tp2.getMaxReceivesPerSecond() == 78);
      
     } catch (Exception e) {
             logger.error("Exception occured", e);
             fail("exception: "+e);
View Full Code Here

Examples of com.comcast.cns.model.CNSRetryPolicy

    CNSTopicAttributes topicAttributes = new CNSTopicAttributes();
    topicAttributes.setTopicArn(topic.getArn());
    topicAttributes.setUserId(user.getUserId());

    CNSTopicDeliveryPolicy deliveryPolicy = new CNSTopicDeliveryPolicy();
    CNSRetryPolicy defaultHealthyRetryPolicy = new CNSRetryPolicy();
    defaultHealthyRetryPolicy.setNumRetries(6);
    defaultHealthyRetryPolicy.setMaxDelayTarget(20);
    defaultHealthyRetryPolicy.setMinDelayTarget(20);
    defaultHealthyRetryPolicy.setNumMaxDelayRetries(3);
    defaultHealthyRetryPolicy.setNumMinDelayRetries(1);
    defaultHealthyRetryPolicy.setNumNoDelayRetries(2);
    defaultHealthyRetryPolicy.setBackOffFunction(CnsBackoffFunction.linear);
    deliveryPolicy.setDefaultHealthyRetryPolicy(defaultHealthyRetryPolicy );
    topicAttributes.setDeliveryPolicy(deliveryPolicy);

    attributeHandler.setTopicAttributes(topicAttributes , topic.getArn());
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.