blob: ed7b188b135a50c8c9e25f21c24ec441c698c68e [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to you under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>${revision}</version>
<relativePath>../log4j-parent</relativePath>
</parent>
<artifactId>log4j-layout-template-json-test</artifactId>
<name>Apache Log4j JSON Template Layout tests</name>
<properties>
<bnd.baseline.skip>true</bnd.baseline.skip>
<maven.deploy.skip>true</maven.deploy.skip>
<sign.skip>true</sign.skip>
<!--
~ OSGi and JPMS options
-->
<bnd-module-name>org.apache.logging.log4j.layout.template.json.test</bnd-module-name>
<Fragment-Host>org.apache.logging.log4j.core</Fragment-Host>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
</dependency>
<dependency>
<groupId>org.jctools</groupId>
<artifactId>jctools-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.java-allocation-instrumenter</groupId>
<artifactId>java-allocation-instrumenter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>log4j2-ecs-layout</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Disable ITs, which are Docker-dependent, by default. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Enforcing a non-UTF-8 encoding to check that the layout
indeed handles everything in UTF-8 without implicitly
relying on the system defaults. -->
<argLine>-Dfile.encoding=US-ASCII</argLine>
<systemPropertyVariables>
<!-- Enable JUnit 5 parallel execution. -->
<junit.jupiter.execution.parallel.enabled>true</junit.jupiter.execution.parallel.enabled>
<junit.jupiter.execution.parallel.mode.default>concurrent</junit.jupiter.execution.parallel.mode.default>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<elastic.version>8.10.2</elastic.version>
<!-- `docker run elasticsearch:<TAG>` exists with code 137 due to insufficient memory.
We limit the used JVM memory to avoid this OOM failure. -->
<elastic.java-opts>-Xms750m -Xmx750m</elastic.java-opts>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<verbose>all</verbose>
<startParallel>true</startParallel>
<autoCreateCustomNetworks>true</autoCreateCustomNetworks>
<images>
<image>
<alias>elasticsearch</alias>
<name>elasticsearch:${elastic.version}</name>
<run>
<env>
<discovery.type>single-node</discovery.type>
<xpack.security.enabled>false</xpack.security.enabled>
<ES_JAVA_OPTS>${elastic.java-opts}</ES_JAVA_OPTS>
</env>
<ports>
<port>9200:9200</port>
</ports>
<network>
<mode>custom</mode>
<name>log4j-layout-template-json-network</name>
<alias>elasticsearch</alias>
</network>
<log>
<prefix>[ES]</prefix>
<color>cyan</color>
</log>
<wait>
<log>recovered \[0\] indices into cluster_state</log>
<time>60000</time>
</wait>
</run>
</image>
<image>
<alias>logstash</alias>
<name>logstash:${elastic.version}</name>
<run>
<dependsOn>
<container>elasticsearch</container>
</dependsOn>
<network>
<mode>custom</mode>
<name>log4j-layout-template-json-network</name>
<alias>logstash</alias>
</network>
<env>
<LS_JAVA_OPTS>${elastic.java-opts}</LS_JAVA_OPTS>
</env>
<ports>
<port>12222:12222</port>
<port>12345:12345</port>
</ports>
<log>
<prefix>[LS]</prefix>
<color>green</color>
</log>
<entrypoint>
<exec>
<arg>logstash</arg>
<arg>--pipeline.batch.size</arg>
<arg>1</arg>
<arg>-e</arg>
<arg>input {
gelf {
host =&gt; "logstash"
use_tcp =&gt; true
use_udp =&gt; false
port =&gt; 12222
type =&gt; "gelf"
}
tcp {
port =&gt; 12345
codec =&gt; json
type =&gt; "tcp"
}
}
filter {
if [type] == "gelf" {
# These are GELF/Syslog logging levels as defined in RFC 3164.
# Map the integer level to its human readable format.
translate {
field =&gt; "[level]"
destination =&gt; "[levelName]"
dictionary =&gt; {
"0" =&gt; "EMERG"
"1" =&gt; "ALERT"
"2" =&gt; "CRITICAL"
"3" =&gt; "ERROR"
"4" =&gt; "WARN"
"5" =&gt; "NOTICE"
"6" =&gt; "INFO"
"7" =&gt; "DEBUG"
}
}
}
}
output {
# (Un)comment for debugging purposes
# stdout { codec =&gt; rubydebug }
elasticsearch {
hosts =&gt; ["http://elasticsearch:9200"]
index =&gt; "log4j"
}
}</arg>
</exec>
</entrypoint>
<wait>
<log>Successfully started Logstash API endpoint</log>
<time>60000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>