Skip to content

Commit

Permalink
build: Micronaut Framework 3.9.1 (micronaut-projects#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo authored May 4, 2023
1 parent 968832b commit 1e1d9e4
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.micronaut.core.io.ResourceResolver;
import io.micronaut.starter.build.dependencies.Coordinate;
import io.micronaut.starter.build.dependencies.DefaultPomDependencyVersionResolver;
import io.micronaut.starter.build.dependencies.StarterCoordinates;
import jakarta.inject.Singleton;

import java.util.Map;
Expand All @@ -23,6 +24,6 @@ public DefaultPomDependencyVersionResolverReplacement(ResourceResolver resourceR
@Override
@NonNull
public Optional<Coordinate> resolve(@NonNull String artifactId) {
return Optional.ofNullable(coordinates.get(artifactId));
return Optional.ofNullable(coordinates.computeIfAbsent(artifactId, k -> StarterCoordinates.ALL_COORDINATES.get(artifactId)));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example.micronaut

import io.opentelemetry.extension.annotations.SpanAttribute
import io.opentelemetry.extension.annotations.WithSpan
import io.opentelemetry.instrumentation.annotations.SpanAttribute
import io.opentelemetry.instrumentation.annotations.WithSpan
import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.Tracer
import jakarta.inject.Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import io.micronaut.http.annotation.QueryValue
import io.micronaut.http.client.annotation.Client
import io.micronaut.tracing.annotation.ContinueSpan
import io.micronaut.tracing.annotation.SpanTag
import io.opentelemetry.extension.annotations.SpanAttribute
import io.opentelemetry.extension.annotations.WithSpan
import io.opentelemetry.instrumentation.annotations.SpanAttribute
import io.opentelemetry.instrumentation.annotations.WithSpan

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package example.micronaut;

import io.opentelemetry.extension.annotations.SpanAttribute;
import io.opentelemetry.extension.annotations.WithSpan;
import io.opentelemetry.instrumentation.annotations.SpanAttribute;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.Tracer;
import jakarta.inject.Singleton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import io.micronaut.http.client.annotation.Client;
import io.micronaut.tracing.annotation.ContinueSpan;
import io.micronaut.tracing.annotation.SpanTag;
import io.opentelemetry.extension.annotations.SpanAttribute;
import io.opentelemetry.extension.annotations.WithSpan;
import io.opentelemetry.instrumentation.annotations.SpanAttribute;
import io.opentelemetry.instrumentation.annotations.WithSpan;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package example.micronaut

import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.Tracer
import io.opentelemetry.extension.annotations.SpanAttribute
import io.opentelemetry.extension.annotations.WithSpan
import io.opentelemetry.instrumentation.annotations.SpanAttribute
import io.opentelemetry.instrumentation.annotations.WithSpan
import jakarta.inject.Singleton
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.abs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import io.micronaut.http.annotation.QueryValue
import io.micronaut.http.client.annotation.Client
import io.micronaut.tracing.annotation.ContinueSpan
import io.micronaut.tracing.annotation.SpanTag
import io.opentelemetry.extension.annotations.SpanAttribute
import io.opentelemetry.extension.annotations.WithSpan
import io.opentelemetry.instrumentation.annotations.SpanAttribute
import io.opentelemetry.instrumentation.annotations.WithSpan

@Client("/warehouse") // <1>
interface WarehouseClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apps": [
{
"name": "default",
"features": ["junit-params"]
"features": ["junit-params", "micronaut-validation"]
}
],
"languages": ["java"]
Expand Down
2 changes: 1 addition & 1 deletion guides/micronaut-data-access-mybatis/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apps": [
{
"name": "default",
"features": ["graalvm", "flyway", "jdbc-hikari", "mybatis", "serialization-jackson"]
"features": ["graalvm", "flyway", "jdbc-hikari", "mybatis", "serialization-jackson", "micronaut-validation"]
}
]
}
2 changes: 1 addition & 1 deletion guides/micronaut-error-handling/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"apps": [
{
"name": "default",
"features": ["graalvm", "views-velocity", "geb", "serialization-jackson"]
"features": ["graalvm", "views-velocity", "geb", "serialization-jackson", "micronaut-validation"]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ datasources:
driverClassName: org.h2.Driver
username: sa
password: ''
schema-generate: CREATE_DROP
dialect: H2
#end::datasource[]
netty:
Expand Down
2 changes: 1 addition & 1 deletion guides/micronaut-microstream-persistence/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apps": [
{
"name": "default",
"features": ["microstream", "serialization-jackson"]
"features": ["microstream", "serialization-jackson", "micronaut-validation"]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
package example.micronaut;

import io.micronaut.core.io.socket.SocketUtils;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;

public class FakeGcsServerContainer extends FixedHostPortGenericContainer<FakeGcsServerContainer> {
class FakeGcsServerContainer extends GenericContainer<FakeGcsServerContainer> {

public static final String DEFAULT_IMAGE_NAME = "fsouza/fake-gcs-server:1.40.1";
public static final int DEFAULT_PORT = 4443;
private static final String DEFAULT_IMAGE_NAME = "fsouza/fake-gcs-server:1.40.1";
private static final int DEFAULT_PORT = 4443;

private int port;

public FakeGcsServerContainer(String dockerImageName) {
super(dockerImageName);
}

@Override
protected void configure() {
super.configure();

this.port = SocketUtils.findAvailableTcpPort();
addFixedExposedPort(port, DEFAULT_PORT);

withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("/bin/fake-gcs-server", "-scheme", "http"));
public FakeGcsServerContainer() {
super(DEFAULT_IMAGE_NAME);
this.withExposedPorts(DEFAULT_PORT)
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("/bin/fake-gcs-server", "-scheme", "http"));
}

public int getPort() {
return port;
public String getUrl() {
if (!isRunning()) {
start();
}
return String.format("http://%s:%s", getHost(), getMappedPort(DEFAULT_PORT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,17 @@
import com.google.cloud.storage.BucketInfo;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import io.micronaut.context.annotation.Bean;
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Primary;
import io.micronaut.context.annotation.Property;
import io.micronaut.context.annotation.Requires;
import io.micronaut.context.event.BeanCreatedEvent;
import io.micronaut.context.event.BeanCreatedEventListener;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.gcp.GoogleCloudConfiguration;
import io.micronaut.objectstorage.googlecloud.GoogleCloudStorageConfiguration;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import java.io.IOException;
Expand All @@ -36,33 +31,25 @@ class ProfilePicturesControllerTest extends AbstractProfilePicturesControllerTes

static final String SPEC_NAME = "ProfilePicturesControllerTest";

static FakeGcsServerContainer fakeGcs = new FakeGcsServerContainer(FakeGcsServerContainer.DEFAULT_IMAGE_NAME);
@Container
static FakeGcsServerContainer fakeGcs = new FakeGcsServerContainer();

@Inject
Storage client;

@Inject
GoogleCloudStorageConfiguration configuration;

@BeforeAll
static void beforeAll() {
fakeGcs.start();
}

@BeforeEach
void beforeEach() {
client.create(BucketInfo.newBuilder(configuration.getBucket()).build());
}

@AfterEach
void afterEach() {
client.get(configuration.getBucket()).delete();
}

@AfterAll
static void afterAll() {
fakeGcs.stop();
}

@Override
protected void assertThatFileIsStored(String key, String expected) throws IOException {
BlobId blobId = BlobId.of(configuration.getBucket(), key);
Expand All @@ -78,9 +65,8 @@ static class FakeGcsFactory {
@Singleton
@Primary
Storage storage() {
String fakeGcsExternalUrl = String.format("http://%s:%s", fakeGcs.getHost(), fakeGcs.getPort());
return StorageOptions.newBuilder()
.setHost(fakeGcsExternalUrl)
.setHost(fakeGcs.getUrl())
.setProjectId("test-project")
.setCredentials(NoCredentials.getInstance())
.build()
Expand Down
2 changes: 1 addition & 1 deletion guides/micronaut-scope-types/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"apps": [
{
"name": "default",
"features": ["junit-params","management"]
"features": ["junit-params","management", "micronaut-validation"]
}
]
}
2 changes: 1 addition & 1 deletion guides/micronaut-spring-boot/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apps": [
{
"name": "default",
"features": ["spring-web","spring-boot", "views-thymeleaf"]
"features": ["spring-web","spring-boot", "views-thymeleaf", "micronaut-validation"]
}
]
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.9
3.9.1

0 comments on commit 1e1d9e4

Please sign in to comment.