use of com.google.container.v1.Operation in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method resolutionzParameterDefinition.
/**
* <pre>
* Requirement A.30: /req/edr/resolution-z-definition Parameter resolution-z definition
* </pre>
* NOTE: Not referenced by ATS
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void resolutionzParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter resolutionz = null;
String paramName = "resolution-z";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
resolutionz = param;
}
}
}
}
}
}
if (resolutionz != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(resolutionz.getName(), paramName, String.format(msg, "name", paramName, resolutionz.getName()));
assertEquals(resolutionz.getIn(), "query", String.format(msg, "in", "query", resolutionz.getIn()));
assertFalse(isRequired(resolutionz), String.format(msg, "required", "false", resolutionz.getRequired()));
assertEquals(resolutionz.getStyle(), "form", String.format(msg, "style", "form", resolutionz.getStyle()));
assertFalse(isExplode(resolutionz), String.format(msg, "explode", "false", resolutionz.getExplode()));
}
}
use of com.google.container.v1.Operation in project oracle-db-examples by oracle-samples.
the class MultiOperation method processChildRowOperation.
/**
* Process next resultset. Get the child operation from the queue (if any submitted) and pass
* the resultset to it for the processing. If no child operation in the queue then process resultset
* with the help of user supplied row handler or the default one. Wait for the child operation or
* the handler to process all rows of a resultset.
*
* @return the completion stage of the child operation.
* @throws SQLException
*/
private CompletionStage<T> processChildRowOperation() throws SQLException {
// Get the result set
ResultSet resultSet = jdbcStatement.getResultSet();
// Remove child operation, if any exist
Operation operationFromQueue = resultOperations.poll();
// Keep as effective final, because it uses in lambda expression
Operation operation;
boolean onRowsHandler = (operationFromQueue == null);
if (onRowsHandler) {
// Handle using onRows handler.
operation = new MultiRowOperation<T>(session, group, true);
} else
operation = operationFromQueue;
if (!(operation instanceof ChildRowOperation)) {
// Throw invalid state
throw new IllegalStateException("TODO");
}
// Trigger child operation to process the resultset
resultStage = ((ChildRowOperation) operation).setResultSet(resultSet, resultStage);
if (onRowsHandler)
resultStage = resultStage.thenRun(() -> rowsHandler.accept(resultNum, (RowOperation<T>) operation));
// Then again move to moreResult stage to process next resultset.
return resultStage.thenComposeAsync(((ChildRowOperation) operation)::resultProcessed, getExecutor()).thenComposeAsync(this::checkForMoreResults, getExecutor());
}
use of com.google.container.v1.Operation in project oracle-db-examples by oracle-samples.
the class MultiOperation method processChildRowCountOperation.
/**
* Process next update count. Get the child operation from the queue (if any submitted) and pass
* the update count to it for the processing. If no child operation in the queue then process update count
* with the help of user supplied rowcount handler or the default one. Wait for the child operation or
* the handler to process the update count.
*
* @param updateCount
* @return the completion stage of the child operation.
*/
private CompletionStage<T> processChildRowCountOperation(long updateCount) {
// Remove child operation, if any exist
Operation operationFromQueue = resultOperations.poll();
// Keep as effective final, because it uses in lambda expression
Operation operation;
boolean onCountHandler = (operationFromQueue == null);
if (onCountHandler) {
// Handle using onCount handler
operation = new MultiRowCountOperation<T>(session, group, true);
} else
operation = operationFromQueue;
if (!(operation instanceof ChildRowCountOperation)) {
// Throw invalid state
throw new IllegalStateException("TODO");
}
resultStage = ((ChildRowCountOperation) operation).setRowCount(updateCount, resultStage);
if (onCountHandler)
resultStage = resultStage.thenRun(() -> countHandler.accept(resultNum, (RowCountOperation<T>) operation));
return resultStage.thenComposeAsync(((ChildRowCountOperation) operation)::resultCountProcessed, getExecutor()).thenComposeAsync(this::checkForMoreResults, getExecutor());
}
use of com.google.container.v1.Operation in project java-docs-samples by GoogleCloudPlatform.
the class PreemptibleIT method testListZoneOperations.
@Test
public void testListZoneOperations() throws IOException {
String filter = String.format("targetLink=\"https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instances/%s\"", PROJECT_ID, ZONE, INSTANCE_NAME);
ListPagedResponse response = ListZoneOperations.listZoneOperations(PROJECT_ID, ZONE, filter);
boolean elementPresent = false;
for (Operation operation : response.iterateAll()) {
elementPresent = true;
break;
}
assertWithMessage("There should be at least one operation for this instance at this point.").that(elementPresent).isTrue();
}
use of com.google.container.v1.Operation in project java-docs-samples by GoogleCloudPlatform.
the class WindowsOsImageIT method setup.
@BeforeAll
public static void setup() throws IOException, ExecutionException, InterruptedException, TimeoutException {
final PrintStream out = System.out;
ByteArrayOutputStream stdOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(stdOut));
requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
requireEnvVar("GOOGLE_CLOUD_PROJECT");
// Cleanup existing test instances.
Util.cleanUpExistingInstances("windowsimage-test-instance-", PROJECT_ID, ZONE);
String randomUUID = UUID.randomUUID().toString().split("-")[0];
INSTANCE_NAME = "windowsimage-test-instance-" + randomUUID;
DISK_NAME = "windowsimage-test-disk-" + randomUUID;
IMAGE_NAME = "windowsimage-test-image-" + randomUUID;
// Create Instance with Windows source image.
try (InstancesClient instancesClient = InstancesClient.create()) {
AttachedDisk attachedDisk = AttachedDisk.newBuilder().setDeviceName(DISK_NAME).setAutoDelete(true).setBoot(true).setType(AttachedDisk.Type.PERSISTENT.name()).setInitializeParams(AttachedDiskInitializeParams.newBuilder().setDiskName(DISK_NAME).setDiskSizeGb(64).setSourceImage("projects/windows-cloud/global/images/windows-server-2012-r2-dc-core-v20220314").build()).build();
Instance instance = Instance.newBuilder().setName(INSTANCE_NAME).setMachineType(String.format("zones/%s/machineTypes/n1-standard-1", ZONE)).addNetworkInterfaces(NetworkInterface.newBuilder().setName("global/networks/default").build()).addDisks(attachedDisk).build();
InsertInstanceRequest request = InsertInstanceRequest.newBuilder().setProject(PROJECT_ID).setZone(ZONE).setInstanceResource(instance).build();
Operation response = instancesClient.insertAsync(request).get();
Assert.assertFalse(response.hasError());
}
stdOut.close();
System.setOut(out);
}
Aggregations