Improved test to check the organization filter
This commit is contained in:
parent
7a0dbf48a9
commit
06930ba4e1
|
@ -69,27 +69,34 @@ public class CKANPackageTest extends ContextTest {
|
||||||
parameters.put(CKANPackage.START_KEY, String.valueOf(0));
|
parameters.put(CKANPackage.START_KEY, String.valueOf(0));
|
||||||
|
|
||||||
boolean[] values = new boolean[]{true, false};
|
boolean[] values = new boolean[]{true, false};
|
||||||
|
for(boolean includeValidOrganization : values) {
|
||||||
for(boolean includeFakeOrganization : values) {
|
for(boolean includeFakeOrganization : values) {
|
||||||
|
|
||||||
MultivaluedMap<String,String> queryParameters = new MultivaluedHashMap<>();
|
MultivaluedMap<String,String> queryParameters = new MultivaluedHashMap<>();
|
||||||
if(includeFakeOrganization) {
|
StringWriter stringWriter = new StringWriter();
|
||||||
queryParameters.add(GCatConstants.Q_KEY, "organization:ckand4scienceharvest OR organization:"+ckanOrganizationName);
|
|
||||||
}else {
|
|
||||||
queryParameters.add(GCatConstants.Q_KEY, "organization:"+ckanOrganizationName);
|
|
||||||
}
|
|
||||||
// parameters.put(GCatConstants.Q_KEY, "organization:ckand4scienceharvest");
|
|
||||||
// parameters.put(GCatConstants.Q_KEY, "organization:dorne");
|
|
||||||
|
|
||||||
/*
|
boolean addOr = false;
|
||||||
queryParameters.add(CKANPackage.ROWS_KEY, String.valueOf(10));
|
if(includeFakeOrganization) {
|
||||||
queryParameters.add(CKANPackage.START_KEY, String.valueOf(0));
|
stringWriter.append("organization:fakeorganization");
|
||||||
*/
|
addOr = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(includeValidOrganization) {
|
||||||
|
if(addOr) {
|
||||||
|
stringWriter.append(" OR ");
|
||||||
|
}
|
||||||
|
stringWriter.append("organization:");
|
||||||
|
stringWriter.append(ckanOrganizationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String filter = stringWriter.toString();
|
||||||
|
if(filter.length()>0) {
|
||||||
|
queryParameters.add(GCatConstants.Q_KEY, filter);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
parameters.put("fl","[\"name\"]");
|
parameters.put("fl","[\"name\"]");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
parameters.put("facet.field","[\"name\"]");
|
parameters.put("facet.field","[\"name\"]");
|
||||||
parameters.put("sort","name asc");
|
parameters.put("sort","name asc");
|
||||||
|
@ -112,6 +119,7 @@ public class CKANPackageTest extends ContextTest {
|
||||||
|
|
||||||
logger.debug("List :\n{}", mapper.writeValueAsString(gotList));
|
logger.debug("List :\n{}", mapper.writeValueAsString(gotList));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue