Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:jaguililla/hexagonal_spring into…
Browse files Browse the repository at this point in the history
… develop

 Conflicts:
	.mvn/parent.xml
	README.md
  • Loading branch information
jaguililla committed Dec 23, 2024
2 parents 6b588ff + a7d9da0 commit dd2842b
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 51 deletions.
84 changes: 53 additions & 31 deletions .mvn/parent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,44 +117,23 @@

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<docker>
<publishRegistry>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</publishRegistry>
</docker>
<image>
<name>${image.registry}/${image.name}:${project.version}</name>
<tags>
<tag>${image.registry}/${image.name}:latest</tag>
</tags>
<env>
<JAVA_TOOL_OPTIONS>
-XX:+AlwaysPreTouch -XX:+UseParallelGC -XX:+UseNUMA
</JAVA_TOOL_OPTIONS>
<BPL_SPRING_AOT_ENABLED>true</BPL_SPRING_AOT_ENABLED>
<BP_SPRING_AOT_ENABLED>true</BP_SPRING_AOT_ENABLED>
<BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
</env>
</image>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
<executions>
<execution>
<id>image</id>
<goals>
<goal>build-image</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down Expand Up @@ -413,5 +392,48 @@
</plugins>
</build>
</profile>

<profile>
<id>buildpack</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<publishRegistry>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</publishRegistry>
</docker>
<image>
<name>${image.registry}/${image.name}:${project.version}</name>
<tags>
<tag>${image.registry}/${image.name}:latest</tag>
</tags>
<env>
<JAVA_TOOL_OPTIONS>
-XX:+AlwaysPreTouch -XX:+UseParallelGC -XX:+UseNUMA
</JAVA_TOOL_OPTIONS>
<BPL_SPRING_AOT_ENABLED>true</BPL_SPRING_AOT_ENABLED>
<BP_SPRING_AOT_ENABLED>true</BP_SPRING_AOT_ENABLED>
<BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
</env>
</image>
</configuration>
<executions>
<execution>
<id>image</id>
<goals>
<goal>build-image</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ configuration options and their default values can be checked [here][gatlingDefa
Those parameters can also be overwritten by system properties from the command line. I.e.:
`-D gatling.core.encoding=utf-8`

To run the Gatling test, execute `./mvnw -P gatling verify` at the shell.
To run the Gatling test, execute `./mvnw -P gatling` at the shell.

[Gatling settings]: https://docs.gatling.io/reference/script/core/configuration
[gatlingDefaults]: https://github.com/gatling/gatling/blob/main/gatling-core/src/main/resources/gatling-defaults.conf
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- data:/var/lib/postgresql/data
- ./src/test/resources/db:/docker-entrypoint-initdb.d
ports:
- "15432:5432"
- "127.0.0.1:15432:5432"

kafka:
image: docker.io/apache/kafka-native:3.8.0
Expand All @@ -33,7 +33,7 @@ services:
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_LOG_DIRS: /tmp/kraft-combined-logs
ports:
- "9092:9092"
- "127.0.0.1:9092:9092"

openobserve:
image: docker.io/openobserve/openobserve:v0.14.0
Expand All @@ -59,7 +59,7 @@ services:
JDBC_PASSWORD: root
KAFKA_SERVER: kafka:19092
ports:
- "18080:8080"
- "127.0.0.1:18080:8080"

volumes:
data:
Expand Down
68 changes: 52 additions & 16 deletions set_up.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,63 @@

import static java.util.Map.entry;

import java.io.Console;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
import java.util.stream.Stream;

private Console console = System.console();
Scanner scanner = new Scanner(System.in);
FileSystem fs = FileSystems.getDefault();

void main() {
var options = List.of(
entry("GitHub", prompt("Keep GitHub workflows and templates: (Yn)", "y")),
entry("GitLab", prompt("Keep GitLab workflows and templates: (Yn)", "y")),
entry("GitLab", prompt("Keep 'CODE_OF_CONDUCT.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep 'CONTRIBUTING.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep 'LICENSE.md' file: (Yn)", "y")),
entry("GitLab", prompt("Keep this set up file 'set_up.java' file: (Yn)", "y"))
);

// Rename artifacts, groups or base package
// Restart Git history (or delete it)
var deletions =
Stream.of(
entry(".github", prompt("Keep GitHub workflows and templates (Yn): ", "y")),
entry(".gitlab*", prompt("Keep GitLab workflows and templates (Yn): ", "y")),
entry("CODE_OF_CONDUCT.md", prompt("Keep 'CODE_OF_CONDUCT.md' file (Yn): ", "y")),
entry("CONTRIBUTING.md", prompt("Keep 'CONTRIBUTING.md' file (Yn): ", "y")),
entry("LICENSE.md", prompt("Keep 'LICENSE.md' file (Yn): ", "y")),
// entry(".git", prompt("Keep Git history (Yn): ", "y")),
entry("set_up.java", prompt("Keep this set up file 'set_up.java' file (Yn): ", "y"))
)
.filter(it -> it.getValue().equalsIgnoreCase("n"))
.toList();

// TODO Rename artifacts, groups or base package
// TODO Show summary before applying changes

deletions.forEach(it -> delete(it.getKey()));
}

public String prompt(String message, String defaultValue) {
console.printf(message);
var v = console.readLine();
String prompt(String message, String defaultValue) {
System.out.print(message);
var v = scanner.nextLine();
return v == null || v.isBlank() ? defaultValue : v;
}

void delete(String glob) {
var matcher = fs.getPathMatcher("glob:./" + glob);
var cwd = new File(".");
Optional
.ofNullable(cwd.listFiles(it -> matcher.matches(it.toPath())))
.map(List::of)
.orElse(List.of())
.forEach(it -> {
try (Stream<Path> paths = Files.walk(it.toPath())) {
paths
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(System.out::println); // (File::delete);
}
catch (IOException _) {
System.out.println("Error deleting " + it);
}
});
}

0 comments on commit dd2842b

Please sign in to comment.