Package org.jclouds.http

Examples of org.jclouds.http.HttpRequest$ConcreteBuilder


@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "OrgApiExpectTest")
public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {

   @Test
   public void testGetOrgList() {
      HttpRequest list = HttpRequest.builder()
               .method("GET")
               .endpoint(endpoint + "/org/")
               .addHeader("Accept", "*/*")
               .addHeader("x-vcloud-authorization", token)
               .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
View Full Code Here


   @Test
   public void testQueryAllGroups() {
     
      // TODO Need an example /admin/groups/query that actually contains records!
     
      HttpRequest queryRequest = HttpRequest.builder()
              .method("GET")
              .endpoint(endpoint + "/admin/groups/query")
              .addHeader("Accept", "*/*")
              .addHeader("x-vcloud-authorization", token)
              .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
View Full Code Here

//   </QueryResultRecords>

   @Test
   public void testQueryAllRoles() {
     
      HttpRequest queryRequest = HttpRequest.builder()
              .method("GET")
              .endpoint(endpoint + "/admin/roles/query")
              .addHeader("Accept", "*/*")
              .addHeader("x-vcloud-authorization", token)
              .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
View Full Code Here

      assertEquals(apiWhenDontExist.getHostedServiceApi().list(), ImmutableSet.of());
   }
  

   public void testCreateServiceWithLabelInLocationWhenResponseIs2xx() throws Exception {
      HttpRequest create = HttpRequest.builder().method("POST")
                                      .endpoint("https://management.core.windows.net/" + subscriptionId + "/services/hostedservices")
                                      .addHeader("x-ms-version", "2012-03-01")
                                      .payload(payloadFromResourceWithContentType("/create_hostedservice_location.xml", "application/xml")).build();
           
      HttpResponse createResponse = HttpResponse.builder()
View Full Code Here

               apiWhenExist.getHostedServiceApi().createServiceWithLabelInLocation(SERVICE_NAME, "service mine",
                        "West US"), "171f77920784404db208200702e59227");
   }

   public void testCreateWithOptionalParamsWhenResponseIs2xx() throws Exception {
      HttpRequest create = HttpRequest.builder().method("POST")
               .endpoint("https://management.core.windows.net/" + subscriptionId + "/services/hostedservices")
               .addHeader("x-ms-version", "2012-03-01")
               .payload(payloadFromResourceWithContentType("/create_hostedservice_location_options.xml", "application/xml")).build();

      HttpResponse createResponse = HttpResponse.builder()
View Full Code Here

   @Test
   public void testBindMap() {
      BindMapAsMetadata binder = new BindMapAsMetadata(xml);

      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
      request = binder.bindToRequest(request, ImmutableMap.of("foo", "bar"));
      assertEquals(request.getPayload().getRawContent(),
                  XMLParser.DEFAULT_XML_HEADER + "\n"+
                  "<Metadata xmlns=\"http://www.vmware.com/vcloud/v1.5\">" + "\n"+
                  "    <MetadataEntry>" + "\n" +
                  "        <Key>foo</Key>" + "\n" +
                  "        <Value>bar</Value>" + "\n" +
                  "    </MetadataEntry>" + "\n" +
                  "</Metadata>" + "\n");
      assertEquals(request.getPayload().getContentMetadata().getContentType(), MediaType.APPLICATION_XML);
   }
View Full Code Here

   @Test
   public void testBindMap() {
      BindStringAsMetadataValue binder = new BindStringAsMetadataValue(xml);

      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
      request = binder.bindToRequest(request, "foo");
      assertEquals(request.getPayload().getRawContent(),
                  XMLParser.DEFAULT_XML_HEADER + "\n"+
                  "<MetadataValue xmlns=\"http://www.vmware.com/vcloud/v1.5\">" + "\n"+
                  "    <Value>foo</Value>" + "\n" +
                  "</MetadataValue>" + "\n");
      assertEquals(request.getPayload().getContentMetadata().getContentType(), MediaType.APPLICATION_XML);
   }
View Full Code Here

*/
@Test(groups = "unit", testName = "JenkinsApiExpectTest")
public class JenkinsApiExpectTest extends BaseJenkinsApiExpectTest {

   public void testGetMasterWhenResponseIs2xx() {
      HttpRequest getMaster = HttpRequest
            .builder()
            .method("GET")
            .endpoint("http://localhost:8080/api/json")
            .addHeader("Accept", "application/json")
            .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
View Full Code Here

   public BasicAuthenticationUnlessAnonymousExpectTest(){
      identity = JenkinsApiMetadata.ANONYMOUS_IDENTITY;
   }
  
   public void testWhenIdentityIsAnonymousNoAuthorizationHeader() {
      HttpRequest getComputerView = HttpRequest
            .builder()
            .method("GET")
            .endpoint("http://localhost:8080/computer/api/json")
            .addHeader("Accept", "application/json").build();
View Full Code Here

            String content, Class<? extends Exception> expected) {

      JenkinsErrorHandler function = new JenkinsErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));
View Full Code Here

TOP

Related Classes of org.jclouds.http.HttpRequest$ConcreteBuilder

Copyright © 2018 www.massapicom. 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.