Improved test
This commit is contained in:
parent
a134a93f02
commit
7630ecbd84
|
@ -5,7 +5,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
## [v4.1.1-SNAPSHOT]
|
||||
|
||||
- Fixed bug on JSONQuery for Facets which does not have any properties to match [#24237]
|
||||
- Fixed bug on JSONQuery for IsRelatedTo relations indicating both source and target resources [#24264]
|
||||
- Fixed bug on returned boolean values as string [#24240]
|
||||
- Enabled array properties [#24225]
|
||||
|
||||
|
||||
## [v4.1.0]
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.resourceregistry.queries;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FilenameFilter;
|
||||
import java.net.URL;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
|
@ -34,8 +35,16 @@ public class JsonQueryTest extends ContextTest {
|
|||
|
||||
File queriesDirectory = getQueriesDirectory();
|
||||
|
||||
for(int i=1; i<7; i++) {
|
||||
File jsonQueryFile = new File(queriesDirectory, "query" + i + ".json");
|
||||
FilenameFilter filenameFilter = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".json");
|
||||
}
|
||||
};
|
||||
|
||||
for(File jsonQueryFile : queriesDirectory.listFiles(filenameFilter)) {
|
||||
logger.info("Going to read JSON query frtm file {}", jsonQueryFile.getAbsolutePath());
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
|
||||
logger.info("Going to test the following JSON query {}", jsonNode.toString());
|
||||
|
@ -47,7 +56,7 @@ public class JsonQueryTest extends ContextTest {
|
|||
logger.info("Created Query from JSON: {}", createdStringBuffer.toString());
|
||||
|
||||
StringBuffer expectedStringBuffer = new StringBuffer();
|
||||
File expectedQueryFile = new File(queriesDirectory, "query" + i + ".query");
|
||||
File expectedQueryFile = new File(queriesDirectory, jsonQueryFile.getName().replace("json", "query"));
|
||||
try(BufferedReader br = new BufferedReader(new FileReader(expectedQueryFile))) {
|
||||
for(String line; (line = br.readLine()) != null; ) {
|
||||
expectedStringBuffer.append(line);
|
||||
|
|
Loading…
Reference in New Issue