Skip to content

feat: COBOL-to-Java Spring Boot migration (5 phases)#71

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1773936110-cobol-to-java-migration
Open

feat: COBOL-to-Java Spring Boot migration (5 phases)#71
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1773936110-cobol-to-java-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Mar 19, 2026

Summary

Adds a complete Java Spring Boot migration of the COBOL-Examples codebase under a new java-migration/ directory. No existing COBOL files are modified. The migration covers 18 COBOL modules across 5 phases:

  • Phase 1: Spring Boot 3.2.4 project with Gradle, Java 17, standard package structure
  • Phase 2: JPA Account entity + AccountRepository replacing 3 COBOL SQL cursors, with Flyway-style migration SQL
  • Phase 3: AccountService, StringUtils, NumericUtils, FileMergeService, SubProgramService — business logic, string/numeric ops, file SORT/MERGE, and CALL BY CONTENT/REFERENCE patterns
  • Phase 4: RecordDto/RecordXmlDto DTOs with Jackson/JAXB annotations, JsonService, XmlService, ReportService for JSON GENERATE, XML GENERATE, and Report Writer replacements
  • Phase 5: AccountCli (Scanner menu), CommandLineArgsRunner, AccountController (REST API)

78 test methods pass across 10 test classes (unit + integration) using H2 in PostgreSQL compatibility mode. Documentation includes README.md (module mapping table, API docs) and MIGRATION_NOTES.md (type translations, cursor mappings, design decisions).

Updates since last revision

  • Added application-h2.properties profile and data-h2.sql seed data for running the app locally without PostgreSQL
  • Added H2 as runtimeOnly dependency (previously test-only) to support the h2 profile
  • End-to-end testing verified all REST endpoints against the running app with H2:
    • GET /accounts → 11 seed accounts returned correctly
    • GET /accounts/disabled → 3 disabled accounts (Bob, Paula, Bill)
    • GET /accounts/search?q=Tester1 → 2 matches (Mike/Tester1, Richard/Tester10)
    • Full CRUD lifecycle: POST (201) → GET (200) → PUT (200) → Toggle (Y→N) → DELETE (204) → GET (404)

Review & Testing Checklist for Human

  • Fixed-width record parsing offsets in CustomerRecord.fromFixedWidth() and StudentRecord.fromFixedWidth() — verify substring positions match the actual COBOL FD record layouts in merge_sort/merge_sort_test.cbl and report_writer/report_test.cbl. These were not validated against real fixed-width input files.
  • DB migration SQL (V1__create_accounts_table.sql) — verify the schema and 11 seed rows match the original sql/create_test_db.sql. Column types, nullable constraints, and default values should be compared side-by-side. Note that data-h2.sql duplicates the INSERT statements and could drift.
  • AccountRepository.searchAccounts @Query — only tested against H2, not real PostgreSQL. The LIKE query across 4 columns should be validated against the actual cobol_db_example database.
  • Hardcoded spring.datasource.password=password in application.properties — acceptable for a demo project but worth flagging.

Recommended test plan: Clone the branch, then:

  1. cd java-migration && ./gradlew test — confirm all 78 test methods pass
  2. ./gradlew bootRun --args='--spring.profiles.active=h2' — start with H2 (no PostgreSQL needed)
  3. curl http://localhost:8080/accounts — verify 11 JSON accounts returned
  4. Optionally test against real PostgreSQL: set up cobol_db_example database, then ./gradlew bootRun (default profile)

Notes

  • AccountCli uses @Profile("cli") — confirmed it does NOT block the REST server in default mode
  • All Java classes include Javadoc referencing the original COBOL source file they replace
  • BigDecimal used throughout for numeric precision (mirrors COBOL packed decimal behavior)
  • SubProgramService.MutableString inner class models COBOL CALL BY REFERENCE — non-standard Java pattern, but faithful to COBOL semantics
  • JAXB @XmlAttribute for the enabled field and null-suppression for blank fields replicate COBOL TYPE IS ATTRIBUTE and SUPPRESS WHEN SPACES

End-to-end test recording

View original video (rec-984cf386c2d94bd78ad06a29ef32b86e-edited.mp4)

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

Phase 1: Spring Boot 3.2.4 project with Gradle, Java 17+
Phase 2: JPA entity, repository, DB migration for Account CRUD
Phase 3: AccountService, StringUtils, NumericUtils, FileMergeService, SubProgramService
Phase 4: JSON (Jackson), XML (JAXB), Report generation services
Phase 5: CLI menu, CommandLineArgs, REST API controller

- 41 tests passing (unit + integration)
- H2 in-memory DB for tests, PostgreSQL for production
- Comprehensive README.md and MIGRATION_NOTES.md
- All Java classes include Javadoc referencing original COBOL sources
- No COBOL files modified or deleted

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

- Add application-h2.properties with H2 in-memory DB config
- Add data-h2.sql with 11 seed records matching COBOL create_test_db.sql
- Add H2 as runtimeOnly dependency for non-test profiles
- Run locally with: ./gradlew bootRun --args='--spring.profiles.active=h2'

Co-Authored-By: Jerry Oliphant <jerry.oliphant@cognition.ai>
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