Git Product home page Git Product logo

api-service-demo's Introduction

description
A demo Jave project with tool gradle,for our CICD. Hope you gays can understand the process of CICD.

API-TEST-DEMO

Java project

1.junit test

包含JUnit单元测试,运行./gradlew clean build 或者 make test

2.build package

生成jar包,方便CI/CD及docker,运行./gradlew -x jar build 或者 make build

3. Run

  • local run

启动项目,通过./gradlew bootRun 或者 make bootRun

API接口为http://localhost:8080/api/increase?number=323

返回num+1(0<num<1000),形式如{'errorCode':0, 'data':'324'}

  • docker run

build docker image

docker build -t api-demo:0.1 .

run docker container

docker run -d -p 8080:8080 api-demo:0.1

浏览器中访问 http://localhost:8080/api/increase?number=323

4. Sonar Scan

before run below command ,please set up sonarqube

./gradlew sonarqube \
    -Dsonar.projectKey=xxx \
    -Dsonar.host.url=http://localhost:9000 \
    -Dsonar.login=admin \
    -Dsonar.password=admin

5. api test with jmeter

需要提前安装好jmeter

/opt/apache-jmeter-5.1.1/bin/jmeter.sh -n -t api-test/api-test-demo.jmx

4.Exception handle

  • num不在0~1000,返回{'errorCode':1, 'data':'please input [0,1000]'}
  • num在每100个数中,必有一个错误数,返回{'errorCode':1, 'data':'internal error'}

test test test for jenkins github webhook test for jenkins github webhook

api-service-demo's People

Contributors

lewisice avatar qinrui-tw avatar qinrui777 avatar xiaoyu-yao 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.