Skip to content

paulthepen/javaSample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operto Integration Sample

This repository contains a sample Java integration between:

  • Operto: A Canada-based property management system focused on cleaning and smart access
  • BrightSide Rental Management Software: A platform for tracking, upkeep, and billing in the short-term rental industry

Note: This codebase is an educational sample—not a working production integration. It illustrates design patterns and techniques commonly used in professional Java backend projects.

Project Structure & Focus

  • The primary focus is the OpertoApi class, which manages retrieval and synchronization of data between the two systems.
  • The reference package provides placeholder/domain objects relevant to the scenario.
  • The project demonstrates integrating new logic into a legacy codebase, where many dependencies are highly coupled and lack test coverage. To address this, the code uses DTOs (a GWT requirement) and several deprecated libraries.
  • The OpertoApiTest class uses TDD techniques with custom mock objects and spies, avoiding external dependencies.
  • HTTP calls are managed via the OkHttp3 library, with an OkHttpWrapper to aid logging and reduce duplication.

Test-Driven Development (TDD) Principles

This project illustrates key aspects of Test-Driven Development (TDD):

  • Tests First: Features and integration logic are designed by first writing tests that specify the desired behavior before implementing production code.
  • Mocking and Spies: Unit tests use custom mocks and spies to simulate dependencies and external services, ensuring tests are fast, isolated, and reproducible. This avoids reliance on real HTTP calls or external systems.
  • Refactoring with Confidence: With comprehensive tests in place, the codebase can be refactored or extended safely, as tests quickly reveal regressions or unexpected behavior.

Benefits demonstrated:

  • Promotes clearly defined and testable interfaces.
  • Encourages loose coupling and modular architecture.
  • Ensures robust test coverage and reliable future maintenance.

For examples, see OpertoApiTest and the usage of custom mocks and spies for model and HTTP interactions.

SOLID Principles & Design Concepts Demonstrated

This sample intentionally demonstrates implementation of the SOLID principles:

  1. Single Responsibility Principle:
    Methods and classes are designed to handle one aspect of data integration at a time.

  2. Open/Closed Principle:
    Usage of a ModelRegistry enables injecting and expanding models without modifying existing logic, supporting extension over modification.

  3. Liskov Substitution Principle:
    All code is written against abstract types, allowing mock and spy objects to substitute for real models seamlessly in tests.

  4. Interface Segregation Principle:
    Interfaces are minimized; for instance, separate Loadable and Saveable interfaces mean implementers only include the operations they need. This is visible in both model and test code.

  5. Dependency Inversion Principle:
    High-level code (such as OpertoApi) depends on abstractions supplied by the registry, not concrete model implementations. This enables simple swapping for mocks/spies during tests and future flexibility.


Additional Notes

  • Extensibility:
    You can add new integrations, models, or test cases following the patterns established here with minimal code changes.

Feel free to use or adapt this adjustment based on your audience. If you'd like a sample “How to Run the Tests” or general “How to Extend” section, let me know!

About

An educational sample of Java code illustrating design patterns and techniques commonly used in backend projects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages