Skip to content

Java migration foundation: Spring Boot/Batch scaffolding, copybook domain layer, mock data fixtures - #198

Open
devanshi-gpta wants to merge 1 commit into
mainfrom
devin/1788376271-java-migration-foundation
Open

devanshi-gpta wants to merge 1 commit into
mainfrom
devin/1788376271-java-migration-foundation

Conversation

@devanshi-gpta

Copy link
Copy Markdown

Summary

Phase 0/1 of the COBOL→Java migration: a java-app/ Spring Boot + Spring Batch project holding the shared data layer that the per-program migrations (online CICS and batch) will build on. No COBOL program is migrated yet — online/ and batch/ are empty packages.

The load-bearing piece is CobolCodec: the sample data encodes signed amounts as zoned decimal with the sign overpunched onto the last digit, so 00000001940{ is 194.00 and 00000001940} is -194.00. Decoding returns a BigDecimal at the exact copybook scale and encoding is byte-exact, which is asserted by round-tripping every record of acctdata.txt, carddata.txt, custdata.txt and dailytran.txt:

Account.parse(record).format().equals(record)   // holds for all 50 records

Each copybook becomes one domain class owning its own layout (RECORD_LENGTH, parse, format), read through a FieldCursor that walks fields in copybook order:

account.accountId   = cursor.fixed(11);   // PIC 9(11) kept fixed-width, never a number
account.activeStatus= cursor.flag();      // PIC X(01)
account.currentBalance = cursor.signed(12, 2); // PIC S9(10)V99, overpunched

Sample data is not copied into java-app: pom.xml maps ../app/data/ASCII/*.txt onto the classpath under carddemo-data/, FixedWidthFixtureLoader.loadAll() parses it into a CardDemoDataSet bean, and each InMemory*Repository seeds itself from that snapshot. Repositories implement Reseedable so tests that mutate balances or users can restore the canonical dataset. RecordKeys normalizes lookup keys, so findById("1") and findById("00000000001") both resolve.

USRSEC has no ASCII file, so MockUserData reproduces the in-stream users of app/jcl/DUSRSECJ.jcl — five admins and five regular users, including the README logins ADMIN001/PASSWORD and USER0001/PASSWORD.

One data quirk worth knowing before the batch work: acctdata.txt carries the group id (A000000000) in the ACCT-ADDR-ZIP position and leaves ACCT-GROUP-ID blank. Parsing follows the copybook (matching what the COBOL programs see), so interest calculation will resolve against the DEFAULT rows of discgrp.txt.

19 tests cover the codec, the loader against all nine sample files, and repository seeding/lookup/mutation.

Link to Devin session: https://app.devin.ai/sessions/a1f9608aacd244c4954b27d7967afe9e
Open in Devin Desktop: https://app.devin.ai/desktop/session/a1f9608aacd244c4954b27d7967afe9e?variant=devin
Requested by: @devanshi-gpta

…ta fixtures

Co-Authored-By: Devanshi Gupta <devanshi.gupta@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 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, CI, and merge conflict 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.

1 participant