Skip to content

feat: add simplified Space API and unit test infrastructure#34

Merged
jimmieme merged 2 commits intoao-space:devfrom
jimmieme:dev
Feb 7, 2026
Merged

feat: add simplified Space API and unit test infrastructure#34
jimmieme merged 2 commits intoao-space:devfrom
jimmieme:dev

Conversation

@jimmieme
Copy link
Member

@jimmieme jimmieme commented Feb 7, 2026

Summary

  • Add simplified one-step space registration API (POST /v2/platform/spaces)
  • Add test mock implementations for Redis-dependent services
  • Add comprehensive unit tests for API endpoints
  • Update README with contributing guidelines

Changes

New Simplified API

  • SpaceResource.java: New REST endpoint for simplified space registration
  • SpaceRegistryInfo.java: Request DTO for space registration
  • SpaceRegistryResult.java: Response DTO with network credentials
  • RegistryService.registerSpace(): One-step registration combining box, user, and
    client registration

Test Infrastructure

  • MockGTRClient.java: In-memory mock for Redis GT route client
  • MockNSRClient.java: In-memory mock for Redis network server route client
  • MockDistributedLockFactory.java: Mock for distributed locks (Redis mocked, MySQL
    real)

Unit Tests

  • SpaceResourceTest.java: Tests for simplified space API
  • NetworkResourceTest.java: Tests for network authentication API
  • BasicResourceTest.java: Tests for status and ability endpoints

API Example

curl -X POST https://platform.example.com/v2/platform/spaces \
  -H "Content-Type: application/json" \
  -H "Request-Id: $(uuidgen)" \
  -d '{
    "boxUUID": "your-box-uuid",
    "userId": "admin",
    "clientUUID": "your-client-uuid",
    "subdomain": "myspace"
  }'

Test Plan

- All 39 unit tests pass
- MockGTRClient properly replaces Redis in tests
- MockNSRClient properly replaces Redis in tests
- MySQL locks work correctly in tests
- Network authentication returns correct credentials

Generated with Claude Code

jimmieme and others added 2 commits February 8, 2026 07:25
- Add SpaceResource for simplified space registration API
- Add SpaceRegistryInfo and SpaceRegistryResult DTOs
- Add mock implementations for Redis-dependent tests:
  - MockGTRClient: in-memory replacement for Redis GT routes
  - MockNSRClient: in-memory replacement for Redis network routes
  - MockDistributedLockFactory: in-memory lock for tests
- Add unit tests: BasicResourceTest, NetworkResourceTest, SpaceResourceTest
- Update README with contributing guidelines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix registryBox call to include 4th parameter (networkSecretKey)
- Fix registerSpace to return plaintext network secret instead of hash
- Update MockDistributedLockFactory to use real MySQL locks for MySQL type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jimmieme jimmieme merged commit 5b62f6b into ao-space:dev Feb 7, 2026
1 check passed
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.

1 participant