@Test public void isOperationCompleteFullName () { String project = MY_AWESOME_PROJECT; String zone = "my-datacenter"; String operationName = "my-operation"; String operationId = String.format(ProjectZoneOperationName.SERVICE_ADDRESS + "%s/zones/%s/operations/%s", project, zone, operationName); ProjectZoneOperationName projectZoneOperation = ProjectZoneOperationName.of(operationName, project, zone); Operation operation = mock(Operation.class); doReturn(operation).when(zoneOperationClient).getZoneOperation(projectZoneOperation); doReturn(99, 100, 101).when(operation).getProgress(); assertFalse(gcpComputePlatform.isOperationComplete(operationId)); assertTrue(gcpComputePlatform.isOperationComplete(operationId)); assertTrue(gcpComputePlatform.isOperationComplete(operationId)); }
public boolean isOperationComplete (String operationId) { if (operationId == null) return false; if (operationId.startsWith(ProjectZoneOperationName.SERVICE_ADDRESS)) { operationId = operationId.substring(ProjectZoneOperationName.SERVICE_ADDRESS.length()); } log.info("Checking status of Google Compute Operation {}", operationId); Operation zoneOperation = getZoneOperationClient().getZoneOperation(ProjectZoneOperationName.parse(operationId)); return zoneOperation.getProgress() >= 100; }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isOperationComplete (String operationId) { if (operationId == null) return false; if (operationId.startsWith(ProjectZoneOperationName.SERVICE_ADDRESS)) { operationId = operationId.substring(ProjectZoneOperationName.SERVICE_ADDRESS.length()); } log.info("Checking status of Google Compute Operation {}", operationId); Operation zoneOperation = getZoneOperationClient().getZoneOperation(ProjectZoneOperationName.parse(operationId)); return zoneOperation.getProgress() >= 100; } }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isOperationComplete (String operationId) { if (operationId == null) return false; if (operationId.startsWith(ProjectZoneOperationName.SERVICE_ADDRESS)) { operationId = operationId.substring(ProjectZoneOperationName.SERVICE_ADDRESS.length()); } log.info("Checking status of Google Compute Operation {}", operationId); Operation zoneOperation = getZoneOperationClient().getZoneOperation(ProjectZoneOperationName.parse(operationId)); return zoneOperation.getProgress() >= 100; }  }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isOperationComplete (String operationId) { if (operationId == null) return false; if (operationId.startsWith(ProjectZoneOperationName.SERVICE_ADDRESS)) { operationId = operationId.substring(ProjectZoneOperationName.SERVICE_ADDRESS.length()); } log.info("Checking status of Google Compute Operation {}", operationId); Operation zoneOperation = getZoneOperationClient().getZoneOperation(ProjectZoneOperationName.parse(operationId)); return zoneOperation.getProgress() >= 100; }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId); }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isOperationComplete (String operationId) { if (operationId == null) return false; if (operationId.startsWith(ProjectZoneOperationName.SERVICE_ADDRESS)) { operationId = operationId.substring(ProjectZoneOperationName.SERVICE_ADDRESS.length()); } log.info("Checking status of Google Compute Operation {}", operationId); Operation zoneOperation = getZoneOperationClient().getZoneOperation(ProjectZoneOperationName.parse(operationId)); return zoneOperation.getProgress() >= 100; }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId);  }