Skip to content

Commit

Permalink
Merge pull request #25 from ClementGib/task#44
Browse files Browse the repository at this point in the history
Task#44: Add maven build and test on repository
  • Loading branch information
ClementGib authored Feb 17, 2024
2 parents 2dcfaf0 + 89d40f5 commit 7900d3e
Show file tree
Hide file tree
Showing 96 changed files with 332 additions and 276 deletions.
File renamed without changes.
32 changes: 32 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: 'Quarkus CI with Maven'

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
cache: maven
- name: Build with Maven and tests
run: mvn -B package --file pom.xml
50 changes: 46 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml
out/
.idea/

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
.idea_modules/
*.iml
*.ipr
*.iml
*.iws

.mvn
# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env

# Docker
env/data/

# Other
compose/data/




quarkus-backend/compose/data/
File renamed without changes.
98 changes: 98 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

public final class MavenWrapperDownloader
{
private static final String WRAPPER_VERSION = "3.2.0";

private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) );

public static void main( String[] args )
{
log( "Apache Maven Wrapper Downloader " + WRAPPER_VERSION );

if ( args.length != 2 )
{
System.err.println( " - ERROR wrapperUrl or wrapperJarPath parameter missing" );
System.exit( 1 );
}

try
{
log( " - Downloader started" );
final URL wrapperUrl = new URL( args[0] );
final String jarPath = args[1].replace( "..", "" ); // Sanitize path
final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize();
downloadFileFromURL( wrapperUrl, wrapperJarPath );
log( "Done" );
}
catch ( IOException e )
{
System.err.println( "- Error downloading: " + e.getMessage() );
if ( VERBOSE )
{
e.printStackTrace();
}
System.exit( 1 );
}
}

private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath )
throws IOException
{
log( " - Downloading to: " + wrapperJarPath );
if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
{
final String username = System.getenv( "MVNW_USERNAME" );
final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
Authenticator.setDefault( new Authenticator()
{
@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication( username, password );
}
} );
}
try ( InputStream inStream = wrapperUrl.openStream() )
{
Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING );
}
log( " - Downloader complete" );
}

private static void log( String msg )
{
if ( VERBOSE )
{
System.out.println( msg );
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
distributionSha256Sum=83aaf914c785c9faed661f223000a92d1de9553f5c82d3b4362e66d9c031625f
wrapperSha256Sum=e63a53cfb9c4d291ebe3c2b0edacb7622bbc480326beaa5a0456e412f52f066a
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ I want to see the history (operation, date, amount, balance) of my operations

1. Lancer les containers (PostgreSQL, PgAdmin, KeyClock) 🐘🐋

*Dans le répertoire `quarkus-backend/compose`*
*Dans le répertoire `compose`*
```bash
docker-compose up
```

2. Lancer le back-end Quarkus
1. Lancer le back-end Quarkus

*Dans le répertoire `quarkus-backend`*
*A la racine du projet*
```bash
quarkus dev -e
#OU
Expand All @@ -136,12 +136,30 @@ quarkus dev -e

3. (Optionel) Lancer les tests Junit 5

*Dans le répertoire `quarkus-backend`*
*A la racine du projet*
```bash
mvn test
```


Quarkus HTTP : `localhost:8080`

Accéder a pgAdmin via : `localhost:15050`



# DETAIL

- validation métier: API Bean validation (JSR 303)

#### Domain :

- validation fonctionnelle dès l'initialisation des objets métier
- organisation métier dans le code métier (package by feature)

### Technique

- Utilisation des records et des constructeurs compact (Java 14)

### Patterns:

- Naming unit test : MethodName_ExpectedBehavior_StateUnderTest
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:15432/basdb
quarkus.hibernate-orm.database.generation=validate
quarkus.hibernate-orm.database.default-schema=basapp
quarkus.hibernate-orm.jdbc.timezone=Europe/Paris
quarkus.http.host=0.0.0.0


%test.scheduler.activation=false
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions quarkus-backend/client/pom.xml → client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
<groupId>com.cdx.bas</groupId>
<artifactId>application</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.cdx.bas.client.transaction;

import com.cdx.bas.application.transaction.TransactionServiceImpl;
import com.cdx.bas.domain.transaction.Transaction;
import com.cdx.bas.domain.transaction.TransactionControllerPort;
import com.cdx.bas.domain.transaction.TransactionPersistencePort;
import com.cdx.bas.domain.transaction.TransactionStatus;
import jakarta.annotation.Nullable;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7900d3e

Please sign in to comment.