Skip to content

Commit

Permalink
Merge pull request #80 from opengeospatial/issue#56
Browse files Browse the repository at this point in the history
Closes #56
  • Loading branch information
dstenger authored Nov 29, 2023
2 parents 7f9acaf + dc0a6aa commit 1139aa8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ protected Input createInput(JsonNode schemaNode, String id) {
JsonNode formatNode = schemaNode.get("format");
if(formatNode != null) {
String format = formatNode.asText();
input.setFormat(format);
if(format.equals("byte")) {
type.setBinary(true);
}
Expand Down Expand Up @@ -373,6 +374,7 @@ public class Type {
private String contentMediaType;
private String contentSchema;
private boolean isBinary;
private String format;

public Type(String typeDefinition) {
this.typeDefinition = typeDefinition;
Expand Down Expand Up @@ -424,13 +426,18 @@ public String toString() {
builder.append("\tIs binary: " + isBinary + "\n");
return builder.toString();
}

public String getFormat() {
return format;
}
}

public class Input {

private String id;
private List<Type> types;
private boolean isBbox;
protected String id;
protected List<Type> types;
protected boolean isBbox;
protected String format;

public Input(String id, List<Type> types, boolean isBbox) {
this.id = id;
Expand Down Expand Up @@ -466,7 +473,15 @@ public boolean addType(Type type) {
return types.add(type);
}

@Override
public String getFormat() {
return format;
}

public void setFormat(String format) {
this.format = format;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Id: " + id + "\n");
Expand Down
24 changes: 20 additions & 4 deletions src/main/java/org/opengis/cite/ogcapiprocesses10/jobs/Jobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ private ObjectNode createExecuteJsonNode(String echoProcessId) {
addOutput(output, outputsNode);
}
executeNode.set("inputs", inputsNode);
if(inputsNode.isEmpty()) {
throw new AssertionError("No supported input found. Only plain string input is supported.");
}
executeNode.set("outputs", outputsNode);
return executeNode;
}
Expand All @@ -305,7 +308,9 @@ private void addInput(Input input, ObjectNode inputsNode) {

for (Type type : types) {
if(type.getTypeDefinition().equals("string")) {
inputsNode.set(input.getId(), new TextNode(TEST_STRING_INPUT));
if(input.getFormat() == null && type.getContentMediaType() == null) {
inputsNode.set(input.getId(), new TextNode(TEST_STRING_INPUT));
}
} else if(input.isBbox()) {
inputNode.set("crs", new TextNode("urn:ogc:def:crs:EPSG:6.6:4326"));
ArrayNode arrayNode = objectMapper.createArrayNode();
Expand All @@ -315,7 +320,9 @@ private void addInput(Input input, ObjectNode inputsNode) {
arrayNode.add(345345345);
inputNode.set("bbox", arrayNode);
inputsNode.set(input.getId(), inputNode);
}
} else if(type.getTypeDefinition().equals(TYPE_DEFINITION_OBJECT)) {
addObjectInput(input, inputsNode);
}
}
}

Expand Down Expand Up @@ -1839,7 +1846,12 @@ public void testJobResultsExceptionResultsNotReady() {
HttpResponse httpResponse = null;
final ValidationData<Void> data = new ValidationData<>();
//create invalid execute request
JsonNode executeNode = createExecuteJsonNodeWithPauseInput(echoProcessId, RESPONSE_VALUE_RAW);
JsonNode executeNode;
try {
executeNode = createExecuteJsonNodeWithPauseInput(echoProcessId, RESPONSE_VALUE_RAW);
} catch (SkipException e) {
throw e;
}

try {
System.out.println("Checking error: asynchronous POST request..."+executeNode);
Expand Down Expand Up @@ -2427,7 +2439,11 @@ private JsonNode createExecuteJsonNodeWithPauseInput(String echoProcessId, Strin
}
}

inputsNode.set("pause", new IntNode(5));
if(inputs.stream().anyMatch(p -> p.getId().equals("pause") )) {
inputsNode.set("pause", new IntNode(5));
} else {
throw new SkipException("No input with id pause found.");
}

executeNode.set("inputs", inputsNode);
executeNode.set("outputs", outputsNode);
Expand Down
4 changes: 3 additions & 1 deletion src/site/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ The following conformance classes from v1.0.0 (https://docs.ogc.org/is/18-062r2/
* OpenAPI 3.0
* Job list

NOTE: For Abstract Test A.46 (/conf/core/job-results-exception-results-not-ready), the ETS will automatically add a field called `"pause":5` into the execution request of the echo process to support Recommendation A.1.
Preconditions:
* For Abstract Test A.46 (/conf/core/job-results-exception-results-not-ready), the ETS will automatically add a field called `"pause":5` into the execution request of the echo process to support Recommendation A.1.
* Several test of process execution rely on the tested process offering a plain string input. Plain string meaning `"type": "string"` and **no** format or content MIME-type. For those tests, other input types will not be used to create an execute JSON request. If no plain string input is available, the respective tests will fail.

0 comments on commit 1139aa8

Please sign in to comment.