-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CI updated - build renamed as build-dev - redundant dep submission removed * IDEA plugin configured for all * kafka consumer starter module created * tests added for util class * ci update * sonar and jacoco config * sonar and jacoco config * ci config enhanced
- Loading branch information
Showing
32 changed files
with
233 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
name: Feature/Bugfix Check | ||
name: Check Branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- feature/** | ||
- bugfix/** | ||
|
||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
- name: Get current branch name | ||
id: get_branch | ||
run: echo "CURRENT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3.1.0 | ||
- name: Build | ||
run: ./gradlew clean assemble | ||
run: CI=true ./gradlew clean assemble | ||
- name: Test | ||
run: ./gradlew test | ||
run: CI=true ./gradlew test | ||
- name: Integration Test | ||
run: ./gradlew integrationTest | ||
|
||
dependency-submission: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
- name: Generate and submit dependency graph | ||
uses: gradle/actions/dependency-submission@v3.1.0 | ||
run: CI=true ./gradlew integrationTest | ||
- name: Sonar Scan | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
BRANCH_NAME: ${{ env.CURRENT_BRANCH_NAME }} | ||
run: | | ||
echo "Branch name $BRANCH_NAME" | ||
CI=true ./gradlew sonar --info -Dsonar.branch.name=$BRANCH_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
module/app/data-generator/src/main/java/com/maemresen/data/generator/util/Topic.java
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugins { | ||
idea | ||
java | ||
jacoco | ||
id("org.springframework.boot") version "3.2.1" | ||
id("io.spring.dependency-management") version "1.1.4" | ||
} | ||
|
||
val avroVersion = "1.11.3" | ||
val confluentVersion = "7.6.1" | ||
val springCloudVersion = "2023.0.0" | ||
val lombokVersion = "1.18.30" | ||
|
||
repositories { | ||
maven { | ||
setUrl("https://packages.confluent.io/maven/") | ||
} | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}") | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter") | ||
implementation("org.springframework.cloud:spring-cloud-starter-stream-kafka") | ||
implementation("org.apache.avro:avro:$avroVersion") | ||
implementation("io.confluent:kafka-avro-serializer:$confluentVersion") | ||
implementation("io.confluent:kafka-schema-registry-client:$confluentVersion") | ||
implementation(project(":module:lib:k8s-workshop-avro-schemes")) | ||
implementation(project(":module:lib:k8s-workshop-messaging-spring-boot-starter")) | ||
|
||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
testImplementation("org.assertj:assertj-core") | ||
|
||
compileOnly("org.projectlombok:lombok:$lombokVersion") | ||
annotationProcessor("org.projectlombok:lombok:$lombokVersion") | ||
testCompileOnly("org.projectlombok:lombok:$lombokVersion") | ||
testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion") | ||
} |
4 changes: 3 additions & 1 deletion
4
...esen/data/generator/DataGeneratorApp.java → ...shop/data/generator/DataGeneratorApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ata/generator/config/SchedulerConfig.java → ...ata/generator/config/SchedulerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...onfig/props/SensorDataGeneratorProps.java → ...onfig/props/SensorDataGeneratorProps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...nerator/messaging/SensorDataProducer.java → ...nerator/messaging/SensorDataProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ata/generator/task/DataGeneratorTask.java → ...ata/generator/task/DataGeneratorTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
...test/java/com/maemresen/k8s/workshop/data/generator/util/SensorDataGeneratorUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.maemresen.k8s.workshop.data.generator.util; | ||
|
||
import com.maemresen.lib.message.dto.SensorData; | ||
import com.maemresen.lib.message.dto.SensorType; | ||
import org.junit.jupiter.api.Test; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class SensorDataGeneratorUtilTest { | ||
|
||
private static final String LOCATION_NAME = "Location"; | ||
private static final String DEVICE_NAME = "Device"; | ||
private static final String SENSOR_NAME = "Sensor"; | ||
private static final SensorType TEMPERATURE_SENSOR_TYPE = SensorType.TEMP; | ||
private static final SensorType HUMIDITY_SENSOR_TYPE = SensorType.HUMIDITY; | ||
|
||
@Test | ||
void generateRandomSensorData_shouldReturnNonNullSensorData() { | ||
final SensorData sensorData = SensorDataGeneratorUtil.generateRandomSensorData(LOCATION_NAME, DEVICE_NAME, SENSOR_NAME, TEMPERATURE_SENSOR_TYPE); | ||
assertThat(sensorData).isNotNull(); | ||
} | ||
|
||
@Test | ||
void generateRandomSensorData_shouldGenerateTemperatureWithinRange() { | ||
SensorData sensorData = SensorDataGeneratorUtil.generateRandomSensorData(LOCATION_NAME, DEVICE_NAME, SENSOR_NAME, TEMPERATURE_SENSOR_TYPE); | ||
assertThat(sensorData.getValue()).isBetween(SensorDataGeneratorUtil.TEMP_MIN_VALUE, SensorDataGeneratorUtil.TEMP_MAX_VALUE); | ||
} | ||
|
||
@Test | ||
void generateRandomSensorData_shouldGenerateHumidityWithinRange() { | ||
final SensorData sensorData = SensorDataGeneratorUtil.generateRandomSensorData(LOCATION_NAME, DEVICE_NAME, SENSOR_NAME, HUMIDITY_SENSOR_TYPE); | ||
assertThat(sensorData.getValue()).isBetween(SensorDataGeneratorUtil.HUMIDITY_MIN_VALUE, SensorDataGeneratorUtil.HUMIDITY_MAX_VALUE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/com/maemresen/listener/ListenerApp.java → ...en/k8s/workshop/listener/ListenerApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...istener/messaging/SensorDataConsumer.java → ...istener/messaging/SensorDataConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...mresen/listener/props/MessagingProps.java → ...rkshop/listener/props/MessagingProps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.