Skip to content

Commit

Permalink
add log4j2.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Feb 10, 2024
1 parent 8e215f4 commit b485b21
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/test/java/org/codelibs/fess/it/CrudTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ protected static void tearDownAll() {
// 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);
Expand All @@ -114,9 +115,11 @@ protected void testCreate() {
// 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());
Expand All @@ -141,10 +144,11 @@ protected void testRead() {
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();
Expand All @@ -169,6 +173,7 @@ protected void testUpdate() {
}

checkUpdate();
logger.info("[END] testUpdate");
}

protected void checkUpdate() {
Expand All @@ -184,6 +189,7 @@ protected void checkUpdate() {
}

protected void testDelete() {
logger.info("[BEGIN] testDelete");
final Map<String, Object> searchBody = createSearchBody(SEARCH_ALL_NUM);

for (int count = 0; count < NUM; count++) {
Expand All @@ -194,6 +200,7 @@ protected void testDelete() {

// Test: number of settings.
checkGetMethod(searchBody, getListEndpointSuffix()).then().body(getJsonPath() + ".size()", equalTo(0));
logger.info("[END] testDelete");
}

// ================
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/org/codelibs/fess/util/GsaConfigParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
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;
Expand All @@ -26,6 +28,8 @@

public class GsaConfigParserTest extends UnitFessTestCase {

private static final Logger logger = LogManager.getLogger(GsaConfigParserTest.class);

@Override
public void setUp() throws Exception {
super.setUp();
Expand All @@ -38,10 +42,10 @@ public void test_parse() throws IOException {
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);
Expand Down
15 changes: 15 additions & 0 deletions src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit b485b21

Please sign in to comment.