use of com.reprezen.kaizen.oasparser.model3.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()));
}
}
use of com.reprezen.kaizen.oasparser.model3.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.reprezen.kaizen.oasparser.model3.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.reprezen.kaizen.oasparser.model3.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.reprezen.kaizen.oasparser.model3.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();
}
Aggregations