Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC510 Lecture 25

CSC510 Lecture 25

Checkpoint
(20261019)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

November 05, 2026

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. PR

  2. coordinate-normalizer robot-reachability catch (Exception exception) { System.out.println( "CoordinateNormalizerLambda failure: "

    + exception.getMessage()); exception.printStackTrace(System.out); return httpResponse(500, "{\"error\":\"Operation failed\"}"); } catch (Exception exception) { return httpResponse(400, "{\"error\":\"Operation failed\"}"); }
  3. Agenda Week 12 Week 13 Week 14 Week 15 Exams

    Week December 09 Fin l Review a a a a December 11 Fin l Ex m ? December 18 Fin l Project ?
  4. Lab 07 1. Structured logging + JUnit JSON verification. 2.

    CloudWatch observation and application-error discussion. 3–4. Interface + constructor injection + in-memory fake. 5. Controlled failing fake + partial-failure analysis. 6. Bounded retries + recovery/exhaustion tests + idempotency discussion. 7. Full regression test results and GitHub PR evidence. No new AWS resources; no live failure injection; submit code through a PR.
  5. (

  6. )

  7. JUnit: recovery, exhaustion, and immediate stop Recovery Retry exhaustion Non-retryable

    Fake fails twice Retryable failure every time Fake throws non-retryable error Third attempt succeeds Propagate exception Propagate immediately assert attempts == 3 assert attempts == 3 assert attempts == 1 Inject a no-op delay so JUnit tests remain fast and deterministic.
  8. JUnit: recovery, exhaustion, and immediate stop Recovery Fake fails twice

    Third attempt succeeds assert attempts == 3 Inject a no-op delay so JUnit tests remain fast and deterministic.
  9. Deterministic failure injection — actual Messaging contract Messaging failingMessaging =

    json -> { throw new RuntimeException("Simulated messaging failure"); }; TemperatureLambda lambda =new TemperatureLambda(fakeStorage, failingMessaging); Local fake only. No SNS outage, AWS credentials, or live failure injection.
  10. Step 4: deterministic failure injection Fail twice, then succeed. A

    controlled test double—not a real SNS failure. public final class FailingPublisher implements EventPublisher { private int attempts; public void publish(String id, String json) { attempts++; if (attempts < 3) throw new TransientPublishException("SNS unavailable"); } public int attempts() { return attempts; } } 16
  11. JUnit: recovery, exhaustion, and immediate stop Retry exhaustion Retryable failure

    every time Propagate exception assert attempts == 3 Inject a no-op delay so JUnit tests remain fast and deterministic.
  12. Step 5: bounded retry policy public class RetryingMessaging implements Messaging

    { public void execute(Runnable operation) { RuntimeException last = null; for (int attempt = 1; attempt <= maxAttempts; attempt++) { try { operation.run(); return; } catch (TransientPublishException e) { last = e; // backoff can be added here } } throw last; } 18
  13. Step 6: verify retries with JUnit Verify behavior, not just

    console output. @Test void transientFailureRecovers() { FailingPublisher publisher = new FailingPublisher(); RetryPolicy policy = new RetryPolicy(3); policy.execute(() -> publisher.publish("id-1", "{}")); assertEquals(3, publisher.attempts()); }
  14. JUnit: recovery, exhaustion, and immediate stop Non-retryable Fake throws non-retryable

    error Propagate immediately assert attempts == 1 Inject a no-op delay so JUnit tests remain fast and deterministic.
  15. JUnit: recovery, exhaustion, and immediate stop Recovery Retry exhaustion Non-retryable

    Fake fails twice Retryable failure every time Fake throws non-retryable error Third attempt succeeds Propagate exception Propagate immediately assert attempts == 3 assert attempts == 3 assert attempts == 1 Inject a no-op delay so JUnit tests remain fast and deterministic.
  16. CSC 5100 Modern Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall

    2026 Copyright Notice. These slides are provided exclusively for educational use in CSC 5100 within the California State University system. Redistribution or use for any other purpose is prohibited without prior written permission.