Package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped

Examples of org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter


      HttpResponse createWithDatasetResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
               .payload(payloadFromResourceWithContentType("/new_machine.json", "application/json; charset=UTF-8"))
               .build();

      JoyentCloudApi apiWithNewMachine = requestsSendResponses(getDatacenters, getDatacentersResponse, createWithDataset, createWithDatasetResponse);

      assertEquals(
            apiWithNewMachine
                  .getMachineApiForDatacenter("us-sw-1")
                  .createWithDataset("sdc:sdc:centos-5.7:1.2.1",
                        CreateMachineOptions.Builder.name("sample-e92").packageName("Small 1GB")).toString(),
            new ParseCreatedMachineTest().expected().toString());
   }
View Full Code Here


   public HttpResponse listResponse = HttpResponse.builder().statusCode(200)
                                                 .payload(payloadFromResource("/dataset_list.json")).build();
  
   public void testListDatasetsWhenResponseIs2xx() {

      JoyentCloudApi apiWhenDatasetsExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(apiWhenDatasetsExists.getDatasetApiForDatacenter("us-sw-1").list().toString(), new ParseDatasetListTest()
               .expected().toString());
   }
View Full Code Here

   }

   public void testListDatasetsWhenResponseIs404() {
      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

      JoyentCloudApi listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(listWhenNone.getDatasetApiForDatacenter("us-sw-1").list(), ImmutableSet.of());
   }
View Full Code Here

   }

   @Test
   public void testApply() {
      JoyentCloudApi cloudApiApi = createMock(JoyentCloudApi.class);
      SshKeyPairGenerator sshKeyPairGenerator = new SshKeyPairGenerator() {

         @Override
         public Map<String, String> get() {
            return keyPair;
         }

      };
      KeyApi keyApi = createMock(KeyApi.class);
      Key key = Key.builder().name("group-foo").key(keyPair.get("public")).build();

      expect(cloudApiApi.getKeyApi()).andReturn(keyApi);

      expect(keyApi.create(key)).andReturn(key);

      replay(cloudApiApi, keyApi);
View Full Code Here

   public HttpResponse listResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResource("/package_list.json")).build();
  
   public void testListPackagesWhenResponseIs2xx() {

      JoyentCloudApi apiWhenPackagesExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(apiWhenPackagesExists.getPackageApiForDatacenter("us-sw-1").list(), new ParsePackageListTest().expected());
   }
View Full Code Here

   }

   public void testListPackagesWhenResponseIs404() {
      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

      JoyentCloudApi listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(listWhenNone.getPackageApiForDatacenter("us-sw-1").list(), ImmutableSet.of());
   }
View Full Code Here

   public HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
            payloadFromResource("/key_list.json")).build();

   public void testListKeysWhenResponseIs2xx() {

      JoyentCloudApi apiWhenKeysExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(apiWhenKeysExists.getKeyApi().list(), new ParseKeyListTest().expected());
   }
View Full Code Here

   }

   public void testListKeysWhenResponseIs404() {
      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

      JoyentCloudApi listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(listWhenNone.getKeyApi().list(), ImmutableSet.of());
   }
View Full Code Here

      HttpResponse createResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
               .payload(payloadFromResourceWithContentType("/key.json", "application/json; charset=UTF-8"))
               .build();

      JoyentCloudApi apiWithNewKey = requestsSendResponses(getDatacenters, getDatacentersResponse, create, createResponse);

      assertEquals(apiWithNewKey.getKeyApi().create(new ParseKeyTest().expected())
            .toString(), new ParseKeyTest().expected().toString());
   }
View Full Code Here

@Test(groups = "unit", testName = "DatacenterApiExpectTest")
public class DatacenterApiExpectTest extends BaseJoyentCloudApiExpectTest {

   public void testGetDatacentersWhenResponseIs2xx() {

      JoyentCloudApi apiWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);

      assertEquals(
            apiWhenDatacentersExists.getDatacenterApi().getDatacenters(),
            ImmutableMap.<String, URI> builder().put("us-east-1", URI.create("https://us-east-1.api.joyentcloud.com"))
                  .put("us-west-1", URI.create("https://us-west-1.api.joyentcloud.com"))
                  .put("us-sw-1", URI.create("https://us-sw-1.api.joyentcloud.com"))
                  .put("eu-ams-1", URI.create("https://eu-ams-1.api.joyentcloud.com")).build());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter

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.