com.google.cloud.compute.deprecated.ZoneOperationId.getOperation()方法的使用及代码示例

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

本文整理了Java中com.google.cloud.compute.deprecated.ZoneOperationId.getOperation()方法的一些代码示例,展示了ZoneOperationId.getOperation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOperationId.getOperation()方法的具体详情如下:
包路径:com.google.cloud.compute.deprecated.ZoneOperationId
类名称:ZoneOperationId
方法名:getOperation

ZoneOperationId.getOperation介绍

暂无

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Override
public String getSelfLink() {
 return super.getSelfLink() + "/zones/" + zone + "/operations/" + getOperation();
}

代码示例来源:origin: googleapis/google-cloud-java

@Override
ZoneOperationId setProjectId(String projectId) {
 if (getProject() != null) {
  return this;
 }
 return ZoneOperationId.of(projectId, zone, getOperation());
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testDeleteZoneOperation_True() {
 EasyMock.expect(
     computeRpcMock.deleteZoneOperation(
       ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation()))
   .andReturn(true);
 EasyMock.replay(computeRpcMock);
 compute = options.getService();
 assertTrue(compute.deleteOperation(ZONE_OPERATION_ID));
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testDeleteZoneOperation_False() {
 EasyMock.expect(
     computeRpcMock.deleteZoneOperation(
       ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation()))
   .andReturn(false);
 EasyMock.replay(computeRpcMock);
 compute = options.getService();
 assertFalse(compute.deleteOperation(ZONE_OPERATION_ID));
}

代码示例来源:origin: googleapis/google-cloud-java

@Override
 public com.google.api.services.compute.model.Operation call() {
  switch (operationId.getType()) {
   case REGION:
    RegionOperationId regionOperationId = (RegionOperationId) operationId;
    return computeRpc.getRegionOperation(
      regionOperationId.getRegion(),
      regionOperationId.getOperation(),
      optionsMap);
   case ZONE:
    ZoneOperationId zoneOperationId = (ZoneOperationId) operationId;
    return computeRpc.getZoneOperation(
      zoneOperationId.getZone(), zoneOperationId.getOperation(), optionsMap);
   case GLOBAL:
    return computeRpc.getGlobalOperation(operationId.getOperation(), optionsMap);
   default:
    throw new IllegalArgumentException("Unexpected operation identity type");
  }
 }
},

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testGetZoneOperation_Null() {
 EasyMock.expect(
     computeRpcMock.getZoneOperation(
       ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation(), EMPTY_RPC_OPTIONS))
   .andReturn(null);
 EasyMock.replay(computeRpcMock);
 compute = options.getService();
 assertNull(compute.getOperation(ZONE_OPERATION_ID));
}

代码示例来源:origin: googleapis/google-cloud-java

@Override
 public Boolean call() {
  switch (operation.getType()) {
   case REGION:
    RegionOperationId regionOperationId = (RegionOperationId) operation;
    return computeRpc.deleteRegionOperation(
      regionOperationId.getRegion(), regionOperationId.getOperation());
   case ZONE:
    ZoneOperationId zoneOperationId = (ZoneOperationId) operation;
    return computeRpc.deleteZoneOperation(
      zoneOperationId.getZone(), zoneOperationId.getOperation());
   case GLOBAL:
    return computeRpc.deleteGlobalOperation(operation.getOperation());
   default:
    throw new IllegalArgumentException("Unexpected operation identity type");
  }
 }
},

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testGetZoneOperation() {
 EasyMock.expect(
     computeRpcMock.getZoneOperation(
       ZONE_OPERATION_ID.getZone(), ZONE_OPERATION_ID.getOperation(), EMPTY_RPC_OPTIONS))
   .andReturn(zoneOperation.toPb());
 EasyMock.replay(computeRpcMock);
 compute = options.getService();
 Operation operation = compute.getOperation(ZONE_OPERATION_ID);
 assertEquals(zoneOperation, operation);
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testGetZoneOperationWithSelectedFields() {
 Capture<Map<ComputeRpc.Option, Object>> capturedOptions = Capture.newInstance();
 EasyMock.expect(
     computeRpcMock.getZoneOperation(
       eq(ZONE_OPERATION_ID.getZone()),
       eq(ZONE_OPERATION_ID.getOperation()),
       capture(capturedOptions)))
   .andReturn(zoneOperation.toPb());
 EasyMock.replay(computeRpcMock);
 compute = options.getService();
 Operation operation = compute.getOperation(ZONE_OPERATION_ID, OPERATION_OPTION_FIELDS);
 String selector =
   (String) capturedOptions.getValue().get(OPERATION_OPTION_FIELDS.getRpcOption());
 assertTrue(selector.contains("selfLink"));
 assertTrue(selector.contains("id"));
 assertTrue(selector.contains("description"));
 assertEquals(23, selector.length());
 assertEquals(zoneOperation, operation);
}

代码示例来源:origin: googleapis/google-cloud-java

private void compareZoneOperationId(ZoneOperationId expected, ZoneOperationId value) {
 assertEquals(expected, value);
 assertEquals(expected.getProject(), expected.getProject());
 assertEquals(expected.getZone(), expected.getZone());
 assertEquals(expected.getOperation(), expected.getOperation());
 assertEquals(expected.getSelfLink(), expected.getSelfLink());
 assertEquals(expected.hashCode(), expected.hashCode());
}

代码示例来源:origin: googleapis/google-cloud-java

assertEquals(PROJECT, zoneOperationId.getProject());
assertEquals(ZONE, zoneOperationId.getZone());
assertEquals(NAME, zoneOperationId.getOperation());
assertEquals(ZONE_URL, zoneOperationId.getSelfLink());
zoneOperationId = ZoneOperationId.of(ZONE, NAME);
assertNull(zoneOperationId.getProject());
assertEquals(ZONE, zoneOperationId.getZone());
assertEquals(NAME, zoneOperationId.getOperation());
zoneOperationId = ZoneOperationId.of(ZoneId.of(PROJECT, ZONE), NAME);
assertEquals(OperationId.Type.ZONE, zoneOperationId.getType());
assertEquals(PROJECT, zoneOperationId.getProject());
assertEquals(ZONE, zoneOperationId.getZone());
assertEquals(NAME, zoneOperationId.getOperation());
RegionOperationId regionOperationId = RegionOperationId.of(PROJECT, REGION, NAME);
assertEquals(OperationId.Type.REGION, regionOperationId.getType());

相关文章