This document provides comprehensive instructions for building and testing the Apache Iggy Java SDK, including the new async client implementation with fixed polling functionality.
# Navigate to Iggy server directory cd /path/to/iggy READ the README.md and start iggy-server as prescribed there. ## Building the Project ### 1. Clean Build ```bash cd iggy/foreign/java/java-sdk # Clean previous builds ../gradlew clean # Build without running tests ../gradlew build -x test # Or build with tests (skip checkstyle) ../gradlew build -x checkstyleMain -x checkstyleTest
# Compile main source code ../gradlew compileJava # Compile test code ../gradlew compileTestJava
# Run all tests (skip checkstyle) ../gradlew test -x checkstyleMain -x checkstyleTest
# Run AsyncPollMessageTest specifically ../gradlew test --tests AsyncPollMessageTest -x checkstyleMain -x checkstyleTest # Run with detailed output ../gradlew test --tests AsyncPollMessageTest --info -x checkstyleMain -x checkstyleTest
# Run all async client tests ../gradlew test --tests "org.apache.iggy.client.async.*" -x checkstyleMain -x checkstyleTest
Test reports are generated at:
java-sdk/build/reports/tests/test/index.html
Open this file in a browser to view detailed test results.
This test validates the async client's polling functionality and demonstrates important behaviors:
# Run with full output cd iggy/foreign/java/java-sdk ../gradlew test --tests AsyncPollMessageTest -x checkstyleMain -x checkstyleTest --info
Expected output:
AsyncIggyTcpClient (client/async/tcp/AsyncIggyTcpClient.java)
AsyncMessagesTcpClient (client/async/tcp/AsyncMessagesTcpClient.java)
AsyncTopicsTcpClient (client/async/tcp/AsyncTopicsTcpClient.java)
AsyncStreamsTcpClient (client/async/tcp/AsyncStreamsTcpClient.java)
File: AsyncMessagesTcpClient.java
// Correct: 4-byte little-endian encoding payload.writeIntLE(partitionId.orElse(0L).intValue());
File: AsyncBytesSerializer.java
if (consumer == null) { buffer.writeByte(0); // Consumer type: 0 for null buffer.writeIntLE(0); // Empty identifier (4 bytes) }
File: AsyncPollMessageTest.java
@BeforeEach to ensure connection before each testConnection Refused
127.0.0.1:8090Timeout Errors
Build Failures
../gradlew clean before buildingJAVA_HOME environment variableCheckstyle Violations
-x checkstyleMain -x checkstyleTest to skip style checksbuild/reports/checkstyle/To enable debug output in tests:
// Debug output is already included in AsyncMessagesTcpClient // Look for lines starting with "DEBUG:" in test output
# Edit source files vim src/main/java/org/apache/iggy/client/async/...
../gradlew compileJava
# Run specific test ../gradlew test --tests AsyncPollMessageTest -x checkstyleMain -x checkstyleTest # Or run all async tests ../gradlew test --tests "org.apache.iggy.client.async.*" -x checkstyleMain -x checkstyleTest
# Open test report in browser open build/reports/tests/test/index.html
build.gradleWhen contributing changes:
Always compile after changes
../gradlew compileJava compileTestJava
Run relevant tests
../gradlew test --tests "*Test" -x checkstyleMain -x checkstyleTest
Check for warnings
../gradlew build 2>&1 | grep -i warning
Clean up test files
The Apache Iggy Java SDK async client is fully functional with:
For questions or issues, refer to the test output and debug messages for detailed diagnostics.