Skip to content

Commit

Permalink
IGNITE-23472 Add test for GridTestLog4jLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
chesnokoff committed Nov 26, 2024
1 parent 52ef234 commit d51ef1c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@

import java.io.File;
import java.net.URL;
import java.util.UUID;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.logger.IgniteLoggerEx;
import org.apache.ignite.internal.util.lang.RunnableX;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -146,6 +148,19 @@ public void testTrace() {
tryLog(() -> log.trace(LOG_MESSAGE), Level.TRACE);
}

/**
* @throws Exception If failed.
*/
@Test
public void testSystemNodeId() throws Exception {
UUID id = UUID.randomUUID();

new GridTestLog4jLogger(LOG_PATH_TEST).setApplicationAndNode(null, id);

assertEquals(U.id8(id), System.getProperty("nodeId"));
assertEquals("ignite", System.getProperty("appId"));
}

/** */
private static void tryLog(RunnableX clo, Level level) {
String assertionMsg = format(ASSERTION_FORMAT_MSG, level.toString(), level);
Expand Down

0 comments on commit d51ef1c

Please sign in to comment.