update test cases
This commit is contained in:
parent
12a57af1c6
commit
1d45fb6a47
14 changed files with 61 additions and 68 deletions
|
@ -17,6 +17,7 @@ package org.codelibs.fess.it;
|
|||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
@ -27,6 +28,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.codelibs.core.lang.ThreadUtil;
|
||||
|
||||
import io.restassured.path.json.JsonPath;
|
||||
import io.restassured.response.Response;
|
||||
|
@ -52,21 +54,17 @@ public class CrawlTestBase extends ITBase {
|
|||
logger.info("Start scheduler \"{}\"", schedulerId);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
ThreadUtil.sleep(1000L);
|
||||
}
|
||||
assertTrue(false, "could not start job.");
|
||||
fail("could not start job.");
|
||||
}
|
||||
|
||||
protected static void waitJob(final String namePrefix) throws InterruptedException {
|
||||
protected static void waitJob(final String namePrefix) {
|
||||
Boolean isRunning = false;
|
||||
int count = 0;
|
||||
|
||||
while (count < 300 && !isRunning) { // Wait until the crawler starts
|
||||
Thread.sleep(500);
|
||||
ThreadUtil.sleep(500);
|
||||
count++;
|
||||
final Map<String, Object> scheduler = getSchedulerItem(namePrefix);
|
||||
assertTrue(scheduler.containsKey("running"));
|
||||
|
@ -74,14 +72,14 @@ public class CrawlTestBase extends ITBase {
|
|||
}
|
||||
if (300 <= count) {
|
||||
logger.info("Time out: Failed to start crawler)");
|
||||
assertTrue(false); // Time Out
|
||||
fail(); // Time Out
|
||||
}
|
||||
|
||||
logger.info("Crawler is running");
|
||||
count = 0;
|
||||
isRunning = true;
|
||||
while (count < 300 && isRunning) { // Wait until the crawler terminates
|
||||
Thread.sleep(1000);
|
||||
ThreadUtil.sleep(1000);
|
||||
count++;
|
||||
final Map<String, Object> scheduler = getSchedulerItem(namePrefix);
|
||||
assertTrue(scheduler.containsKey("running"));
|
||||
|
@ -90,7 +88,7 @@ public class CrawlTestBase extends ITBase {
|
|||
}
|
||||
if (300 <= count) {
|
||||
logger.info("Time out: Crawler takes too much time");
|
||||
//TODO assertTrue(false); // Time Out
|
||||
//TODO fail(); // Time Out
|
||||
}
|
||||
|
||||
logger.info("Crawler terminated");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.codelibs.fess.it.admin;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +64,13 @@ public class BackupTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,24 +57,19 @@ public class CrawlerLogTests extends CrawlTestBase {
|
|||
settingTestToken();
|
||||
|
||||
// create and execute a web crawler
|
||||
try {
|
||||
createWebConfig();
|
||||
logger.info("WebConfig is created");
|
||||
refresh();
|
||||
webConfigId = getWebConfigIds(NAME_PREFIX).get(0);
|
||||
createWebConfig();
|
||||
logger.info("WebConfig is created");
|
||||
refresh();
|
||||
webConfigId = getWebConfigIds(NAME_PREFIX).get(0);
|
||||
|
||||
createJob();
|
||||
logger.info("Job is created");
|
||||
refresh();
|
||||
createJob();
|
||||
logger.info("Job is created");
|
||||
refresh();
|
||||
|
||||
startJob(NAME_PREFIX);
|
||||
startJob(NAME_PREFIX);
|
||||
|
||||
waitJob(NAME_PREFIX);
|
||||
refresh();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
assertTrue(false);
|
||||
}
|
||||
waitJob(NAME_PREFIX);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.codelibs.fess.it.admin;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +65,13 @@ public class GeneralTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.codelibs.fess.it.admin;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +64,13 @@ public class JobLogTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.codelibs.fess.it.admin;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +64,13 @@ public class LogTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.core.lang.ThreadUtil;
|
||||
import org.codelibs.fess.helper.PluginHelper.Artifact;
|
||||
import org.codelibs.fess.it.CrudTestBase;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -146,7 +147,7 @@ public class PluginTests extends CrudTestBase {
|
|||
boolean exists = installed.stream().map(this::getArtifactFromMap)
|
||||
.anyMatch(a -> a.getName().equals(target.getName()) && a.getVersion().equals(target.getVersion()));
|
||||
if (!exists) {
|
||||
Thread.sleep(500);
|
||||
ThreadUtil.sleep(500);
|
||||
continue;
|
||||
}
|
||||
assertTrue(exists);
|
||||
|
@ -166,7 +167,7 @@ public class PluginTests extends CrudTestBase {
|
|||
boolean exists = installed.stream().map(this::getArtifactFromMap)
|
||||
.anyMatch(a -> a.getName().equals(target.getName()) && a.getVersion().equals(target.getVersion()));
|
||||
if (exists) {
|
||||
Thread.sleep(500);
|
||||
ThreadUtil.sleep(500);
|
||||
continue;
|
||||
}
|
||||
assertFalse(exists);
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.codelibs.fess.it.admin;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +65,13 @@ public class SuggestTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.codelibs.fess.it.admin;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -64,13 +65,13 @@ public class SystemInfoTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.codelibs.fess.it.admin.dict;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -61,7 +62,7 @@ public abstract class DictCrudTestBase extends CrudTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
assertTrue(false);
|
||||
fail();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.codelibs.fess.it.admin.dict;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -65,13 +65,13 @@ public class DictTests extends CrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> createTestParam(int id) {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.it.admin.dict;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -74,7 +74,7 @@ public class ProtwordsTests extends DictCrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.it.admin.dict;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -74,7 +74,7 @@ public class StopwordsTests extends DictCrudTestBase {
|
|||
|
||||
@Override
|
||||
protected Map<String, Object> getUpdateMap() {
|
||||
assertTrue(false); // Unreachable
|
||||
fail(); // Unreachable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,27 +58,22 @@ public class SearchApiTests extends CrawlTestBase {
|
|||
settingTestToken();
|
||||
|
||||
// create and execute a file crawler
|
||||
try {
|
||||
labelId = createLabel();
|
||||
crawlLabelId = createCrawlLabel();
|
||||
labelId = createLabel();
|
||||
crawlLabelId = createCrawlLabel();
|
||||
|
||||
createFileConfig();
|
||||
logger.info("FileConfig is created");
|
||||
refresh();
|
||||
fileConfigId = getFileConfigIds(NAME_PREFIX).get(0);
|
||||
createFileConfig();
|
||||
logger.info("FileConfig is created");
|
||||
refresh();
|
||||
fileConfigId = getFileConfigIds(NAME_PREFIX).get(0);
|
||||
|
||||
createJob();
|
||||
logger.info("Job is created");
|
||||
refresh();
|
||||
createJob();
|
||||
logger.info("Job is created");
|
||||
refresh();
|
||||
|
||||
startJob(NAME_PREFIX);
|
||||
startJob(NAME_PREFIX);
|
||||
|
||||
waitJob(NAME_PREFIX);
|
||||
refresh();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
assertTrue(false);
|
||||
}
|
||||
waitJob(NAME_PREFIX);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
|
Loading…
Add table
Reference in a new issue