GithubHelp home page GithubHelp logo

swe-dependencies's Introduction

Kacper Urbaniec | SWE | 11.11.2022

Assignment 3: Dependencies

🏗️ Architecture

  • provider.customer | CustomerService

    Spring Boot service available @ http://localhost:8080
    Provides a list of customers via a REST API. The customer has the typical information like name, address, date of birth, email address, status, and more. Besides the basic information, the customer has a list of financial products. Every product has a name, balance, product code, and interest rate, among others.

  • consumer.info | InfoService

    Spring Boot service available @ http://localhost:8090
    Provides a modified list of customer via REST API. Returns a list of all customers with name, email, and status.

  • consumer.aggregator | AggregatorService

    Node service available @ http://localhost:9000
    Provides a modified list of customer via REST API. Returns a list of all customers with names and an aggregated balance (sum of all product balances).

🤝 Test & Verify Pacts

  1. Run tests & generate pact for InfoService consumer

    # On Unix: chmod +x ./consumer.info/gradlew
    ./consumer.info/gradlew -p "consumer.info" test 
  2. Run tests & generate pact for AggregatorService consumer

    npm --prefix ./consumer.aggregator/ install
    npm --prefix ./consumer.aggregator/ run test 
  3. Verfiy pacts for CustomerService provider

    # On Unix: chmod +x ./provider.customer/gradlew
    ./provider.customer/gradlew -p "provider.customer" test 

For example, if one were to remove the balance field from the API CustomerService, the contract check would fail and output the following error messages.

image-20221111204320248

image-20221111204446501

Pact & other consumer-driven testing frameworks help detect breaking service modifications to prevent such client defects.

🚀 Run

  1. CustomerService

    ./provider.customer/gradlew -p "provider.customer" bootRun 

    API

    • /customers - Query all customers

      curl http://localhost:8080/customers
    • /customer/{customer-email} - Query specific customer

      curl http://localhost:8080/customer/[email protected]
  2. InfoService

    Requires running CustomerService.

    ./consumer.info/gradlew -p "consumer.info" bootRun 

    API

    • /customers - Query all customer info

      curl http://localhost:8090/customers
  3. AggregatorService

    Requires running CustomerService.

    npm --prefix ./consumer.aggregator/ run build 
    npm --prefix ./consumer.aggregator/ run start 

    API

    • /customers - Query all customers with aggregated balances

      curl http://localhost:9000/customers

Additionally, a postman collection can be found in the test.postman folder to manually interact with the services.

Acknowledgments

swe-dependencies's People

Contributors

kurbaniec avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.