Skip to content

Commit

Permalink
[WIP] Admin API Test: searchlist #1054
Browse files Browse the repository at this point in the history
  • Loading branch information
igarash1 committed May 30, 2018
1 parent 4862e26 commit 7fafbeb
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions src/test/java/org/codelibs/fess/it/admin/SearchListTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,22 @@ protected Map<String, Object> createSearchBody(final int size) {
@Override
protected Map<String, Object> getUpdateMap() {
final Map<String, Object> updateMap = new HashMap<>();
// final Map<String, Object> doc = new HashMap<>();
updateMap.put("click_count", 100);
// updateMap.put("click_count", 100);
return updateMap;
}

@Override
protected void testUpdate() {

// Test: update settings api
// final Set<String> keySet = createTestParam(0).keySet();
final Map<String, Object> updateMap = getUpdateMap();
final Map<String, Object> searchBody = createSearchBody(SEARCH_ALL_NUM);
List<Map<String, Object>> settings = getItemList(searchBody);
// logger.info("size of settings = " + settings.size());

for (Map<String, Object> setting : settings) {
final Map<String, Object> requestBody = new HashMap<>(updateMap);
final String idKey = getIdKey();

requestBody.put("version", 1);
requestBody.put("crud_mode", 2);

Expand All @@ -124,32 +122,9 @@ protected void testUpdate() {
doc.put("title", setting.get("title"));
doc.put("role", "Rguest");
doc.put("boost", setting.get("boost"));
// doc.put("click_count", "100"); // Validation Error
// doc.put("click_count", 100); // Validation Error
requestBody.put("doc", doc);
/*
// for debugging
logger.info("elements of requestBody...");
Set<String> keySet = requestBody.keySet();
for (String key : keySet) {
if (requestBody.get(key) != null) {
logger.info(key + ", " + requestBody.get(key).toString());
} else {
logger.info(key + ", null");
}
}
logger.info("elements of setting...");
keySet = setting.keySet();
for (String key : keySet) {
if (setting.get(key) != null) {
logger.info(key + ", " + setting.get(key).toString());
} else {
logger.info(key + ", null");
}
}
*/

checkPostMethod(requestBody, getItemEndpointSuffix()).then().body("response.status", equalTo(0));
refresh();
}
Expand All @@ -159,7 +134,7 @@ protected void testUpdate() {

@Override
protected List<Map<String, Object>> getItemList(final Map<String, Object> body) {
final String response = checkMethodBase(body).get(API_PATH + "/" + LIST_ENDPOINT_SUFFIX).asString();
final String response = checkMethodBase(body).get(getApiPath() + "/" + getListEndpointSuffix()).asString();
final List<Map<String, Object>> results = JsonPath.from(response).getList("response.docs");
return results;
}
Expand Down

0 comments on commit 7fafbeb

Please sign in to comment.