Intro Document for XDN Developers
Formatting XDN Java code
We enforce Google Java Style for everything under src/edu/umass/cs/xdn and test, and CI will block pushes that are not formatted.
- Run
bin/run_java_formatter.shto format the XDN Java sources and tests in-place. The helper downloadsgoogle-java-format1.17.0 intojars/on first use. - Run
bin/run_java_formatter.sh --checkto verify formatting without changing files (same command used in.github/workflows/google-java-format.yml). - Requirements:
bash,curl, andjavaon your PATH. Override the formatter version by exportingGOOGLE_JAVA_FORMAT_VERSIONbefore running the script.
Running test
The simplest way to run a single unit test is by using IDE, such as IntelliJ, our recommended IDE.
There, ensure to register all the *.jar inside the lib directory into the Project's Library.
To do so, go to "File" -> "Project Structure", then choose "Libraries"
in the "Project Settings" sidebar.
We use ant to build and run all of our unit test, use the following command to run all the unit tests:
Running a specific test from the CLI
Use the JUnit ConsoleLauncher shipped in lib/ so the same classpath is used as our Ant targets.
- Clean and compile the project and tests:
ant clean jar xdn-compile-tests - Run a single test method via the
executesubcommand (example fortestGetReplicaInfoSingleService):
Another example forjava -cp "lib/junit-platform-console-standalone-1.11.1.jar:build/classes:build/test-classes:lib/*" \ org.junit.platform.console.ConsoleLauncher execute \ --select-method edu.umass.cs.xdn.XdnGetReplicaInfoTest#testGetReplicaInfoSingleService \ --details=verbosetestTwoPaxosBasedServicesthat runs two deterministic services:
Example output (truncated):
Test plan execution started. Number of static tests: 1
├─ JUnit Jupiter
│ └─ XdnGetReplicaInfoTest
│ └─ testGetReplicaInfoSingleService() ✔
Test run finished after 0.5s
[ 1 tests found ]
[ 1 tests successful]
Running all unit tests from the CLI
Use the same ConsoleLauncher to scan the compiled test classes:
# Compile app + tests
ant clean jar xdn-compile-tests
# Run everything under test/edu/umass/cs
java -cp "lib/junit-platform-console-standalone-1.11.1.jar:build/classes:build/test-classes:lib/*" \
org.junit.platform.console.ConsoleLauncher execute \
--scan-class-path build/test-classes \
--include-package edu.umass.cs \
--include-classname '.*Test' \
--details=summary
Running XDN scripted tests
Some Xdn*Test classes require per-method JVM isolation. Use bin/run_xdn_tests.sh (or ant xdn-unit-tests-script) to execute them. Example:
Logging, or why we should not use printf()
To printout logging for specific classes, you can specify those classes
in the ./conf/logging.properties file. For example
...
edu.umass.cs.xdn.XdnGeoDemandProfiler.level=FINEST
edu.umass.cs.xdn.XdnReplicaCoordinator.level=FINEST
edu.umass.cs.reconfiguration.http.HttpActiveReplica.level=FINE
TODO
- [ ] Architecture documentation.
- [ ] Consistency model documentation.
- [ ] Replica coordinator documentation.
- [ ] StateDiff capture documentation.