GH-614 - Expose factory method to create a (SpringBoot)ApplicationRuntime.
We now expose ApplicationRuntime.of(ApplicationContext) to create a SpringBootApplicationRuntime as that's needed a lot in integration tests for runtime and observability components.
This commit is contained in:
@@ -27,7 +27,6 @@ import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.modulith.core.ApplicationModules;
|
||||
import org.springframework.modulith.runtime.autoconfigure.TestSpringBootApplicationRuntime;
|
||||
import org.springframework.modulith.test.TestApplicationModules;
|
||||
|
||||
/**
|
||||
@@ -43,7 +42,7 @@ public class ApplicationModulesRuntimeIntegrationTests {
|
||||
void detectsTypeInAdditionalPackageAsApplicationType() {
|
||||
|
||||
var context = SpringApplication.run(SampleApplication.class);
|
||||
var applicationRuntime = new TestSpringBootApplicationRuntime(context);
|
||||
var applicationRuntime = ApplicationRuntime.of(context);
|
||||
|
||||
var runtime = new ApplicationModulesRuntime(() -> modules, applicationRuntime);
|
||||
|
||||
@@ -55,7 +54,7 @@ public class ApplicationModulesRuntimeIntegrationTests {
|
||||
void onlyLooksUpApplicationModulesOnce() {
|
||||
|
||||
var context = SpringApplication.run(SampleApplication.class);
|
||||
var applicationRuntime = new TestSpringBootApplicationRuntime(context);
|
||||
var applicationRuntime = ApplicationRuntime.of(context);
|
||||
var supplier = new CountingSupplier<>(() -> modules);
|
||||
|
||||
var runtime = new ApplicationModulesRuntime(supplier, applicationRuntime);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.modulith.runtime.autoconfigure;
|
||||
package org.springframework.modulith.runtime;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.modulith.runtime.ApplicationRuntime;
|
||||
import org.springframework.modulith.runtime.SpringBootApplicationRuntime;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SpringBootApplicationRuntime}.
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.modulith.runtime.autoconfigure;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class TestSpringBootApplicationRuntime extends SpringBootApplicationRuntime {
|
||||
|
||||
public TestSpringBootApplicationRuntime(ApplicationContext context) {
|
||||
super(context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user