Demo · Parity Lab · Apache DayTrader

Trades, logins and pages recorded on a 2010 Java server, replayed on its modern replacement.

Pick the cases to run. Each one is a set of web requests (buys, sells, logins, registrations, profile updates, and the home, portfolio, quotes and account pages) that was recorded on the original DayTrader 2.1.7 running on Apache Geronimo and Java 6. AWS replays them on the modernized Java 21 code against a fresh PostgreSQL schema, then compares every database row afterwards and every value the original pages showed.

Slice 1: pricing and orders 14 cases, 39 web requests
Slice 2: accounts and login 17 cases, 39 web requests
Slice 3: the trading pages 12 cases, 52 web requests

·

How it works

The original was recorded once; the replacement is tested on every run

The original server needs Java 6 and a 2010 application server, so it does not run here. It ran once, in a container on our machine, with a small test switch that fixes the random price moves and the clock. Every request and every table was recorded. The modern code gets the same starting data, the same random numbers and the same clock, so the results must match to the cent and to the second.

Your browser
Amazon CloudFrontthis site and /api
Amazon API Gatewaywith request limits
AWS Lambdachecks the request, starts the runner
AWS Lambda containermodern Java code and the recordings
Amazon Aurora ServerlessPostgreSQL; a schema per run, dropped after
  1. What is compared

    After each case, all six tables (about 2,900 rows: accounts, profiles, quotes, holdings, orders, id counters), field by field, as stored. For each request, the login, registration and account-page values, the order the original page showed, the orders it reported as completed, and the market summary: the index average to all 16 decimal places the database produces, the top gainers and losers, and the volume.

  2. Approved differences

    Slice 1: selling a holding twice crashes the original with a NullPointerException; the replacement returns a cancelled order. Slice 2: passwords are stored as PBKDF2 hashes instead of plain text (the comparison checks that each hash verifies the original's password); a failed login no longer prints the typed password back; the account page no longer pre-fills the password and shows only the card's last four digits; and orders are reported as completed only after a successful login.

  3. Changes approved later

    An opening balance that is not a number crashes the original (HTTP 500); the replacement refuses the registration. The original writes user ids, names and addresses into its pages unescaped, so HTML in a name runs in the browser; the replacement escapes every value. After a buy of 0.1 shares the original's home page fails with "Rounding necessary"; the replacement rounds the total to the cent. Selling someone else's holding is refused and nothing is written. And a buy of an unknown stock, or of a quantity that is not a number, gets a message instead of an HTTP 500. The cases these touch are marked with the change they rely on.

  4. What the tests found in the original

    Any signed-in user can sell anyone's holdings: the original checks the holding number, not its owner. A buy can overdraw the account. A stock's daily low and high never change. The original's two data-access modes disagree: one halves a stock above $400, the other never does. Passwords are stored in plain text and echoed on a failed login. A failed login with someone else's user id still marks their orders as completed. And registration accepts a negative opening balance, while every database error ends in the same vague "Registration operation failed;". In the pages: the account page lists "the last five orders" from a query with no sort order, so which five appear is up to the database; and a quote request for a symbol longer than ten characters, or for no symbols at all, shows an all-zero "Invalid symbol" row.

The recordings were made on the official Apache release, unchanged except for the test switch, which reseeds the random generator and fixes the clock (72 changed lines, published with the case study). Prices and users are DayTrader's own invented test data.

DayTrader on the demos page · Parity Lab: CardDemo's nightly batch · All demos