Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c884ba3
Remove cs410J files that might end up in the project archetypes.
DavidWhitlock Aug 15, 2026
078bcce
Add beginnings of a copilot-instructions.md file.
DavidWhitlock Aug 15, 2026
8be2b9e
SNAPSHOT versions for Winter 2027.
DavidWhitlock Aug 15, 2026
6d159f5
Remove cs410J files that might end up in the project archetypes.
DavidWhitlock Aug 15, 2026
c579ee9
Add beginnings of a copilot-instructions.md file.
DavidWhitlock Aug 15, 2026
a2bd255
SNAPSHOT versions for Winter 2027.
DavidWhitlock Aug 15, 2026
100f5fc
Attempt to update to Greenmail 2.1.1. It's not working yet because t…
DavidWhitlock Nov 28, 2024
6b30f6c
GreenMail now uses Angus Mail, so the legacy com.sun.mail SSL socket …
DavidWhitlock Aug 15, 2026
adfdac8
Merge branch 'main' into Winter2027-SNAPSHOT
DavidWhitlock Aug 15, 2026
e3024e9
Merge remote-tracking branch 'origin/Winter2027-SNAPSHOT' into Winter…
DavidWhitlock Aug 15, 2026
e054287
Use the Canvas API to fetch the responses to the end-of-the-term survey.
DavidWhitlock Aug 16, 2026
d469265
Ignore the "Can I use your answers?" question.
DavidWhitlock Aug 16, 2026
6fdb534
If student hasn't consented to their answers being used, don't includ…
DavidWhitlock Aug 17, 2026
aa37b28
Use the same XHTML format as the old "comments.html" files on the web…
DavidWhitlock Aug 17, 2026
7754777
For the first question, display a table with the frequency of each of…
DavidWhitlock Aug 17, 2026
934e9fb
Generate the name of the HTML from the name of the term in which the …
DavidWhitlock Aug 17, 2026
1f51db5
Added logging to provide an indication of what the program is doing.
DavidWhitlock Aug 17, 2026
ae190f4
Merge branch 'Winter2027-SNAPSHOT' into issue-490/upgrade-greenmail-t…
DavidWhitlock Aug 23, 2026
6cad9c4
Merge pull request #552 from JoyOfCodingPDX/issue-490/upgrade-greenma…
DavidWhitlock Aug 23, 2026
93d34ec
Increment grader artifact version.
DavidWhitlock Oct 24, 2026
42f8a7b
Merge pull request #554 from JoyOfCodingPDX/issue-547/extract-end-of-…
DavidWhitlock Oct 24, 2026
431fe03
Added an example of using the HttpClient API to fetch the contents of…
DavidWhitlock Oct 24, 2026
837d48c
Use HttpClient in the HttpRequestHelper instead of the old URLConnect…
DavidWhitlock Oct 24, 2026
3403423
Increment the version of the "examples" artifact.
DavidWhitlock Oct 24, 2026
8d1a901
Make some improvements to the HttpRequestHelper code.
DavidWhitlock Oct 24, 2026
6b6f6f1
Remove the getContentLines() method from HttpRequestHelper because it…
DavidWhitlock Oct 24, 2026
34707b6
Merge pull request #556 from JoyOfCodingPDX/issue-553/java-11-http-cl…
DavidWhitlock Oct 26, 2026
a9a72da
Improvements to web examples including asynchronously downloading a f…
DavidWhitlock Nov 1, 2026
ceee04f
Tests for persisting AI usage information in Student XML files.
DavidWhitlock Nov 1, 2026
e25afde
Persist AI usage in Student XML.
DavidWhitlock Nov 1, 2026
d79999a
Tests to validate that AI usage information is passed through the sub…
DavidWhitlock Nov 1, 2026
201d54f
Pass AI usage information through the submit process.
DavidWhitlock Nov 1, 2026
b1179bd
Ask the submitter to provide information about how they used AI in th…
DavidWhitlock Nov 1, 2026
9e3b99d
Update version of grader artifact.
DavidWhitlock Nov 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -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 <module> -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/<project> 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.
8 changes: 4 additions & 4 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<parent>
<artifactId>joy</artifactId>
<groupId>io.github.davidwhitlock.joy</groupId>
<version>1.3.0</version>
<version>1.3.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>examples</artifactId>
<name>examples</name>
<version>1.4.1</version>
<version>1.5.0-SNAPSHOT</version>
<url>https://www.cs.pdx.edu/~whitlock</url>
<dependencies>
<dependency>
<groupId>io.github.davidwhitlock.joy</groupId>
<artifactId>projects</artifactId>
<version>3.0.5</version>
<version>3.0.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
Expand Down Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>io.github.davidwhitlock.joy</groupId>
<artifactId>projects</artifactId>
<version>3.0.5</version>
<version>3.0.6-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<HttpResponse<Path>> 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);
}
}
80 changes: 80 additions & 0 deletions examples/src/main/java/edu/pdx/cs/joy/web/HttpClientGet.java
Original file line number Diff line number Diff line change
@@ -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<String> response = client.send(request, BodyHandlers.ofString());
Map<String, List<String>> 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);
}
}
Loading
Loading