@Test public void testGetZones() { OSClient<?> osClient = mock(OSClient.class); ComputeService computeService = mock(ComputeService.class); ZoneService zoneService = mock(ZoneService.class); when(availabilityZone.getZoneName()).thenReturn("zone1"); when(osClient.compute()).thenReturn(computeService); when(computeService.zones()).thenReturn(zoneService); List availabilityZones = Collections.singletonList(availabilityZone); when(zoneService.list()).thenReturn(availabilityZones); List<AvailabilityZone> actual = underTest.getZones(osClient, "region"); Assert.assertEquals(1L, actual.size()); Assert.assertEquals("zone1", actual.get(0).value()); }
public List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack) { List<? extends AvailabilityZone> zonesFromOS = osClient.compute().zones().list(); LOGGER.debug("Zones from openstack for {}: {}", regionFromOpenStack, zonesFromOS); return zonesFromOS.stream().map(z -> availabilityZone(z.getZoneName())).collect(Collectors.toList()); }
OpenStackClient { public List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack) { List<? extends AvailabilityZone> zonesFromOS = osClient.compute().zones().list(); LOGGER.debug("Zones from openstack for {}: {}", regionFromOpenStack, zonesFromOS); return zonesFromOS.stream().map(z -> availabilityZone(z.getZoneName())).collect(Collectors.toList()); } }
OpenStackClient { public List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack) { List<? extends AvailabilityZone> zonesFromOS = osClient.compute().zones().list(); LOGGER.debug("Zones from openstack for {}: {}", regionFromOpenStack, zonesFromOS); return zonesFromOS.stream().map(z -> availabilityZone(z.getZoneName())).collect(Collectors.toList()); }  }
OpenStackClient { public List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack) { List<? extends AvailabilityZone> zonesFromOS = osClient.compute().zones().list(); LOGGER.debug("Zones from openstack for {}: {}", regionFromOpenStack, zonesFromOS); return zonesFromOS.stream().map(z -> availabilityZone(z.getZoneName())).collect(Collectors.toList()); }  @PostConstruct void init(); AuthenticatedContext createAuthenticatedContext(CloudContext cloudContext, CloudCredential cloudCredential); OSClient<?> createOSClient(AuthenticatedContext authenticatedContext); OSClient<?> createOSClient(CloudCredential cloudCredential); String getV2TenantId(AuthenticatedContext authenticatedContext); boolean isV2Keystone(AuthenticatedContext authenticatedContext); boolean isV2Keystone(CloudCredential cloudCredential); boolean isV2Keystone(KeystoneCredentialView osCredential); KeystoneCredentialView createKeystoneCredential(CloudCredential cloudCredential); KeystoneCredentialView createKeystoneCredential(AuthenticatedContext authenticatedContext); List<CloudResource> getResources(String stackName, CloudCredential cloudCredential); Set<String> getRegion(CloudCredential cloudCredential); List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack); List<? extends Flavor> getFlavors(OSClient<?> osClient); }
OpenStackClient { public List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack) { List<? extends AvailabilityZone> zonesFromOS = osClient.compute().zones().list(); LOGGER.debug("Zones from openstack for {}: {}", regionFromOpenStack, zonesFromOS); return zonesFromOS.stream().map(z -> availabilityZone(z.getZoneName())).collect(Collectors.toList()); }  @PostConstruct void init(); AuthenticatedContext createAuthenticatedContext(CloudContext cloudContext, CloudCredential cloudCredential); OSClient<?> createOSClient(AuthenticatedContext authenticatedContext); OSClient<?> createOSClient(CloudCredential cloudCredential); String getV2TenantId(AuthenticatedContext authenticatedContext); boolean isV2Keystone(AuthenticatedContext authenticatedContext); boolean isV2Keystone(CloudCredential cloudCredential); boolean isV2Keystone(KeystoneCredentialView osCredential); KeystoneCredentialView createKeystoneCredential(CloudCredential cloudCredential); KeystoneCredentialView createKeystoneCredential(AuthenticatedContext authenticatedContext); List<CloudResource> getResources(String stackName, CloudCredential cloudCredential); Set<String> getRegion(CloudCredential cloudCredential); List<com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone> getZones(OSClient<?> osClient, String regionFromOpenStack); List<? extends Flavor> getFlavors(OSClient<?> osClient); static final String OS_NEUTRON_SUBNET; static final String OS_NEUTRON_NET; static final String OS_NEUTRON_FLOATING_IP; static final String OS_TROVE_INSTANCE; static final String OS_CINDER_VOLUME_ATTACHMENT; static final String OS_NEUTRON_PORT; static final String OS_NEUTRON_SECURITY_GROUP; static final String OS_NEUTRON_ROUTER; }