Refactor the CR plugin to a Lifecycle one
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.example.security.oauth2resourceserver;
|
||||
|
||||
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;
|
||||
|
||||
@@ -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,13 +9,13 @@ dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-webflux")
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
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
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.example.security.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;
|
||||
|
||||
@@ -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,13 +9,13 @@ dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
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
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.example.security.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;
|
||||
|
||||
Reference in New Issue
Block a user