public Payload payloadFromResourceWithContentType(String resource, String contentType) { try { return payloadFromStringWithContentType(Strings2.toStringAndClose(getClass().getResourceAsStream(resource)), contentType); } catch (IOException e) { throw Throwables.propagate(e); } } }
private Payload payloadFromResource(String resource) { try { return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)), "application/xml"); } catch (IOException e) { throw propagate(e); } } }
private Payload payloadFromResource(String resource) { try { return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)), "application/xml"); } catch (IOException e) { throw propagate(e); } } }
public Payload payloadFromResourceWithContentType(String resource, String contentType) { try { return payloadFromStringWithContentType(Strings2.toStringAndClose(getClass().getResourceAsStream(resource)), contentType); } catch (IOException e) { throw Throwables.propagate(e); } }
public Payload payloadFromResourceWithContentType(String resource, String contentType) { try { return payloadFromStringWithContentType( Strings2.toStringAndClose(getClass().getResourceAsStream(resource)), contentType); } catch (IOException e) { throw Throwables.propagate(e); } } }
private Payload payloadFromResource(String resource) { try { return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)), "application/xml"); } catch (IOException e) { throw propagate(e); } } }
private Payload payloadFromResource(String resource) { try { return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)), "application/xml"); } catch (IOException e) { throw propagate(e); } } }
public Payload payloadFromResourceWithContentType(String resource, String contentType) { try { return payloadFromStringWithContentType(Strings2.toStringAndClose(getClass().getResourceAsStream(resource)), contentType); } catch (IOException e) { throw Throwables.propagate(e); } }
public Payload payloadFromResourceWithContentType(String resource, String contentType) { try { return payloadFromStringWithContentType(Strings2.toStringAndClose(getClass().getResourceAsStream(resource)), contentType); } catch (IOException e) { throw Throwables.propagate(e); } } }
@Test public void testDeleteNotFound() throws IOException { HttpResponse response = HttpResponse.builder().statusCode(BAD_REQUEST.getStatusCode()) .payload( payloadFromStringWithContentType( "<ErrorResponse><Error><Type>Sender</Type><Code>InvalidChangeBatch</Code>" + "<Message>Tried to delete resource record set krank.foo.bar., type TXT but it was not found</Message>" + "</Error></ErrorResponse>", "application/xml")).build(); function.handleError(command, response); assertEquals(command.getException().getClass(), ResourceNotFoundException.class); assertEquals(command.getException().getMessage(), "Tried to delete resource record set krank.foo.bar., type TXT but it was not found"); AWSResponseException exception = AWSResponseException.class.cast(command.getException().getCause()); assertEquals(exception.getError().getCode(), "InvalidChangeBatch"); }
@Test public void testDeleteNotFound() throws IOException { HttpResponse response = HttpResponse.builder().statusCode(BAD_REQUEST.getStatusCode()) .payload( payloadFromStringWithContentType( "<ErrorResponse><Error><Type>Sender</Type><Code>InvalidChangeBatch</Code>" + "<Message>Tried to delete resource record set krank.foo.bar., type TXT but it was not found</Message>" + "</Error></ErrorResponse>", "application/xml")).build(); function.handleError(command, response); assertEquals(command.getException().getClass(), ResourceNotFoundException.class); assertEquals(command.getException().getMessage(), "Tried to delete resource record set krank.foo.bar., type TXT but it was not found"); AWSResponseException exception = AWSResponseException.class.cast(command.getException().getCause()); assertEquals(exception.getError().getCode(), "InvalidChangeBatch"); }
public HttpRequest initialAuthWithUsernameAndPassword(String username, String password){ return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"passwordCredentials\":{\"username\":\"%s\",\"password\":\"%s\"}}}", username, password), "application/json")).build(); }
public HttpRequest initialAuthWithUsernameAndPassword(String username, String password) { return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"passwordCredentials\":{\"username\":\"%s\",\"password\":\"%s\"}}}", username, password), "application/json")).build(); }
public HttpRequest initialAuthWithUsernameAndApiKey(String username, String apiKey) { return HttpRequest .builder() .method("POST") .endpoint("https://identity.api.rackspacecloud.com/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload(payloadFromStringWithContentType( format("{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"%s\",\"apiKey\":\"%s\"}}}", username, apiKey), "application/json")).build(); }
public HttpRequest initialAuthWithAccessKeyAndSecretKeyAndTenantId(String accessKey, String secretKey){ return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantId\":\"%s\"}}", accessKey, secretKey, getTenantId()), "application/json")).build(); }
public HttpRequest initialAuthWithUsernameAndPasswordAndTenantName(String username, String password){ return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"passwordCredentials\":{\"username\":\"%s\",\"password\":\"%s\"},\"tenantName\":\"%s\"}}", username, password, getTenantName()), "application/json")).build(); }
public HttpRequest initialAuthWithAccessKeyAndSecretKeyAndTenantName(String accessKey, String secretKey){ return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantName\":\"%s\"}}", accessKey, secretKey, getTenantName()), "application/json")).build(); }
public HttpRequest initialAuthWithAccessKeyAndSecretKeyAndTenantName(String accessKey, String secretKey) { return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantName\":\"%s\"}}", accessKey, secretKey, getTenantName()), "application/json")).build(); }
public HttpRequest initialAuthWithUsernameAndPasswordAndTenantName(String username, String password) { return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"passwordCredentials\":{\"username\":\"%s\",\"password\":\"%s\"},\"tenantName\":\"%s\"}}", username, password, getTenantName()), "application/json")).build(); }
public HttpRequest initialAuthWithAccessKeyAndSecretKeyAndTenantId(String accessKey, String secretKey) { return HttpRequest.builder().method("POST") .endpoint("http://localhost:5000/v2.0/tokens") .addHeader(HttpHeaders.ACCEPT, "application/json") .payload( payloadFromStringWithContentType( format( "{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantId\":\"%s\"}}", accessKey, secretKey, getTenantId()), "application/json")).build(); }