Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
457b9a3
Created db.migration folders
cormaco7 Aug 26, 2024
38b096e
Updating README.md
niall-mccloy Aug 26, 2024
807ce80
Create docker.yml
johnhutchman Aug 26, 2024
38392c5
Working on backend for view-job-roles
Aug 26, 2024
31c8f2d
adding docker file and docker yml file
johnhutchman Aug 27, 2024
2b9b4a0
Further working on backend for view-job-roles
Aug 27, 2024
c310ed9
Got the Swagger displaying correctly for view-job-roles
Aug 27, 2024
84cbb33
Added the SQL files for the status table, insert statements
Aug 27, 2024
4321416
Merge pull request #2 from connmor2003/004-docker.yml-setup
johnhutchman Aug 27, 2024
2701020
Finished main work on this branch, needs testing still
Aug 27, 2024
af1b430
Update README.md
niall-mccloy Aug 27, 2024
a15b242
Merge pull request #1 from connmor2003/002-updating-readmefile
niall-mccloy Aug 28, 2024
654b373
Added login system
jxryyy Aug 29, 2024
196b1de
Fixed test yml file
jxryyy Aug 29, 2024
e7bface
Fixed user password
jxryyy Aug 29, 2024
40574ce
Fixed yml env variables
jxryyy Aug 29, 2024
50f6f41
Added unit and integration tests
Aug 29, 2024
6b8c322
Debugging
jxryyy Aug 29, 2024
3d6c758
Debugging
jxryyy Aug 29, 2024
20f6728
Debugging
jxryyy Aug 29, 2024
55c67dd
Debugging
jxryyy Aug 29, 2024
0628d31
Fixed test yml file
jxryyy Aug 29, 2024
c49cbf2
Test
jxryyy Aug 29, 2024
826e90f
Test v2
jxryyy Aug 29, 2024
7758ce9
Debugging
jxryyy Aug 30, 2024
6a21c87
Fixed test yml file and fixed AuthServiceTest
jxryyy Aug 30, 2024
11e9776
Fixed build yml file to skip tests
jxryyy Aug 30, 2024
226b864
Fixed code issues
Aug 30, 2024
43a5ad8
Fixed naming of app and config file
jxryyy Aug 30, 2024
a285f26
Fixed test yml push and controller test function naming
jxryyy Aug 30, 2024
fbaa1ad
Fixed test yml file
jxryyy Aug 30, 2024
9a02784
Fixed review comments
jxryyy Sep 2, 2024
2e08260
Fixed service test
jxryyy Sep 2, 2024
e8682e9
Changed Dao and Service methods, removed test
Sep 2, 2024
823909a
Merged main into branchMerge remote-tracking branch 'origin/main' int…
Sep 2, 2024
07b1dcb
Merge pull request #4 from connmor2003/001-view-job-roles
connmor2003 Sep 2, 2024
cafef73
added selenium and login test
cormaco7 Sep 2, 2024
2abc633
changed xpath to id
cormaco7 Sep 3, 2024
0e9a28d
Fixed merge conflicts
jxryyy Sep 3, 2024
6331a61
Fixed merge conflicts
jxryyy Sep 3, 2024
021f9d6
conflict resolution
cormaco7 Sep 3, 2024
1df1468
Fixed integration testing, mvn test and fixed test migration to migra…
jxryyy Sep 3, 2024
de1b11e
Fixed test yml file
jxryyy Sep 3, 2024
cc7d853
adding job info method
johnhutchman Sep 3, 2024
24f376e
fixing dao query
niall-mccloy Sep 3, 2024
2db718c
addressing issue with docker yml
niall-mccloy Sep 4, 2024
a6aee56
Merge pull request #5 from connmor2003/001-docker.yml-bug-fix
niall-mccloy Sep 4, 2024
704857e
Fixed test yml file
jxryyy Sep 4, 2024
68ec1f9
Merge branch 'main' of github.com:connmor2003/java-dropwizard-flyway-…
jxryyy Sep 4, 2024
1c689bb
Bug fix
jxryyy Sep 4, 2024
2606f8d
Merge pull request #3 from connmor2003/004-add-login-system
jericoatos Sep 4, 2024
0acfb6d
making changes
Meganc3379 Sep 4, 2024
cc9f9bb
Merge pull request #6 from connmor2003/004-login-dockerfix
niall-mccloy Sep 4, 2024
d56f381
fixes
johnhutchman Sep 4, 2024
2023a4b
fixing conflicts
johnhutchman Sep 4, 2024
f21c3a8
Fixed readme file and added authorisation
jxryyy Sep 4, 2024
d4686cd
Fixed job role integration test to include login token
jxryyy Sep 4, 2024
3c020cf
some changes
johnhutchman Sep 4, 2024
7830a94
changes
johnhutchman Sep 4, 2024
96d6417
fixing test issues and linter
niall-mccloy Sep 4, 2024
ffde277
final changes
johnhutchman Sep 5, 2024
d347aa7
Added authorisation system
jxryyy Sep 5, 2024
73f05a9
Added integration test for job role
jxryyy Sep 5, 2024
41dec9a
updating database schema
niall-mccloy Sep 6, 2024
2fdd246
Merge pull request #11 from connmor2003/002-view-role-detail
niall-mccloy Sep 6, 2024
a00494b
Added authorisation
jxryyy Sep 6, 2024
7c5ce4e
Fixed integration test
jxryyy Sep 6, 2024
0c114fa
adding role ordering]
niall-mccloy Sep 9, 2024
45ff60b
backend work
Sep 9, 2024
b5c5ee6
worked on the sql query in the dao
Sep 9, 2024
a1f63e1
added InvalidException class
Sep 9, 2024
ee390b1
fixed numberOfOpenPositions
Sep 9, 2024
bbc5a4d
Merge pull request #8 from connmor2003/041-authorisation-system
jericoatos Sep 10, 2024
d7e9185
altered the SQL query - not completed yet
Sep 10, 2024
cf194a3
further work on the validations for Job Role
Sep 10, 2024
6b11a96
Even further work on the validations for Job Role
Sep 10, 2024
8081fda
fixed linting issues
Sep 10, 2024
2b478f5
changed band and capability names to ids
Sep 10, 2024
0c69658
fixed errors
Sep 10, 2024
dc51ddd
fixes
Sep 10, 2024
612581a
finished implementing validation on backend
Sep 10, 2024
751af3b
resolved conflicts
Sep 10, 2024
f3f4937
added some more job role validation and added the JobRoleValidator tests
Sep 10, 2024
70320e0
started controller test
Sep 10, 2024
7b6e578
added unit tests for createJobRole method in controller
Sep 10, 2024
66a8bbd
finished JobRoleController unit tests for creating a job role
Sep 10, 2024
fc7d6de
added unit tests for the createJobRole method in the Service class
Sep 10, 2024
22ac9a7
added integration test for the createJobRole endpoint
Sep 10, 2024
b7e1ba4
fixed linting issues
Sep 10, 2024
a288cc7
Made the requested changes
Sep 10, 2024
61f4c04
added authorization
Sep 11, 2024
24786eb
fixed integration test
Sep 11, 2024
e462d6e
updated test.yml fie
Sep 11, 2024
7c489c3
updated test.yml file
Sep 11, 2024
46dd560
added role ordering
jxryyy Sep 11, 2024
5b2cfa0
h
jxryyy Sep 11, 2024
38d5bda
not working
niall-mccloy Sep 11, 2024
e3b1025
merge
jxryyy Sep 11, 2024
3400366
merge
jxryyy Sep 11, 2024
1f56356
merge
jxryyy Sep 11, 2024
8a1d3d6
merging
niall-mccloy Sep 11, 2024
6c4487f
starting unit tests
niall-mccloy Sep 11, 2024
17ec622
unit tests
niall-mccloy Sep 12, 2024
3cddfe0
adjusting yml
niall-mccloy Sep 12, 2024
4893622
Merge pull request #12 from connmor2003/012-add-new-role
connmor2003 Sep 12, 2024
8b3670d
merging main
niall-mccloy Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B package -DskipTests=true --file pom.xml
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build & push the Docker image
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_NAME: ${{ secrets.DB_NAME }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: employee_demo
IMAGE_TAG: derry-t1-api
run: |
docker build --build-arg DB_PASSWORD=${DB_PASSWORD} --build-arg DB_USERNAME=${DB_USERNAME} --build-arg DB_HOST=${DB_HOST} --build-arg DB_NAME=${DB_NAME} -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG


47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Unit and Integration Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Test Migration
env:
FLYWAY_PASSWORD: ${{ secrets.DB_PASSWORD }}
FLYWAY_USER: ${{ secrets.DB_USERNAME }}
FLYWAY_URL: jdbc:mysql://${{ secrets.DB_HOST }}/${{ secrets.TEST_DB_NAME }}
FLYWAY_BASELINE_ON_MIGRATE: true
run: |
mvn flyway:clean
mvn flyway:migrate

- name: Maven build with Integration and Unit Tests
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_NAME: ${{ secrets.TEST_DB_NAME }}
VALID_TEST_EMAIL: ${{ secrets.VALID_TEST_EMAIL }}
VALID_TEST_PASSWORD: ${{ secrets.VALID_TEST_PASSWORD }}
VALID_ADMIN_EMAIL: ${{ secrets.VALID_ADMIN_EMAIL}}
VALID_ADMIN_PASSWORD: ${{ secrets.VALID_ADMIN_PASSWORD}}

run: mvn clean integration-test

- name: Unit Tests
run: mvn test
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM maven:latest
#set maven dependency to specific version?

WORKDIR /code

COPY . /code

ARG DB_HOST
ARG DB_PASSWORD
ARG DB_USERNAME
ARG DB_NAME

ENV DB_HOST ${DB_HOST}
ENV DB_PASSWORD ${DB_PASSWORD}
ENV DB_USERNAME ${DB_USERNAME}
ENV DB_NAME ${DB_NAME}

RUN mvn clean install -DskipTests=true

EXPOSE 8080

CMD ["java","-jar", "/code/target/JavaWebService-1.0-SNAPSHOT.jar", "server", "/code/config.yml"]
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,46 @@ How to start the test application
2. DB_PASSWORD
3. DB_HOST
4. DB_NAME
1. Run `mvn clean install` to build your application
1. You can start application via:
1. Terminal: `java -jar target/java-swagger-flyway-starter-org.kainos.ea.jar server config.yml`
2. IDE: Edit run configuration -> Add `server` to program arguments -> Run
1. To check that your application is running enter url `http://localhost:8080/api/test`
2. Run `mvn clean install` to build your application
3. You can start application via IDE: Edit run configuration -> Add `server` to program arguments -> Run
4. To check that your application is running enter url `http://localhost:8080/api/test`

Health Check
---

To see your applications health enter url `http://localhost:8081/healthcheck`

**How to Lint**
---

Configure checkstyle in Intellij:
1. Open Settings,
2. Go to Tools, then Checkstyle,
3. Under Configuration File, click Add,
4. Type 'Sun Checks Modified' in the Description,
5. Click Browse, then go to src/main/resources/sun_checks_modified,
6. Click Next, then Next again, then Finish,
7. Check the box for Active, then click Apply, then OK,
8. Click on the CheckStyle button above the Terminal button and select Sun Checks Modified as the Rules.

**How to run Integration Tests**
---

1. Open the .zshrc file
2. Add the following lines to your ~/.zshrc file:

```
export "VALID_TEST_EMAIL"="user@email.com"
export "VALID_TEST_PASSWORD"="regularU\$er123"
export "VALID_ADMIN_EMAIL"="admin@email.com"
export VALID_ADMIN_PASSWORD="admin!Pa\$\$word123"

```

3. Reload your terminal session if required:

```
. ~/.zshrc
```

4. Reload IntelliJ if required
142 changes: 136 additions & 6 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>java-dropwizard-flyway-starter</artifactId>
<name>Test</name>
<artifactId>JavaWebService</artifactId>
<name>WebService</name>
<version>1.0-SNAPSHOT</version>
<build>
<pluginManagement>
Expand Down Expand Up @@ -60,6 +60,7 @@
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -90,6 +91,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
Expand All @@ -101,16 +103,41 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -122,6 +149,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -131,6 +159,23 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<configLocation>src/main/resources/sun_checks_modified.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand All @@ -141,16 +186,101 @@
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.23.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>mockito-core</artifactId>
<groupId>org.mockito</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>2.0.23</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
<exclusion>
<artifactId>jersey-test-framework-core</artifactId>
<groupId>org.glassfish.jersey.test-framework</groupId>
</exclusion>
<exclusion>
<artifactId>jersey-test-framework-provider-inmemory</artifactId>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</reporting>
Expand All @@ -166,8 +296,8 @@
</dependencies>
</dependencyManagement>
<properties>
<dropwizard.version>2.0.3</dropwizard.version>
<mainClass>org.example.TestApplication</mainClass>
<dropwizard.version>2.0.23</dropwizard.version>
<mainClass>org.example.KainosJobWebApplication</mainClass>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down
Loading