From c884ba3d196b1b14cc60a39ce649af834aaa41f7 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 15:49:53 -0700 Subject: [PATCH 01/22] Remove cs410J files that might end up in the project archetypes. --- .../java/edu/pdx/cs410J/xml/phonebook.dtd | 40 ------------------- .../edu/pdx/cs410J/whitlock/noExtension | 0 .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../edu/pdx/cs410J/airline/package.html | 3 -- .../edu/pdx/cs410J/airline/package.html | 3 -- .../edu/pdx/cs410J/apptbook/package.html | 3 -- .../edu/pdx/cs410J/apptbook/package.html | 3 -- .../edu/pdx/cs410J/phonebill/package.html | 3 -- .../edu/pdx/cs410J/phonebill/package.html | 3 -- 14 files changed, 94 deletions(-) delete mode 100644 examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd delete mode 100644 grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension delete mode 100644 projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html delete mode 100644 projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html delete mode 100644 projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html delete mode 100644 projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html delete mode 100644 projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html delete mode 100644 projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html diff --git a/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd b/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd deleted file mode 100644 index c2d768b356..0000000000 --- a/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension b/grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 4f17af6f2c..0000000000 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 63197885a4..0000000000 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 54dbc66f8b..0000000000 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 9777aff71c..0000000000 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 6d4adf245a..0000000000 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index a579da692a..0000000000 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html b/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html deleted file mode 100644 index 02be23647a..0000000000 --- a/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html b/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html deleted file mode 100644 index bed1173886..0000000000 --- a/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html b/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html deleted file mode 100644 index 3a7e4bb21a..0000000000 --- a/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html b/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html deleted file mode 100644 index 8d4ef70cbf..0000000000 --- a/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html b/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html deleted file mode 100644 index e0071f61b0..0000000000 --- a/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html b/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html deleted file mode 100644 index fd40306218..0000000000 --- a/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Phone Bill project.

- \ No newline at end of file From 078bcce9f04e69973312cdc5e2bbc241941c0b55 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 15:50:49 -0700 Subject: [PATCH 02/22] Add beginnings of a copilot-instructions.md file. --- .github/copilot-instructions.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..ea9bc2c212 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,22 @@ +# JoyOfCoding repository instructions + +## Build, test, and lint + +- Use the Maven Wrapper from the repository root. The CI build is `./mvnw --batch-mode verify --file pom.xml`; it runs unit tests, integration tests, and the configured JaCoCo reporting. CI runs this with JDK 21 and 24. The reactor enforces Java 21, except `projects-parent/projects`, which deliberately compiles Java 8-compatible APIs. +- Run a module's unit tests with its required reactor dependencies: `./mvnw --batch-mode -pl -am test`. For one test or method, add `-Dtest=FullyQualifiedTestClass` or `-Dtest=FullyQualifiedTestClass#method`; for example, `./mvnw --batch-mode -pl projects-parent/projects -am -Dtest=edu.pdx.cs.joy.InvokeMainTest test`. +- Integration tests live in `src/it/java`, are compiled separately, and run through Failsafe during `verify`. Run one with `./mvnw --batch-mode -pl web -am -Dit.test=edu.pdx.cs.joy.servlets.MovieDatabaseServletIT verify`. The `web` module starts Jetty on port 8080 for its integration-test lifecycle. +- The project does not have one reactor-wide lint phase. The reference project modules under `projects-parent/originals-parent` bind Checkstyle; run it for a changed reference project with `./mvnw --batch-mode -pl projects-parent/originals-parent/ checkstyle:check`. Generate the Maven documentation site with `./mvnw --batch-mode site --file pom.xml`. + +## Architecture + +- This is a Maven multi-module codebase for "The Joy of Coding" course. The root reactor builds `examples`, `web`, `family`, `grader`, and `projects-parent`. +- `projects-parent/projects` is the shared course API: abstract domain types, parsers/dumpers, XML helpers, and test utilities used by the course projects. Keep it Java 8-compatible because Android projects consume it. +- `projects-parent/originals-parent` contains the reference implementations of student assignments (airline, appointment book, phone bill, student, and kata, including web variants). `projects-parent/archetypes-parent` packages the corresponding student project templates. Template source is under each archetype's `src/main/resources/archetype-resources`; its `META-INF/maven/archetype-metadata.xml` controls which files are filtered and packaged. +- `examples` contains independent Java examples, while `family` is a family-tree application and `grader` is the course grading/gradebook tooling. The grader produces a shaded executable with `edu.pdx.cs.joy.grader.GraderTools` as its entry point. +- `web` packages a WAR. Traditional servlet endpoints and URL mappings are declared in `web/src/main/webapp/WEB-INF/web.xml`; RESTEasy/Guice REST services are registered in `edu.pdx.cs.joy.di.RestModule` and served beneath `/rest`. + +## Codebase conventions + +- Use JUnit Jupiter for tests, with Hamcrest matchers commonly used for expressive assertions. Keep fast tests in `src/test/java`; put tests that need external services, Jetty, or mail fixtures in `src/it/java` and name them `*IT`. +- Course-project command-line tests should extend `edu.pdx.cs.joy.InvokeMainTestCase` from the shared `projects` test JAR. Its default invocation rejects mutable static fields and captures standard output/error; use its explicit `invokeMainAllowingMutableStaticFields` only when that behavior is intentional. +- Reference projects are built with the `grader` profile, which applies API-doclet validation and JaCoCo thresholds (at least 75% instruction coverage and no missed classes). Preserve the original project and archetype-template distinction when changing assignment-facing behavior. From 8be2b9e5907122853f2f628743d2b1ec18faf58a Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 16:12:18 -0700 Subject: [PATCH 03/22] SNAPSHOT versions for Winter 2027. --- examples/pom.xml | 8 ++++---- family/pom.xml | 8 ++++---- grader/pom.xml | 4 ++-- pom.xml | 4 ++-- .../archetypes-parent/airline-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- .../archetypes-parent/airline-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/apptbook-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- .../archetypes-parent/apptbook-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/java-koans-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 4 ++-- .../archetypes-parent/kata-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 4 ++-- .../archetypes-parent/phonebill-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/phonebill-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- projects-parent/archetypes-parent/pom.xml | 4 ++-- .../archetypes-parent/student-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- projects-parent/originals-parent/airline-web/pom.xml | 10 +++++----- projects-parent/originals-parent/airline/pom.xml | 8 ++++---- projects-parent/originals-parent/apptbook-web/pom.xml | 10 +++++----- projects-parent/originals-parent/apptbook/pom.xml | 8 ++++---- projects-parent/originals-parent/kata/pom.xml | 6 +++--- projects-parent/originals-parent/phonebill-web/pom.xml | 10 +++++----- projects-parent/originals-parent/phonebill/pom.xml | 10 +++++----- projects-parent/originals-parent/pom.xml | 4 ++-- projects-parent/originals-parent/student/pom.xml | 8 ++++---- projects-parent/pom.xml | 4 ++-- projects-parent/projects/pom.xml | 4 ++-- web/pom.xml | 8 ++++---- 35 files changed, 106 insertions(+), 106 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index c6475cd46f..29990daedf 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -3,18 +3,18 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 examples examples - 1.4.1 + 1.4.2-SNAPSHOT https://www.cs.pdx.edu/~whitlock io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT com.sun.mail @@ -45,7 +45,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/family/pom.xml b/family/pom.xml index 910c90a1ef..cec52e5c2c 100644 --- a/family/pom.xml +++ b/family/pom.xml @@ -3,12 +3,12 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 family jar - 1.1.7 + 1.1.8-SNAPSHOT Family Tree Application An Family Tree application for The Joy of Coding https://www.cs.pdx.edu/~whitlock @@ -16,12 +16,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT com.h2database diff --git a/grader/pom.xml b/grader/pom.xml index 8e0db23c6f..dcb0673dd0 100644 --- a/grader/pom.xml +++ b/grader/pom.xml @@ -2,7 +2,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 grader @@ -34,7 +34,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT com.opencsv diff --git a/pom.xml b/pom.xml index 80e1f83ffa..f814793935 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT joy pom Java Example Code @@ -94,7 +94,7 @@ 0.75 0 - 1.6.0 + 1.6.1-SNAPSHOT diff --git a/projects-parent/archetypes-parent/airline-archetype/pom.xml b/projects-parent/archetypes-parent/airline-archetype/pom.xml index 4c3d67ea9a..315faf73d6 100644 --- a/projects-parent/archetypes-parent/airline-archetype/pom.xml +++ b/projects-parent/archetypes-parent/airline-archetype/pom.xml @@ -5,10 +5,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT airline-archetype - 2.2.6 + 2.2.7-SNAPSHOT maven-archetype airline-archetype diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml index 678d68f69d..f3be8580c9 100644 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/airline-web-archetype/pom.xml b/projects-parent/archetypes-parent/airline-web-archetype/pom.xml index 86cb159639..e4295b13b0 100644 --- a/projects-parent/archetypes-parent/airline-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/airline-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT airline-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype airline-web-archetype diff --git a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml index 9d63ab6b3f..6f4d4c3cec 100644 --- a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/apptbook-archetype/pom.xml b/projects-parent/archetypes-parent/apptbook-archetype/pom.xml index b815d9a477..3cc0e758b6 100644 --- a/projects-parent/archetypes-parent/apptbook-archetype/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT apptbook-archetype - 2.2.6 + 2.2.7-SNAPSHOT maven-archetype apptbook-archetype diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml index f79a65986f..d1f5269415 100644 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml b/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml index 9cf375b48c..8845a05df7 100644 --- a/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT apptbook-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype apptbook-web-archetype diff --git a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml index ff44dc535e..02cdd6f6e4 100644 --- a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/java-koans-archetype/pom.xml b/projects-parent/archetypes-parent/java-koans-archetype/pom.xml index f2ab6868eb..874c5df7d6 100644 --- a/projects-parent/archetypes-parent/java-koans-archetype/pom.xml +++ b/projects-parent/archetypes-parent/java-koans-archetype/pom.xml @@ -3,13 +3,13 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 java-koans-archetype - 2.2.10 + 2.2.11-SNAPSHOT maven-archetype java-koans-archetype diff --git a/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml index c6516918a6..ba03338b55 100644 --- a/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${artifactId} ${groupId} @@ -50,7 +50,7 @@ io.github.davidwhitlock.joy.com.sandwich koans-lib - 1.3.0 + 1.3.1-SNAPSHOT diff --git a/projects-parent/archetypes-parent/kata-archetype/pom.xml b/projects-parent/archetypes-parent/kata-archetype/pom.xml index 57fb323cd4..38a4d1262d 100644 --- a/projects-parent/archetypes-parent/kata-archetype/pom.xml +++ b/projects-parent/archetypes-parent/kata-archetype/pom.xml @@ -5,10 +5,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT kata-archetype - 2.2.7 + 2.2.8-SNAPSHOT maven-archetype kata-archetype diff --git a/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml index a28049c39b..03a9191728 100644 --- a/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${groupId} ${artifactId} @@ -97,7 +97,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/phonebill-archetype/pom.xml b/projects-parent/archetypes-parent/phonebill-archetype/pom.xml index 2169bcc9e2..246c16e60b 100644 --- a/projects-parent/archetypes-parent/phonebill-archetype/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-archetype/pom.xml @@ -3,11 +3,11 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 phonebill-archetype - 2.3.1 + 2.3.2-SNAPSHOT maven-archetype phonebill-archetype diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml index 99e815e4b1..159deb35da 100644 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -43,17 +43,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml b/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml index 959cc2a183..f4bf0f25bb 100644 --- a/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT phonebill-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype phonebill-web-archetype diff --git a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml index 8f4f4bdc54..ca1e850bf8 100644 --- a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -22,17 +22,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/pom.xml b/projects-parent/archetypes-parent/pom.xml index 65d31e5433..ba1da8613c 100644 --- a/projects-parent/archetypes-parent/pom.xml +++ b/projects-parent/archetypes-parent/pom.xml @@ -7,11 +7,11 @@ io.github.davidwhitlock.joy projects-parent - 2.2.6 + 2.2.7-SNAPSHOT archetypes-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/archetypes-parent/student-archetype/pom.xml b/projects-parent/archetypes-parent/student-archetype/pom.xml index 0c6fd69359..ff4eab52b6 100644 --- a/projects-parent/archetypes-parent/student-archetype/pom.xml +++ b/projects-parent/archetypes-parent/student-archetype/pom.xml @@ -5,11 +5,11 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT student-archetype - 2.3.6 + 2.3.7-SNAPSHOT maven-archetype Archetype for Student project diff --git a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml index ae287d2fad..80af68124d 100644 --- a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${groupId} ${artifactId} @@ -102,12 +102,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/airline-web/pom.xml b/projects-parent/originals-parent/airline-web/pom.xml index 27839f0be2..5fbcf107f2 100644 --- a/projects-parent/originals-parent/airline-web/pom.xml +++ b/projects-parent/originals-parent/airline-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original airline-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/airline/pom.xml b/projects-parent/originals-parent/airline/pom.xml index 08f9d2924e..ace9835ad5 100644 --- a/projects-parent/originals-parent/airline/pom.xml +++ b/projects-parent/originals-parent/airline/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original airline jar - 2.2.6 + 2.2.7-SNAPSHOT Airline Project An Airline application for The Joy of Coding at Portland State University 2000 @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/apptbook-web/pom.xml b/projects-parent/originals-parent/apptbook-web/pom.xml index 21f8a96e71..dc2f18c8ff 100644 --- a/projects-parent/originals-parent/apptbook-web/pom.xml +++ b/projects-parent/originals-parent/apptbook-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original apptbook-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/apptbook/pom.xml b/projects-parent/originals-parent/apptbook/pom.xml index c3444c439b..2d15a35b00 100644 --- a/projects-parent/originals-parent/apptbook/pom.xml +++ b/projects-parent/originals-parent/apptbook/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original apptbook jar - 2.2.6 + 2.2.7-SNAPSHOT Appointment Book Project An Appointment Book application for The Joy of Coding at Portland State University 2000 @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/kata/pom.xml b/projects-parent/originals-parent/kata/pom.xml index 3db3a97909..4d9c5209aa 100644 --- a/projects-parent/originals-parent/kata/pom.xml +++ b/projects-parent/originals-parent/kata/pom.xml @@ -4,11 +4,11 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT io.github.davidwhitlock.joy.original kata - 2.2.6 + 2.2.7-SNAPSHOT jar Kata Project @@ -98,7 +98,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/phonebill-web/pom.xml b/projects-parent/originals-parent/phonebill-web/pom.xml index 810e266e8e..7d04b11145 100644 --- a/projects-parent/originals-parent/phonebill-web/pom.xml +++ b/projects-parent/originals-parent/phonebill-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original phonebill-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -22,17 +22,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/phonebill/pom.xml b/projects-parent/originals-parent/phonebill/pom.xml index f1b6c5c351..b82827d215 100644 --- a/projects-parent/originals-parent/phonebill/pom.xml +++ b/projects-parent/originals-parent/phonebill/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original phonebill jar - 2.3.1 + 2.3.2-SNAPSHOT Phone Bill Project A Phone Bill application for The Joy of Coding at Portland State University 2000 @@ -43,17 +43,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/pom.xml b/projects-parent/originals-parent/pom.xml index f5917e6869..9d0bae24f3 100644 --- a/projects-parent/originals-parent/pom.xml +++ b/projects-parent/originals-parent/pom.xml @@ -5,11 +5,11 @@ io.github.davidwhitlock.joy projects-parent - 2.2.6 + 2.2.7-SNAPSHOT originals-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/originals-parent/student/pom.xml b/projects-parent/originals-parent/student/pom.xml index bb3a0bbc1f..28b9c87ecc 100644 --- a/projects-parent/originals-parent/student/pom.xml +++ b/projects-parent/originals-parent/student/pom.xml @@ -4,11 +4,11 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT io.github.davidwhitlock.joy.original student - 2.3.6 + 2.3.7-SNAPSHOT jar Student Project @@ -88,12 +88,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/pom.xml b/projects-parent/pom.xml index 06bcf62c0e..65d7ff4aba 100644 --- a/projects-parent/pom.xml +++ b/projects-parent/pom.xml @@ -7,11 +7,11 @@ io.github.davidwhitlock.joy joy - 1.3.0 + 1.3.1-SNAPSHOT projects-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/projects/pom.xml b/projects-parent/projects/pom.xml index 49d1eb4f7b..21451ba6c0 100644 --- a/projects-parent/projects/pom.xml +++ b/projects-parent/projects/pom.xml @@ -2,13 +2,13 @@ projects-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 projects Project APIs Classes needed for the Projects in The Joy of Coding - 3.0.5 + 3.0.6-SNAPSHOT http://www.cs.pdx.edu/~whitlock diff --git a/web/pom.xml b/web/pom.xml index 68f3cbb96d..2ff7363684 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -3,13 +3,13 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 web war Web Application examples - 2.1.0 + 2.1.1-SNAPSHOT http://www.cs.pdx.edu/~whitlock 7.0.2.Final @@ -117,12 +117,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy family - 1.1.7 + 1.1.8-SNAPSHOT jakarta.xml.bind From 6d159f5ed8f3b86d4d9d6a6969a6eb6173768887 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 15:49:53 -0700 Subject: [PATCH 04/22] Remove cs410J files that might end up in the project archetypes. --- .../java/edu/pdx/cs410J/xml/phonebook.dtd | 40 ------------------- .../edu/pdx/cs410J/whitlock/noExtension | 0 .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../pdx/cs410J/__artifactId__/package.html | 6 --- .../edu/pdx/cs410J/airline/package.html | 3 -- .../edu/pdx/cs410J/airline/package.html | 3 -- .../edu/pdx/cs410J/apptbook/package.html | 3 -- .../edu/pdx/cs410J/apptbook/package.html | 3 -- .../edu/pdx/cs410J/phonebill/package.html | 3 -- .../edu/pdx/cs410J/phonebill/package.html | 3 -- 14 files changed, 94 deletions(-) delete mode 100644 examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd delete mode 100644 grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension delete mode 100644 projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html delete mode 100644 projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html delete mode 100644 projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html delete mode 100644 projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html delete mode 100644 projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html delete mode 100644 projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html delete mode 100644 projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html diff --git a/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd b/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd deleted file mode 100644 index c2d768b356..0000000000 --- a/examples/src/resources/java/edu/pdx/cs410J/xml/phonebook.dtd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension b/grader/src/main/resources/edu/pdx/cs410J/whitlock/noExtension deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 4f17af6f2c..0000000000 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 63197885a4..0000000000 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 54dbc66f8b..0000000000 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 9777aff71c..0000000000 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index 6d4adf245a..0000000000 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/main/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the application classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html deleted file mode 100644 index a579da692a..0000000000 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/src/test/javadoc/edu/pdx/cs410J/__artifactId__/package.html +++ /dev/null @@ -1,6 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - -

Contains the test classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html b/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html deleted file mode 100644 index 02be23647a..0000000000 --- a/projects-parent/originals-parent/airline/src/main/javadoc/edu/pdx/cs410J/airline/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html b/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html deleted file mode 100644 index bed1173886..0000000000 --- a/projects-parent/originals-parent/airline/src/test/javadoc/edu/pdx/cs410J/airline/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Airline project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html b/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html deleted file mode 100644 index 3a7e4bb21a..0000000000 --- a/projects-parent/originals-parent/apptbook/src/main/javadoc/edu/pdx/cs410J/apptbook/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html b/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html deleted file mode 100644 index 8d4ef70cbf..0000000000 --- a/projects-parent/originals-parent/apptbook/src/test/javadoc/edu/pdx/cs410J/apptbook/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Appointment Book project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html b/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html deleted file mode 100644 index e0071f61b0..0000000000 --- a/projects-parent/originals-parent/phonebill/src/main/javadoc/edu/pdx/cs410J/phonebill/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the application classes for the Phone Bill project.

- \ No newline at end of file diff --git a/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html b/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html deleted file mode 100644 index fd40306218..0000000000 --- a/projects-parent/originals-parent/phonebill/src/test/javadoc/edu/pdx/cs410J/phonebill/package.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Contains the test classes for the Phone Bill project.

- \ No newline at end of file From c579ee9fdc32862a6267f561d5e6f3ddf5f6483d Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 15:50:49 -0700 Subject: [PATCH 05/22] Add beginnings of a copilot-instructions.md file. --- .github/copilot-instructions.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..ea9bc2c212 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,22 @@ +# JoyOfCoding repository instructions + +## Build, test, and lint + +- Use the Maven Wrapper from the repository root. The CI build is `./mvnw --batch-mode verify --file pom.xml`; it runs unit tests, integration tests, and the configured JaCoCo reporting. CI runs this with JDK 21 and 24. The reactor enforces Java 21, except `projects-parent/projects`, which deliberately compiles Java 8-compatible APIs. +- Run a module's unit tests with its required reactor dependencies: `./mvnw --batch-mode -pl -am test`. For one test or method, add `-Dtest=FullyQualifiedTestClass` or `-Dtest=FullyQualifiedTestClass#method`; for example, `./mvnw --batch-mode -pl projects-parent/projects -am -Dtest=edu.pdx.cs.joy.InvokeMainTest test`. +- Integration tests live in `src/it/java`, are compiled separately, and run through Failsafe during `verify`. Run one with `./mvnw --batch-mode -pl web -am -Dit.test=edu.pdx.cs.joy.servlets.MovieDatabaseServletIT verify`. The `web` module starts Jetty on port 8080 for its integration-test lifecycle. +- The project does not have one reactor-wide lint phase. The reference project modules under `projects-parent/originals-parent` bind Checkstyle; run it for a changed reference project with `./mvnw --batch-mode -pl projects-parent/originals-parent/ checkstyle:check`. Generate the Maven documentation site with `./mvnw --batch-mode site --file pom.xml`. + +## Architecture + +- This is a Maven multi-module codebase for "The Joy of Coding" course. The root reactor builds `examples`, `web`, `family`, `grader`, and `projects-parent`. +- `projects-parent/projects` is the shared course API: abstract domain types, parsers/dumpers, XML helpers, and test utilities used by the course projects. Keep it Java 8-compatible because Android projects consume it. +- `projects-parent/originals-parent` contains the reference implementations of student assignments (airline, appointment book, phone bill, student, and kata, including web variants). `projects-parent/archetypes-parent` packages the corresponding student project templates. Template source is under each archetype's `src/main/resources/archetype-resources`; its `META-INF/maven/archetype-metadata.xml` controls which files are filtered and packaged. +- `examples` contains independent Java examples, while `family` is a family-tree application and `grader` is the course grading/gradebook tooling. The grader produces a shaded executable with `edu.pdx.cs.joy.grader.GraderTools` as its entry point. +- `web` packages a WAR. Traditional servlet endpoints and URL mappings are declared in `web/src/main/webapp/WEB-INF/web.xml`; RESTEasy/Guice REST services are registered in `edu.pdx.cs.joy.di.RestModule` and served beneath `/rest`. + +## Codebase conventions + +- Use JUnit Jupiter for tests, with Hamcrest matchers commonly used for expressive assertions. Keep fast tests in `src/test/java`; put tests that need external services, Jetty, or mail fixtures in `src/it/java` and name them `*IT`. +- Course-project command-line tests should extend `edu.pdx.cs.joy.InvokeMainTestCase` from the shared `projects` test JAR. Its default invocation rejects mutable static fields and captures standard output/error; use its explicit `invokeMainAllowingMutableStaticFields` only when that behavior is intentional. +- Reference projects are built with the `grader` profile, which applies API-doclet validation and JaCoCo thresholds (at least 75% instruction coverage and no missed classes). Preserve the original project and archetype-template distinction when changing assignment-facing behavior. From a2bd255aa19c050bfcfe96f773eb01f87c0d96c2 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 16:12:18 -0700 Subject: [PATCH 06/22] SNAPSHOT versions for Winter 2027. --- examples/pom.xml | 8 ++++---- family/pom.xml | 8 ++++---- grader/pom.xml | 4 ++-- pom.xml | 4 ++-- .../archetypes-parent/airline-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- .../archetypes-parent/airline-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/apptbook-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- .../archetypes-parent/apptbook-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/java-koans-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 4 ++-- .../archetypes-parent/kata-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 4 ++-- .../archetypes-parent/phonebill-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- .../archetypes-parent/phonebill-web-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 8 ++++---- projects-parent/archetypes-parent/pom.xml | 4 ++-- .../archetypes-parent/student-archetype/pom.xml | 4 ++-- .../src/main/resources/archetype-resources/pom.xml | 6 +++--- projects-parent/originals-parent/airline-web/pom.xml | 10 +++++----- projects-parent/originals-parent/airline/pom.xml | 8 ++++---- projects-parent/originals-parent/apptbook-web/pom.xml | 10 +++++----- projects-parent/originals-parent/apptbook/pom.xml | 8 ++++---- projects-parent/originals-parent/kata/pom.xml | 6 +++--- projects-parent/originals-parent/phonebill-web/pom.xml | 10 +++++----- projects-parent/originals-parent/phonebill/pom.xml | 10 +++++----- projects-parent/originals-parent/pom.xml | 4 ++-- projects-parent/originals-parent/student/pom.xml | 8 ++++---- projects-parent/pom.xml | 4 ++-- projects-parent/projects/pom.xml | 4 ++-- web/pom.xml | 8 ++++---- 35 files changed, 106 insertions(+), 106 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index c6475cd46f..29990daedf 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -3,18 +3,18 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 examples examples - 1.4.1 + 1.4.2-SNAPSHOT https://www.cs.pdx.edu/~whitlock io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT com.sun.mail @@ -45,7 +45,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/family/pom.xml b/family/pom.xml index 910c90a1ef..cec52e5c2c 100644 --- a/family/pom.xml +++ b/family/pom.xml @@ -3,12 +3,12 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 family jar - 1.1.7 + 1.1.8-SNAPSHOT Family Tree Application An Family Tree application for The Joy of Coding https://www.cs.pdx.edu/~whitlock @@ -16,12 +16,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT com.h2database diff --git a/grader/pom.xml b/grader/pom.xml index 8e0db23c6f..dcb0673dd0 100644 --- a/grader/pom.xml +++ b/grader/pom.xml @@ -2,7 +2,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 grader @@ -34,7 +34,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT com.opencsv diff --git a/pom.xml b/pom.xml index 80e1f83ffa..f814793935 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT joy pom Java Example Code @@ -94,7 +94,7 @@ 0.75 0 - 1.6.0 + 1.6.1-SNAPSHOT
diff --git a/projects-parent/archetypes-parent/airline-archetype/pom.xml b/projects-parent/archetypes-parent/airline-archetype/pom.xml index 4c3d67ea9a..315faf73d6 100644 --- a/projects-parent/archetypes-parent/airline-archetype/pom.xml +++ b/projects-parent/archetypes-parent/airline-archetype/pom.xml @@ -5,10 +5,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT airline-archetype - 2.2.6 + 2.2.7-SNAPSHOT maven-archetype airline-archetype diff --git a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml index 678d68f69d..f3be8580c9 100644 --- a/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/airline-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/airline-web-archetype/pom.xml b/projects-parent/archetypes-parent/airline-web-archetype/pom.xml index 86cb159639..e4295b13b0 100644 --- a/projects-parent/archetypes-parent/airline-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/airline-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT airline-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype airline-web-archetype diff --git a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml index 9d63ab6b3f..6f4d4c3cec 100644 --- a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/apptbook-archetype/pom.xml b/projects-parent/archetypes-parent/apptbook-archetype/pom.xml index b815d9a477..3cc0e758b6 100644 --- a/projects-parent/archetypes-parent/apptbook-archetype/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT apptbook-archetype - 2.2.6 + 2.2.7-SNAPSHOT maven-archetype apptbook-archetype diff --git a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml index f79a65986f..d1f5269415 100644 --- a/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml b/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml index 9cf375b48c..8845a05df7 100644 --- a/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT apptbook-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype apptbook-web-archetype diff --git a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml index ff44dc535e..02cdd6f6e4 100644 --- a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/java-koans-archetype/pom.xml b/projects-parent/archetypes-parent/java-koans-archetype/pom.xml index f2ab6868eb..874c5df7d6 100644 --- a/projects-parent/archetypes-parent/java-koans-archetype/pom.xml +++ b/projects-parent/archetypes-parent/java-koans-archetype/pom.xml @@ -3,13 +3,13 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 java-koans-archetype - 2.2.10 + 2.2.11-SNAPSHOT maven-archetype java-koans-archetype diff --git a/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml index c6516918a6..ba03338b55 100644 --- a/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/java-koans-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${artifactId} ${groupId} @@ -50,7 +50,7 @@ io.github.davidwhitlock.joy.com.sandwich koans-lib - 1.3.0 + 1.3.1-SNAPSHOT diff --git a/projects-parent/archetypes-parent/kata-archetype/pom.xml b/projects-parent/archetypes-parent/kata-archetype/pom.xml index 57fb323cd4..38a4d1262d 100644 --- a/projects-parent/archetypes-parent/kata-archetype/pom.xml +++ b/projects-parent/archetypes-parent/kata-archetype/pom.xml @@ -5,10 +5,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT kata-archetype - 2.2.7 + 2.2.8-SNAPSHOT maven-archetype kata-archetype diff --git a/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml index a28049c39b..03a9191728 100644 --- a/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/kata-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${groupId} ${artifactId} @@ -97,7 +97,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/phonebill-archetype/pom.xml b/projects-parent/archetypes-parent/phonebill-archetype/pom.xml index 2169bcc9e2..246c16e60b 100644 --- a/projects-parent/archetypes-parent/phonebill-archetype/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-archetype/pom.xml @@ -3,11 +3,11 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 phonebill-archetype - 2.3.1 + 2.3.2-SNAPSHOT maven-archetype phonebill-archetype diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml index 99e815e4b1..159deb35da 100644 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -43,17 +43,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml b/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml index 959cc2a183..f4bf0f25bb 100644 --- a/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-web-archetype/pom.xml @@ -4,10 +4,10 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT phonebill-web-archetype - 3.1.0 + 3.1.1-SNAPSHOT maven-archetype phonebill-web-archetype diff --git a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml index 8f4f4bdc54..ca1e850bf8 100644 --- a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -3,7 +3,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 ${groupId} @@ -22,17 +22,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/archetypes-parent/pom.xml b/projects-parent/archetypes-parent/pom.xml index 65d31e5433..ba1da8613c 100644 --- a/projects-parent/archetypes-parent/pom.xml +++ b/projects-parent/archetypes-parent/pom.xml @@ -7,11 +7,11 @@ io.github.davidwhitlock.joy projects-parent - 2.2.6 + 2.2.7-SNAPSHOT archetypes-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/archetypes-parent/student-archetype/pom.xml b/projects-parent/archetypes-parent/student-archetype/pom.xml index 0c6fd69359..ff4eab52b6 100644 --- a/projects-parent/archetypes-parent/student-archetype/pom.xml +++ b/projects-parent/archetypes-parent/student-archetype/pom.xml @@ -5,11 +5,11 @@ archetypes-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT student-archetype - 2.3.6 + 2.3.7-SNAPSHOT maven-archetype Archetype for Student project diff --git a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml index ae287d2fad..80af68124d 100644 --- a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml @@ -4,7 +4,7 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT ${groupId} ${artifactId} @@ -102,12 +102,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/airline-web/pom.xml b/projects-parent/originals-parent/airline-web/pom.xml index 27839f0be2..5fbcf107f2 100644 --- a/projects-parent/originals-parent/airline-web/pom.xml +++ b/projects-parent/originals-parent/airline-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original airline-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/airline/pom.xml b/projects-parent/originals-parent/airline/pom.xml index 08f9d2924e..ace9835ad5 100644 --- a/projects-parent/originals-parent/airline/pom.xml +++ b/projects-parent/originals-parent/airline/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original airline jar - 2.2.6 + 2.2.7-SNAPSHOT Airline Project An Airline application for The Joy of Coding at Portland State University 2000 @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/apptbook-web/pom.xml b/projects-parent/originals-parent/apptbook-web/pom.xml index 21f8a96e71..dc2f18c8ff 100644 --- a/projects-parent/originals-parent/apptbook-web/pom.xml +++ b/projects-parent/originals-parent/apptbook-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original apptbook-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -21,17 +21,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/apptbook/pom.xml b/projects-parent/originals-parent/apptbook/pom.xml index c3444c439b..2d15a35b00 100644 --- a/projects-parent/originals-parent/apptbook/pom.xml +++ b/projects-parent/originals-parent/apptbook/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original apptbook jar - 2.2.6 + 2.2.7-SNAPSHOT Appointment Book Project An Appointment Book application for The Joy of Coding at Portland State University 2000 @@ -32,12 +32,12 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/kata/pom.xml b/projects-parent/originals-parent/kata/pom.xml index 3db3a97909..4d9c5209aa 100644 --- a/projects-parent/originals-parent/kata/pom.xml +++ b/projects-parent/originals-parent/kata/pom.xml @@ -4,11 +4,11 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT io.github.davidwhitlock.joy.original kata - 2.2.6 + 2.2.7-SNAPSHOT jar Kata Project @@ -98,7 +98,7 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/phonebill-web/pom.xml b/projects-parent/originals-parent/phonebill-web/pom.xml index 810e266e8e..7d04b11145 100644 --- a/projects-parent/originals-parent/phonebill-web/pom.xml +++ b/projects-parent/originals-parent/phonebill-web/pom.xml @@ -3,12 +3,12 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original phonebill-web - 3.1.0 + 3.1.1-SNAPSHOT 8080 @@ -22,17 +22,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/phonebill/pom.xml b/projects-parent/originals-parent/phonebill/pom.xml index f1b6c5c351..b82827d215 100644 --- a/projects-parent/originals-parent/phonebill/pom.xml +++ b/projects-parent/originals-parent/phonebill/pom.xml @@ -3,13 +3,13 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 io.github.davidwhitlock.joy.original phonebill jar - 2.3.1 + 2.3.2-SNAPSHOT Phone Bill Project A Phone Bill application for The Joy of Coding at Portland State University 2000 @@ -43,17 +43,17 @@ io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/originals-parent/pom.xml b/projects-parent/originals-parent/pom.xml index f5917e6869..9d0bae24f3 100644 --- a/projects-parent/originals-parent/pom.xml +++ b/projects-parent/originals-parent/pom.xml @@ -5,11 +5,11 @@ io.github.davidwhitlock.joy projects-parent - 2.2.6 + 2.2.7-SNAPSHOT originals-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/originals-parent/student/pom.xml b/projects-parent/originals-parent/student/pom.xml index bb3a0bbc1f..28b9c87ecc 100644 --- a/projects-parent/originals-parent/student/pom.xml +++ b/projects-parent/originals-parent/student/pom.xml @@ -4,11 +4,11 @@ originals-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT io.github.davidwhitlock.joy.original student - 2.3.6 + 2.3.7-SNAPSHOT jar Student Project @@ -88,12 +88,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy projects - 3.0.5 + 3.0.6-SNAPSHOT tests test diff --git a/projects-parent/pom.xml b/projects-parent/pom.xml index 06bcf62c0e..65d7ff4aba 100644 --- a/projects-parent/pom.xml +++ b/projects-parent/pom.xml @@ -7,11 +7,11 @@ io.github.davidwhitlock.joy joy - 1.3.0 + 1.3.1-SNAPSHOT projects-parent - 2.2.6 + 2.2.7-SNAPSHOT pom diff --git a/projects-parent/projects/pom.xml b/projects-parent/projects/pom.xml index 49d1eb4f7b..21451ba6c0 100644 --- a/projects-parent/projects/pom.xml +++ b/projects-parent/projects/pom.xml @@ -2,13 +2,13 @@ projects-parent io.github.davidwhitlock.joy - 2.2.6 + 2.2.7-SNAPSHOT 4.0.0 projects Project APIs Classes needed for the Projects in The Joy of Coding - 3.0.5 + 3.0.6-SNAPSHOT http://www.cs.pdx.edu/~whitlock diff --git a/web/pom.xml b/web/pom.xml index 68f3cbb96d..2ff7363684 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -3,13 +3,13 @@ joy io.github.davidwhitlock.joy - 1.3.0 + 1.3.1-SNAPSHOT 4.0.0 web war Web Application examples - 2.1.0 + 2.1.1-SNAPSHOT http://www.cs.pdx.edu/~whitlock 7.0.2.Final @@ -117,12 +117,12 @@ io.github.davidwhitlock.joy examples - 1.4.1 + 1.4.2-SNAPSHOT io.github.davidwhitlock.joy family - 1.1.7 + 1.1.8-SNAPSHOT jakarta.xml.bind From 100f5fc0d5bc51c5b37b8e35d1d8bc4cb417322f Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Thu, 28 Nov 2024 09:57:26 -0800 Subject: [PATCH 07/22] Attempt to update to Greenmail 2.1.1. It's not working yet because the self-signed certificate doesn't have a subject alternate name for localhost. --- grader/pom.xml | 2 +- .../pdx/cs/joy/grader/GreenmailIntegrationTestCase.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/grader/pom.xml b/grader/pom.xml index dcb0673dd0..387d63f91a 100644 --- a/grader/pom.xml +++ b/grader/pom.xml @@ -64,7 +64,7 @@ com.icegreen greenmail - 2.0.1 + 2.1.1 test
diff --git a/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java b/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java index 54454abc13..66626b64dc 100644 --- a/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java +++ b/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java @@ -6,6 +6,8 @@ import com.icegreen.greenmail.store.FolderListener; import com.icegreen.greenmail.store.MailFolder; import com.icegreen.greenmail.user.GreenMailUser; +import com.icegreen.greenmail.util.DummySSLServerSocketFactory; +import com.icegreen.greenmail.util.DummySSLSocketFactory; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.ServerSetup; import com.sun.mail.util.MailSSLSocketFactory; @@ -16,6 +18,7 @@ import org.junit.jupiter.api.BeforeEach; import java.security.GeneralSecurityException; +import java.security.Security; import java.util.Properties; public class GreenmailIntegrationTestCase { @@ -33,6 +36,8 @@ public void startEmailServer() throws FolderException, AuthorizationException { ServerSetup imaps = new ServerSetup(imapsPort, emailServerHost, ServerSetup.PROTOCOL_IMAPS); emailServer = new GreenMail(new ServerSetup[]{ smtp, imaps }); + Security.setProperty("ssl.SocketFactory.provider", DummySSLSocketFactory.class.getName()); + GreenMailUser user = emailServer.setUser(emailAddress, imapUserName, imapPassword); doSomethingWithUser(user); @@ -81,8 +86,7 @@ protected Folder openFolder(Store store, String folderName) throws MessagingExce protected Store connectToIMAPServer() throws GeneralSecurityException, MessagingException { Properties props = new Properties(); - MailSSLSocketFactory socketFactory = new MailSSLSocketFactory(); - socketFactory.setTrustedHosts(new String[]{"127.0.0.1", "localhost"}); + DummySSLSocketFactory socketFactory = new DummySSLSocketFactory(); props.put("mail.imaps.ssl.socketFactory", socketFactory); Session session = Session.getInstance(props, null); From 6b30f6c2c4e278f8d9091bd8bf29a9d81ac427f6 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 15 Aug 2026 16:29:54 -0700 Subject: [PATCH 08/22] =?UTF-8?q?GreenMail=20now=20uses=20Angus=20Mail,=20?= =?UTF-8?q?so=20the=20legacy=20com.sun.mail=20SSL=20socket=20factory=20was?= =?UTF-8?q?=20ignored.=20The=20tests=20hit=20GreenMail=E2=80=99s=20self-si?= =?UTF-8?q?gned=20IMAPS=20certificate;=20localhost-only=20trust=20and=20di?= =?UTF-8?q?sabled=20hostname=20verification=20now=20use=20standard=20mail?= =?UTF-8?q?=20properties.=20I=20also=20made=20the=20MIME=20content-type=20?= =?UTF-8?q?assertion=20case-insensitive=20because=20GreenMail=20now=20norm?= =?UTF-8?q?alizes=20text/plain.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grader/pom.xml | 2 +- .../joy/grader/GreenmailIntegrationTestCase.java | 14 +++----------- .../joy/grader/poa/POASubmissionsDownloaderIT.java | 3 ++- .../edu/pdx/cs/joy/grader/GraderEmailAccount.java | 9 +++------ 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/grader/pom.xml b/grader/pom.xml index 387d63f91a..18a91ac6b0 100644 --- a/grader/pom.xml +++ b/grader/pom.xml @@ -64,7 +64,7 @@ com.icegreen greenmail - 2.1.1 + 2.1.12 test diff --git a/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java b/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java index 66626b64dc..5240be7f23 100644 --- a/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java +++ b/grader/src/it/java/edu/pdx/cs/joy/grader/GreenmailIntegrationTestCase.java @@ -6,19 +6,14 @@ import com.icegreen.greenmail.store.FolderListener; import com.icegreen.greenmail.store.MailFolder; import com.icegreen.greenmail.user.GreenMailUser; -import com.icegreen.greenmail.util.DummySSLServerSocketFactory; -import com.icegreen.greenmail.util.DummySSLSocketFactory; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.ServerSetup; -import com.sun.mail.util.MailSSLSocketFactory; import jakarta.mail.*; import jakarta.mail.internet.InternetAddress; import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import java.security.GeneralSecurityException; -import java.security.Security; import java.util.Properties; public class GreenmailIntegrationTestCase { @@ -36,8 +31,6 @@ public void startEmailServer() throws FolderException, AuthorizationException { ServerSetup imaps = new ServerSetup(imapsPort, emailServerHost, ServerSetup.PROTOCOL_IMAPS); emailServer = new GreenMail(new ServerSetup[]{ smtp, imaps }); - Security.setProperty("ssl.SocketFactory.provider", DummySSLSocketFactory.class.getName()); - GreenMailUser user = emailServer.setUser(emailAddress, imapUserName, imapPassword); doSomethingWithUser(user); @@ -83,11 +76,10 @@ protected Folder openFolder(Store store, String folderName) throws MessagingExce return folder; } - protected Store connectToIMAPServer() throws GeneralSecurityException, MessagingException { + protected Store connectToIMAPServer() throws MessagingException { Properties props = new Properties(); - - DummySSLSocketFactory socketFactory = new DummySSLSocketFactory(); - props.put("mail.imaps.ssl.socketFactory", socketFactory); + props.put("mail.imaps.ssl.trust", emailServerHost); + props.put("mail.imaps.ssl.checkserveridentity", "false"); Session session = Session.getInstance(props, null); Store store = session.getStore("imaps"); diff --git a/grader/src/it/java/edu/pdx/cs/joy/grader/poa/POASubmissionsDownloaderIT.java b/grader/src/it/java/edu/pdx/cs/joy/grader/poa/POASubmissionsDownloaderIT.java index 5e8d6f72d5..1ab5de13b0 100644 --- a/grader/src/it/java/edu/pdx/cs/joy/grader/poa/POASubmissionsDownloaderIT.java +++ b/grader/src/it/java/edu/pdx/cs/joy/grader/poa/POASubmissionsDownloaderIT.java @@ -23,6 +23,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalToIgnoringCase; import static org.mockito.Mockito.*; public class POASubmissionsDownloaderIT extends GreenmailIntegrationTestCase { @@ -88,7 +89,7 @@ private void assertEmailIsProperlyProcessed(String subject, String poa, String s POASubmission submission = captor.getValue(); assertThat(submission.getSubject(), equalTo(subject)); assertThat(submission.getContent(), equalTo(poa)); - assertThat(submission.getContentType(), equalTo(contentType)); + assertThat(submission.getContentType(), equalToIgnoringCase(contentType)); assertThat(submission.getSubmitter(), equalTo(sender)); ArgumentCaptor statusCaptor = ArgumentCaptor.forClass(StatusMessage.class); diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/GraderEmailAccount.java b/grader/src/main/java/edu/pdx/cs/joy/grader/GraderEmailAccount.java index 1614dca453..6bc25a756d 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/GraderEmailAccount.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/GraderEmailAccount.java @@ -1,13 +1,11 @@ package edu.pdx.cs.joy.grader; import com.google.common.annotations.VisibleForTesting; -import com.sun.mail.util.MailSSLSocketFactory; import jakarta.mail.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -280,9 +278,8 @@ private Store connectToIMAPServer() { Properties props = new Properties(); if (this.trustLocalhostSSL) { - MailSSLSocketFactory socketFactory= new MailSSLSocketFactory(); - socketFactory.setTrustedHosts("127.0.0.1", "localhost"); - props.put("mail.imaps.ssl.socketFactory", socketFactory); + props.put("mail.imaps.ssl.trust", "127.0.0.1 localhost"); + props.put("mail.imaps.ssl.checkserveridentity", "false"); } Session session = Session.getInstance(props, null); @@ -290,7 +287,7 @@ private Store connectToIMAPServer() { store.connect(this.emailServerHostName, this.emailServerPort, this.userName, this.password); return store; - } catch (MessagingException | GeneralSecurityException ex) { + } catch (MessagingException ex) { throw new IllegalStateException("While connecting to " + this.emailServerHostName + ":" + this.emailServerPort, ex); } } From e0542871bf5220ee4b2f5343524e93e99df06003 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 08:52:28 -0700 Subject: [PATCH 09/22] Use the Canvas API to fetch the responses to the end-of-the-term survey. --- .../edu/pdx/cs/joy/grader/GraderTools.java | 5 + .../canvas/ExportCanvasSurveyResponses.java | 378 ++++++++++++++++++ .../ExportCanvasSurveyResponsesTest.java | 130 ++++++ 3 files changed, 513 insertions(+) create mode 100644 grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java create mode 100644 grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/GraderTools.java b/grader/src/main/java/edu/pdx/cs/joy/grader/GraderTools.java index d34cb2ec34..cd220da462 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/GraderTools.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/GraderTools.java @@ -4,6 +4,7 @@ import ch.qos.logback.classic.Logger; import com.google.common.annotations.VisibleForTesting; import edu.pdx.cs.joy.grader.canvas.CompareCanvasAndWebsiteSchedules; +import edu.pdx.cs.joy.grader.canvas.ExportCanvasSurveyResponses; import edu.pdx.cs.joy.grader.canvas.GradesFromCanvasImporter; import edu.pdx.cs.joy.grader.gradebook.ui.GradeBookGUI; import edu.pdx.cs.joy.grader.poa.ui.PlanOfAttackGrader; @@ -87,6 +88,9 @@ private static Class getToolClass(String tool) { case "compareCanvasAndWebsiteSchedules": return CompareCanvasAndWebsiteSchedules.class; + case "exportCanvasSurveyResponses": + return ExportCanvasSurveyResponses.class; + default: usage("Unknown tool: " + tool); return null; @@ -123,6 +127,7 @@ private static void usage(String message) { err.println(" findUngradedSubmissions List submissions that need to be tested or graded"); err.println(" compareCanvasAndWebsiteSchedules"); err.println(" Compare assignment due dates in Canvas and the website schedule"); + err.println(" exportCanvasSurveyResponses Export End of Term Survey responses from a Canvas course"); err.println(" toolArg A command line argument to send to the tool"); err.println(); diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java new file mode 100644 index 0000000000..5f812dbf68 --- /dev/null +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -0,0 +1,378 @@ +package edu.pdx.cs.joy.grader.canvas; + +import com.google.common.annotations.VisibleForTesting; +import com.opencsv.CSVReader; +import com.opencsv.exceptions.CsvValidationException; +import jakarta.json.Json; +import jakarta.json.JsonArray; +import jakarta.json.JsonObject; +import jakarta.json.JsonReader; +import jakarta.json.JsonString; +import jakarta.json.JsonValue; + +import java.io.IOException; +import java.io.PrintStream; +import java.io.StringReader; +import java.io.Writer; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Exports the responses to the End of Term Survey from a Canvas Classic Quiz + * as anonymized HTML. + */ +public class ExportCanvasSurveyResponses { + static final URI DEFAULT_CANVAS_BASE_URI = URI.create("https://canvas.pdx.edu"); + static final String SURVEY_TITLE = "End of Term Survey"; + + private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^>]+)>;\\s*rel=\"next\""); + private static final Pattern QUESTION_COLUMN_PATTERN = Pattern.compile("^\\d+:\\s+(.+)$"); + private static final Duration REPORT_POLL_DELAY = Duration.ofSeconds(1); + + private final HttpClient httpClient; + private final URI canvasBaseUri; + + public ExportCanvasSurveyResponses() { + this(HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build(), DEFAULT_CANVAS_BASE_URI); + } + + @VisibleForTesting + ExportCanvasSurveyResponses(HttpClient httpClient, URI canvasBaseUri) { + this.httpClient = httpClient; + this.canvasBaseUri = canvasBaseUri; + } + + public static void main(String[] args) throws IOException, InterruptedException { + try { + new ExportCanvasSurveyResponses().run(args); + + } catch (IllegalArgumentException | IllegalStateException ex) { + usage(ex.getMessage()); + } + } + + @VisibleForTesting + void run(String[] args) throws IOException, InterruptedException { + if (args.length == 0) { + throw new IllegalArgumentException("Missing Canvas API token file name"); + } + if (args.length == 1) { + throw new IllegalArgumentException("Missing Canvas course ID"); + } + if (args.length == 2) { + throw new IllegalArgumentException("Missing HTML output file name"); + } + if (args.length > 3) { + throw new IllegalArgumentException("Extraneous command line argument: " + args[3]); + } + + String apiToken = readApiToken(Path.of(args[0])); + int courseId = parseCourseId(args[1]); + Path outputFile = Path.of(args[2]); + + export(apiToken, courseId, outputFile); + } + + @VisibleForTesting + void export(String apiToken, int courseId, Path outputFile) throws IOException, InterruptedException { + CanvasQuiz quiz = findClassicSurvey(apiToken, courseId); + String reportCsv = downloadStudentAnalysisReport(apiToken, courseId, quiz.id()); + Map> responses = parseSurveyResponses(reportCsv); + writeHtml(outputFile, responses); + } + + private CanvasQuiz findClassicSurvey(String apiToken, int courseId) throws IOException, InterruptedException { + List matches = new ArrayList<>(); + URI nextPage = this.canvasBaseUri.resolve("/api/v1/courses/" + courseId + "/quizzes?per_page=100"); + + while (nextPage != null) { + HttpResponse response = invokeCanvas(nextPage, apiToken, HttpRequest.BodyPublishers.noBody()); + for (CanvasQuiz quiz : parseQuizzes(response.body())) { + if (SURVEY_TITLE.equals(quiz.title())) { + matches.add(quiz); + } + } + nextPage = getNextPage(response.headers()); + } + + if (matches.isEmpty()) { + throw new IllegalStateException("Canvas course " + courseId + " has no quiz named \"" + SURVEY_TITLE + "\""); + } + if (matches.size() > 1) { + throw new IllegalStateException("Canvas course " + courseId + " has multiple quizzes named \"" + SURVEY_TITLE + "\""); + } + + CanvasQuiz survey = matches.get(0); + if (survey.quizType() == null) { + throw new IllegalStateException("\"" + SURVEY_TITLE + "\" is not a Classic Quiz"); + } + return survey; + } + + private String downloadStudentAnalysisReport(String apiToken, int courseId, int quizId) throws IOException, InterruptedException { + URI reportsUri = this.canvasBaseUri.resolve("/api/v1/courses/" + courseId + "/quizzes/" + quizId + "/reports"); + String body = """ + {"quiz_report":{"report_type":"student_analysis","includes_all_versions":true}} + """; + HttpResponse response = invokeCanvas(reportsUri, apiToken, HttpRequest.BodyPublishers.ofString(body)); + JsonObject report = parseObject(response.body()); + + JsonString progressUrl = report.getJsonString("progress_url"); + JsonString reportUrl = report.getJsonString("url"); + if (progressUrl == null || reportUrl == null) { + throw new IOException("Canvas did not return a report progress URL"); + } + + waitForReport(apiToken, URI.create(progressUrl.getString())); + JsonObject completedReport = getJsonObject(apiToken, URI.create(reportUrl.getString())); + JsonObject file = completedReport.getJsonObject("file"); + if (file == null || file.getJsonString("url") == null) { + throw new IOException("Canvas did not return a generated report file"); + } + + return downloadReportFile(apiToken, URI.create(file.getString("url"))); + } + + private String downloadReportFile(String apiToken, URI fileUrl) throws IOException, InterruptedException { + URI currentUrl = fileUrl; + boolean includeAuthorization = true; + + while (true) { + HttpResponse response = sendRequest(currentUrl, apiToken, HttpRequest.BodyPublishers.noBody(), includeAuthorization); + if (response.statusCode() >= 200 && response.statusCode() < 300) { + return response.body(); + } + if (response.statusCode() < 300 || response.statusCode() >= 400) { + throw new IOException("Canvas report download from " + currentUrl + " failed with status code " + response.statusCode()); + } + + String location = response.headers().firstValue("Location") + .orElseThrow(() -> new IOException("Canvas report download redirected without a Location header")); + currentUrl = currentUrl.resolve(location); + includeAuthorization = isCanvasUri(currentUrl); + } + } + + private void waitForReport(String apiToken, URI progressUrl) throws IOException, InterruptedException { + while (true) { + JsonObject progress = getJsonObject(apiToken, progressUrl); + String workflowState = progress.getString("workflow_state", ""); + if ("completed".equals(workflowState)) { + return; + } + if ("failed".equals(workflowState)) { + throw new IOException("Canvas failed to generate the student analysis report"); + } + + Thread.sleep(REPORT_POLL_DELAY); + } + } + + private JsonObject getJsonObject(String apiToken, URI uri) throws IOException, InterruptedException { + HttpResponse response = invokeCanvas(uri, apiToken, HttpRequest.BodyPublishers.noBody()); + return parseObject(response.body()); + } + + private HttpResponse invokeCanvas(URI uri, String apiToken, HttpRequest.BodyPublisher body) + throws IOException, InterruptedException { + if (!isCanvasUri(uri)) { + throw new IllegalArgumentException("Canvas API returned an unexpected URI: " + uri); + } + + HttpResponse response = sendRequest(uri, apiToken, body, true); + if (response.statusCode() < 200 || response.statusCode() >= 300) { + throw new IOException("Canvas request to " + uri + " failed with status code " + response.statusCode()); + } + return response; + } + + private HttpResponse sendRequest(URI uri, String apiToken, HttpRequest.BodyPublisher body, boolean includeAuthorization) + throws IOException, InterruptedException { + HttpRequest.Builder request = HttpRequest.newBuilder(uri) + .header("Accept", "application/json"); + if (includeAuthorization) { + request.header("Authorization", "Bearer " + apiToken); + } + if (body.contentLength() == 0) { + request.GET(); + } else { + request.header("Content-Type", "application/json").POST(body); + } + + HttpResponse response = this.httpClient.send(request.build(), HttpResponse.BodyHandlers.ofString()); + return response; + } + + private boolean isCanvasUri(URI uri) { + return this.canvasBaseUri.getScheme().equalsIgnoreCase(uri.getScheme()) + && this.canvasBaseUri.getHost().equalsIgnoreCase(uri.getHost()) + && this.canvasBaseUri.getPort() == uri.getPort(); + } + + @VisibleForTesting + static Map> parseSurveyResponses(String csv) throws IOException { + try (CSVReader reader = new CSVReader(new StringReader(csv))) { + String[] header = reader.readNext(); + if (header == null) { + throw new IOException("Canvas student analysis report is empty"); + } + + Map questionColumns = findQuestionColumns(header); + Map> responses = new LinkedHashMap<>(); + questionColumns.values().forEach(question -> responses.putIfAbsent(question, new ArrayList<>())); + + String[] row; + while ((row = reader.readNext()) != null) { + for (Map.Entry questionColumn : questionColumns.entrySet()) { + int column = questionColumn.getKey(); + if (column < row.length && !row[column].isBlank()) { + responses.get(questionColumn.getValue()).add(row[column]); + } + } + } + return responses; + + } catch (CsvValidationException ex) { + throw new IOException("While parsing the Canvas student analysis report", ex); + } + } + + private static Map findQuestionColumns(String[] header) { + Map questionColumns = new LinkedHashMap<>(); + for (int column = 0; column < header.length; column++) { + Matcher matcher = QUESTION_COLUMN_PATTERN.matcher(header[column]); + if (matcher.matches()) { + questionColumns.put(column, matcher.group(1)); + } + } + if (questionColumns.isEmpty()) { + throw new IllegalArgumentException("Canvas student analysis report has no question columns"); + } + return questionColumns; + } + + private static List parseQuizzes(String json) { + List quizzes = new ArrayList<>(); + try (JsonReader reader = Json.createReader(new StringReader(json))) { + JsonArray values = reader.readArray(); + for (JsonValue value : values) { + if (value.getValueType() != JsonValue.ValueType.OBJECT) { + continue; + } + JsonObject quiz = value.asJsonObject(); + JsonString title = quiz.getJsonString("title"); + if (title != null && quiz.containsKey("id")) { + quizzes.add(new CanvasQuiz(quiz.getInt("id"), title.getString(), quiz.getString("quiz_type", null))); + } + } + } + return quizzes; + } + + private static JsonObject parseObject(String json) { + try (JsonReader reader = Json.createReader(new StringReader(json))) { + return reader.readObject(); + } + } + + private URI getNextPage(HttpHeaders headers) { + for (String linkHeader : headers.allValues("Link")) { + Matcher matcher = NEXT_LINK_PATTERN.matcher(linkHeader); + if (matcher.find()) { + return URI.create(matcher.group(1)); + } + } + return null; + } + + private static String readApiToken(Path apiTokenFile) throws IOException { + if (!Files.exists(apiTokenFile)) { + throw new IllegalArgumentException("Canvas API token file \"" + apiTokenFile + "\" does not exist"); + } + + String apiToken = Files.readString(apiTokenFile).trim(); + if (apiToken.isEmpty()) { + throw new IllegalArgumentException("Canvas API token file \"" + apiTokenFile + "\" is empty"); + } + return apiToken; + } + + private static int parseCourseId(String courseIdText) { + try { + return Integer.parseInt(courseIdText); + } catch (NumberFormatException ex) { + throw new IllegalArgumentException("Canvas course ID \"" + courseIdText + "\" is not an integer"); + } + } + + private static void writeHtml(Path outputFile, Map> responses) throws IOException { + Path parent = outputFile.toAbsolutePath().getParent(); + if (parent != null && !Files.exists(parent)) { + throw new IllegalArgumentException("Parent directory \"" + parent + "\" does not exist"); + } + + try (Writer writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8)) { + writer.write("\n\n\n\n"); + writeEscapedHtml(writer, SURVEY_TITLE); + writer.write("\n\n\n

"); + writeEscapedHtml(writer, SURVEY_TITLE); + writer.write("

\n
    \n"); + + for (Map.Entry> question : responses.entrySet()) { + writer.write("
  1. "); + writeEscapedHtml(writer, question.getKey()); + writer.write("\n
      \n"); + for (String answer : question.getValue()) { + writer.write("
    • "); + writeEscapedHtml(writer, answer); + writer.write("
    • \n"); + } + writer.write("
    \n
  2. \n"); + } + writer.write("
\n\n\n"); + } + } + + private static void writeEscapedHtml(Writer writer, String text) throws IOException { + for (int i = 0; i < text.length(); i++) { + switch (text.charAt(i)) { + case '&' -> writer.write("&"); + case '<' -> writer.write("<"); + case '>' -> writer.write(">"); + case '"' -> writer.write("""); + case '\'' -> writer.write("'"); + default -> writer.write(text.charAt(i)); + } + } + } + + private static void usage(String message) { + PrintStream err = System.err; + err.println("+++ " + message); + err.println(); + err.println("usage: java ExportCanvasSurveyResponses apiTokenFileName courseId htmlFileName"); + err.println(" apiTokenFileName File containing the Canvas API token"); + err.println(" courseId Canvas ID of the course offering"); + err.println(" htmlFileName Output file for anonymized survey responses"); + err.println(); + err.println("Exports the \"" + SURVEY_TITLE + "\" Classic Quiz from Canvas as anonymized HTML"); + err.println(); + System.exit(1); + } + + private record CanvasQuiz(int id, String title, String quizType) { + } +} diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java new file mode 100644 index 0000000000..ef27dcf6af --- /dev/null +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -0,0 +1,130 @@ +package edu.pdx.cs.joy.grader.canvas; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpServer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.http.HttpClient; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ExportCanvasSurveyResponsesTest { + + @Test + void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir File tempDir) + throws IOException, InterruptedException { + List authorizationHeaders = new ArrayList<>(); + List redirectedAuthorizationHeaders = new ArrayList<>(); + HttpServer fileServer = HttpServer.create(new InetSocketAddress(0), 0); + URI fileServerUri = URI.create("http://localhost:" + fileServer.getAddress().getPort()); + fileServer.createContext("/files/student-analysis.csv", exchange -> { + try { + redirectedAuthorizationHeaders.add(exchange.getRequestHeaders().getFirst("Authorization")); + respond(exchange, 200, """ + name,id,section,section_id,submitted,attempt,100: What should future students know?,0.5,101: May we use your answer?,0.0,n correct,n incorrect,score + Student One,1,001,10,2026-08-10,1,Use & write tests,0.5,Yes,0.0,2,0,1 + Student Two,2,001,10,2026-08-10,1,,0.5,No,0.0,1,1,0.5 + """); + } finally { + exchange.close(); + } + }); + fileServer.start(); + + HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); + URI canvasBaseUri = URI.create("http://localhost:" + server.getAddress().getPort()); + server.createContext("/", exchange -> { + try { + authorizationHeaders.add(exchange.getRequestHeaders().getFirst("Authorization")); + respondToCanvasRequest(exchange, canvasBaseUri, fileServerUri); + } finally { + exchange.close(); + } + }); + server.start(); + + try { + File output = new File(tempDir, "survey.html"); + ExportCanvasSurveyResponses exporter = new ExportCanvasSurveyResponses(HttpClient.newHttpClient(), canvasBaseUri); + exporter.export("canvas-token", 42, output.toPath()); + + String html = Files.readString(output.toPath()); + assertThat(html, containsString("What should future students know?")); + assertThat(html, containsString("Use <generics> & write tests")); + assertThat(html, containsString("Yes")); + assertThat(html, not(containsString("Student One"))); + assertThat(html, not(containsString("student.one@example.com"))); + + assertEquals(6, authorizationHeaders.size()); + authorizationHeaders.forEach(header -> assertEquals("Bearer canvas-token", header)); + assertEquals(1, redirectedAuthorizationHeaders.size()); + assertEquals(null, redirectedAuthorizationHeaders.get(0)); + } finally { + server.stop(0); + fileServer.stop(0); + } + } + + private static void respondToCanvasRequest(HttpExchange exchange, URI canvasBaseUri, URI fileServerUri) throws IOException { + String path = exchange.getRequestURI().getPath(); + if (path.equals("/api/v1/courses/42/quizzes") && "page=2".equals(exchange.getRequestURI().getQuery())) { + respond(exchange, 200, """ + [{"id": 9, "title": "End of Term Survey", "quiz_type": "assignment"}] + """); + + } else if (path.equals("/api/v1/courses/42/quizzes")) { + exchange.getResponseHeaders().add("Link", + "<" + canvasBaseUri + "/api/v1/courses/42/quizzes?page=2>; rel=\"next\""); + respond(exchange, 200, """ + [{"id": 8, "title": "Other Quiz", "quiz_type": "assignment"}] + """); + + } else if (path.equals("/api/v1/courses/42/quizzes/9/reports") && "POST".equals(exchange.getRequestMethod())) { + String requestBody = new String(exchange.getRequestBody().readAllBytes(), StandardCharsets.UTF_8); + assertThat(requestBody, containsString("\"report_type\":\"student_analysis\"")); + assertThat(requestBody, containsString("\"includes_all_versions\":true")); + respond(exchange, 201, """ + { + "progress_url": "%s/progress/4", + "url": "%s/api/v1/courses/42/quizzes/9/reports/7" + } + """.formatted(canvasBaseUri, canvasBaseUri)); + + } else if (path.equals("/progress/4")) { + respond(exchange, 200, """ + {"workflow_state": "completed"} + """); + + } else if (path.equals("/api/v1/courses/42/quizzes/9/reports/7")) { + respond(exchange, 200, """ + {"file": {"url": "%s/files/student-analysis.csv"}} + """.formatted(canvasBaseUri)); + + } else if (path.equals("/files/student-analysis.csv")) { + exchange.getResponseHeaders().add("Location", fileServerUri + "/files/student-analysis.csv"); + exchange.sendResponseHeaders(302, -1); + + } else { + respond(exchange, 404, "{}"); + } + } + + private static void respond(HttpExchange exchange, int statusCode, String body) throws IOException { + byte[] bytes = body.getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().add("Content-Type", "application/json"); + exchange.sendResponseHeaders(statusCode, bytes.length); + exchange.getResponseBody().write(bytes); + } +} From d4692653d05c105618b88dd2f498c59836b6697f Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 08:59:44 -0700 Subject: [PATCH 10/22] Ignore the "Can I use your answers?" question. --- .../cs/joy/grader/canvas/ExportCanvasSurveyResponses.java | 4 +++- .../joy/grader/canvas/ExportCanvasSurveyResponsesTest.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index 5f812dbf68..cd910e5543 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -40,6 +40,8 @@ public class ExportCanvasSurveyResponses { private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^>]+)>;\\s*rel=\"next\""); private static final Pattern QUESTION_COLUMN_PATTERN = Pattern.compile("^\\d+:\\s+(.+)$"); + private static final String CONSENT_QUESTION = + "May I use your answers to these questions (not your name) todescribe this course in the future?"; private static final Duration REPORT_POLL_DELAY = Duration.ofSeconds(1); private final HttpClient httpClient; @@ -254,7 +256,7 @@ private static Map findQuestionColumns(String[] header) { Map questionColumns = new LinkedHashMap<>(); for (int column = 0; column < header.length; column++) { Matcher matcher = QUESTION_COLUMN_PATTERN.matcher(header[column]); - if (matcher.matches()) { + if (matcher.matches() && !CONSENT_QUESTION.equals(matcher.group(1))) { questionColumns.put(column, matcher.group(1)); } } diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java index ef27dcf6af..c31c080835 100644 --- a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -33,7 +33,7 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil try { redirectedAuthorizationHeaders.add(exchange.getRequestHeaders().getFirst("Authorization")); respond(exchange, 200, """ - name,id,section,section_id,submitted,attempt,100: What should future students know?,0.5,101: May we use your answer?,0.0,n correct,n incorrect,score + name,id,section,section_id,submitted,attempt,100: What should future students know?,0.5,101: May I use your answers to these questions (not your name) todescribe this course in the future?,0.0,n correct,n incorrect,score Student One,1,001,10,2026-08-10,1,Use & write tests,0.5,Yes,0.0,2,0,1 Student Two,2,001,10,2026-08-10,1,,0.5,No,0.0,1,1,0.5 """); @@ -63,7 +63,8 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil String html = Files.readString(output.toPath()); assertThat(html, containsString("What should future students know?")); assertThat(html, containsString("Use <generics> & write tests")); - assertThat(html, containsString("Yes")); + assertThat(html, not(containsString("May I use your answers to these questions"))); + assertThat(html, not(containsString("Yes"))); assertThat(html, not(containsString("Student One"))); assertThat(html, not(containsString("student.one@example.com"))); From 6fdb534fb3792d650fa5b556be9d990f245f2eab Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 18:38:44 -0700 Subject: [PATCH 11/22] If student hasn't consented to their answers being used, don't include them in the report. --- .../canvas/ExportCanvasSurveyResponses.java | 20 +++++++++++++++++++ .../ExportCanvasSurveyResponsesTest.java | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index cd910e5543..1d0489c69b 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -233,11 +233,16 @@ static Map> parseSurveyResponses(String csv) throws IOExcep } Map questionColumns = findQuestionColumns(header); + int consentColumn = findConsentColumn(header); Map> responses = new LinkedHashMap<>(); questionColumns.values().forEach(question -> responses.putIfAbsent(question, new ArrayList<>())); String[] row; while ((row = reader.readNext()) != null) { + if (!hasGivenConsent(row, consentColumn)) { + continue; + } + for (Map.Entry questionColumn : questionColumns.entrySet()) { int column = questionColumn.getKey(); if (column < row.length && !row[column].isBlank()) { @@ -266,6 +271,21 @@ private static Map findQuestionColumns(String[] header) { return questionColumns; } + private static int findConsentColumn(String[] header) { + for (int column = 0; column < header.length; column++) { + Matcher matcher = QUESTION_COLUMN_PATTERN.matcher(header[column]); + if (matcher.matches() && CONSENT_QUESTION.equals(matcher.group(1))) { + return column; + } + } + + throw new IllegalArgumentException("Canvas student analysis report has no consent question"); + } + + private static boolean hasGivenConsent(String[] row, int consentColumn) { + return consentColumn < row.length && "yes".equalsIgnoreCase(row[consentColumn].trim()); + } + private static List parseQuizzes(String json) { List quizzes = new ArrayList<>(); try (JsonReader reader = Json.createReader(new StringReader(json))) { diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java index c31c080835..c57cfc6f04 100644 --- a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -35,7 +35,7 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil respond(exchange, 200, """ name,id,section,section_id,submitted,attempt,100: What should future students know?,0.5,101: May I use your answers to these questions (not your name) todescribe this course in the future?,0.0,n correct,n incorrect,score Student One,1,001,10,2026-08-10,1,Use & write tests,0.5,Yes,0.0,2,0,1 - Student Two,2,001,10,2026-08-10,1,,0.5,No,0.0,1,1,0.5 + Student Two,2,001,10,2026-08-10,1,This answer must not be included,0.5,No,0.0,1,1,0.5 """); } finally { exchange.close(); @@ -63,6 +63,7 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil String html = Files.readString(output.toPath()); assertThat(html, containsString("What should future students know?")); assertThat(html, containsString("Use <generics> & write tests")); + assertThat(html, not(containsString("This answer must not be included"))); assertThat(html, not(containsString("May I use your answers to these questions"))); assertThat(html, not(containsString("Yes"))); assertThat(html, not(containsString("Student One"))); From aa37b2896f5dd855cebcb6d5ce673b2660cd1e86 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 18:44:28 -0700 Subject: [PATCH 12/22] Use the same XHTML format as the old "comments.html" files on the website. --- .../canvas/ExportCanvasSurveyResponses.java | 37 ++++++++++++++----- .../ExportCanvasSurveyResponsesTest.java | 4 ++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index 1d0489c69b..9d5a1d04c6 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -38,6 +38,10 @@ public class ExportCanvasSurveyResponses { static final URI DEFAULT_CANVAS_BASE_URI = URI.create("https://canvas.pdx.edu"); static final String SURVEY_TITLE = "End of Term Survey"; + private static final String PAGE_TITLE = "Previously on The Joy of Coding..."; + private static final String INTRODUCTION = "Here are some comments from students who have taken The Joy of Coding."; + private static final String XHTML_DOCTYPE = + ""; private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^>]+)>;\\s*rel=\"next\""); private static final Pattern QUESTION_COLUMN_PATTERN = Pattern.compile("^\\d+:\\s+(.+)$"); private static final String CONSENT_QUESTION = @@ -347,24 +351,37 @@ private static void writeHtml(Path outputFile, Map> respons } try (Writer writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8)) { - writer.write("\n\n\n\n"); - writeEscapedHtml(writer, SURVEY_TITLE); - writer.write("\n\n\n

"); - writeEscapedHtml(writer, SURVEY_TITLE); - writer.write("

\n
    \n"); + writer.write(XHTML_DOCTYPE + "\n"); + writer.write("\n"); + writer.write(" \n"); + writer.write(" "); + writeEscapedHtml(writer, PAGE_TITLE); + writer.write("\n"); + writer.write(" \n"); + writer.write(" \n"); + writer.write("

    "); + writeEscapedHtml(writer, PAGE_TITLE); + writer.write("

    \n"); + writer.write("

    "); + writeEscapedHtml(writer, INTRODUCTION); + writer.write("

    \n"); + writer.write("
      \n"); for (Map.Entry> question : responses.entrySet()) { - writer.write("
    1. "); + writer.write("
    2. "); writeEscapedHtml(writer, question.getKey()); - writer.write("\n
        \n"); + writer.write("\n"); + writer.write("
          \n"); for (String answer : question.getValue()) { - writer.write("
        • "); + writer.write("
        • "); writeEscapedHtml(writer, answer); writer.write("
        • \n"); } - writer.write("
        \n\n"); + writer.write("
      \n"); } - writer.write("
    \n\n\n"); + writer.write("
\n"); + writer.write(" \n"); + writer.write("\n"); } } diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java index c57cfc6f04..0a7840a6f3 100644 --- a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -61,6 +61,10 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil exporter.export("canvas-token", 42, output.toPath()); String html = Files.readString(output.toPath()); + assertThat(html, containsString("Previously on The Joy of Coding...")); + assertThat(html, containsString("

Previously on The Joy of Coding...

")); + assertThat(html, containsString("

Here are some comments from students who have taken The Joy of Coding.

")); assertThat(html, containsString("What should future students know?")); assertThat(html, containsString("Use <generics> & write tests")); assertThat(html, not(containsString("This answer must not be included"))); From 7754777c8acb916a3da09e768ddf0589c6a3b688 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 19:03:16 -0700 Subject: [PATCH 13/22] For the first question, display a table with the frequency of each of the multiple-choice answers. --- .../canvas/ExportCanvasSurveyResponses.java | 42 ++++++++++++++++--- .../ExportCanvasSurveyResponsesTest.java | 13 ++++-- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index 9d5a1d04c6..c4641c9d69 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -40,6 +40,9 @@ public class ExportCanvasSurveyResponses { private static final String PAGE_TITLE = "Previously on The Joy of Coding..."; private static final String INTRODUCTION = "Here are some comments from students who have taken The Joy of Coding."; + private static final String PREPARATION_QUESTION = "How well prepared were you for the work in this class?"; + private static final List PREPARATION_RESPONSES = + List.of("very good", "good", "fair", "poor", "very poor"); private static final String XHTML_DOCTYPE = ""; private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^>]+)>;\\s*rel=\"next\""); @@ -371,13 +374,19 @@ private static void writeHtml(Path outputFile, Map> respons writer.write("
  • "); writeEscapedHtml(writer, question.getKey()); writer.write("
  • \n"); - writer.write("
      \n"); - for (String answer : question.getValue()) { - writer.write("
    • "); - writeEscapedHtml(writer, answer); - writer.write("
    • \n"); + + if (PREPARATION_QUESTION.equals(question.getKey())) { + writeResponseCounts(writer, question.getValue()); + + } else { + writer.write("
        \n"); + for (String answer : question.getValue()) { + writer.write("
      • "); + writeEscapedHtml(writer, answer); + writer.write("
      • \n"); + } + writer.write("
      \n"); } - writer.write("
    \n"); } writer.write(" \n"); writer.write(" \n"); @@ -385,6 +394,27 @@ private static void writeHtml(Path outputFile, Map> respons } } + private static void writeResponseCounts(Writer writer, List responses) throws IOException { + Map counts = new LinkedHashMap<>(); + PREPARATION_RESPONSES.forEach(response -> counts.put(response, 0)); + for (String response : responses) { + if (counts.containsKey(response)) { + counts.merge(response, 1, Integer::sum); + } + } + + writer.write(" \n"); + writer.write(" \n"); + for (Map.Entry count : counts.entrySet()) { + writer.write(" \n"); + } + writer.write("
    ResponseStudents
    "); + writeEscapedHtml(writer, count.getKey()); + writer.write(""); + writer.write(String.valueOf(count.getValue())); + writer.write("
    \n"); + } + private static void writeEscapedHtml(Writer writer, String text) throws IOException { for (int i = 0; i < text.length(); i++) { switch (text.charAt(i)) { diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java index 0a7840a6f3..7a54cd41e4 100644 --- a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -33,9 +33,10 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil try { redirectedAuthorizationHeaders.add(exchange.getRequestHeaders().getFirst("Authorization")); respond(exchange, 200, """ - name,id,section,section_id,submitted,attempt,100: What should future students know?,0.5,101: May I use your answers to these questions (not your name) todescribe this course in the future?,0.0,n correct,n incorrect,score - Student One,1,001,10,2026-08-10,1,Use & write tests,0.5,Yes,0.0,2,0,1 - Student Two,2,001,10,2026-08-10,1,This answer must not be included,0.5,No,0.0,1,1,0.5 + name,id,section,section_id,submitted,attempt,100: How well prepared were you for the work in this class?,0.5,101: What should future students know?,0.5,102: May I use your answers to these questions (not your name) todescribe this course in the future?,0.0,n correct,n incorrect,score + Student One,1,001,10,2026-08-10,1,very good,0.5,Use & write tests,0.5,Yes,0.0,2,0,1 + Student Two,2,001,10,2026-08-10,1,good,0.5,Another useful response,0.5,Yes,0.0,2,0,1 + Student Three,3,001,10,2026-08-10,1,very good,0.5,This answer must not be included,0.5,No,0.0,1,1,0.5 """); } finally { exchange.close(); @@ -65,6 +66,12 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil assertThat(html, containsString("Previously on The Joy of Coding...")); assertThat(html, containsString("

    Previously on The Joy of Coding...

    ")); assertThat(html, containsString("

    Here are some comments from students who have taken The Joy of Coding.

    ")); + assertThat(html, containsString("ResponseStudents")); + assertThat(html, containsString("very good1")); + assertThat(html, containsString("good1")); + assertThat(html, containsString("fair0")); + assertThat(html, containsString("poor0")); + assertThat(html, containsString("very poor0")); assertThat(html, containsString("What should future students know?")); assertThat(html, containsString("Use <generics> & write tests")); assertThat(html, not(containsString("This answer must not be included"))); From 934e9fbd5b0f278f8b206b07668a287d431cfbb5 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 19:19:06 -0700 Subject: [PATCH 14/22] Generate the name of the HTML from the name of the term in which the course was offered. --- .../canvas/ExportCanvasSurveyResponses.java | 37 ++++++++++++++----- .../ExportCanvasSurveyResponsesTest.java | 14 ++++--- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index c4641c9d69..7d36248813 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -47,6 +47,7 @@ public class ExportCanvasSurveyResponses { ""; private static final Pattern NEXT_LINK_PATTERN = Pattern.compile("<([^>]+)>;\\s*rel=\"next\""); private static final Pattern QUESTION_COLUMN_PATTERN = Pattern.compile("^\\d+:\\s+(.+)$"); + private static final Pattern TERM_NAME_PATTERN = Pattern.compile("^(Winter|Spring|Summer|Fall) (\\d{4})$"); private static final String CONSENT_QUESTION = "May I use your answers to these questions (not your name) todescribe this course in the future?"; private static final Duration REPORT_POLL_DELAY = Duration.ofSeconds(1); @@ -81,28 +82,43 @@ void run(String[] args) throws IOException, InterruptedException { if (args.length == 1) { throw new IllegalArgumentException("Missing Canvas course ID"); } - if (args.length == 2) { - throw new IllegalArgumentException("Missing HTML output file name"); - } - if (args.length > 3) { - throw new IllegalArgumentException("Extraneous command line argument: " + args[3]); + if (args.length > 2) { + throw new IllegalArgumentException("Extraneous command line argument: " + args[2]); } String apiToken = readApiToken(Path.of(args[0])); int courseId = parseCourseId(args[1]); - Path outputFile = Path.of(args[2]); - export(apiToken, courseId, outputFile); + export(apiToken, courseId, Path.of(".")); } @VisibleForTesting - void export(String apiToken, int courseId, Path outputFile) throws IOException, InterruptedException { + void export(String apiToken, int courseId, Path outputDirectory) throws IOException, InterruptedException { + Path outputFile = outputDirectory.resolve(outputFileName(getCourseTermName(apiToken, courseId))); CanvasQuiz quiz = findClassicSurvey(apiToken, courseId); String reportCsv = downloadStudentAnalysisReport(apiToken, courseId, quiz.id()); Map> responses = parseSurveyResponses(reportCsv); writeHtml(outputFile, responses); } + private String getCourseTermName(String apiToken, int courseId) throws IOException, InterruptedException { + URI courseUri = this.canvasBaseUri.resolve("/api/v1/courses/" + courseId + "?include%5B%5D=term"); + JsonObject course = getJsonObject(apiToken, courseUri); + JsonObject term = course.getJsonObject("term"); + if (term == null || term.getJsonString("name") == null) { + throw new IOException("Canvas course " + courseId + " has no term name"); + } + return term.getString("name"); + } + + private static String outputFileName(String termName) { + Matcher matcher = TERM_NAME_PATTERN.matcher(termName); + if (!matcher.matches()) { + throw new IllegalArgumentException("Canvas course term \"" + termName + "\" is not a season and year"); + } + return "comments-" + matcher.group(1).toLowerCase() + matcher.group(2) + ".html"; + } + private CanvasQuiz findClassicSurvey(String apiToken, int courseId) throws IOException, InterruptedException { List matches = new ArrayList<>(); URI nextPage = this.canvasBaseUri.resolve("/api/v1/courses/" + courseId + "/quizzes?per_page=100"); @@ -432,10 +448,11 @@ private static void usage(String message) { PrintStream err = System.err; err.println("+++ " + message); err.println(); - err.println("usage: java ExportCanvasSurveyResponses apiTokenFileName courseId htmlFileName"); + err.println("usage: java ExportCanvasSurveyResponses apiTokenFileName courseId"); err.println(" apiTokenFileName File containing the Canvas API token"); err.println(" courseId Canvas ID of the course offering"); - err.println(" htmlFileName Output file for anonymized survey responses"); + err.println(""); + err.println("Writes comments-seasonyear.html for the course's Canvas term"); err.println(); err.println("Exports the \"" + SURVEY_TITLE + "\" Classic Quiz from Canvas as anonymized HTML"); err.println(); diff --git a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java index 7a54cd41e4..21e06072ad 100644 --- a/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java +++ b/grader/src/test/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponsesTest.java @@ -57,11 +57,10 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil server.start(); try { - File output = new File(tempDir, "survey.html"); ExportCanvasSurveyResponses exporter = new ExportCanvasSurveyResponses(HttpClient.newHttpClient(), canvasBaseUri); - exporter.export("canvas-token", 42, output.toPath()); + exporter.export("canvas-token", 42, tempDir.toPath()); - String html = Files.readString(output.toPath()); + String html = Files.readString(new File(tempDir, "comments-summer2026.html").toPath()); assertThat(html, containsString("Previously on The Joy of Coding...")); assertThat(html, containsString("

    Previously on The Joy of Coding...

    ")); @@ -80,7 +79,7 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil assertThat(html, not(containsString("Student One"))); assertThat(html, not(containsString("student.one@example.com"))); - assertEquals(6, authorizationHeaders.size()); + assertEquals(7, authorizationHeaders.size()); authorizationHeaders.forEach(header -> assertEquals("Bearer canvas-token", header)); assertEquals(1, redirectedAuthorizationHeaders.size()); assertEquals(null, redirectedAuthorizationHeaders.get(0)); @@ -92,7 +91,12 @@ void exportsAnonymizedResponsesFromClassicQuizStudentAnalysisReport(@TempDir Fil private static void respondToCanvasRequest(HttpExchange exchange, URI canvasBaseUri, URI fileServerUri) throws IOException { String path = exchange.getRequestURI().getPath(); - if (path.equals("/api/v1/courses/42/quizzes") && "page=2".equals(exchange.getRequestURI().getQuery())) { + if (path.equals("/api/v1/courses/42")) { + respond(exchange, 200, """ + {"term": {"name": "Summer 2026"}} + """); + + } else if (path.equals("/api/v1/courses/42/quizzes") && "page=2".equals(exchange.getRequestURI().getQuery())) { respond(exchange, 200, """ [{"id": 9, "title": "End of Term Survey", "quiz_type": "assignment"}] """); From 1f51db5c71b73755141e3d34259ddb3e45ad942d Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 16 Aug 2026 19:28:17 -0700 Subject: [PATCH 15/22] Added logging to provide an indication of what the program is doing. --- .../joy/grader/canvas/ExportCanvasSurveyResponses.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java index 7d36248813..44a2ce38b1 100644 --- a/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java +++ b/grader/src/main/java/edu/pdx/cs/joy/grader/canvas/ExportCanvasSurveyResponses.java @@ -9,6 +9,8 @@ import jakarta.json.JsonReader; import jakarta.json.JsonString; import jakarta.json.JsonValue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.PrintStream; @@ -38,6 +40,7 @@ public class ExportCanvasSurveyResponses { static final URI DEFAULT_CANVAS_BASE_URI = URI.create("https://canvas.pdx.edu"); static final String SURVEY_TITLE = "End of Term Survey"; + private static final Logger logger = LoggerFactory.getLogger("edu.pdx.cs.joy.grader"); private static final String PAGE_TITLE = "Previously on The Joy of Coding..."; private static final String INTRODUCTION = "Here are some comments from students who have taken The Joy of Coding."; private static final String PREPARATION_QUESTION = "How well prepared were you for the work in this class?"; @@ -94,10 +97,13 @@ void run(String[] args) throws IOException, InterruptedException { @VisibleForTesting void export(String apiToken, int courseId, Path outputDirectory) throws IOException, InterruptedException { + logger.info("Retrieving the Canvas term for course " + courseId); Path outputFile = outputDirectory.resolve(outputFileName(getCourseTermName(apiToken, courseId))); + logger.info("Finding the \"" + SURVEY_TITLE + "\" quiz"); CanvasQuiz quiz = findClassicSurvey(apiToken, courseId); String reportCsv = downloadStudentAnalysisReport(apiToken, courseId, quiz.id()); Map> responses = parseSurveyResponses(reportCsv); + logger.info("Writing anonymized survey responses to " + outputFile); writeHtml(outputFile, responses); } @@ -152,6 +158,7 @@ private String downloadStudentAnalysisReport(String apiToken, int courseId, int String body = """ {"quiz_report":{"report_type":"student_analysis","includes_all_versions":true}} """; + logger.info("Requesting the Canvas student analysis report"); HttpResponse response = invokeCanvas(reportsUri, apiToken, HttpRequest.BodyPublishers.ofString(body)); JsonObject report = parseObject(response.body()); @@ -161,6 +168,7 @@ private String downloadStudentAnalysisReport(String apiToken, int courseId, int throw new IOException("Canvas did not return a report progress URL"); } + logger.info("Waiting for Canvas to generate the student analysis report"); waitForReport(apiToken, URI.create(progressUrl.getString())); JsonObject completedReport = getJsonObject(apiToken, URI.create(reportUrl.getString())); JsonObject file = completedReport.getJsonObject("file"); @@ -168,6 +176,7 @@ private String downloadStudentAnalysisReport(String apiToken, int courseId, int throw new IOException("Canvas did not return a generated report file"); } + logger.info("Downloading the student analysis report"); return downloadReportFile(apiToken, URI.create(file.getString("url"))); } From 93d34ec4cee020ff045401cef85e02ffaea99bbb Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Fri, 23 Oct 2026 17:49:42 -0700 Subject: [PATCH 16/22] Increment grader artifact version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f814793935..29f7ba80ac 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 0.75 0 - 1.6.1-SNAPSHOT + 1.7.0-SNAPSHOT From 431fe03eabe1afe31d42ea8a3c8aa62b4480b0b4 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 24 Oct 2026 08:32:11 -0700 Subject: [PATCH 17/22] Added an example of using the HttpClient API to fetch the contents of a URL. --- .../edu/pdx/cs/joy/web/HttpClientGet.java | 80 +++++++++++++++++++ .../java/edu/pdx/cs/joy/web/UrlHttpGet.java | 2 +- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 examples/src/main/java/edu/pdx/cs/joy/web/HttpClientGet.java diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/HttpClientGet.java b/examples/src/main/java/edu/pdx/cs/joy/web/HttpClientGet.java new file mode 100644 index 0000000000..908c36a7d0 --- /dev/null +++ b/examples/src/main/java/edu/pdx/cs/joy/web/HttpClientGet.java @@ -0,0 +1,80 @@ +package edu.pdx.cs.joy.web; + +import java.io.IOException; +import java.io.PrintStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.List; +import java.util.Map; + +/** + * Demonstrates making an HTTP GET request using the {@link java.net.http.HttpClient} class + * + * @author David Whitlock + * @since Winter 2027 + */ +public class HttpClientGet { + + /** + * Fetches the content of a URL using the {@link java.net.http.HttpClient} + * + * @param urlString The URL to GET + * @throws java.io.IOException If a problem occurs while reading URL + */ + private static void getURL(String urlString) throws IOException, InterruptedException { + PrintStream out = System.out; + out.println("Headers"); + + try (HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build()) { + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(urlString)) + .build(); + HttpResponse response = client.send(request, BodyHandlers.ofString()); + Map> headers = response.headers().map(); + for (String key : headers.keySet()) { + out.print(" "); + if (key != null) { + out.print(key + ": "); + } + for (String value : headers.get(key)) { + out.print(value); + } + out.println(); + } + + out.println("\nContent"); + out.flush(); + + out.println(response.body()); + } + } + + public static void main(String[] args) throws IOException, InterruptedException { + String url = null; + + for (String arg : args) { + if (url == null) { + url = arg; + + } else { + usage("Extraneous command line argument: " + arg); + } + } + + if (url == null) { + usage("Missing URL"); + } + + getURL(url); + } + + private static void usage(String message) { + PrintStream err = System.err; + err.println("** " + message); + err.println("usage: java HttpClientGet url"); + System.exit(1); + } +} diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/UrlHttpGet.java b/examples/src/main/java/edu/pdx/cs/joy/web/UrlHttpGet.java index 65a37d46d3..65b5f719ed 100644 --- a/examples/src/main/java/edu/pdx/cs/joy/web/UrlHttpGet.java +++ b/examples/src/main/java/edu/pdx/cs/joy/web/UrlHttpGet.java @@ -38,7 +38,7 @@ private static void getURL(String urlString) throws IOException { for (String value : headers.get(key)) { out.print(value); } - out.println("\n"); + out.println(); } out.println("\nContent"); From 837d48c6d0f53715139d25438c33621d797a8ffb Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 24 Oct 2026 08:40:22 -0700 Subject: [PATCH 18/22] Use HttpClient in the HttpRequestHelper instead of the old URLConnection. --- .../edu/pdx/cs/joy/web/HttpRequestHelper.java | 109 ++++++++---------- 1 file changed, 50 insertions(+), 59 deletions(-) diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java index 09fdcfedf1..88c50ae6d0 100644 --- a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java +++ b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java @@ -4,8 +4,11 @@ import java.io.*; import java.net.HttpURLConnection; -import java.net.URL; +import java.net.URI; import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Iterator; @@ -16,6 +19,10 @@ */ public class HttpRequestHelper { + private static final HttpClient CLIENT = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.NORMAL) + .build(); + private final String urlString; public HttpRequestHelper(String urlString) { @@ -30,18 +37,14 @@ public HttpRequestHelper(String urlString) { */ public Response get(Map parameters) throws IOException { StringBuilder query = encodeParameters(parameters); - if (query.length() > 0) { + if (!query.isEmpty()) { query.insert(0, '?'); } - URL url = new URL(urlString + query); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("GET"); - conn.setDoOutput(true); - conn.setDoInput(true); - - return new Response(conn); - + HttpRequest request = HttpRequest.newBuilder(URI.create(urlString + query)) + .GET() + .build(); + return send(request); } /** @@ -51,7 +54,7 @@ public Response get(Map parameters) throws IOException { * @return A Response summarizing the result of the POST */ public Response post(Map parameters) throws IOException { - return sendEncodedRequest(urlString, "POST", parameters); + return sendEncodedRequest("POST", parameters); } /** @@ -61,25 +64,28 @@ public Response post(Map parameters) throws IOException { * @return A Response summarizing the result of the POST */ public Response delete(Map parameters) throws IOException { - return sendEncodedRequest(urlString, "DELETE", parameters); + return sendEncodedRequest("DELETE", parameters); } - private Response sendEncodedRequest(String urlString, String requestMethod, Map parameters) throws IOException { - StringBuilder data = encodeParameters(parameters); + private Response sendEncodedRequest(String requestMethod, Map parameters) throws IOException { + String data = encodeParameters(parameters).toString(); - URL url = new URL(urlString); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod(requestMethod); - conn.setDoOutput(true); - - OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8); - wr.write(data.toString()); - wr.flush(); + HttpRequest request = HttpRequest.newBuilder(URI.create(urlString)) + .header("Content-Type", "application/x-www-form-urlencoded") + .method(requestMethod, HttpRequest.BodyPublishers.ofString(data, StandardCharsets.UTF_8)) + .build(); + return send(request); + } - Response response = new Response(conn); - wr.close(); + private Response send(HttpRequest request) throws IOException { + try { + HttpResponse response = CLIENT.send(request, HttpResponse.BodyHandlers.ofString()); + return new Response(response); - return response; + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new IOException("Interrupted while sending HTTP request", e); + } } /** @@ -118,22 +124,11 @@ public Response put(Map parameters) throws IOException { data.append("\n"); }); - URL url = new URL(urlString); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("PUT"); - conn.setDoOutput(true); - conn.setDoInput(true); - conn.setRequestProperty("Content-Type", "text/plain"); - conn.setRequestProperty("Context-Length", String.valueOf(data.length())); - - OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8); - wr.write(data.toString()); - wr.flush(); - - Response response = new Response(conn); - wr.close(); - - return response; + HttpRequest request = HttpRequest.newBuilder(URI.create(urlString)) + .header("Content-Type", "text/plain") + .PUT(HttpRequest.BodyPublishers.ofString(data.toString(), StandardCharsets.UTF_8)) + .build(); + return send(request); } /** @@ -147,26 +142,22 @@ public static class Response { private int contentLines = 0; - private Response(HttpURLConnection conn) throws IOException { - this.httpStatusCode = conn.getResponseCode(); - InputStream stream; - if (this.httpStatusCode != java.net.HttpURLConnection.HTTP_OK) { - stream = conn.getErrorStream(); - - } else { - stream = conn.getInputStream(); - } + private Response(HttpResponse response) { + this.httpStatusCode = response.statusCode(); StringBuilder content = new StringBuilder(); - if (stream != null) { - BufferedReader rd = new BufferedReader(new InputStreamReader(stream)); - String line; - while ((line = rd.readLine()) != null) { - content.append(line); - content.append("\n"); - contentLines++; + String body = response.body(); + if (body != null) { + try (BufferedReader rd = new BufferedReader(new StringReader(body))) { + String line; + while ((line = rd.readLine()) != null) { + content.append(line); + content.append("\n"); + contentLines++; + } + } catch (IOException e) { + throw new UncheckedIOException(e); } - rd.close(); } this.content = content.toString().trim(); @@ -180,7 +171,7 @@ public Response(String content) { /** * Returns the HTTP status code of the response - * @see java.net.HttpURLConnection#getResponseCode() + * @see java.net.http.HttpResponse#statusCode() */ public int getHttpStatusCode() { return httpStatusCode; From 3403423b46927e599d03070b25a21aa4ccde1073 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 24 Oct 2026 09:02:03 -0700 Subject: [PATCH 19/22] Increment the version of the "examples" artifact. --- examples/pom.xml | 2 +- family/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 2 +- projects-parent/originals-parent/airline-web/pom.xml | 2 +- projects-parent/originals-parent/apptbook-web/pom.xml | 2 +- projects-parent/originals-parent/phonebill-web/pom.xml | 2 +- projects-parent/originals-parent/phonebill/pom.xml | 2 +- projects-parent/originals-parent/student/pom.xml | 2 +- web/pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index 29990daedf..ae20dfab03 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -8,7 +8,7 @@ 4.0.0 examples examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT https://www.cs.pdx.edu/~whitlock diff --git a/family/pom.xml b/family/pom.xml index cec52e5c2c..f313dda9bf 100644 --- a/family/pom.xml +++ b/family/pom.xml @@ -21,7 +21,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT com.h2database diff --git a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml index 6f4d4c3cec..8516a0d052 100644 --- a/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/airline-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -26,7 +26,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml index 02cdd6f6e4..1f2be235c7 100644 --- a/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/apptbook-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -26,7 +26,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml index 159deb35da..b7bed86431 100644 --- a/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-archetype/src/main/resources/archetype-resources/pom.xml @@ -48,7 +48,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml index ca1e850bf8..347714da1a 100644 --- a/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/phonebill-web-archetype/src/main/resources/archetype-resources/pom.xml @@ -27,7 +27,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml index 80af68124d..76483be9ce 100644 --- a/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml +++ b/projects-parent/archetypes-parent/student-archetype/src/main/resources/archetype-resources/pom.xml @@ -102,7 +102,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/originals-parent/airline-web/pom.xml b/projects-parent/originals-parent/airline-web/pom.xml index 5fbcf107f2..daf9ffc658 100644 --- a/projects-parent/originals-parent/airline-web/pom.xml +++ b/projects-parent/originals-parent/airline-web/pom.xml @@ -26,7 +26,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/originals-parent/apptbook-web/pom.xml b/projects-parent/originals-parent/apptbook-web/pom.xml index dc2f18c8ff..00077685a5 100644 --- a/projects-parent/originals-parent/apptbook-web/pom.xml +++ b/projects-parent/originals-parent/apptbook-web/pom.xml @@ -26,7 +26,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/originals-parent/phonebill-web/pom.xml b/projects-parent/originals-parent/phonebill-web/pom.xml index 7d04b11145..c8f6fd02bb 100644 --- a/projects-parent/originals-parent/phonebill-web/pom.xml +++ b/projects-parent/originals-parent/phonebill-web/pom.xml @@ -27,7 +27,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/originals-parent/phonebill/pom.xml b/projects-parent/originals-parent/phonebill/pom.xml index b82827d215..01a17cc37b 100644 --- a/projects-parent/originals-parent/phonebill/pom.xml +++ b/projects-parent/originals-parent/phonebill/pom.xml @@ -48,7 +48,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/projects-parent/originals-parent/student/pom.xml b/projects-parent/originals-parent/student/pom.xml index 28b9c87ecc..438ff81a05 100644 --- a/projects-parent/originals-parent/student/pom.xml +++ b/projects-parent/originals-parent/student/pom.xml @@ -88,7 +88,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy diff --git a/web/pom.xml b/web/pom.xml index 2ff7363684..ed75560a51 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -117,7 +117,7 @@ io.github.davidwhitlock.joy examples - 1.4.2-SNAPSHOT + 1.5.0-SNAPSHOT io.github.davidwhitlock.joy From 8d1a9012f7ec1997b94fd70279dca74bd85af35f Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 24 Oct 2026 09:10:54 -0700 Subject: [PATCH 20/22] Make some improvements to the HttpRequestHelper code. --- .../edu/pdx/cs/joy/web/HttpRequestHelper.java | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java index 88c50ae6d0..05915ece5a 100644 --- a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java +++ b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java @@ -11,11 +11,12 @@ import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; +import java.util.stream.Collectors; /** - * A helper class that provides methods for requesting resources via HTTP + * A helper class that provides methods for requesting resources via HTTP. It handles parameter encoding + * and the specifics of the {@link HttpClient} API. */ public class HttpRequestHelper { @@ -36,9 +37,9 @@ public HttpRequestHelper(String urlString) { * @return A Response summarizing the result of the GET */ public Response get(Map parameters) throws IOException { - StringBuilder query = encodeParameters(parameters); + String query = encodeParameters(parameters); if (!query.isEmpty()) { - query.insert(0, '?'); + query = "?" + query; } HttpRequest request = HttpRequest.newBuilder(URI.create(urlString + query)) @@ -68,7 +69,7 @@ public Response delete(Map parameters) throws IOException { } private Response sendEncodedRequest(String requestMethod, Map parameters) throws IOException { - String data = encodeParameters(parameters).toString(); + String data = encodeParameters(parameters); HttpRequest request = HttpRequest.newBuilder(URI.create(urlString)) .header("Content-Type", "application/x-www-form-urlencoded") @@ -93,20 +94,11 @@ private Response send(HttpRequest request) throws IOException { * @param parameters The parameter key/value pairs * @return The encoded parameters */ - private StringBuilder encodeParameters(Map parameters) { - StringBuilder query = new StringBuilder(); - for (Iterator> iter = parameters.entrySet().iterator(); iter.hasNext(); ) { - Map.Entry pair = iter.next(); - String key = pair.getKey(); - String value = pair.getValue(); - query.append(URLEncoder.encode(key, StandardCharsets.UTF_8)); - query.append("="); - query.append(URLEncoder.encode(value, StandardCharsets.UTF_8)); - if (iter.hasNext()) { - query.append("&"); - } - } - return query; + private String encodeParameters(Map parameters) { + return parameters.entrySet().stream() + .map(pair -> URLEncoder.encode(pair.getKey(), StandardCharsets.UTF_8) + "=" + + URLEncoder.encode(pair.getValue(), StandardCharsets.UTF_8)) + .collect(Collectors.joining("&")); } /** From 6b6f6f18fb57640be21993864e122db404909958 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sat, 24 Oct 2026 09:18:45 -0700 Subject: [PATCH 21/22] Remove the getContentLines() method from HttpRequestHelper because it made the implementation of the class more complicated than it needed to be. --- .../edu/pdx/cs/joy/web/HttpRequestHelper.java | 31 +++---------------- .../joy/servlets/MovieDatabaseServletIT.java | 12 ++++--- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java index 05915ece5a..3c62e044a6 100644 --- a/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java +++ b/examples/src/main/java/edu/pdx/cs/joy/web/HttpRequestHelper.java @@ -132,27 +132,11 @@ public static class Response { private final String content; - private int contentLines = 0; - private Response(HttpResponse response) { this.httpStatusCode = response.statusCode(); - StringBuilder content = new StringBuilder(); String body = response.body(); - if (body != null) { - try (BufferedReader rd = new BufferedReader(new StringReader(body))) { - String line; - while ((line = rd.readLine()) != null) { - content.append(line); - content.append("\n"); - contentLines++; - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - this.content = content.toString().trim(); + this.content = body == null ? "" : body.trim(); } @VisibleForTesting @@ -176,15 +160,8 @@ public String getContent() { return content; } - /** - * Returns the number of lines in the response's content - */ - public int getContentLines() { - return contentLines; - } } - private static Map arrayToMap(String[] parameters) { Map params = new HashMap<>(); for (int i = 0; i < parameters.length; i++) { @@ -223,10 +200,10 @@ public static void main(String[] args) throws IOException { return; } + String content = response.getContent(); System.out.println("Returned code " + response.getHttpStatusCode() + " and " + - response.getContentLines() + " lines of content\n"); - System.out.println(response.getContent()); - + content.lines().count() + " lines of content\n"); + System.out.println(content); } public static class RestException extends RuntimeException { diff --git a/web/src/it/java/edu/pdx/cs/joy/servlets/MovieDatabaseServletIT.java b/web/src/it/java/edu/pdx/cs/joy/servlets/MovieDatabaseServletIT.java index e4fc175200..87a2210d5c 100644 --- a/web/src/it/java/edu/pdx/cs/joy/servlets/MovieDatabaseServletIT.java +++ b/web/src/it/java/edu/pdx/cs/joy/servlets/MovieDatabaseServletIT.java @@ -63,7 +63,7 @@ public void testGetAllMovies() throws IOException { String content = response.getContent(); assertTrue(content.contains(title1), content); assertTrue(content.contains(title2), content); - int lines = response.getContentLines(); + int lines = countLines(response.getContent()); assertTrue(lines > 1, () -> "Expected more than 1 line, only got " + lines + "\n" + "In content: " + content); } @@ -77,7 +77,7 @@ public void testGetOneMovie() throws IOException { assertNotNull(response); assertTrue(response.getContent().contains(title), response.getContent()); assertTrue(response.getContent().contains(year), response.getContent()); - assertEquals(1, response.getContentLines()); + assertEquals(1, countLines(response.getContent())); } @Test @@ -151,12 +151,12 @@ public void testUpdateMovie() throws IOException { HttpRequestHelper.Response response = http().put(Map.of("id", String.valueOf(id), "title", newTitle, "year", newYear)); assertEquals(HTTP_OK, response.getHttpStatusCode(), response.getContent()); - assertEquals(1, response.getContentLines()); + assertEquals(1, countLines(response.getContent())); assertEquals(String.valueOf(id), response.getContent()); response = http().get(Map.of("id", String.valueOf(id))); assertEquals(HTTP_OK, response.getHttpStatusCode()); - assertEquals(1, response.getContentLines()); + assertEquals(1, countLines(response.getContent())); assertTrue(response.getContent().contains(newTitle)); assertTrue(response.getContent().contains(newYear)); } @@ -172,4 +172,8 @@ public void canDeleteMovieFromServer() throws IOException { assertThat(response.getContent(), response.getHttpStatusCode(), equalTo(HTTP_NOT_FOUND)); } + + private static int countLines(String content) { + return (int) content.lines().count(); + } } From a9a72dad75734af9ecfdab0f0be8c9dc1c80fb35 Mon Sep 17 00:00:00 2001 From: David Whitlock Date: Sun, 1 Nov 2026 06:34:35 -0800 Subject: [PATCH 22/22] Improvements to web examples including asynchronously downloading a file using the HttpClient API. --- .../joy/web/DownloadFileAsynchronously.java | 58 +++++++++++++++++++ .../java/edu/pdx/cs/joy/web/RawHttpGet.java | 5 +- .../pdx/cs/joy/servlets/SessionServlet.java | 40 +++++++++---- 3 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 examples/src/main/java/edu/pdx/cs/joy/web/DownloadFileAsynchronously.java diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/DownloadFileAsynchronously.java b/examples/src/main/java/edu/pdx/cs/joy/web/DownloadFileAsynchronously.java new file mode 100644 index 0000000000..9c4453b86c --- /dev/null +++ b/examples/src/main/java/edu/pdx/cs/joy/web/DownloadFileAsynchronously.java @@ -0,0 +1,58 @@ +package edu.pdx.cs.joy.web; + +import java.io.PrintStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.file.Path; +import java.util.concurrent.CompletableFuture; + +public class DownloadFileAsynchronously { + + private static void getURL(String url, Path path) { + try (HttpClient client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build()) { + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(url)) + .build(); + CompletableFuture> download = + client.sendAsync(request, HttpResponse.BodyHandlers.ofFile(path)); + download.thenApply(HttpResponse::body); + + download.join(); + } + } + + public static void main(String[] args) { + String url = null; + String fileName = null; + + for (String arg : args) { + if (url == null) { + url = arg; + + } else if (fileName == null) { + fileName = arg; + + } else { + usage("Extraneous command line argument: " + arg); + } + } + + if (url == null) { + usage("Missing URL"); + + } else if (fileName == null) { + usage("Missing file name"); + } + + getURL(url, Path.of(fileName)); + } + + private static void usage(String message) { + PrintStream err = System.err; + err.println("** " + message); + err.println("usage: java DownloadFileAsynchronously url file"); + System.exit(1); + } +} diff --git a/examples/src/main/java/edu/pdx/cs/joy/web/RawHttpGet.java b/examples/src/main/java/edu/pdx/cs/joy/web/RawHttpGet.java index d770523d34..047b9c2005 100644 --- a/examples/src/main/java/edu/pdx/cs/joy/web/RawHttpGet.java +++ b/examples/src/main/java/edu/pdx/cs/joy/web/RawHttpGet.java @@ -48,9 +48,10 @@ public static void main(String[] args) throws IOException { String file = null; int port = 80; - for (String arg : args) { + for (int i = 0; i < args.length; i++) { + String arg = args[i]; if (arg.equals("-port")) { - port = Integer.parseInt(arg); + port = Integer.parseInt(args[++i]); } else if (host == null) { host = arg; diff --git a/web/src/main/java/edu/pdx/cs/joy/servlets/SessionServlet.java b/web/src/main/java/edu/pdx/cs/joy/servlets/SessionServlet.java index cf5777ef72..6b1bdbd277 100644 --- a/web/src/main/java/edu/pdx/cs/joy/servlets/SessionServlet.java +++ b/web/src/main/java/edu/pdx/cs/joy/servlets/SessionServlet.java @@ -4,8 +4,7 @@ import jakarta.servlet.ServletException; import java.io.IOException; import java.io.PrintWriter; -import java.util.Date; -import java.util.Enumeration; +import java.util.*; /** * A servlet that uses a session to maintain information about a user @@ -83,16 +82,37 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) private void dumpCoookies(Cookie[] cookies, PrintWriter out) { out.println("

    Your cookies:

    "); + out.println(""); + dumpCookiesTableHeader(out); + out.println(""); + Arrays.sort(cookies, Comparator.comparing(Cookie::getName)); for (Cookie cookie : cookies) { - dumpKeyValue("Name", cookie.getName(), out); - dumpKeyValue("Domain", cookie.getDomain(), out); - dumpKeyValue("Path", cookie.getPath(), out); - dumpKeyValue("Value", cookie.getValue(), out); - dumpKeyValue("Comment", cookie.getComment(), out); - dumpKeyValue("Version", cookie.getVersion(), out); - dumpKeyValue("Max Age", cookie.getMaxAge(), out); - dumpKeyValue("Secure", cookie.getSecure(), out); + out.println(""); + dumpTableCell(cookie.getName(), out); + dumpTableCell(cookie.getValue(), out); + dumpTableCell(cookie.getDomain(), out); + dumpTableCell(cookie.getPath(), out); + dumpTableCell(cookie.getMaxAge(), out); + dumpTableCell(cookie.getSecure(), out); + out.println(""); } + out.println(""); + out.println("
    "); + } + + private void dumpTableCell(Object value, PrintWriter out) { + out.println(""); + } + + private void dumpCookiesTableHeader(PrintWriter out) { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); + out.println(""); } private void dumpSession(HttpSession session, PrintWriter out) {
    " + value + "
    NameValueDomainPathMax AgeSecure