Skip to content

Add Java GSDK unit tests and CI workflow#195

Merged
dgkanatsios merged 3 commits intomainfrom
copilot/add-unit-tests-for-gsdk
Mar 3, 2026
Merged

Add Java GSDK unit tests and CI workflow#195
dgkanatsios merged 3 commits intomainfrom
copilot/add-unit-tests-for-gsdk

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

What this PR does / why we need it:

Adds 84 unit tests for the Java GSDK and a GitHub Actions workflow to run them on PRs. Mirrors the approach taken for C# (#191) and C++ (#192).

Tests — 8 test classes in java/gameserverSDK/src/test/java/com/microsoft/azure/gaming/:

  • OperationTest (20) — Gson @SerializedName deserialization across all casings (continue, Continue, CONTINUE)
  • JsonFileConfigurationTest (17) — Config file parsing, alternate key casings, validation errors for missing endpoint/serverId
  • SessionHostHeartbeatInfoTest (14) — Heartbeat response model + Gson deserialization with ZonedDateTime
  • GameserverSDKConstantsTest (10) — Public API key constants stability
  • SessionConfigTest (7) — ToMapAllStrings(), JSON round-trip
  • MaintenanceScheduleTest (7) — Schedule/event deserialization, multi-event/resource scenarios
  • EnumTest (5) — GameHostHealth, SessionHostStatus values and serialization
  • ConnectedPlayerTest (4) — Data class edge cases

CI workflow.github/workflows/java-tests.yml:

  • Triggers on PRs touching java/**
  • JDK 8 (Temurin) on ubuntu-latest to match sourceCompatibility = 1.8
  • Builds full project, runs :gameserverSDK:test

Other: .gitignore updated to exclude GSDK_output_*.txt log files generated during test runs.

Special notes for your reviewer:

JsonFileConfigurationTest uses reflection to set environment variables (System.getenv() internal map) since the production code reads config file paths from env vars directly. This works reliably on JDK 8 which is the target. A cleaner approach would require refactoring JsonFileConfiguration to accept an injectable config source (similar to C#'s ISystemOperations), but that's a larger change.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 3, 2026 18:41
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Add 84 unit tests across 8 test classes covering:
- ConnectedPlayer data class
- SessionHostHeartbeatInfo getters/setters and JSON deserialization
- SessionConfig including ToMapAllStrings
- Operation enum Gson serialization with @SerializedName casings
- MaintenanceSchedule/MaintenanceEvent deserialization
- JsonFileConfiguration config file parsing and validation
- GameHostHealth/SessionHostStatus enum values
- GameserverSDK public API constant keys

Add .github/workflows/java-tests.yml CI workflow to run tests on PRs.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for the Java GSDK Add Java GSDK unit tests and CI workflow Mar 3, 2026
@dgkanatsios dgkanatsios marked this pull request as ready for review March 3, 2026 18:57
@dgkanatsios dgkanatsios merged commit abdd790 into main Mar 3, 2026
2 checks passed
@dgkanatsios dgkanatsios deleted the copilot/add-unit-tests-for-gsdk branch March 3, 2026 19:00
Copilot AI added a commit that referenced this pull request Mar 19, 2026
* Initial plan

* Initial plan for Java GSDK unit tests

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Add Java GSDK unit tests and CI workflow

Add 84 unit tests across 8 test classes covering:
- ConnectedPlayer data class
- SessionHostHeartbeatInfo getters/setters and JSON deserialization
- SessionConfig including ToMapAllStrings
- Operation enum Gson serialization with @SerializedName casings
- MaintenanceSchedule/MaintenanceEvent deserialization
- JsonFileConfiguration config file parsing and validation
- GameHostHealth/SessionHostStatus enum values
- GameserverSDK public API constant keys

Add .github/workflows/java-tests.yml CI workflow to run tests on PRs.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Mar 19, 2026
* Initial plan

* Initial plan for Java GSDK unit tests

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Add Java GSDK unit tests and CI workflow

Add 84 unit tests across 8 test classes covering:
- ConnectedPlayer data class
- SessionHostHeartbeatInfo getters/setters and JSON deserialization
- SessionConfig including ToMapAllStrings
- Operation enum Gson serialization with @SerializedName casings
- MaintenanceSchedule/MaintenanceEvent deserialization
- JsonFileConfiguration config file parsing and validation
- GameHostHealth/SessionHostStatus enum values
- GameserverSDK public API constant keys

Add .github/workflows/java-tests.yml CI workflow to run tests on PRs.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
dgkanatsios added a commit that referenced this pull request Mar 19, 2026
* Initial plan

* Initial plan for Java GSDK unit tests

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

* Add Java GSDK unit tests and CI workflow

Add 84 unit tests across 8 test classes covering:
- ConnectedPlayer data class
- SessionHostHeartbeatInfo getters/setters and JSON deserialization
- SessionConfig including ToMapAllStrings
- Operation enum Gson serialization with @SerializedName casings
- MaintenanceSchedule/MaintenanceEvent deserialization
- JsonFileConfiguration config file parsing and validation
- GameHostHealth/SessionHostStatus enum values
- GameserverSDK public API constant keys

Add .github/workflows/java-tests.yml CI workflow to run tests on PRs.

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants