Package org.jclouds.openstack.nova.v2_0.features

Examples of org.jclouds.openstack.nova.v2_0.features.ImageApi


      }

      @Override
      protected Function<Object, IterableWithMarker<ImageDetails>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<ImageDetails>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ImageDetails> apply(Object input) {
               return IterableWithMarker.class.cast(imageApi.listInDetail(marker(input.toString())));
            }

            @Override
            public String toString() {
               return "listInDetail()";
View Full Code Here


      }

      @Override
      protected Function<Object, IterableWithMarker<Image>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<Image>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Image> apply(Object input) {
               return IterableWithMarker.class.cast(imageApi.list(marker(input.toString())));
            }

            @Override
            public String toString() {
               return "list()";
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<ImageDetails>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<ImageDetails>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ImageDetails> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               Collection<String> markers = paginationOptions.buildQueryParameters().get("marker");

               if (!markers.isEmpty()) {
                  return IterableWithMarker.class.cast(imageApi.listInDetail(marker(getOnlyElement(markers))));
               }
               else {
                  return IterableWithMarkers.EMPTY;
               }                
            }
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Image>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<Image>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Image> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               Collection<String> markers = paginationOptions.buildQueryParameters().get("marker");

               if (!markers.isEmpty()) {
                  return IterableWithMarker.class.cast(imageApi.listInDetail(marker(getOnlyElement(markers))));
               }
               else {
                  return IterableWithMarkers.EMPTY;
               }
            }
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<ImageDetails>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<ImageDetails>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ImageDetails> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               Collection<String> markers = paginationOptions.buildQueryParameters().get("marker");

               if (!markers.isEmpty()) {
                  return IterableWithMarker.class.cast(imageApi.listInDetail(marker(getOnlyElement(markers))));
               }
               else {
                  return IterableWithMarkers.EMPTY;
               }                
            }
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Image>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<Image>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Image> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               Collection<String> markers = paginationOptions.buildQueryParameters().get("marker");

               if (!markers.isEmpty()) {
                  return IterableWithMarker.class.cast(imageApi.listInDetail(marker(getOnlyElement(markers))));
               }
               else {
                  return IterableWithMarkers.EMPTY;
               }
            }
View Full Code Here

@Test(groups = "unit", singleThreaded = true, testName = "LoadFloatingIpsForInstanceTest")
public class LoadFloatingIpsForInstanceTest {

   @Test
   public void testReturnsPublicIpOnMatch() throws Exception {
      NovaApi api = createMock(NovaApi.class);
      FloatingIPApi ipApi = createMock(FloatingIPApi.class);
      FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build();

      expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
      expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(testIp)))
               .atLeastOnce();

      replay(api);
      replay(ipApi);
View Full Code Here

      verify(ipApi);
   }

   @Test
   public void testReturnsNullWhenNotFound() throws Exception {
      NovaApi api = createMock(NovaApi.class);
      FloatingIPApi ipApi = createMock(FloatingIPApi.class);

      expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();

      expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of()))
      .atLeastOnce();

      replay(api);
View Full Code Here

   }

   @Test
   public void testReturnsNullWhenNotAssigned() throws Exception {
      NovaApi api = createMock(NovaApi.class);
      FloatingIPApi ipApi = createMock(FloatingIPApi.class);

      expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();

      expect(ipApi.list()).andReturn((FluentIterable) FluentIterable.from(ImmutableSet.<FloatingIP> of(FloatingIP.builder().id("1").ip("1.1.1.1").build())))
      .atLeastOnce();

      replay(api);
View Full Code Here

                        authToken).build()).build();

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

      NovaApi apiWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list,
               listResponse);

      assertEquals(apiWhenSecurityGroupsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));

      assertEquals(apiWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get()
               .list().toString(), new ParseSecurityGroupListTest().expected().toString());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.features.ImageApi

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.