Skip to content

Commit

Permalink
fix(deps): update dependencies (#603)
Browse files Browse the repository at this point in the history
* fix(deps): update dependencies

* fix(kafka): Add sslbundle to kafka config, disable pitest verbose

---------

Co-authored-by: juancgalvis <8420868+juancgalvis@users.noreply.github.com>
  • Loading branch information
1 parent b81e5f6 commit 71e568a
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/main/java/co/com/bancolombia/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ public final class Constants {
public static final String APP_SERVICE = "app-service";
public static final String PATH_GRAPHQL = "/graphql";
// dependencies
public static final String SECRETS_VERSION = "4.4.23";
public static final String SPRING_BOOT_VERSION = "3.3.5";
public static final String SECRETS_VERSION = "4.4.24";
public static final String SPRING_BOOT_VERSION = "3.4.0";
public static final String LOMBOK_VERSION = "1.18.36";
public static final String REACTIVE_COMMONS_VERSION = "5.1.0-beta";
public static final String REACTIVE_COMMONS_VERSION = "5.1.2-beta";
public static final String REACTIVE_COMMONS_MAPPER_VERSION = "0.1.0";
public static final String BLOCK_HOUND_VERSION = "1.0.10.RELEASE";
public static final String AWS_BOM_VERSION = "2.29.15";
public static final String COMMONS_JMS_VERSION = "2.3.5";
public static final String AWS_BOM_VERSION = "2.29.34";
public static final String COMMONS_JMS_VERSION = "2.3.6";
public static final String GRAPHQL_KICKSTART_VERSION = "15.1.0";
public static final String ARCH_UNIT_VERSION = "1.3.0";
public static final String OKHTTP_VERSION = "4.12.0";
public static final String RESILIENCE_4J_VERSION = "2.2.0";
public static final String BIN_STASH_VERSION = "1.2.6";
public static final String SPRING_DOC_OPENAPI_VERSION = "2.6.0";
public static final String SPRING_DOC_OPENAPI_VERSION = "2.7.0";
// gradle plugins
public static final String JACOCO_VERSION = "0.8.12";
public static final String SONAR_VERSION = "6.0.1.5171";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package co.com.bancolombia.factory.upgrades.actions;

import static co.com.bancolombia.Constants.MainFiles.MAIN_GRADLE;

import co.com.bancolombia.factory.ModuleBuilder;
import co.com.bancolombia.factory.upgrades.UpdateUtils;
import co.com.bancolombia.factory.upgrades.UpgradeAction;
import lombok.SneakyThrows;

public class UpgradeY2024M12D18PitestVerbose implements UpgradeAction {

@Override
@SneakyThrows
public boolean up(ModuleBuilder builder) {
return builder.updateFile(
MAIN_GRADLE, content -> UpdateUtils.replace(content, "verbose = true", "verbose = false"));
}

@Override
public String name() {
return "3.20.5->3.20.6";
}

@Override
public String description() {
return "Set verbose to false in pitest";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package {{package}}.kafka.consumer.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.reactive.ReactiveKafkaConsumerTemplate;
Expand All @@ -17,14 +18,18 @@ public class KafkaConfig {
@Bean
public ReceiverOptions<String, String> kafkaReceiverOptions(
@Value(value = "${adapters.kafka.consumer.topic}") String topic,
KafkaProperties kafkaProperties) throws UnknownHostException {
kafkaProperties.setClientId(InetAddress.getLocalHost().getHostName()); // Set id based on hostname, customize here another properties
ReceiverOptions<String, String> basicReceiverOptions = ReceiverOptions.create(kafkaProperties.buildConsumerProperties());
KafkaProperties kafkaProperties,
SslBundles sslBundles) throws UnknownHostException {
// Set id based on hostname, customize here another properties
kafkaProperties.setClientId(InetAddress.getLocalHost().getHostName());
ReceiverOptions<String, String> basicReceiverOptions =
ReceiverOptions.create(kafkaProperties.buildConsumerProperties(sslBundles));
return basicReceiverOptions.subscription(Collections.singletonList(topic));
}

@Bean
public ReactiveKafkaConsumerTemplate<String, String> reactiveKafkaConsumerTemplate(ReceiverOptions<String, String> kafkaReceiverOptions) {
public ReactiveKafkaConsumerTemplate<String, String> reactiveKafkaConsumerTemplate(
ReceiverOptions<String, String> kafkaReceiverOptions) {
return new ReactiveKafkaConsumerTemplate<>(kafkaReceiverOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

@Component
{{#lombok}}
@Log4j2
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public class ApiRest {
@GetMapping(path = "/path")
public Mono<String> commandName() {
// return useCase.doAction();
return Mono.just("Hello World");
return Mono.just("");
}
}
2 changes: 1 addition & 1 deletion src/main/resources/structure/root/main.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ subprojects {
excludedClasses = []
excludedTestClasses = []
pitestVersion = '1.17.1'
verbose = true
verbose = false
outputFormats = ['XML', 'HTML']
threads = 8
exportLineCoverage = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package co.com.bancolombia.factory.upgrades.actions;

import static co.com.bancolombia.Constants.MainFiles.MAIN_GRADLE;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import co.com.bancolombia.factory.ModuleBuilder;
import co.com.bancolombia.factory.upgrades.UpgradeAction;
import co.com.bancolombia.utils.FileUtils;
import com.github.mustachejava.resolver.DefaultResolver;
import java.io.IOException;
import java.nio.file.Files;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
class UpgradeY2024M12D18PitestVerboseTest {

@Mock private Project project;
@Mock private Logger logger;

private ModuleBuilder builder;
private UpgradeAction updater;

@BeforeEach
public void setup() throws IOException {
when(project.getName()).thenReturn("UtilsTest");
when(project.getLogger()).thenReturn(logger);
when(project.getProjectDir()).thenReturn(Files.createTempDirectory("sample").toFile());

builder = spy(new ModuleBuilder(project));
updater = new UpgradeY2024M12D18PitestVerbose();

assertNotNull(updater.name());
assertNotNull(updater.description());
}

@Test
void shouldApplyUpdate() throws IOException {
DefaultResolver resolver = new DefaultResolver();
// Arrange
builder.addFile(
MAIN_GRADLE, FileUtils.getResourceAsString(resolver, "pitest-verbose/main-before.txt"));
// Act
boolean applied = updater.up(builder);
// Assert
assertTrue(applied);
verify(builder)
.addFile(
MAIN_GRADLE, FileUtils.getResourceAsString(resolver, "pitest-verbose/main-after.txt"));
}
}
129 changes: 129 additions & 0 deletions src/test/resources/pitest-verbose/main-after.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
apply plugin: 'info.solidsoft.pitest.aggregator'

allprojects {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
}

subprojects {
apply plugin: 'info.solidsoft.pitest'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'io.spring.dependency-management'

compileJava.dependsOn validateStructure
java {
sourceCompatibility = JavaVersion.VERSION_17
}

test {
useJUnitPlatform()
}

dependencies {
implementation platform('software.amazon.awssdk:bom:2.29.15')
implementation 'io.projectreactor:reactor-core'
implementation 'io.projectreactor.addons:reactor-extra'

testImplementation 'io.projectreactor.tools:blockhound-junit-platform:1.0.10.RELEASE'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
implementation platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
}

tasks.withType(Test).configureEach {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
jvmArgs += [
"-XX:+AllowRedefinitionToAddDeleteMethods"
]
}
}

test.finalizedBy(project.tasks.jacocoTestReport)

pitest {
targetClasses = ['your.package.*']
excludedClasses = []
excludedTestClasses = []
pitestVersion = '1.16.1'
verbose = false
outputFormats = ['XML', 'HTML']
threads = 8
exportLineCoverage = true
timestampedReports = false
//mutators = ['STRONGER', 'DEFAULTS']
fileExtensionsToFilter.addAll('xml', 'orbit')
junit5PluginVersion = '1.2.1'
failWhenNoMutations = false
jvmArgs = ["-XX:+AllowRedefinitionToAddDeleteMethods"]
}

jacocoTestReport {
dependsOn test, 'pitest'
reports {
xml.setRequired true
xml.setOutputLocation layout.buildDirectory.file("reports/jacoco.xml")
csv.setRequired false
html.setOutputLocation layout.buildDirectory.dir("reports/jacocoHtml")
}
}

}

jacoco {
toolVersion = "${jacocoVersion}"
reportsDirectory.set(layout.buildDirectory.dir("reports"))
}

tasks.register('jacocoMergedReport', JacocoReport) {
dependsOn = [test, subprojects.jacocoTestReport, pitestReportAggregate]
additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.setFrom files(subprojects.sourceSets.main.output)
executionData.setFrom project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
reports {
xml.setRequired true
csv.setRequired false
html.setRequired true
}
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs = [
'-Amapstruct.suppressGeneratorTimestamp=true'
]
}


pitestReportAggregate {
doLast {
def reportDir = layout.buildDirectory.dir("reports/pitest").get().asFile
def consolidatedReport = new File(reportDir, 'mutations.xml')
consolidatedReport.withWriter { writer ->
writer.write("<mutations>\n")
subprojects.each { subproject ->
def xmlReport = subproject.layout.buildDirectory.file("reports/pitest/mutations.xml").get().asFile
if (xmlReport.exists()) {
def xmlContent = xmlReport.text
xmlContent = xmlContent.replaceAll("<\\?xml[^>]*>", "")
xmlContent = xmlContent.replaceAll("</?mutations( partial=\"true\")?>", "")
writer.write(xmlContent.trim() + "\n")
}
}
writer.write("</mutations>")
}
}
}

tasks.named('wrapper') {
gradleVersion = '8.10.2'
}
Loading

0 comments on commit 71e568a

Please sign in to comment.