Examples of AtmosUtils


Examples of org.jclouds.atmos.util.AtmosUtils

         "<Message>%s</Message>\n" +
         "</Error>\n";

   @Test
   public void testGet500WithoutError() {
      AtmosUtils utils = createMock(AtmosUtils.class);
      BackoffLimitedRetryHandler backoffLimitedRetryHandler = createMock(BackoffLimitedRetryHandler.class);
      HttpCommand command = createMock(HttpCommand.class);

      expect(command.getFailureCount()).andReturn(0).once();
      expect(command.incrementFailureCount()).andReturn(1).once();
View Full Code Here

Examples of org.jclouds.atmos.util.AtmosUtils

      verify(utils, backoffLimitedRetryHandler, command);
   }

   @Test
   public void testGet500WithError1040() {
      AtmosUtils utils = createMock(AtmosUtils.class);
      BackoffLimitedRetryHandler backoffLimitedRetryHandler = createMock(BackoffLimitedRetryHandler.class);
      HttpCommand command = createMock(HttpCommand.class);
      String content = String.format(HTTP_MESSAGE_FORMAT, 1040, "The server is busy. Please try again");
      HttpResponse response = HttpResponse.builder().statusCode(500).payload(content).build();

      expect(command.getFailureCount()).andReturn(0).once();
      expect(utils.parseAtmosErrorFromContent(command, response, content)).andReturn(new AtmosError(1040, "The server is busy. Please try again")).once();
      expect(backoffLimitedRetryHandler.shouldRetryRequest(command, response)).andReturn(true).once();

      replay(utils, backoffLimitedRetryHandler, command);

      AtmosServerErrorRetryHandler retry = new AtmosServerErrorRetryHandler(backoffLimitedRetryHandler, utils);
View Full Code Here

Examples of org.jclouds.atmos.util.AtmosUtils

         "<Message>%s</Message>\n" +
         "</Error>\n";

   @Test
   public void testGet500WithoutError() {
      AtmosUtils utils = createMock(AtmosUtils.class);
      BackoffLimitedRetryHandler backoffLimitedRetryHandler = createMock(BackoffLimitedRetryHandler.class);
      HttpCommand command = createMock(HttpCommand.class);

      expect(command.getFailureCount()).andReturn(0).once();
      expect(command.incrementFailureCount()).andReturn(1).once();
View Full Code Here

Examples of org.jclouds.atmos.util.AtmosUtils

      verify(utils, backoffLimitedRetryHandler, command);
   }

   @Test
   public void testGet500WithError1040() {
      AtmosUtils utils = createMock(AtmosUtils.class);
      BackoffLimitedRetryHandler backoffLimitedRetryHandler = createMock(BackoffLimitedRetryHandler.class);
      HttpCommand command = createMock(HttpCommand.class);
      String content = String.format(HTTP_MESSAGE_FORMAT, 1040, "The server is busy. Please try again");
      HttpResponse response = HttpResponse.builder().statusCode(500).payload(content).build();

      expect(command.getFailureCount()).andReturn(0).once();
      expect(utils.parseAtmosErrorFromContent(command, response, content)).andReturn(new AtmosError(1040, "The server is busy. Please try again")).once();
      expect(backoffLimitedRetryHandler.shouldRetryRequest(command, response)).andReturn(true).once();

      replay(utils, backoffLimitedRetryHandler, command);

      AtmosServerErrorRetryHandler retry = new AtmosServerErrorRetryHandler(backoffLimitedRetryHandler, utils);
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.