Package org.jclouds.rest.internal

Examples of org.jclouds.rest.internal.GeneratedHttpRequest


// surefire
@Test(groups = "unit", testName = "NetworkAsyncClientTest")
public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<NetworkAsyncClient> {
   public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "listNetworks", ListNetworksOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());

      assertRequestLineEquals(httpRequest,
            "GET http://localhost:8080/client/api?response=json&command=listNetworks&listAll=true HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here


   }

   public void testListNetworksOptions() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "listNetworks", ListNetworksOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListNetworksOptions.Builder.type(NetworkType.ADVANCED)
            .domainId("6").id("5")));

      assertRequestLineEquals(httpRequest,
            "GET http://localhost:8080/client/api?response=json&command=listNetworks&listAll=true&type=Advanced&domainid=6&id=5 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
View Full Code Here

   }

   public void testGetNetwork() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "getNetwork", String.class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("id"));

      assertRequestLineEquals(httpRequest,
            "GET http://localhost:8080/client/api?response=json&command=listNetworks&listAll=true&id=id HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

                                          .addQueryParam("displaytext", "lovely").build();

   public void testCreateNetworkInZone() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "createNetworkInZone", String.class, String.class, String.class,
            String.class, CreateNetworkOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely"));

      assertRequestLineEquals(httpRequest, createNetwork.getRequestLine());
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

   public void testCreateNetworkInZoneOptions() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "createNetworkInZone", String.class, String.class, String.class,
            String.class, CreateNetworkOptions[].class);

      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely", CreateNetworkOptions.Builder
            .netmask("255.255.255.0").domainId("6")));

      assertRequestLineEquals(httpRequest, createNetworkOptions.getRequestLine());
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

   }

   public void testDeleteNetwork() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(NetworkAsyncClient.class, "deleteNetwork", String.class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));

      assertRequestLineEquals(httpRequest,
            "GET http://localhost:8080/client/api?response=json&command=deleteNetwork&id=5 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

      c.set(Calendar.DAY_OF_MONTH, 31);
      Date end = c.getTime();

      Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "generateUsageRecords",
         Date.class, Date.class, GenerateUsageRecordsOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));

      assertRequestLineEquals(httpRequest,
         "GET http://localhost:8080/client/api?response=json&command=generateUsageRecords&startdate=2012-01-01&enddate=2012-01-31 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

      c.set(Calendar.DAY_OF_MONTH, 31);
      Date end = c.getTime();

      Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "generateUsageRecords",
         Date.class, Date.class, GenerateUsageRecordsOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, GenerateUsageRecordsOptions.Builder.domainId("42")));

      assertRequestLineEquals(httpRequest,
         "GET http://localhost:8080/client/api?response=json&command=generateUsageRecords&startdate=2012-01-01&enddate=2012-01-31&domainid=42 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

      c.set(Calendar.DAY_OF_MONTH, 31);
      Date end = c.getTime();

      Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "listUsageRecords",
         Date.class, Date.class, ListUsageRecordsOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));

      assertRequestLineEquals(httpRequest,
         "GET http://localhost:8080/client/api?response=json&command=listUsageRecords&listAll=true&startdate=2012-01-01&enddate=2012-01-31 HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

      c.set(Calendar.DAY_OF_MONTH, 31);
      Date end = c.getTime();

      Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "listUsageRecords",
         Date.class, Date.class, ListUsageRecordsOptions[].class);
      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, ListUsageRecordsOptions.Builder.accountInDomain("fred", "42").accountId("41").keyword("bob")));

      assertRequestLineEquals(httpRequest,
         "GET http://localhost:8080/client/api?response=json&command=listUsageRecords&listAll=true&startdate=2012-01-01&enddate=2012-01-31&account=fred&domainid=42&accountid=41&keyword=bob HTTP/1.1");
      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
      assertPayloadEquals(httpRequest, null, null, false);
View Full Code Here

TOP

Related Classes of org.jclouds.rest.internal.GeneratedHttpRequest

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.