Skip to content

FreemanBoss/Dec2Hex_Java_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dec2Hex Java Project

Overview

The Dec2Hex_Java_Project is a Java-based application that converts decimal values into their hexadecimal equivalents. This project includes a fully automated CI/CD pipeline using Jenkins, SonarQube, JaCoCo, and Docker. It demonstrates modern software engineering practices, including automated builds, testing, and code quality analysis.


Features

Converts decimal numbers to hexadecimal.

Automated unit testing using JUnit.

Code quality analysis with SonarQube.

Test coverage reporting using JaCoCo.

Fully containerized using Docker for portability.


Tech Stack

Programming Language: Java

Build System: Jenkins

Static Analysis Tool: SonarQube

Test Coverage Tool: JaCoCo

Containerization: Docker


Requirements

  1. Docker: Installed and running.

  2. Java 17: Ensure Java 17 or higher is available.

  3. SonarQube Server: Hosted locally or remotely.

  4. Jenkins Server: Hosted locally or remotely.


Setup Instructions

  1. Clone the Repository

git clone https://github.com/FreemanBoss/Dec2Hex_Java_Project.git
cd Dec2Hex_Java_Project

  1. Docker Setup

Run the following to start Jenkins and SonarQube:

Start Jenkins

docker run -d --name jenkins -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts

Start SonarQube

docker run -d --name sonarqube -p 9000:9000 sonarqube

  1. Configure Jenkins

Install required plugins: SonarQube Scanner, Git, JUnit, and Pipeline.

Add your SonarQube server URL under "Manage Jenkins > Configure System".

Create a pipeline job pointing to this repository.

  1. Configure SonarQube

Log in to your SonarQube instance at http://:9000.

Create a new project and generate a token.

Add the token to Jenkins under "Manage Jenkins > Credentials".

  1. Run the Pipeline

Trigger the Jenkins pipeline to automate the build, test, and analysis process.

Check the SonarQube dashboard for detailed analysis and code quality metrics.


How It Works

  1. Compilation: Jenkins compiles the Dec2Hex.java program.

  2. Testing: Executes JUnit tests to ensure accuracy and handle edge cases.

  3. Code Quality: SonarQube analyzes the code for bugs, vulnerabilities, and maintainability.

  4. Coverage Reports: JaCoCo generates test coverage reports.

  5. Artifact Generation: The pipeline creates coverage reports in the target/site/jacoco/ directory.


Challenges and Scaling

Server Scaling on DigitalOcean:

Initial Setup:

2GB RAM, 2 vCPUs, 60GB SSD disk.

Midway Upgrade:

Upgraded to 4GB RAM, 2 vCPUs, 80GB SSD disk.

Final Configuration:

8GB RAM, 4 vCPUs, 160GB SSD disk for smooth performance during coverage reporting.


Test Cases

The project includes five key test cases in Dec2HexTest.java to handle:

  1. Valid decimal input.

  2. Negative input (error handling).

  3. Zero input.

  4. Non-integer input (error handling).

  5. No input provided (error handling).


License

This project is licensed under the MIT License. See the LICENSE file for more details.


Contributors

  • FreemanBoss

For questions, feedback, or contributions, please feel free to reach out or create an issue in the repository.

About

CI implementation using docker, Jenkins and sonarqube

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages