Package org.jclouds.joyent.cloudapi.v6_5.options

Examples of org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions


   }

   @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

   }

   public void testGetDatacentersWhenResponseIs404() {
      HttpResponse getDatacentersResponse = HttpResponse.builder().statusCode(404).build();

      JoyentCloudApi getDatacentersWhenNone = requestSendsResponse(getDatacenters, getDatacentersResponse);

      assertEquals(getDatacentersWhenNone.getDatacenterApi().getDatacenters(), ImmutableMap.of());
   }
View Full Code Here

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

   public void testListMachinesWhenResponseIs2xx() {

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

      assertEquals(apiWhenMachinesExists.getMachineApiForDatacenter("us-sw-1").list(), new ParseMachineListTest().expected());
   }
View Full Code Here

   }

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

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

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

TOP

Related Classes of org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions

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.