@And("^I expect the response error message to include:$")
 public void and_I_expect_the_response_error_message_include(String expected) {
   assertNotNull(exception);
   assertTrue(exception instanceof AmazonServiceException);
   String actual = exception.getErrorMessage().toLowerCase();
   assertTrue(
       "Error message doesn't match. Expected : " + expected + ". Actual :" + actual,
       actual.contains(expected.toLowerCase()));
 }
Example #2
0
 /**
  * Update the tags stored in EC2 with the specified information. Re-try 5 times if instances isn't
  * up by catchErrorCode - e.g. InvalidSpotInstanceRequestID.NotFound or
  * InvalidInstanceRequestID.NotFound
  *
  * @param ec2
  * @param instTags
  * @param catchErrorCode
  * @param params
  * @throws InterruptedException
  */
 private void updateRemoteTags(
     AmazonEC2 ec2, Collection<Tag> instTags, String catchErrorCode, String... params)
     throws InterruptedException {
   for (int i = 0; i < 5; i++) {
     try {
       CreateTagsRequest tagRequest = new CreateTagsRequest();
       tagRequest.withResources(params).setTags(instTags);
       ec2.createTags(tagRequest);
       break;
     } catch (AmazonServiceException e) {
       if (e.getErrorCode().equals(catchErrorCode)) {
         Thread.sleep(5000);
         continue;
       }
       LOGGER.log(Level.SEVERE, e.getErrorMessage(), e);
     }
   }
 }