[!TIP]
π Deutsche Version hier verfΓΌgbar π
This project contains integration tests that validate full compatibility between the Java and .NET implementations of the X.Justiz Core SDK. The tests ensure that data serialized by one SDK can be correctly deserialized by the other, with no data loss or mapping errors.
These tests ensure that:
Before running the integration tests, ensure you have the following installed:
| Software | Minimum Version | How to Check | Download |
|---|---|---|---|
| .NET SDK | 8.0 or later | dotnet --version |
Download .NET |
| Java JDK | 17 or later | java -version |
Download OpenJDK |
| Gradle | (included via wrapper) | N/A | Included |
# Verify installation
dotnet --version
# Should output: 8.0.x or higher
JAVA_HOME environment variable:
```powershell
echo $env:JAVA_HOME
java -version
```
5050 - Used by .NET API8080 - Used by Java API
# Check if ports are in use
netstat -ano | findstr :5050
netstat -ano | findstr :8080
# If no output, ports are available
# Verify installation
dotnet --version
# Verify installation
java -version
# Ensure JAVA_HOME is set
echo $JAVA_HOME
chmod +x java/gradlew
# Navigate to the integration tests directory
cd dotnet/test/xjustiz.core-dotnet.IntegrationTests
# Run all integration tests
dotnet test
# Run with detailed output
dotnet test --logger "console;verbosity=detailed"
# Run specific test category
dotnet test --filter "FullyQualifiedName~JavaToDotNet"
dotnet test --filter "FullyQualifiedName~DotNetToJava"
dotnet test --filter "FullyQualifiedName~FullRoundTrip"
Ctrl+Shift+B)Test β Test Explorer or Ctrl+E, T)| Test | Description |
|ββ|ββββ-|
| JavaToDotNet_HttpJson | Java API serializes JSON, .NET API deserializes |
| JavaToDotNet_HttpXml | Java API serializes XML, .NET API deserializes |
| JavaToDotNet_JsonFile | JSON file from Java API uploaded to .NET API |
| JavaToDotNet_XmlFile | XML file from Java API uploaded to .NET API |
| Test | Description |
|ββ|ββββ-|
| DotNetToJava_HttpJson | .NET API serializes JSON, Java API deserializes |
| DotNetToJava_HttpXml | .NET API serializes XML, Java API deserializes |
| DotNetToJava_JsonFile | JSON file from .NET API uploaded to Java API |
| DotNetToJava_XmlFile | XML file from .NET API uploaded to Java API |
| Test | Description |
|ββ|ββββ-|
| FullRoundTrip_JavaDotNetJava | Java β .NET β Java (verify data stability) |
| FullRoundTrip_DotNetJavaDotNet | .NET β Java β .NET (verify data stability) |
| MixedFormat_JsonToXmlToJson | Cross-format conversion testing |
| StressTest_MultipleRoundTrips | 5 complete round-trips stability test |
All tests run against these example datasets from /example-datasets/:
arbeitsrecht - Labor law caseerbrecht - Inheritance law casefluggastrecht - Airline passenger rights casemietrecht - Tenancy law casexjustiz.core-dotnet.IntegrationTests/
βββ Infrastructure/
β βββ ApiProcessManager.cs # Manages API lifecycle with robust error handling
β βββ CrossApiClient.cs # HTTP client for JSON/XML communication
β βββ MessageComparer.cs # Deep comparison utility for validation
β βββ TestDataProvider.cs # Loads test datasets
βββ IntegrationTestFixture.cs # xUnit test fixture (shared across tests)
βββ JavaToDotNetCompatibilityTests.cs
βββ DotNetToJavaCompatibilityTests.cs
βββ FullRoundTripCompatibilityTests.cs
βββ README.md
Solution:
JAVA_HOME~/.bashrc or ~/.zshrc:
export JAVA_HOME=/path/to/java
export PATH=$JAVA_HOME/bin:$PATH
Solution: Find and stop the process using the port:
# Windows - find process
netstat -ano | findstr :5050
# Kill process by PID
taskkill /PID <PID> /F
# Linux/Mac - find and kill
lsof -i :5050
kill -9 <PID>
Solution:
The Gradle wrapper should be in /java/gradlew.bat. If missing:
cd java
gradle wrapper --gradle-version 8.5
Possible causes:
StartupTimeoutSeconds in ApiProcessManager.csSolution: Try running the APIs manually first:
# Terminal 1 - Start .NET API
cd dotnet/example-api
dotnet run --urls http://localhost:5050
# Terminal 2 - Start Java API
cd java
./gradlew :example-api:bootRun
The test output will show exactly which fields differ. Common causes:
MessageComparer.csIf you want to test the APIs manually:
# Terminal 1 - .NET API
cd dotnet/example-api
dotnet run --urls http://localhost:5050
# Swagger UI: http://localhost:5050/swagger
# Terminal 2 - Java API
cd java
./gradlew :example-api:bootRun
# Swagger UI: http://localhost:8080/swagger-ui.html
Both APIs expose the same endpoints:
POST /XJustizCore/json - Accept JSON messagePOST /XJustizCore/xml - Accept XML messagePOST /XJustizCore/json-file - Accept JSON file uploadPOST /XJustizCore/xml-file - Accept XML file uploadPOST /XJustizCore/json/generate-file - Generate JSON outputPOST /XJustizCore/xml/generate-file - Generate XML output[Collection("Integration Tests")] attributeIntegrationTestFixture via constructor:
[Collection("Integration Tests")]
public class MyNewTests
{
private readonly IntegrationTestFixture fixture;
public MyNewTests(IntegrationTestFixture fixture)
{
this.fixture = fixture;
}
[Fact]
public async Task MyTest()
{
// Use fixture.Client for API calls
// Use fixture.Comparer for data validation
}
}
This project is part of the X.Justiz Core SDK and is licensed under MIT.