Skip to content

Commit

Permalink
Merge branch 'master' into issue#131
Browse files Browse the repository at this point in the history
  • Loading branch information
dstenger authored Oct 21, 2024
2 parents d8e87bb + 70214e6 commit 9a625c0
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void validateResponseForEDRGeoJSON(ITestContext testContext) {
String supportedFormat = null;

for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("GeoJSON")) {
if (outputFormatList.get(f).equalsIgnoreCase("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
Expand Down Expand Up @@ -228,7 +228,7 @@ else if(bboxEnv.get(0).getClass().toString().contains("java.util.ArrayList")) {

try {
if(supportedFormat!=null && supportedCRS!=null) {
if(supportedFormat.equals("GeoJSON") &&
if(supportedFormat.equalsIgnoreCase("GeoJSON") &&

(supportedCRS.equals("CRS84") ||
supportedCRS.equals("CRS:84") ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void validateResponseForGeoJSON(ITestContext testContext) {
ArrayList<String> outputFormatList = (ArrayList<String>) variables.get("output_formats");
String supportedFormat = null;
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("GeoJSON")) {
if (outputFormatList.get(f).equalsIgnoreCase("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.List;

public abstract class AbstractProcessor {

Expand All @@ -29,5 +30,27 @@ public String readStringFromURL(String urlString,int limit) throws Exception

return response.toString();
}


int getMaximum(int noOfCollections, int collectionsListSize) {
//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise use the specified noOfCollections
int maximum = noOfCollections == -1 ? collectionsListSize : noOfCollections;
maximum = noOfCollections > collectionsListSize ? collectionsListSize : noOfCollections;
return maximum;
}

String getSupportedFormat(List<String> outputFormatList) {
String supportedFormat = "";
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equalsIgnoreCase("CoverageJSON") || outputFormatList.get(f).toLowerCase().contains("CoverageJSON".toLowerCase())) { //preference for CoverageJSON if supported
supportedFormat = outputFormatList.get(f);
}
else if (outputFormatList.get(f).equalsIgnoreCase("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
return supportedFormat;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ public String validateAreaQueryUsingParameters(Set<String> collectionIds, String
StringBuffer sb = new StringBuffer();

ArrayList<String> collectionsList = new ArrayList<String>();
collectionsList.addAll(collectionIds);

//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise use the specified noOfCollections
int maximum = noOfCollections == -1 ? collectionsList.size() : noOfCollections;
collectionsList.addAll(collectionIds);

//fix setting of maximum, see https://github.com/opengeospatial/ets-ogcapi-edr10/issues/133
int maximum = getMaximum(noOfCollections, collectionsList.size());

for (int c = 0; c < maximum; c++) {

Expand Down Expand Up @@ -85,16 +84,8 @@ public String validateAreaQueryUsingParameters(Set<String> collectionIds, String
HashMap link = (HashMap) areaQuery.get("link");
HashMap variables = (HashMap) link.get("variables");
ArrayList<String> outputFormatList = (ArrayList<String>) variables.get("output_formats");
String supportedFormat = null;
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("CoverageJSON") || outputFormatList.get(f).contains("CoverageJSON")) { //preference for CoverageJSON if supported
supportedFormat = outputFormatList.get(f);
}
else if (outputFormatList.get(f).equals("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}

String supportedFormat = getSupportedFormat(outputFormatList);

double medianx = 0d;
double mediany = 0d;
double lminx = 0d; //lens
Expand Down Expand Up @@ -173,8 +164,10 @@ else if(bboxEnv.get(0).getClass().toString().contains("java.util.ArrayList")) {
try {
sampleParamaterNameSafe = URLEncoder.encode(sampleParamaterName,"UTF8");
}
catch(Exception ex) {ex.printStackTrace();}

catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}

String sampleDateTime = null;
if (extent.containsKey("temporal")) {
Expand Down Expand Up @@ -236,7 +229,10 @@ else if(intervalEnv.get(0).getClass().toString().contains("java.util.ArrayList")
pageContent = readStringFromURL(constructedURL,10); //you can use Integer.MAX_VALUE for no limit

}
catch(Exception ex) { ex.printStackTrace();}
catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}

if(pageContent!=null) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ public String validateCorridorQueryUsingParameters(Set<String> collectionIds, St

int numberOfCollectionsWithCorridorSupport = 0;

//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise use the specified noOfCollections
int maximum = noOfCollections == -1 ? collectionsList.size() : noOfCollections;
//fix setting of maximum, see https://github.com/opengeospatial/ets-ogcapi-edr10/issues/133
int maximum = getMaximum(noOfCollections, collectionsList.size());

for (int c = 0; c < maximum; c++) {

Expand Down Expand Up @@ -93,15 +92,7 @@ public String validateCorridorQueryUsingParameters(Set<String> collectionIds, St
HashMap link = (HashMap) corridorQuery.get("link");
HashMap variables = (HashMap) link.get("variables");
ArrayList<String> outputFormatList = (ArrayList<String>) variables.get("output_formats");
String supportedFormat = null;
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("CoverageJSON") || outputFormatList.get(f).contains("CoverageJSON")) { //preference for CoverageJSON if supported
supportedFormat = outputFormatList.get(f);
}
else if (outputFormatList.get(f).equals("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
String supportedFormat = getSupportedFormat(outputFormatList);

double medianx = 0d;
double mediany = 0d;
Expand Down Expand Up @@ -236,7 +227,10 @@ else if(intervalEnv.get(0).getClass().toString().contains("java.util.ArrayList")
pageContent = readStringFromURL(constructedURL,10); //you can use Integer.MAX_VALUE for no limit

}
catch(Exception ex) { ex.printStackTrace();}
catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}

if(pageContent!=null) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ public String validatePositionQueryUsingParameters(Set<String> collectionIds, St
StringBuffer sb = new StringBuffer();
ArrayList<String> collectionsList = new ArrayList<String>();
collectionsList.addAll(collectionIds);

//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise use the specified noOfCollections
int maximum = noOfCollections == -1 ? collectionsList.size() : noOfCollections;

//fix setting of maximum, see https://github.com/opengeospatial/ets-ogcapi-edr10/issues/133
int maximum = getMaximum(noOfCollections, collectionsList.size());

for (int c = 0; c < maximum; c++) {

Expand Down Expand Up @@ -87,14 +86,7 @@ public String validatePositionQueryUsingParameters(Set<String> collectionIds, St
sb.append(" The variables element is missing from the collection "+collectionId+" .");
} else {
ArrayList<String> outputFormatList = (ArrayList<String>) variables.get("output_formats");
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("CoverageJSON") || outputFormatList.get(f).contains("CoverageJSON")) { //preference for CoverageJSON if supported
supportedFormat = outputFormatList.get(f);
}
else if (outputFormatList.get(f).equals("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
supportedFormat = getSupportedFormat(outputFormatList);
}

double medianx = 0d;
Expand Down Expand Up @@ -216,7 +208,11 @@ else if(intervalEnv.get(0).getClass().toString().contains("java.util.ArrayList")
pageContent = readStringFromURL(constructedURL,10); //you can use Integer.MAX_VALUE for no limit

}
catch(Exception ex) {ex.printStackTrace();}
catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}


if(pageContent!=null) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public void validateNoQueryParameters(Object collectionIdentifiers) {
//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise, use the specified noOfCollections
int maximum = this.noOfCollections == -1 ? collectionsList.size() : this.noOfCollections;
maximum = this.noOfCollections > collectionsList.size() ? collectionsList.size() : this.noOfCollections;

for (int c = 0; c < maximum; c++) {

Expand Down Expand Up @@ -181,6 +182,7 @@ public void validateCoordsQueryParameters(Object collectionIdentifiers) {
//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise, use the specified noOfCollections
int maximum = this.noOfCollections == -1 ? collectionsList.size() : this.noOfCollections;
maximum = this.noOfCollections > collectionsList.size() ? collectionsList.size() : this.noOfCollections;

for (int c = 0; c < maximum; c++) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ public String validateTrajectoryQueryUsingParameters(Set<String> collectionIds,

int numberOfCollectionsWithTrajectorySupport = 0;

//if noOfCollections is -1 (meaning check box 'Test all collections' was checked)
//use all collections. Otherwise use the specified noOfCollections
int maximum = noOfCollections == -1 ? collectionsList.size() : noOfCollections;
//fix setting of maximum, see https://github.com/opengeospatial/ets-ogcapi-edr10/issues/133
int maximum = getMaximum(noOfCollections, collectionsList.size());

for (int c = 0; c <maximum; c++) {

Expand Down Expand Up @@ -88,15 +87,7 @@ public String validateTrajectoryQueryUsingParameters(Set<String> collectionIds,
HashMap link = (HashMap) trajectoryQuery.get("link");
HashMap variables = (HashMap) link.get("variables");
ArrayList<String> outputFormatList = (ArrayList<String>) variables.get("output_formats");
String supportedFormat = null;
for (int f = 0; f < outputFormatList.size(); f++) {
if (outputFormatList.get(f).equals("CoverageJSON") || outputFormatList.get(f).contains("CoverageJSON")) { //preference for CoverageJSON if supported
supportedFormat = outputFormatList.get(f);
}
else if (outputFormatList.get(f).equals("GeoJSON")) {
supportedFormat = outputFormatList.get(f);
}
}
String supportedFormat = getSupportedFormat(outputFormatList);

double medianx = 0d;
double mediany = 0d;
Expand Down Expand Up @@ -172,8 +163,10 @@ else if(bboxEnv.get(0).getClass().toString().contains("java.util.ArrayList")) {
try {
sampleParamaterNameSafe = URLEncoder.encode(sampleParamaterName,"UTF8");
}
catch(Exception ex) {ex.printStackTrace();}

catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}

String sampleDateTime = null;
if (extent.containsKey("temporal")) {
Expand Down Expand Up @@ -233,7 +226,10 @@ else if(intervalEnv.get(0).getClass().toString().contains("java.util.ArrayList")
pageContent = readStringFromURL(constructedURL,10); //you can use Integer.MAX_VALUE for no limit

}
catch(Exception ex) { ex.printStackTrace();}
catch(Exception ex) {
ex.printStackTrace();
sb.append(ex.getMessage() + " \n");
}

if(pageContent!=null) {

Expand Down

0 comments on commit 9a625c0

Please sign in to comment.