Skip to content

fishey2/java-component-template

Repository files navigation

Java Component Template

GitHub Actions Overall

Actions Status

SonarCloud Overall

Quality Gate Status

SonarCloud Summary

Maintainability Rating Reliability Rating Security Rating

SonarCloud Details

SonarCloud Lines of Code SonarCloud Coverage SonarCloud Duplicated Lines (%) SonarCloud Bugs SonarCloud Vulnerabilities Code Smells Technical Debt

Description

Component template project for Java including Spring Boot 2 and JUnit

The goal of this template project is to have branches that are ready to go with different non-conflicting implementations for various things on-top of the master branch.

// Pull in the reference implementation for ActiveMQ
git pull origin with_activemq

// Pull in the reference implementation for PostgreSQL
git pull origin with_postgresql

// Pull in the reference implementation for Flyway DB Migrations
git pull origin with_flyway

List of branches:

Testing

Currently Implemented Quality Gates:

Gate Number Description Condition
1 Unit Tests 100% PASS
2 Integration Tests 100% PASS
3 Jacoco (Code Coverage) 100% BRANCH COVERAGE
4 SonarCloud (Static Analysis) NOT IMPLEMENTED
5 Functional Tests 100% PASS

Development

For development, it is suggested that you run using Gradle and bring up docker yourself.

$ docker-compose up -d

$ gradle test

$ docker-compose down

Unit/Integration

To run the unit/integration tests

$ make test

Functional

For functional tests, you should use make, which will build the application and docker container

$ make testFunctional

This runs the equivalent of

# Creates java executable
$ ./gradlew bootJar

# Builds the docker container
$ docker-compose -f docker-compose-test.yml build

# Launches the docker container
$ docker-compose -f docker-compose-test.yml up -d

# Waits for service locally
./scripts/wait-for-url.sh http://localhost:8080

# Runs the tests
$ ./gradlew functionalTest

# Tears down containers
$ docker-compose -f docker-compose-test.yml down

Reference Implementations

A list of Reference Implementations

To be converted to docs

CodeCov

  - name: Upload coverage to Codecov
    uses: codecov/codecov-action@v1
    with:
      token: ${{ secrets.CODECOV_TOKEN }}
      file: ./build/reports/jacoco/test/jacocoUnitTestReport.xml
      flags: unittests
      name: codecov-umbrella

Spring profiles

Set env variable

SPRING_PROFILES_ACTIVE=test

About

A template project for Java based projects with Spring Boot 2, Gradle, Logback and JUnit5

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 2

  •  
  •  

Languages