Skip to content

DC local profile: seed a deterministic ESPI sample dataset (customer, usage, PII, ApplicationInformation) for manual testing #253

Open

Description

@dfcoffin

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

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.

  1. Have DC local run 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, locations classpath:db/migration,classpath:db/vendor/h2,classpath:db/seed/local.
  2. Add openespi-datacustodian/src/main/resources/db/seed/local/R__local_sample_data.sql, a repeatable migration that is never on the classpath of the prod or docker profiles. Content, with fixed UUID v5 ids so URLs in the runbook are stable:
    • Retail customers: a second login customer/customer (ROLE_USER), alongside admin. It may be easier to keep them in DevSandboxAdminSeedRunner, 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_party client (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.
  3. 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.
  4. 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 local start: admin/admin and customer/customer log in.
  • With a DC admin token, GET .../resource/UsagePoint, .../MeterReading, .../ReadingType, .../IntervalBlock, .../UsageSummary, .../Customer, .../CustomerAccount and .../ApplicationInformation each return at least one Atom entry.
  • The seed SQL is not packaged for, or applied in, prod or docker.
  • One test (H2, test profile 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions