Repository navigation
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Goal
Start the Data Custodian on the local profile (H2) with a small, realistic and deterministic ESPI dataset, so the customer consent flow and every ESPI feed can be tested by hand right after startup.
Today
DevSandboxAdminSeedRunnerseeds only the custodianadmin/admin(profilesdev-mysql,dev-postgresql,local,test,testcontainers).- With no customers, usage points or ApplicationInformation, the consent screen has nothing to authorize, and after fix(#247): export DC collection endpoints as Atom feeds instead of a bare List #250 every ESPI feed returns a valid but empty Atom feed. (Before fix(#247): export DC collection endpoints as Atom feeds instead of a bare List #250 the empty
List.of()still returned 500.) localbuilds the schema with Hibernatecreate-dropand Flyway turned off (Make Flyway the single schema owner in every app and profile (H2 included); fix drifted/missing migration locations #241), so seed SQL has no migration location to live in.- ESPI sample XML exists in
openespi-common/src/test/resources/fixtures/(test_usage_data_*.xmland others), but there is no working DC import path: the legacy upload is not migrated, and full XML import is Implement comprehensive JAXB unmarshalling support for XML import #89 (affected by the<content>gap in Third Party cannot unmarshal any ESPI Atom feed (AtomFeedDto date adapters + abstract entry type) #197).
Proposal
Recommended: versioned SQL seed in a local-only Flyway location. It is the fastest and most deterministic route, and it doesn't depend on #89.
- Have DC
localrun Flyway, which is the DC part of Make Flyway the single schema owner in every app and profile (H2 included); fix drifted/missing migration locations #241:ddl-auto: validate, locationsclasspath:db/migration,classpath:db/vendor/h2,classpath:db/seed/local. - Add
openespi-datacustodian/src/main/resources/db/seed/local/R__local_sample_data.sql, a repeatable migration that is never on the classpath of theprodordockerprofiles. Content, with fixed UUID v5 ids so URLs in the runbook are stable:- Retail customers: a second login
customer/customer(ROLE_USER), alongsideadmin. It may be easier to keep them inDevSandboxAdminSeedRunner, because of the bcrypt cost. - Usage data for
customer: 1 electricity UsagePoint with LocalTimeParameters, ReadingType (kWh, 15-minute), MeterReading, 1–2 days of IntervalBlocks/IntervalReadings, and 1 UsageSummary (or ElectricPowerQualitySummary). - Customer PII: Customer, CustomerAccount, CustomerAgreement, ServiceLocation and Meter, so the FB_51+ customer resources return data.
- ApplicationInformation for the AS-seeded
third_partyclient (client_id=third_party, redirect and notification URIs matching the TP local profile), so the consent screen can name the Third Party and the admin feeds have a row.
- Retail customers: a second login
- Derive the values from a GBA sample feed in the fixtures, so the data is realistic. Note which file it came from in the SQL header.
- Alternative, later: once Implement comprehensive JAXB unmarshalling support for XML import #89 / Third Party cannot unmarshal any ESPI Atom feed (AtomFeedDto date adapters + abstract entry type) #197 make XML import work, add a
local-only runner that imports the fixtures instead. Not needed for the first manual-test milestone.
Acceptance
- On a fresh
localstart:admin/adminandcustomer/customerlog in. - With a DC admin token,
GET .../resource/UsagePoint,.../MeterReading,.../ReadingType,.../IntervalBlock,.../UsageSummary,.../Customer,.../CustomerAccountand.../ApplicationInformationeach return at least one Atom entry. - The seed SQL is not packaged for, or applied in,
prodordocker. - One test (H2,
testprofile with the seed location) asserts the counts and that every ESPI feed marshals its seeded entries without error. That is the real-data guard DC feed (collection) endpoints return 500: a bare List is passed to JAXB instead of an Atom feed #247 asked for.
Related
#241 (Flyway as the single schema owner), #247 / #250 (feeds), #89 / #197 (XML import), #245 (customer portal), #232 (consent flow), and the local runbook issue filed alongside this one.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity