| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Ex3 submission is exactly one WAR for Tomcat's webapps/ plus a
directory holding the client, its jars and its batch file.
package.sh now stages both under build/dist/ex3. The WAR is named
guess-market.war after the context path the client expects, and carries
the api and service jars with gson and JAXB; Tomcat only has to provide
the servlet API. The client directory holds ui-client, api, ui-fx,
gson, OkHttp and JavaFX, and nothing of the engine.
An executable's Class-Path used to name every module. List only the
modules it depends on, so the client jar no longer points at
service.jar, and stop producing a plain jar for the server module.
Add tomcat.sh to try the result by hand: it copies the packaged WAR
into a local Tomcat ($CATALINA_HOME, or the newest
C:\tomcat\apache-tomcat-*) and runs it in the foreground.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New module for the Ex3 desktop app. It reuses the ui-fx views and
depends on the api only, never on the engine.
ServerClient owns the OkHttp session and the last snapshot pulled from
/api/sync. RemoteCatalogContext, RemoteGuessMarketContext and
RemoteAccountContext implement the api interfaces on top of it: reads
are answered from the snapshot, so AppState never waits on the network,
and writes go over HTTP and pull a fresh snapshot before returning.
A daemon thread polls once a second with blocking calls and refreshes
AppState through Platform.runLater only when the server's version
moved. AppState reselects the event and user by id, so a refresh keeps
the selection.
Server and user name come from --server= and --user= until the login
screen exists.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exercise 3 asks for a new desktop client that reuses the Exercise 2
screens, and the course asks that clients depend on the DTO contract,
never on the engine. ui-desktop mixed both: its views and controllers
only talk to the api interfaces, but AppView and AppState each had a
convenience constructor that built a ServiceEngine, which tied every UI
class to the service module.
Move the screens, controllers, components, FXML, skins and fonts into
a new ui-fx module that depends on api alone. Packages are unchanged,
so FXML controller names and resource paths keep working as they are.
ui-desktop keeps only the Exercise 2 app: Launcher, App, which now
builds the ServiceEngine and passes its contexts in, and ServiceEngine
itself. The Exercise 3 client can then reuse ui-fx with remote
contexts and never put the engine on its classpath. The build proves
the split: ui-fx compiles with nothing but api visible.
Tests move with the code they cover. AppStateTest drives the real
engine, so it stays in ui-desktop.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exercise 3 moves the market behind a Tomcat server that the desktop
and browser clients share. Add a server module, registered in the
build scripts, holding the pieces every later endpoint builds on:
- ServerEngine wires one in-memory market (repositories, ledger,
trading pipeline, v3 upload loader) and lives in the servlet context
for the webapp's lifetime. Its catalog refuses path-based loading,
so events can only arrive through uploaded streams and the server
never reads or writes files.
- EngineBootstrap builds that engine when the webapp deploys.
- CorsFilter answers preflights and echoes the caller's Origin with
Allow-Credentials, which the browser client needs to send its
session cookie from another origin. With usernames as the only
login, echoing any origin exposes nothing a page couldn't get by
logging in itself.
- /api/health reports that the engine is up.
Vendor tomcat-juli 10.1.26 next to the other Tomcat jars. It ships in
Tomcat's bin/ rather than lib/, and embedded Tomcat cannot start
without it. A test deploys the module into embedded Tomcat, so
annotation scanning, the health check and CORS are checked against a
real container.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ex-2 loader has to reject documents that are schema-valid but
logically broken, and so far only error-2.xml and error-3.xml exercised
that path. Add one fixture per validation rule under
test-data/ex-2/invalid, each a copy of small.xml with a single defect
described in a leading comment: a non-.xml extension, a duplicate event
id, commission outside 0..90 on either side, a duplicate user name,
zero or negative initial cash, a market maker referencing an unknown
event, and an event with no market maker or with two.
Teach LedgerMapper to map individual LedgerEntry records to
LedgerEntryDTO, renaming id to seq and time to at and rendering the
timestamp through InstantOptions.humanize, so callers can show a ledger
history rather than only the account summary.
Make ui-desktop depend on api and service in the build tooling and in
its Eclipse classpath, since the desktop UI now talks to the service
layer directly, and put lib/openjfx on java.library.path for the test
run so tests touching JavaFX can load its native libraries.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move AccountDTO/MarketDTO/MarketStateDTO/PurchaseReceiptDTO/TradeRowDTO
out of the catch-all api package into model.market (and LedgerDTO into
model.ledger), matching the existing model.event convention so DTOs
live next to the domain they describe rather than in the interface
package. Relocate LedgerMapper from mapper.v2 to infrastructure.adapter
to match the module's established package layout, and update all call
sites and imports accordingly.
Also register the ui-desktop module in the build tooling: add it to
MODULES, add openjfx to the shipped runtime libs, and generalize
package.sh so each executable module (ui-console, ui-desktop) gets its
own Main-Class/Class-Path manifest and run script instead of
special-casing ui-console. Fold long Class-Path manifest lines at 72
bytes per the JAR spec, since adding ui-desktop's dependencies pushed
the line past the limit.
|
| |
|
|
|
|
| |
Vendor jacocoagent.jar/jacococli.jar under lib/jacoco/ (excluded from
the shipped classpath), attach the agent during test runs, and
generate an HTML+XML report into build/coverage after tests pass.
|
| |
|
|
|
|
|
|
|
| |
state I/O
Adds a full pre-load validation pass for GM XML seeds (ids, names,
options, commission, LMSR liquidity), replaces IO.print with
System.out, and surfaces detailed error messages across load/save
commands instead of generic failures.
|
|
|
BuyMenuCommand to PlaceOrderMenuCommand
Introduces XMLValidatorV1 and deserializer/adapter classes for events, ledgers,
markets, users, and trading mechanisms. Replaces the monolithic build.bat/run.sh
scripts with per-module tools (_util.sh, build.sh, package.sh, test.sh) that
compile in dependency order.
|