Giter VIP home page Giter VIP logo

bi_java_gcp's Introduction

BI JAVA GCP

The goal of this project is to build a cloud storage microservice application using Google Cloud Platform (GCP) SDK and the Spring Boot JAVA framework. The application will utilize the GCP Storage service to store and manage data in the cloud. The data objects will be manipulated using a local library and its functionality will be exposed usng an API controller built using OpenAPI3 "Swagger"

Versions

- Java 17
- Spring Boot 2.7.6
- Maven 4.0.0
- Docker 20.10.17

Getting Started

This project is a simple Microservice. It is a Spring Boot application that can be run locally or in a Docker container. The purpose of this project is to build a simple microservice using the Google cloud platform to perform Business Intelligence .

Install Java JDK locally

You can download it from the Oracle website

Clone the project

git clone https://github.com/CPNV-ES-BI/BI_JAVA_GCP.git

Dependencies

- Spring Boot Starter
- Spring Boot Starter Web
- Spring Cloud GCP Starter
- Spring Cloud GCP Starter Storage
- Springdoc Openapi UI
- Spring Boot Starter Test

Build the project locally

Run the spring boot application locally using the maven wrapper.

./mvnw spring-boot:run

Build the tests locally

Create the environnement properties

In order to run the tests, we need to configure the environnement properties in the project.

A file name src/main/resources/gcp.example.properties contain those variables:

GCP_ACCESS_KEY_ID=
GCP_SECRET_ACCESS_KEY=
GCP_PROJECT_ID=
GCP_CLIENT_ID=
GCP_CLIENT_EMAIL=
GCP_BUCKET_NAME=

All those variables need to be set for the proper conduct of the tests like this:

GCP_ACCESS_KEY_ID=test

Even if it's a string, a property value doesn't contain quotes.

Run all tests

This command will run all the tests in the project.

./mvnw test

Run specific class tests

This command will run all the tests in the DataObjectControllerTest class.

./mvnw test -Dtest=DataObjectControllerTest

Run specific method tests

This command will run the test_DoesExist_ExistsCase_True test in the DataObjectControllerTest class. To make this work, you add to separate the class name from the method name with a #.

./mvnw test -Dtest=DataObjectControllerTest#test_DoesExist_ExistsCase_True

Run the docker image

Those commands create and run the docker using docker-compose.

Run the production image

docker compose up developement

Run the test image

docker compose up test

This command starts the image and run it as a container. It runs all tests and report the result in the console.

CI with Maven

During the project, a continous integration github action has been created to test the unit test from the project.

The configuration of the file can be find in the wiki.

Directory structure

The directory structure of the project is as follows:

- .github/workflows
    - main.yml
- src
    - main
        - java
            - com
                - cpnv
                    - bijavagcp
                        - api
                            - DataObjectController
                        - config
                            - GcpConfiguration
                        - exceptions
                            - ObjectAlreadyExistsException
                            - ObjectNotFoundException
                        - services
                            - DataObject
                            - DataObjectService
                        - BiJavaGcpApplication                            
        - resources
            - application.properties
            - gcp.properties
    - test
        - java
            - com
                - cpnv
                    - bijavagcp
                        - services
                            - DataObjectControllerTest
- docker-compose.yml
- Dockerfile
- README.md
- mvnw
- mvnw.cmd
- pom.xml

The root directory contains all the configuration files for the project and the dockerfile while the src directory is split into two parts: main and test. The main directory contains the code of the application while the test directory contains the tests of the application.

Branching

For branching, we will use the Gitflow branching model due to its simplicity and ease of use. Wiki link for specification : wiki

Contribute

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

back to top

License

Distributed under the MIT License. See LICENSE for more information.

back to top

Contact

bi_java_gcp's People

Contributors

robieltes avatar nomeos 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.