Skip to content

feat: Java Spring Boot migration - project structure, domain models, services, CLI, and tests#74

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774547515-java-spring-boot-migration
Open

feat: Java Spring Boot migration - project structure, domain models, services, CLI, and tests#74
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774547515-java-spring-boot-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Complete migration of all COBOL example programs into a single Java Spring Boot application under java-migration/. The app uses Spring Shell for CLI interaction, Spring Data JPA + Flyway for database access, and Jackson for JSON/XML serialization.

What's included (29 files, ~2400 lines):

  • 7 domain models: Account (JPA entity), Customer/PersonCustomer/CorpCustomer (REDEFINES → inheritance), CustomerRecord, StudentRecord, SerializableRecord
  • 7 services: StringUtilService, SearchService, NumericConversionService, AccountService, FileMergeService, ReportService, SerializationService
  • 3 Spring Shell command classes: AccountCommands, UtilityCommands, SubProgramCommands
  • 1 Flyway migration (V1__create_accounts.sql) copied from existing sql/create_test_db.sql
  • 4 unit test classes (52 tests, all passing) + 1 integration test class (Testcontainers, requires Docker)
  • Documentation: java-migration/README.md and migration-matrix.md

Unit tests pass locally (mvn test -Dtest='!*IT'). Integration tests were not run (require Docker for Testcontainers).

Review & Testing Checklist for Human

  • Verify CustomerRecord fixed-width field widths/offsets match the COBOL FD definitions in merge_sort/merge_sort_test.cbl. Incorrect widths would silently corrupt record parsing in fromFixedWidth()/toFixedWidth().
  • Verify V1__create_accounts.sql is an accurate copy of sql/create_test_db.sql, and that Account.java @Column name mappings (first_name, last_name, is_enabled, create_dt, mod_dt) match the DDL column names exactly.
  • Verify XML attribute handling for the enabled field in SerializableRecord / SerializationService.generateXml() — the COBOL TYPE OF ws-record-flag IS ATTRIBUTE should produce enabled="..." as an XML attribute, not an element.
  • Run integration tests with Docker (mvn test or mvn verify) to confirm AccountRepositoryIT passes against a real PostgreSQL via Testcontainers.
  • Missing .gitignore for java-migration/ — IDE artifacts (.classpath, .project, .settings/) and target/ are not ignored. They were manually excluded from this commit but will be easy to accidentally commit later.

Recommended test plan: Clone the branch, run cd java-migration && mvn clean verify with Docker running. Then mvn spring-boot:run with a local PostgreSQL (cobol_db_example database) and exercise the shell commands listed in the README.

Notes

  • application.yml uses env-var placeholders (${DB_URL:...}, ${DB_USERNAME:...}, ${DB_PASSWORD:}) with sensible defaults for local dev.
  • SubProgramCommands simulates COBOL working-storage persistence via mutable instance fields and CANCEL via field reset — a reasonable approximation but not a perfect semantic match.
  • mouse/mouse_example.cbl intentionally not migrated (terminal curses demo, no business value).

Link to Devin session: https://app.devin.ai/sessions/518f2d09e8374455a2578de070f5f06e
Requested by: @jerryoliphant-cog

…services, CLI, and tests

- Initialize Spring Boot 3.2.x Maven project with JPA, Shell, Jackson, Flyway, Testcontainers
- Create domain models: Account (JPA entity), Customer hierarchy (REDEFINES), CustomerRecord, StudentRecord, SerializableRecord
- Create utility services: StringUtilService (trim/unstring/isNumeric), SearchService (linear/binary), NumericConversionService
- Create database layer: Flyway migration, AccountRepository (JPA), AccountService
- Create file processing services: FileMergeService, ReportService, SerializationService
- Create Spring Shell CLI: AccountCommands, UtilityCommands, SubProgramCommands
- Add unit tests (52 passing): StringUtilServiceTest, SearchServiceTest, SerializationServiceTest, FileMergeServiceTest
- Add integration test: AccountRepositoryIT (Testcontainers/PostgreSQL)
- Add documentation: java-migration/README.md and migration-matrix.md

Co-Authored-By: Jerry Oliphant <jerry.oliphant@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants