add log4j2.xml

This commit is contained in:
Shinsuke Sugaya 2024-02-10 16:25:06 +09:00
parent 8e215f4cbd
commit b485b21c9d
3 changed files with 29 additions and 3 deletions

View file

@ -101,6 +101,7 @@ public abstract class CrudTestBase extends ITBase {
// Bodies
// ================
protected void testCreate() {
logger.info("[BEGIN] testCreate");
// Test: create setting api.
for (int i = 0; i < NUM; i++) {
final Map<String, Object> requestBody = createTestParam(i);
@ -114,9 +115,11 @@ public abstract class CrudTestBase extends ITBase {
// Test: number of settings.
final Map<String, Object> searchBody = createSearchBody(SEARCH_ALL_NUM);
checkGetMethod(searchBody, getListEndpointSuffix()).then().body(getJsonPath() + ".size()", equalTo(NUM));
logger.info("[END] testCreate");
}
protected void testRead() {
logger.info("[BEGIN] testRead");
// Test: get settings api.
final Map<String, Object> searchBody = createSearchBody(SEARCH_ALL_NUM);
List<String> nameList = getPropList(searchBody, getKeyProperty());
@ -141,10 +144,11 @@ public abstract class CrudTestBase extends ITBase {
searchBody.put("page", i + 1);
checkGetMethod(searchBody, getListEndpointSuffix()).then().body("response." + getListEndpointSuffix() + ".size()", equalTo(1));
}
logger.info("[END] testRead");
}
protected void testUpdate() {
logger.info("[BEGIN] testUpdate");
// Test: update settings api
final Set<String> keySet = createTestParam(0).keySet();
final Map<String, Object> updateMap = getUpdateMap();
@ -169,6 +173,7 @@ public abstract class CrudTestBase extends ITBase {
}
checkUpdate();
logger.info("[END] testUpdate");
}
protected void checkUpdate() {
@ -184,6 +189,7 @@ public abstract class CrudTestBase extends ITBase {
}
protected void testDelete() {
logger.info("[BEGIN] testDelete");
final Map<String, Object> searchBody = createSearchBody(SEARCH_ALL_NUM);
for (int count = 0; count < NUM; count++) {
@ -194,6 +200,7 @@ public abstract class CrudTestBase extends ITBase {
// Test: number of settings.
checkGetMethod(searchBody, getListEndpointSuffix()).then().body(getJsonPath() + ".size()", equalTo(0));
logger.info("[END] testDelete");
}
// ================

View file

@ -18,6 +18,8 @@ package org.codelibs.fess.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codelibs.core.io.ResourceUtil;
import org.codelibs.fess.es.config.exentity.LabelType;
import org.codelibs.fess.helper.SystemHelper;
@ -26,6 +28,8 @@ import org.xml.sax.InputSource;
public class GsaConfigParserTest extends UnitFessTestCase {
private static final Logger logger = LogManager.getLogger(GsaConfigParserTest.class);
@Override
public void setUp() throws Exception {
super.setUp();
@ -38,10 +42,10 @@ public class GsaConfigParserTest extends UnitFessTestCase {
parser.parse(new InputSource(is));
}
parser.getWebConfig().ifPresent(c -> {
System.out.println(c.toString());
logger.debug(c.toString());
}).orElse(() -> fail());
parser.getFileConfig().ifPresent(c -> {
System.out.println(c.toString());
logger.debug(c.toString());
}).orElse(() -> fail());
LabelType[] labelTypes = parser.getLabelTypes();
assertEquals(3, labelTypes.length);

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>