Search in sources :

Example 31 with Operation

use of com.google.cloud.compute.v1.Operation in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method fParameterDefinition.

/**
 * Abstract Test 48: Validate that the f query parameter is constructed correctly. (position)
 * Abstract Test 64: Validate that the f query parameter is constructed correctly. (area)
 * Abstract Test 80: Validate that the f query parameter is constructed correctly. (cube)
 * Abstract Test 98: Validate that the f query parameter is constructed correctly. (trajectory)
 * Abstract Test 130: Validate that the f query parameter is constructed correctly. (corridor)
 * Abstract Test 145: Validate that the f query parameter is constructed correctly. (locations)
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void fParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter f = null;
    String paramName = "f";
    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)) {
                            f = param;
                        }
                    }
                }
            }
        }
    }
    if (f != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(f.getName(), paramName, String.format(msg, "name", paramName, f.getName()));
        assertEquals(f.getIn(), "query", String.format(msg, "in", "query", f.getIn()));
        assertFalse(isRequired(f), String.format(msg, "required", "false", f.getRequired()));
        assertEquals(f.getStyle(), "form", String.format(msg, "style", "form", f.getStyle()));
        assertFalse(isExplode(f), String.format(msg, "explode", "false", f.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 32 with Operation

use of com.google.cloud.compute.v1.Operation in project ets-ogcapi-edr10 by opengeospatial.

the class CollectionsTime method corridorHeightParameterDefinition.

/**
 * <pre>
 * Abstract Test 120: Validate that the corridor-height query parameter is constructed correctly.
 * </pre>
 *
 * @param testPoint the testPoint under test, never <code>null</code>
 * @param model api definition, never <code>null</code>
 */
public void corridorHeightParameterDefinition(TestPoint testPoint, OpenApi3 model) {
    Parameter corridorHeight = null;
    String paramName = "corridor-height";
    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)) {
                            corridorHeight = param;
                        }
                    }
                }
            }
        }
    }
    if (corridorHeight != null) {
        String msg = "Expected property '%s' with value '%s' but was '%s'";
        assertEquals(corridorHeight.getName(), paramName, String.format(msg, "name", paramName, corridorHeight.getName()));
        assertEquals(corridorHeight.getIn(), "query", String.format(msg, "in", "query", corridorHeight.getIn()));
        assertTrue(isRequired(corridorHeight), String.format(msg, "required", "true", corridorHeight.getRequired()));
        assertEquals(corridorHeight.getStyle(), "form", String.format(msg, "style", "form", corridorHeight.getStyle()));
        assertFalse(isExplode(corridorHeight), String.format(msg, "explode", "false", corridorHeight.getExplode()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 33 with Operation

use of com.google.cloud.compute.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()));
    }
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) Parameter(com.reprezen.kaizen.oasparser.model3.Parameter) Operation(com.reprezen.kaizen.oasparser.model3.Operation)

Example 34 with Operation

use of com.google.cloud.compute.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());
}
Also used : ResultSet(java.sql.ResultSet) RowOperation(jdk.incubator.sql2.RowOperation) RowPublisherOperation(jdk.incubator.sql2.RowPublisherOperation) Operation(jdk.incubator.sql2.Operation) RowCountOperation(jdk.incubator.sql2.RowCountOperation) RowOperation(jdk.incubator.sql2.RowOperation)

Example 35 with Operation

use of com.google.cloud.compute.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());
}
Also used : RowCountOperation(jdk.incubator.sql2.RowCountOperation) RowOperation(jdk.incubator.sql2.RowOperation) RowPublisherOperation(jdk.incubator.sql2.RowPublisherOperation) Operation(jdk.incubator.sql2.Operation) RowCountOperation(jdk.incubator.sql2.RowCountOperation)

Aggregations

ArrayList (java.util.ArrayList)81 Test (org.junit.Test)79 AbstractMessage (com.google.protobuf.AbstractMessage)65 Operation (com.google.cloud.compute.v1.Operation)49 Operation (com.google.container.v1.Operation)43 StatusCondition (com.google.container.v1.StatusCondition)40 Operation (com.google.container.v1beta1.Operation)24 StatusCondition (com.google.container.v1beta1.StatusCondition)23 InstancesClient (com.google.cloud.compute.v1.InstancesClient)20 Operation (com.reprezen.kaizen.oasparser.model3.Operation)16 Path (com.reprezen.kaizen.oasparser.model3.Path)15 Operation (net.opengis.ows.v_1_0_0.Operation)15 Instance (com.google.cloud.compute.v1.Instance)13 Parameter (com.reprezen.kaizen.oasparser.model3.Parameter)13 DomainType (net.opengis.ows.v_1_0_0.DomainType)13 AttachedDisk (com.google.cloud.compute.v1.AttachedDisk)12 InsertInstanceRequest (com.google.cloud.compute.v1.InsertInstanceRequest)11 Operation (org.osate.aadl2.Operation)8 NetworkInterface (com.google.cloud.compute.v1.NetworkInterface)7 BooleanLiteral (org.osate.aadl2.BooleanLiteral)7