use of org.openstack4j.api.compute.ext.ZoneService in project cloudbreak by hortonworks.
the class OpenStackClientTest method testGetZones.
@Test
public void testGetZones() {
OSClient<?> osClient = mock(OSClient.class);
ComputeService computeService = mock(ComputeService.class);
ZoneService zoneService = mock(ZoneService.class);
List availabilityZones = newArrayList(availabilityZone("zone1"));
when(osClient.compute()).thenReturn(computeService);
when(computeService.zones()).thenReturn(zoneService);
when(zoneService.list()).thenReturn(availabilityZones);
List<AvailabilityZone> actual = underTest.getZones(osClient, "region");
Assert.assertEquals(1, actual.size());
Assert.assertEquals("zone1", actual.get(0).value());
}
use of org.openstack4j.api.compute.ext.ZoneService in project cloudbreak by hortonworks.
the class OpenStackClientTest method testGetZonesWhenAvailabiltyZonesEmpt.
@Test
public void testGetZonesWhenAvailabiltyZonesEmpt() {
OSClient<?> osClient = mock(OSClient.class);
ComputeService computeService = mock(ComputeService.class);
ZoneService zoneService = mock(ZoneService.class);
when(osClient.compute()).thenReturn(computeService);
when(computeService.zones()).thenReturn(zoneService);
when(zoneService.list()).thenReturn(Collections.emptyList());
List<AvailabilityZone> actual = underTest.getZones(osClient, "region");
Assert.assertEquals(0, actual.size());
}
Aggregations