hackathon/docs/maven/test-config.xml
Christoph Wagner a489c15cf5 feat: Add complete HSP implementation with integration tests passing
Initial implementation of HTTP Sender Plugin following TDD methodology
  with hexagonal architecture. All 313 tests passing (0 failures).

  This commit adds:
  - Complete domain model and port interfaces
  - All adapter implementations (HTTP, gRPC, file logging, config)
  - Application services (data collection, transmission, backpressure)
  - Comprehensive test suite with 18 integration tests

  Test fixes applied during implementation:
  - Fix base64 encoding validation in DataCollectionServiceIntegrationTest
  - Fix exception type handling in IConfigurationPortTest
  - Fix CompletionException unwrapping in IHttpPollingPortTest
  - Fix sequential batching in DataTransmissionServiceIntegrationTest
  - Add test adapter failure simulation for reconnection tests
  - Use adapter counters for gRPC verification

  Files added:
  - pom.xml with all dependencies (JUnit 5, Mockito, WireMock, gRPC, Jackson)
  - src/main/java: Domain model, ports, adapters, application services
  - src/test/java: Unit tests, integration tests, test utilities
2025-11-20 22:38:55 +01:00

497 lines
20 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
JaCoCo Test Coverage Configuration for HSP Project
This configuration enforces strict test coverage thresholds:
- 95% line coverage (Req-Test-4, Phase 1.3)
- 90% branch coverage (Req-Test-4, Phase 1.3)
Validates:
- Req-Test-4: Test coverage requirements
- Req-Norm-2: EN 50716 software quality measures
- Phase 1.3: Test Coverage Enhancement
-->
<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>
<!-- ========== PROJECT COORDINATES (Example) ========== -->
<groupId>com.siemens.coreshield</groupId>
<artifactId>hsp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HTTP Sender Plugin (HSP)</name>
<description>Diagnostic Data Collection System with gRPC Transmission</description>
<!-- ========== PROPERTIES ========== -->
<properties>
<!-- Java Version -->
<java.version>25</java.version>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Test Coverage Thresholds (Req-Test-4, Phase 1.3) -->
<jacoco.line.coverage>0.95</jacoco.line.coverage>
<jacoco.branch.coverage>0.90</jacoco.branch.coverage>
<jacoco.instruction.coverage>0.90</jacoco.instruction.coverage>
<jacoco.method.coverage>0.90</jacoco.method.coverage>
<jacoco.class.coverage>0.85</jacoco.class.coverage>
<!-- Test Framework Versions -->
<junit.version>5.10.1</junit.version>
<mockito.version>5.7.0</mockito.version>
<assertj.version>3.24.2</assertj.version>
<wiremock.version>3.0.1</wiremock.version>
<awaitility.version>4.2.0</awaitility.version>
<!-- Plugin Versions -->
<maven-surefire.version>3.2.3</maven-surefire.version>
<maven-failsafe.version>3.2.3</maven-failsafe.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<pitest-maven.version>1.15.3</pitest-maven.version>
</properties>
<!-- ========== DEPENDENCIES ========== -->
<dependencies>
<!-- Testing Dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>${wiremock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>
<!-- gRPC Testing -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
<version>1.60.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-inprocess</artifactId>
<version>1.60.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- ========== BUILD CONFIGURATION ========== -->
<build>
<plugins>
<!-- ===== MAVEN COMPILER PLUGIN ===== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>${java.version}</release>
<compilerArgs>
<arg>-parameters</arg>
<arg>-Xlint:all</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- ===== MAVEN SUREFIRE (Unit Tests) ===== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<!-- Include all unit tests -->
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
<!-- Exclude integration tests -->
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IT.java</exclude>
<exclude>**/*E2ETest.java</exclude>
</excludes>
<!-- Parallel execution for faster tests -->
<parallel>methods</parallel>
<threadCount>4</threadCount>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<!-- Report configuration -->
<reportFormat>plain</reportFormat>
<printSummary>true</printSummary>
</configuration>
</plugin>
<!-- ===== MAVEN FAILSAFE (Integration Tests) ===== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe.version}</version>
<configuration>
<!-- Include integration tests only -->
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IT.java</include>
</includes>
<!-- Sequential execution for integration tests -->
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- ===== JACOCO (Code Coverage) ===== -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<!-- Prepare JaCoCo agent -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- Generate coverage report -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!-- Check coverage thresholds -->
<execution>
<id>check-coverage</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<!-- LINE COVERAGE: 95% minimum -->
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.line.coverage}</minimum>
</limit>
</limits>
</rule>
<!-- BRANCH COVERAGE: 90% minimum -->
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.branch.coverage}</minimum>
</limit>
</limits>
</rule>
<!-- INSTRUCTION COVERAGE: 90% minimum -->
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.instruction.coverage}</minimum>
</limit>
</limits>
</rule>
<!-- METHOD COVERAGE: 90% minimum -->
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.method.coverage}</minimum>
</limit>
</limits>
</rule>
<!-- CLASS COVERAGE: 85% minimum -->
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>CLASS</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.class.coverage}</minimum>
</limit>
</limits>
</rule>
</rules>
<!-- Fail build if thresholds not met -->
<haltOnFailure>true</haltOnFailure>
</configuration>
</execution>
<!-- Generate aggregate report (for multi-module projects) -->
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Exclusions from coverage -->
<excludes>
<!-- Generated code -->
<exclude>**/*_*.class</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/proto/**</exclude>
<!-- Main entry points -->
<exclude>**/HspApplication.class</exclude>
<!-- Exception classes -->
<exclude>**/*Exception.class</exclude>
<!-- Trivial getters/setters (if not using Lombok) -->
<!-- <exclude>**/*DTO.class</exclude> -->
</excludes>
<!-- Report formats -->
<formats>
<format>HTML</format>
<format>XML</format>
</formats>
</configuration>
</plugin>
<!-- ===== PITEST (Mutation Testing) ===== -->
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>${pitest-maven.version}</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<configuration>
<!-- Target classes -->
<targetClasses>
<param>com.siemens.coreshield.hsp.*</param>
</targetClasses>
<!-- Target tests -->
<targetTests>
<param>com.siemens.coreshield.hsp.*Test</param>
</targetTests>
<!-- Mutation score threshold: 80% -->
<mutationThreshold>80</mutationThreshold>
<coverageThreshold>95</coverageThreshold>
<!-- Output formats -->
<outputFormats>
<outputFormat>HTML</outputFormat>
<outputFormat>XML</outputFormat>
</outputFormats>
<!-- Mutators -->
<mutators>
<mutator>DEFAULTS</mutator>
</mutators>
<!-- Fail build if threshold not met -->
<failWhenNoMutations>false</failWhenNoMutations>
</configuration>
</plugin>
</plugins>
</build>
<!-- ========== PROFILES ========== -->
<profiles>
<!-- ===== INTEGRATION TESTS PROFILE ===== -->
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- ===== PERFORMANCE TESTS PROFILE ===== -->
<profile>
<id>performance-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*PerformanceTest.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- ===== ALL TESTS PROFILE (Unit + Integration + Performance) ===== -->
<profile>
<id>all-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*IntegrationTest.java</include>
<include>**/*IT.java</include>
<include>**/*PerformanceTest.java</include>
<include>**/*E2ETest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- ===== MUTATION TESTING PROFILE ===== -->
<profile>
<id>mutation-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<executions>
<execution>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<!-- ========== REPORTING ========== -->
<reporting>
<plugins>
<!-- JaCoCo Report -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- Surefire Report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire.version}</version>
</plugin>
</plugins>
</reporting>
</project>