Giter Site home page Giter Site logo

thanos-mockserver's Introduction

Thanos MockServer

Build Status codecov Maintainability FOSSA Status

How to use

  1. 准备好契约(/resources/contracts)和接口定义(/resource/schemas)
  2. 配置application.properties, 选择所需要的模式(默认Standalone)
  3. 启动MockServerMain (如为Platform模式需要先启动ContractService)
  4. Rest查询/apis/mappings获取TCP端口列表
  5. 指向对应端口进行正常挡板使用

Remark:

  • 可外部覆盖的配置:
    • platformMode(true/false)
    • contractService.baseHttpPath(路径信息如'http://localhost:8081', platformMode时必须配置)
    • 如若没有配置则默认使用application.properties中的值

Functions

  • 为每对生产者-消费者启动挡板服务。Startup diff MockServerThread, each thread serve for provider-consumer pair and via diff port
  • 能通过REST API查询TCP挡板服务端口。Port mapping could be get via HTTP GET via API, API doc could be found at root or http://localhost:8082/api.html
  • 支持Standalone单机模式,启动时文本获取契约信息,没有动态更新。When standalone mode, contract & schema would be load from file base and no dynamic update
  • REST API辅助工具:根据契约生成定长请求报文,根据接口定义解释定长报文。Also provided utils, said could generate request msg base on contract, and parse message base on schema.
  • 支持Platform平台模式,启动时从ContractService获取契约信息。 When non-standalone mode, contract & schema would be load from contract service HTTP, dynamic update is not implement yet.
  • Platform平台模式下,接收ContractService动态更新. Support dynamic update in platform mode

TODO

  • 预定义常用正则Validator。 Pre-define Regex Validator
  • 预定义一个FuncValidator(如DateTime)。Pre-define a FuncValidator
  • Platform模式下Rest请求ContractService需要添加重试机制. Enhance retry logic in platform mode
  • 挡板服务启动时支持白名单、黑名单配置. Enhance with white list and black list config

Component Diagram

Note: Async communication between threads which using Guava EventBus is not shown in above diagram

thanos-mockserver's People

Contributors

abigail830 avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

fossabot

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.