Skip to content

Commit dd83add

Browse files
committed
Corrected pom file, updated sonar plugin and github actions configuration; Improved code coverage as much as possible; Updated readme with instructions about usage of application
1 parent 01361e9 commit dd83add

File tree

11 files changed

+131
-60
lines changed

11 files changed

+131
-60
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1-
name: Software-Development-Simulation-Main-Build
1+
name: Build and Analyze with SonarQube
22

33
on:
44
push:
55
branches:
66
- main
7+
pull_request:
8+
branches:
9+
- main
710

811
jobs:
912
build:
10-
name: Build and analyze
1113
runs-on: ubuntu-latest
1214

1315
steps:
14-
- uses: actions/checkout@v4
16+
- name: Checkout code
17+
uses: actions/checkout@v4
1518
with:
1619
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1720
- name: Set up JDK 22
18-
uses: actions/setup-java@v1
21+
uses: actions/setup-java@v4
1922
with:
2023
java-version: 22
24+
distribution: 'corretto'
2125
- name: Cache SonarQube packages
22-
uses: actions/cache@v1
26+
uses: actions/cache@v4
2327
with:
2428
path: ~/.sonar/cache
2529
key: ${{ runner.os }}-sonar
2630
restore-keys: ${{ runner.os }}-sonar
31+
- name: Pre-fetch Maven dependencies
32+
run: mvn dependency:go-offline
2733
- name: Cache Maven packages
28-
uses: actions/cache@v1
34+
uses: actions/cache@v4
2935
with:
3036
path: ~/.m2
3137
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@@ -34,4 +40,4 @@ jobs:
3440
env:
3541
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3642
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
37-
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Software-Development-Simulation -Dsonar.projectName='Software Development Simulation' -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
43+
run: mvn clean install -B verify sonar:sonar

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,31 @@
55
![SonarQube Quality Gate](https://img.shields.io/badge/SonarQube%20Quality%20Gate-Passed-brightgreen)
66
![SonarQube Duplicated Lines](https://img.shields.io/badge/SonarQube%20Duplicated%20Lines-0%25-brightgreen)
77
![SonarQube LOC](https://img.shields.io/badge/SonarQube%20LOC-2000-blue)
8-
![JaCoCo Coverage](https://img.shields.io/badge/JaCoCo%20Coverage-93.1%25-brightgreen)
8+
![JaCoCo Coverage](https://img.shields.io/badge/JaCoCo%20Coverage-95.8%25-brightgreen)
99

1010
**Note:** SonarQube information is based on the last GitHub Action run and is generated locally. As such, there is no direct link available to the SonarQube dashboard.
1111

1212
## Overview
1313

1414
The Software Development Simulation project is a web-based application designed to simulate and manage software development tasks. It utilizes Spring Boot for backend services, Spring Integration for messaging, and integrates with Swagger for API documentation.
1515

16+
## Usage guide
17+
18+
This application is to be used from web interface that has two views:
19+
20+
1. Main view on index page, with fallowing features:
21+
- Allows user input for desired number of randomly generated development Epics, which is given as range between MIN - MAX (to input exact number user should input same value for both).
22+
- Allows saving those generated epics along with current development teams setup for future use, or manual change.
23+
- Allows managing previously saved, i.e. predefined epics, and consequently user stories and technical tasks, with option to save without overriding previous data.
24+
- Allows addition, editing and removal of epics, user stories and technical tasks in currently loaded predefined data.
25+
- Provides view of informational output, error output as well as jira stream generated output during application flow.
26+
- Provides options to change to "Developers page" view.
27+
2. Developers page view, with fallowing features
28+
- View of current development teams setups and details about each developer (their personal data, skill level, position, etc.).
29+
- Allows managing of said data through editing developer data, adding, moving or removing individual developers from their development teams.
30+
- Provide options to generate new batch of developers data with random data using predefined parameters (male/female gender ratio, MIN - MAX range of total possible number of developers and MIN - MAX possible number of developers assigned in each development team).
31+
- Provides option to add previously mentioned generated developers data to existing or to create fresh data (by checking option to not retain previous development team setup)
32+
1633
## Features
1734

1835
- **Spring Boot Application**: Built with Spring Boot 3.3.5.

pom.xml

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,76 +37,88 @@
3737
</issueManagement>
3838
<properties>
3939
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
40-
<spring-version>3.3.5</spring-version>
41-
<spring-integration-version>6.3.5</spring-integration-version>
42-
<jmockit-version>1.49.2</jmockit-version>
43-
<junit-jupiter-version>5.11.3</junit-jupiter-version>
40+
<spring.version>3.3.5</spring.version>
41+
<spring-integration.version>6.3.5</spring-integration.version>
42+
<jmockit.version>1.55.0</jmockit.version>
43+
<junit-jupiter.version>5.11.3</junit-jupiter.version>
44+
<mockito.version>5.14.2</mockito.version>
4445
<application.version>${project.version}</application.version>
46+
<jacoco.version>0.8.12</jacoco.version>
47+
<sonar.projectKey>Software-Development-Simulation</sonar.projectKey>
48+
<sonar.projectName>Software Development Simulation</sonar.projectName>
49+
<sonar.projectVersion>${application.version}</sonar.projectVersion>
50+
<sonar.host.url>${env.SONAR_HOST_URL}</sonar.host.url>
51+
<sonar.token>${env.SONAR_TOKEN}</sonar.token>
52+
<sonar.java.binaries>target/classes</sonar.java.binaries>
53+
<sonar.coverage.exclusions>
54+
src/main/java/dev/markodojkic/softwaredevelopmentsimulation/SoftwareDevelopmentSimulationApp.java
55+
</sonar.coverage.exclusions>
56+
<sonar.dynamic>reuseReports</sonar.dynamic>
4557
</properties>
4658

4759
<dependencies>
4860
<!-- Spring -->
4961
<dependency>
5062
<groupId>org.springframework.boot</groupId>
5163
<artifactId>spring-boot</artifactId>
52-
<version>${spring-version}</version>
64+
<version>${spring.version}</version>
5365
<scope>compile</scope>
5466
</dependency>
5567
<dependency>
5668
<groupId>org.springframework.boot</groupId>
5769
<artifactId>spring-boot-autoconfigure</artifactId>
58-
<version>${spring-version}</version>
70+
<version>${spring.version}</version>
5971
<scope>compile</scope>
6072
<optional>true</optional>
6173
</dependency>
6274
<dependency>
6375
<groupId>org.springframework.boot</groupId>
6476
<artifactId>spring-boot-starter-thymeleaf</artifactId>
65-
<version>${spring-version}</version>
77+
<version>${spring.version}</version>
6678
<scope>compile</scope>
6779
</dependency>
6880
<dependency>
6981
<groupId>org.springframework.boot</groupId>
7082
<artifactId>spring-boot-devtools</artifactId>
71-
<version>${spring-version}</version>
83+
<version>${spring.version}</version>
7284
<optional>true</optional>
7385
</dependency>
7486
<dependency>
7587
<groupId>org.springframework.boot</groupId>
7688
<artifactId>spring-boot-starter-web</artifactId>
77-
<version>${spring-version}</version>
89+
<version>${spring.version}</version>
7890
<scope>compile</scope>
7991
</dependency>
8092
<dependency>
8193
<groupId>org.springframework.boot</groupId>
8294
<artifactId>spring-boot-test-autoconfigure</artifactId>
83-
<version>${spring-version}</version>
95+
<version>${spring.version}</version>
8496
<scope>test</scope>
8597
</dependency>
8698

8799
<!-- Spring integration -->
88100
<dependency>
89101
<groupId>org.springframework.integration</groupId>
90102
<artifactId>spring-integration-core</artifactId>
91-
<version>${spring-integration-version}</version>
103+
<version>${spring-integration.version}</version>
92104
<scope>compile</scope>
93105
</dependency>
94106
<dependency>
95107
<groupId>org.springframework.integration</groupId>
96108
<artifactId>spring-integration-stream</artifactId>
97-
<version>${spring-integration-version}</version>
109+
<version>${spring-integration.version}</version>
98110
<scope>compile</scope>
99111
</dependency>
100112
<dependency>
101113
<groupId>org.springframework.integration</groupId>
102114
<artifactId>spring-integration-mqtt</artifactId>
103-
<version>${spring-integration-version}</version>
115+
<version>${spring-integration.version}</version>
104116
<scope>compile</scope>
105117
</dependency>
106118
<dependency>
107119
<groupId>org.springframework.integration</groupId>
108120
<artifactId>spring-integration-file</artifactId>
109-
<version>${spring-integration-version}</version>
121+
<version>${spring-integration.version}</version>
110122
<scope>compile</scope>
111123
</dependency>
112124

@@ -159,37 +171,37 @@
159171
<dependency>
160172
<groupId>com.github.hazendaz.jmockit</groupId>
161173
<artifactId>jmockit</artifactId>
162-
<version>${jmockit-version}</version>
174+
<version>${jmockit.version}</version>
163175
<scope>test</scope>
164176
</dependency>
165177
<dependency>
166178
<groupId>org.junit.jupiter</groupId>
167179
<artifactId>junit-jupiter</artifactId>
168-
<version>${junit-jupiter-version}</version>
180+
<version>${junit-jupiter.version}</version>
169181
<scope>test</scope>
170182
</dependency>
171183
<dependency>
172184
<groupId>org.junit.jupiter</groupId>
173185
<artifactId>junit-jupiter-api</artifactId>
174-
<version>${junit-jupiter-version}</version>
186+
<version>${junit-jupiter.version}</version>
175187
<scope>test</scope>
176188
</dependency>
177189
<dependency>
178190
<groupId>org.junit.jupiter</groupId>
179191
<artifactId>junit-jupiter-engine</artifactId>
180-
<version>${junit-jupiter-version}</version>
192+
<version>${junit-jupiter.version}</version>
181193
<scope>test</scope>
182194
</dependency>
183195
<dependency>
184196
<groupId>org.junit.platform</groupId>
185-
<artifactId>junit-platform-suite-api</artifactId>
197+
<artifactId>junit-platform-suite</artifactId>
186198
<version>1.11.3</version>
187199
<scope>test</scope>
188200
</dependency>
189201
<dependency>
190202
<groupId>org.mockito</groupId>
191203
<artifactId>mockito-junit-jupiter</artifactId>
192-
<version>5.14.2</version>
204+
<version>${mockito.version}</version>
193205
<scope>test</scope>
194206
</dependency>
195207
<dependency>
@@ -230,7 +242,7 @@
230242
<plugin>
231243
<groupId>org.springframework.boot</groupId>
232244
<artifactId>spring-boot-maven-plugin</artifactId>
233-
<version>${spring-version}</version>
245+
<version>${spring.version}</version>
234246
<configuration>
235247
<mainClass>dev.markodojkic.softwaredevelopmentsimulation.SoftwareDevelopmentSimulationApp</mainClass>
236248
<layout>JAR</layout>
@@ -252,26 +264,27 @@
252264
<target>22</target>
253265
</configuration>
254266
</plugin>
267+
<plugin>
268+
<groupId>org.sonarsource.scanner.maven</groupId>
269+
<artifactId>sonar-maven-plugin</artifactId>
270+
<version>5.0.0.4389</version>
271+
</plugin>
255272
<plugin>
256273
<groupId>org.jacoco</groupId>
257274
<artifactId>jacoco-maven-plugin</artifactId>
258-
<version>0.8.12</version>
275+
<version>${jacoco.version}</version>
259276
<executions>
260277
<execution>
261278
<goals>
262279
<goal>prepare-agent</goal>
263-
</goals>
264-
</execution>
265-
<execution>
266-
<id>report</id>
267-
<phase>test</phase>
268-
<goals>
269280
<goal>report</goal>
270281
</goals>
282+
<phase>test</phase>
271283
<configuration>
272284
<excludes>
273285
<exclude>dev/markodojkic/softwaredevelopmentsimulation/SoftwareDevelopmentSimulationApp.class</exclude>
274286
</excludes>
287+
<destFile>${project.build.directory}/site/jacoco/jacoco.xml</destFile>
275288
</configuration>
276289
</execution>
277290
</executions>
@@ -282,18 +295,27 @@
282295
<version>3.5.1</version>
283296
<configuration>
284297
<argLine>
285-
${argLine} <!-- Defines jacoco javaagent -->
286298
-Dspring.profiles.active=test
287299
-Xshare:off
288300
-XX:+EnableDynamicAgentLoading
289-
-javaagent:${user.home}/.m2/repository/com/github/hazendaz/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar
301+
-javaagent:${settings.localRepository}/com/github/hazendaz/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
302+
-javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar
303+
-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=target/jacoco.exec
290304
</argLine>
305+
<includes>dev/markodojkic/softwaredevelopmentsimulation/test/SoftwareDevelopmentSimulationAppTestsSuite</includes>
291306
</configuration>
292307
</plugin>
293308
<plugin>
294309
<groupId>org.codehaus.mojo</groupId>
295310
<artifactId>versions-maven-plugin</artifactId>
296311
<version>2.17.1</version>
312+
<executions>
313+
<execution>
314+
<goals>
315+
<goal>use-latest-versions</goal>
316+
</goals>
317+
</execution>
318+
</executions>
297319
</plugin>
298320
</plugins>
299321
</build>

src/main/java/dev/markodojkic/softwaredevelopmentsimulation/model/BaseTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public String toString() {
4040
}
4141

4242
public void setAssignee(Developer assignee) {
43-
this.assignee = this.assignee == null ? assignee : this.assignee;
43+
this.assignee = assignee == null ? this.assignee : assignee;
4444
}
4545

4646
public void setReporter(Developer reporter) {
47-
this.reporter = this.reporter == null ? reporter : this.reporter;
47+
this.reporter = reporter == null ? this.reporter : reporter;
4848
}
4949
}

src/main/java/dev/markodojkic/softwaredevelopmentsimulation/util/Utilities.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ public class Utilities {
6666
static {
6767
boolean isTesting = System.getProperty("spring.profiles.active", "default").equals("test");
6868

69-
Path base = isTesting ? Paths.get("src/test/resources", "dev.markodojkic.software_development_simulation.testing_data") : Paths.get(System.getProperty("user.home"), "dev.markodojkic", "software_development_simulation", "1.4.0");
69+
currentApplicationDataPath = isTesting ? Paths.get("src/test/resources", "dev.markodojkic.software_development_simulation.testing_data") : Paths.get(System.getProperty("user.home"), "dev.markodojkic", "software_development_simulation", "1.4.0");
7070

71-
currentApplicationDataPath = base;
72-
currentApplicationLogsPath = Paths.get(String.valueOf(base), "logs", isTesting ? "2012-12-12 00-00-00" : ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH-mm-ss")));
71+
currentApplicationLogsPath = Paths.get(String.valueOf(currentApplicationDataPath), "logs", isTesting ? "2012-12-12 00-00-00" : ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH-mm-ss")));
7372

74-
if(isTesting){
73+
if(!Files.exists(currentApplicationDataPath)){
7574
try {
7675
Files.createDirectories(currentApplicationDataPath);
7776
Files.createDirectories(currentApplicationLogsPath);

src/main/resources/banner.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
|___/_|_| |_| |_|\__,_|_|\__,_|\__\___/|_|
1717

1818
Application version: ${application.version}
19-
Powered by Spring Boot (v${spring-version}) and Spring Integration (v${spring-integration-version})
19+
Powered by Spring Boot (v${spring.version}) and Spring Integration (v${spring-integration.version})
2020
Ⓒ Marko Dojkić 2024

src/test/java/dev/markodojkic/softwaredevelopmentsimulation/test/BaseTaskTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.markodojkic.softwaredevelopmentsimulation.test;
22

3+
import com.fasterxml.jackson.core.JsonProcessingException;
34
import dev.markodojkic.softwaredevelopmentsimulation.enums.Priority;
45
import dev.markodojkic.softwaredevelopmentsimulation.enums.DeveloperType;
56
import dev.markodojkic.softwaredevelopmentsimulation.model.BaseTask;
@@ -8,7 +9,9 @@
89
import org.junit.jupiter.api.Test;
910

1011
import java.time.ZonedDateTime;
12+
import java.util.ArrayList;
1113

14+
import static dev.markodojkic.softwaredevelopmentsimulation.util.Utilities.*;
1215
import static org.junit.jupiter.api.Assertions.*;
1316
import static org.mockito.Mockito.mock;
1417
import static org.mockito.Mockito.when;
@@ -25,6 +28,11 @@ void when_noArgsConstructorIsCalled_correctValuesAreSetAsDefault() {
2528
assertNull(task.getAssignee());
2629
assertNull(task.getReporter());
2730
assertNull(task.getCreatedOn());
31+
32+
// Assertion for toString method
33+
String expectedToString = "BaseTask{id='null', name='null', description='null', priority=null, assignee='UNASSIGNED', reporter='UNASSIGNED', createdOn=null}";
34+
35+
assertEquals(expectedToString, task.toString());
2836
}
2937

3038
@Test
@@ -82,6 +90,7 @@ void when_equalsOrHashCodeIsCalled_onEqualObjectAreSame_onNonEqualObjectsAreDiff
8290
// Test equality
8391
assertEquals(task1, task2);
8492
assertEquals(task1.hashCode(), task2.hashCode());
93+
assertNotEquals(task1, assignee1);
8594

8695
// Create tasks with different IDs
8796
BaseTask task3 = new BaseTask("2", "Task Name", "Task Description", Priority.NORMAL, assignee1, reporter1, ZonedDateTime.now());
@@ -134,6 +143,15 @@ void when_gettersAndSettersAreCalled_valuesAreCorrectlyRetrievedOrSet() {
134143
assertEquals(Priority.CRITICAL, task.getPriority());
135144
assertEquals("assignee 1", task.getAssignee().getDisplayName());
136145
assertEquals("reporter 1", task.getReporter().getDisplayName());
146+
task.setAssignee(null);
147+
task.setReporter(null);
148+
assertEquals("assignee 1", task.getAssignee().getDisplayName());
149+
assertEquals("reporter 1", task.getReporter().getDisplayName());
137150
assertNotNull(task.getCreatedOn());
138151
}
152+
153+
@Test
154+
void when_emptyListIsPassedToJSONSerializer_emptyJSONArrayIsRetrieved() throws JsonProcessingException {
155+
assertEquals("[]", getObjectMapper().writeValueAsString(new ArrayList<>()));
156+
}
139157
}

0 commit comments

Comments
 (0)