Refactor the CR plugin to a Lifecycle one

This commit is contained in:
Sébastien Deleuze
2024-06-14 18:29:28 +02:00
parent b3612bd36c
commit e4ff6fc20c
110 changed files with 264 additions and 261 deletions

View File

@@ -150,7 +150,7 @@ configuration:
[source,]
----
crSmokeTest {
lifecycleSmokeTest {
checkpointEvent = "com.example.MyCustomEvent"
}
----

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,15 +9,15 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("io.micrometer:micrometer-registry-prometheus")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.actuator.webmvc;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,15 +9,15 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("io.micrometer:micrometer-registry-prometheus")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.actuator.webmvc;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -10,7 +10,7 @@ buildscript {
plugins {
id "io.spring.javaformat" version "$javaFormatVersion" apply false
id "org.jetbrains.kotlin.jvm" version "$kotlinVersion" apply false
id "org.springframework.cr.smoke-test-aggregator"
id "org.springframework.lifecycle.smoke-test-aggregator"
}
subprojects {

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
// Not using Spring Cloud bom due to existing issues with dependency management
@@ -14,16 +14,16 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
implementation("org.springframework.cloud:spring-cloud-starter:${springCloudStarterVersion}")
runtimeOnly("org.postgresql:postgresql")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation(project(":cloud:context-refresh-hikari"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -10,8 +10,8 @@ import com.example.contextrefreshhikari.entities.User;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
ext {
@@ -12,15 +12,15 @@ dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
implementation("org.springframework.cloud:spring-cloud-starter:$springCloudStarterVersion")
implementation("org.springframework.boot:spring-boot-starter-actuator")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -9,7 +9,7 @@ import java.nio.file.StandardOpenOption;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
ext {
@@ -13,15 +13,15 @@ dependencies {
org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
implementation("org.springframework.cloud:spring-cloud-starter:$springCloudStarterVersion")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -9,7 +9,7 @@ import java.nio.file.StandardOpenOption;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
// Not using Spring Cloud bom due to existing issues with dependency management
@@ -13,14 +13,14 @@ dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer:${springCloudCommonsVerions}")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.loadbalancing;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,2 +0,0 @@
org.springframework.context.ApplicationListener=\
org.springframework.cr.listener.CheckpointListener

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,16 +9,16 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("org.postgresql:postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = false
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
@ApplicationTest
public class DataJdbcApplicationTests {

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,16 +9,16 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("com.mysql:mysql-connector-j")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = false
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
@ApplicationTest
public class DataJpaApplicationTests {

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,14 +9,14 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = false
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
/**
* @author Christoph Strobl

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -12,16 +12,16 @@ dependencies {
implementation("org.hibernate.orm:hibernate-core")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("com.mysql:mysql-connector-j")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = false
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
@ApplicationTest
public class HibernateApplicationTests {

View File

@@ -1,17 +1,17 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -6,8 +6,8 @@ import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,17 +1,17 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -5,8 +5,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,17 +1,17 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -7,8 +7,8 @@ import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,20 +1,20 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.webflux;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -14,13 +14,13 @@ dependencies {
}
}
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.webflux;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -14,13 +14,13 @@ dependencies {
}
}
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -18,7 +18,7 @@ package com.example.webmvc;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,20 +1,20 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -18,7 +18,7 @@ package com.example.webmvc;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -12,13 +12,13 @@ repositories {
gradlePlugin {
plugins {
crSmokeTestPlugin {
id = "org.springframework.cr.smoke-test"
implementationClass = "org.springframework.cr.gradle.CrSmokeTestPlugin"
lifecycleSmokeTestPlugin {
id = "org.springframework.lifecycle.smoke-test"
implementationClass = "org.springframework.lifecycle.gradle.LifecycleSmokeTestPlugin"
}
crSmokeTestAggregatorPlugin {
id = "org.springframework.cr.smoke-test-aggregator"
implementationClass = "org.springframework.cr.gradle.CrSmokeTestAggregatorPlugin"
lifecycleSmokeTestAggregatorPlugin {
id = "org.springframework.lifecycle.smoke-test-aggregator"
implementationClass = "org.springframework.lifecycle.gradle.LifecycleSmokeTestAggregatorPlugin"
}
}
}

View File

@@ -13,4 +13,4 @@ pluginManagement {
}
}
rootProject.name="cr-smoke-test-plugin"
rootProject.name="lifecycle-smoke-test-plugin"

View File

@@ -14,15 +14,15 @@
* limitations under the License.
*/
package org.springframework.cr.gradle;
package org.springframework.lifecycle.gradle;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.TaskProvider;
import org.springframework.cr.gradle.tasks.UpdateConcoursePipeline;
import org.springframework.cr.gradle.tasks.UpdateStatusPage;
import org.springframework.lifecycle.gradle.tasks.UpdateConcoursePipeline;
import org.springframework.lifecycle.gradle.tasks.UpdateStatusPage;
/**
* Plugin for a project that aggregates the smoke tests to provide status and a CI
@@ -31,7 +31,7 @@ import org.springframework.cr.gradle.tasks.UpdateStatusPage;
* @author Andy Wilkinson
* @author Sebastien Deleuze
*/
public class CrSmokeTestAggregatorPlugin implements Plugin<Project> {
public class LifecycleSmokeTestAggregatorPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle;
package org.springframework.lifecycle.gradle;
import java.util.HashMap;
import java.util.Locale;
@@ -37,22 +37,21 @@ import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.testing.Test;
import org.gradle.api.tasks.testing.logging.TestExceptionFormat;
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile;
import org.springframework.boot.gradle.plugin.SpringBootPlugin;
import org.springframework.boot.gradle.tasks.bundling.BootJar;
import org.springframework.cr.gradle.dsl.CrSmokeTestExtension;
import org.springframework.cr.gradle.tasks.AppTest;
import org.springframework.cr.gradle.tasks.DescribeSmokeTests;
import org.springframework.cr.gradle.tasks.RestoreJvmApplication;
import org.springframework.cr.gradle.tasks.StartAndCheckpointJvmApplication;
import org.springframework.cr.gradle.tasks.StartApplication;
import org.springframework.cr.gradle.tasks.StartJvmApplication;
import org.springframework.cr.gradle.tasks.StopApplication;
import org.springframework.lifecycle.gradle.dsl.LifecycleSmokeTestExtension;
import org.springframework.lifecycle.gradle.tasks.AppTest;
import org.springframework.lifecycle.gradle.tasks.DescribeSmokeTests;
import org.springframework.lifecycle.gradle.tasks.RestoreJvmApplication;
import org.springframework.lifecycle.gradle.tasks.StartAndCheckpointJvmApplication;
import org.springframework.lifecycle.gradle.tasks.StartApplication;
import org.springframework.lifecycle.gradle.tasks.StartJvmApplication;
import org.springframework.lifecycle.gradle.tasks.StopApplication;
/**
* {@link Plugin} for a checkpoint/restore smoke test project. Configures an {@code appTest} source set
* {@link Plugin} for a lifecycle smoke test project. Configures an {@code appTest} source set
* and tasks for running the contained tests against the application running on the JVM
* and as a native image.
*
@@ -60,7 +59,7 @@ import org.springframework.cr.gradle.tasks.StopApplication;
* @author Moritz Halbritter
* @author Sebastien Deleuze
*/
public class CrSmokeTestPlugin implements Plugin<Project> {
public class LifecycleSmokeTestPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
@@ -70,8 +69,8 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
}
private void configureBootJavaProject(Project project) {
CrSmokeTestExtension extension = project.getExtensions()
.create("crSmokeTest", CrSmokeTestExtension.class, project);
LifecycleSmokeTestExtension extension = project.getExtensions()
.create("lifecycleSmokeTest", LifecycleSmokeTestExtension.class, project);
extension.getWebApplication().convention(false);
extension.getCheckpointEvent().convention("org.springframework.boot.context.event.ApplicationReadyEvent");
JavaPluginExtension javaExtension = project.getExtensions().getByType(JavaPluginExtension.class);
@@ -116,7 +115,7 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
dependencies.project(Map.of("path", project.getPath(), "configuration", smokeTests.getName())));
}
private void configureAppTests(Project project, CrSmokeTestExtension extension, SourceSet appTest) {
private void configureAppTests(Project project, LifecycleSmokeTestExtension extension, SourceSet appTest) {
configureJvmAppTests(project, appTest, extension);
configureJvmCrAppTests(project, appTest, extension);
}
@@ -134,14 +133,14 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
.setJvmTarget(javaExtension.getTargetCompatibility().toString()));
}
private void configureJvmAppTests(Project project, SourceSet sourceSet, CrSmokeTestExtension extension) {
private void configureJvmAppTests(Project project, SourceSet sourceSet, LifecycleSmokeTestExtension extension) {
Provider<RegularFile> archiveFile = project.getTasks()
.named(SpringBootPlugin.BOOT_JAR_TASK_NAME, BootJar.class)
.flatMap(BootJar::getArchiveFile);
configureTasks(project, sourceSet, ApplicationType.JVM, archiveFile, extension);
}
private void configureJvmCrAppTests(Project project, SourceSet sourceSet, CrSmokeTestExtension extension) {
private void configureJvmCrAppTests(Project project, SourceSet sourceSet, LifecycleSmokeTestExtension extension) {
Provider<RegularFile> archiveFile = project.getTasks()
.named(SpringBootPlugin.BOOT_JAR_TASK_NAME, BootJar.class)
.flatMap(BootJar::getArchiveFile);
@@ -149,7 +148,7 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
}
private TaskProvider<AppTest> configureTasks(Project project, SourceSet appTest, ApplicationType type,
Provider<RegularFile> applicationBinary, CrSmokeTestExtension extension) {
Provider<RegularFile> applicationBinary, LifecycleSmokeTestExtension extension) {
String dir = switch (type) {
case JVM -> "jvmApp";
case JVM_CHECKPOINT_RESTORE -> "jvmCrApp";
@@ -214,7 +213,7 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
private TaskProvider<? extends StartApplication> createRestoreApplicationTask(Project project,
Provider<RegularFile> applicationBinary, Provider<Directory> outputDirectory,
TaskProvider<? extends StartApplication> startTask, CrSmokeTestExtension extension) {
TaskProvider<? extends StartApplication> startTask, LifecycleSmokeTestExtension extension) {
TaskProvider<? extends StartApplication> restoreTask = project.getTasks().register("restoreApp", RestoreJvmApplication.class, (restore) -> {
restore.getApplicationBinary().set(applicationBinary);
restore.getOutputDirectory().set(outputDirectory);
@@ -253,7 +252,7 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
private TaskProvider<? extends StartApplication> createStartApplicationTask(Project project, ApplicationType type,
Provider<RegularFile> applicationBinary, Provider<Directory> outputDirectory,
CrSmokeTestExtension extension) {
LifecycleSmokeTestExtension extension) {
String taskName = switch (type) {
case JVM -> "startApp";
case JVM_CHECKPOINT_RESTORE -> "startAndCheckpointApp";
@@ -285,10 +284,10 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
task.getInputs()
.file(startTask.flatMap(StartApplication::getApplicationBinary))
.withPropertyName("applicationBinary");
task.systemProperty("org.springframework.cr.smoketest.standard-output",
task.systemProperty("org.springframework.lifecycle.smoketest.standard-output",
startTask.get().getOutputFile().get().getAsFile().getAbsolutePath());
if (checkpointTask != null && checkpointTask.isPresent()) {
task.systemProperty("org.springframework.cr.smoketest.standard-output-checkpoint",
task.systemProperty("org.springframework.lifecycle.smoketest.standard-output-checkpoint",
checkpointTask.get().getOutputFile().get().getAsFile().getAbsolutePath());
}
task.finalizedBy(stopTask);

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.dsl;
package org.springframework.lifecycle.gradle.dsl;
import javax.inject.Inject;
@@ -22,19 +22,19 @@ import org.gradle.api.Project;
import org.gradle.api.provider.Property;
/**
* DSL extension for configuring checkpoint/restore smoke tests.
* DSL extension for configuring lifecycle smoke tests.
*
* @author Andy Wilkinson
* @author Sebastien Deleuze
*/
public class CrSmokeTestExtension {
public class LifecycleSmokeTestExtension {
private final Property<Boolean> webApplication;
private final Property<String> checkpointEvent;
@Inject
public CrSmokeTestExtension(Project project) {
public LifecycleSmokeTestExtension(Project project) {
this.webApplication = project.getObjects().property(Boolean.class);
this.checkpointEvent = project.getObjects().property(String.class);
}

View File

@@ -17,4 +17,4 @@
/**
* DSL for smoke testing of applications using checkpoint/restore.
*/
package org.springframework.cr.gradle.dsl;
package org.springframework.lifecycle.gradle.dsl;

View File

@@ -17,4 +17,4 @@
/**
* Gradle plugin for smoke testing of applications using checkpoint/restore.
*/
package org.springframework.cr.gradle;
package org.springframework.lifecycle.gradle;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.io.FileInputStream;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.tasks.Internal;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.io.IOException;

View File

@@ -1,4 +1,4 @@
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.util.ArrayList;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.util.Properties;

View File

@@ -1,4 +1,4 @@
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.io.IOException;
@@ -34,7 +34,7 @@ public abstract class StartAndCheckpointJvmApplication extends StartApplication
command.add("/bin/bash");
command.add("-c");
StringBuilder builder = new StringBuilder(executable.getAbsolutePath());
builder.append(" -Dorg.springframework.cr.smoketest.checkpoint=");
builder.append(" -Dorg.springframework.lifecycle.smoketest.checkpoint=");
builder.append(getCheckpointEvent().get());
builder.append(" -XX:CRaCCheckpointTo=");
builder.append(outputDirectory);

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.io.IOException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.util.ArrayList;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.IOException;
import java.nio.file.Files;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.File;
import java.io.FileWriter;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;
import java.io.IOException;
import java.nio.file.Files;

View File

@@ -17,4 +17,4 @@
/**
* Tasks for smoke testing of applications using checkpoint/restore.
*/
package org.springframework.cr.gradle.tasks;
package org.springframework.lifecycle.gradle.tasks;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -10,11 +10,11 @@ dependencies {
implementation("org.springframework.integration:spring-integration-file")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.integration:spring-integration-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -25,8 +25,8 @@ import java.util.UUID;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.util.StreamUtils;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -24,16 +24,16 @@ dependencies {
implementation("com.jayway.jsonpath:json-path")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
runtimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -22,8 +22,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -11,10 +11,10 @@ dependencies {
implementation("org.springframework.amqp:spring-rabbit:3.0.8")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -20,8 +20,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
id "com.github.davidmc24.gradle.plugin.avro" version "1.3.0"
}
@@ -17,11 +17,11 @@ dependencies {
implementation("org.apache.avro:avro:1.11.0")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -12,10 +12,10 @@ dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -20,8 +20,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -15,10 +15,10 @@ dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -21,8 +21,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -14,10 +14,10 @@ dependencies {
}
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -5,8 +5,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -13,10 +13,10 @@ dependencies {
}
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
appTestImplementation("org.awaitility:awaitility:4.2.0")
}

View File

@@ -5,8 +5,8 @@ import java.time.Duration;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.listener;
package org.springframework.lifecycle.listener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -28,12 +28,12 @@ import org.springframework.context.ApplicationListener;
/**
* {@link ApplicationListener} trigger a checkpoint when the application is fully started
* when the {@code org.springframework.cr.smoketest.checkpoint} JVM system property is set
* to {@code onApplicationReady}.
* when the {@code org.springframework.lifecycle.smoketest.checkpoint} JVM system property
* is set to {@code onApplicationReady}.
*/
class CheckpointListener implements ApplicationListener<ApplicationEvent> {
private static final String CHECKPOINT_EVENT_PROPERTY_NAME = "org.springframework.cr.smoketest.checkpoint";
private static final String CHECKPOINT_EVENT_PROPERTY_NAME = "org.springframework.lifecycle.smoketest.checkpoint";
private final Log logger = LogFactory.getLog(getClass());

View File

@@ -0,0 +1,2 @@
org.springframework.context.ApplicationListener=\
org.springframework.lifecycle.listener.CheckpointListener

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support;
package org.springframework.lifecycle.smoketest.support;
import java.io.File;
import java.io.IOException;
@@ -62,15 +62,15 @@ public class Output {
}
public static Output current() {
String outputProperty = System.getProperty("org.springframework.cr.smoketest.standard-output");
String outputProperty = System.getProperty("org.springframework.lifecycle.smoketest.standard-output");
if (outputProperty == null) {
throw new IllegalStateException(
"Standard output is not available as org.springframework.cr.smoketest.standard-output "
"Standard output is not available as org.springframework.lifecycle.smoketest.standard-output "
+ "system property has not been set");
}
Path outputCheckpointPath = null;
String outputCheckpointProperty = System
.getProperty("org.springframework.cr.smoketest.standard-output-checkpoint");
.getProperty("org.springframework.lifecycle.smoketest.standard-output-checkpoint");
if (outputCheckpointProperty != null) {
outputCheckpointPath = new File(outputCheckpointProperty).toPath();
}

View File

@@ -14,11 +14,11 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.assertj;
package org.springframework.lifecycle.smoketest.support.assertj;
import org.assertj.core.api.AssertProvider;
import org.springframework.cr.smoketest.support.Output;
import org.springframework.lifecycle.smoketest.support.Output;
/**
* An {@link AssertProvider} for {@link OutputAssert}.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.assertj;
package org.springframework.lifecycle.smoketest.support.assertj;
import java.util.List;
import java.util.Optional;
@@ -22,7 +22,7 @@ import java.util.Optional;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.error.BasicErrorMessageFactory;
import org.springframework.cr.smoketest.support.Output;
import org.springframework.lifecycle.smoketest.support.Output;
/**
* An {@link AbstractAssert} for {@link Output}.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -23,7 +23,7 @@ import java.net.URI;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.Extensions;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
import org.springframework.test.web.reactive.server.WebTestClient;
import static java.lang.annotation.ElementType.TYPE;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.util.List;
import java.util.regex.Matcher;
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.springframework.cr.smoketest.support.Output;
import org.springframework.lifecycle.smoketest.support.Output;
/**
* Provides access to data about the application which is being tested.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.net.URI;

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.springframework.cr.smoketest.support.assertj.AssertableOutput;
import org.springframework.lifecycle.smoketest.support.assertj.AssertableOutput;
/**
* {@link ParameterResolver} for {@link AssertableOutput}.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.time.Duration;
import java.time.Instant;
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.springframework.cr.smoketest.support.Output;
import org.springframework.lifecycle.smoketest.support.Output;
/**
* {@link BeforeAllCallback} that waits for the application to have started.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.util.Locale;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import java.util.Locale;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cr.smoketest.support.junit;
package org.springframework.lifecycle.smoketest.support.junit;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -16,14 +16,14 @@ dependencies {
implementation("com.unboundid:unboundid-ldapsdk")
implementation("org.crac:crac")
implementation("org.apache.commons:commons-pool2")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.security.ldap;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -20,16 +20,20 @@ public class MainController {
@GetMapping("/users")
public List<Person> users() {
return this.ldap.search().query((query) -> query.where("objectclass").is("person"))
.toList(new PersonContextMapper());
return this.ldap.search()
.query((query) -> query.where("objectclass").is("person"))
.toList(new PersonContextMapper());
}
private static final class PersonContextMapper extends AbstractContextMapper<Person> {
@Override
protected Person doMapFromContext(DirContextOperations ctx) {
Person.Essence essense = new Person.Essence(ctx);
essense.setUsername(ctx.getStringAttribute("uid"));
return (Person) essense.createUserDetails();
}
}
}

View File

@@ -46,8 +46,8 @@ public class SecurityConfig {
@Bean
UserDetailsService users() {
return new InMemoryUserDetailsManager(User.withUsername("user").password("{noop}password")
.authorities("app").build());
return new InMemoryUserDetailsManager(
User.withUsername("user").password("{noop}password").authorities("app").build());
}
}

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -15,14 +15,14 @@ dependencies {
implementation("org.springframework.security:spring-security-ldap")
implementation("com.unboundid:unboundid-ldapsdk")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -2,7 +2,7 @@ package com.example.security.ldap;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -9,16 +9,16 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.security:spring-security-oauth2-authorization-server:1.0.0-SNAPSHOT")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
appTestImplementation("com.fasterxml.jackson.core:jackson-databind")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

View File

@@ -8,7 +8,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.springframework.cr.smoketest.support.junit.ApplicationTest;
import org.springframework.lifecycle.smoketest.support.junit.ApplicationTest;
import org.springframework.http.HttpHeaders;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.util.LinkedMultiValueMap;

View File

@@ -1,7 +1,7 @@
plugins {
id "java"
id "org.springframework.boot"
id "org.springframework.cr.smoke-test"
id "org.springframework.lifecycle.smoke-test"
}
dependencies {
@@ -10,14 +10,14 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
implementation("com.squareup.okhttp3:mockwebserver")
implementation("org.crac:crac")
implementation(project(":cr-listener"))
implementation(project(":lifecycle-listener"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
appTestImplementation(project(":cr-smoke-test-support"))
appTestImplementation(project(":lifecycle-smoke-test-support"))
}
crSmokeTest {
lifecycleSmokeTest {
webApplication = true
}

Some files were not shown because too many files have changed in this diff Show More