org.jclouds.openstack.nova.v2_0.domain.regionscoped.ZoneState类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.regionscoped.ZoneState类的一些代码示例,展示了ZoneState类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneState类的具体详情如下:
包路径:org.jclouds.openstack.nova.v2_0.domain.regionscoped.ZoneState
类名称:ZoneState

ZoneState介绍

暂无

代码示例

代码示例来源:origin: com.amysta.jclouds.api/openstack-nova

@Override
public String toString() {
 return string().toString();
}

代码示例来源:origin: apache/jclouds

@Test
public void testListAvailabilityZones() throws Exception {
 Optional<? extends AvailabilityZoneApi> availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne");
 if (availabilityZoneApi.isPresent()) {
   FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.get().listAvailabilityZones();
   for (AvailabilityZone zone : zones) {
    assertNotNull(zone.getName());
    assertTrue(zone.getState().isAvailable(), "zone: " + zone.getName() + " is not available.");
   }
 }
}

代码示例来源:origin: apache/jclouds

@Test
  public void testListInDetail() throws Exception {

   Optional<? extends AvailabilityZoneApi> availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne");
   if (availabilityZoneApi.isPresent()) {
     FluentIterable<? extends AvailabilityZoneDetails> zones = availabilityZoneApi.get().listInDetail();

     for (AvailabilityZoneDetails zone : zones) {
      assertNotNull(zone.getName());
      assertTrue(zone.getState()
         .isAvailable(), "zone: " + zone.getName() + " is not available.");
      String hostName = zone.getHosts().keySet().iterator().next();
      assertNotNull(hostName, "Expected host name to be not null");
      String hostServiceName = zone.getHosts().get(hostName).keySet().iterator().next();
      assertNotNull(hostServiceName, "Expected host service name to be not null");
      HostService hostService = zone.getHosts().get(hostName).get(hostServiceName);
      assertTrue(hostService.isAvailable(), "Couldn't find host service availability");
      assertTrue(hostService.isActive(), "Couldn't find host service state");
      assertNotNull(hostService.getUpdated(), "Expected Updated time, but none received ");

     }
   }
  }
}

代码示例来源:origin: org.apache.jclouds.api/openstack-nova

@Override
public String toString() {
 return string().toString();
}

代码示例来源:origin: apache/jclouds

assertTrue(zone.get()
   .getState()
   .isAvailable(), "Zone: " + zone.get()
   .getName() + " is not available.");
String hostName = zone.get().getHosts().keySet().iterator().next();

代码示例来源:origin: apache/jclouds

@Override
public String toString() {
 return string().toString();
}

代码示例来源:origin: apache/jclouds

public void testListAvailabilityZones() throws Exception {
 HttpRequest list = HttpRequest
    .builder()
    .method("GET")
    .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-availability-zone")
    .addHeader("Accept", "application/json")
    .addHeader("X-Auth-Token", authToken).build();
 HttpResponse listResponse = HttpResponse.builder().statusCode(200)
    .payload(payloadFromResource("/listAvailabilityZones.json")).build();
 NovaApi availabilityZonesApi = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
    extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
 assertEquals(availabilityZonesApi.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
 FluentIterable<? extends AvailabilityZone> zones = availabilityZonesApi.getAvailabilityZoneApi("az-1.region-a.geo-1").get().listAvailabilityZones();
 Optional<? extends AvailabilityZone> zone = zones.first();
 assertTrue(zone.isPresent(), "Couldn't find zone");
 assertEquals(zone.get().getName(), "internal", "Expected zone name to be internal but it was: " + zone.get().getName());
 assertTrue(zone.get().getState().isAvailable(), "Zone: " + zone.get().getName() + " is not available.");
}

相关文章