Skip to content

Commit

Permalink
Tests for Spring Boot 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
valb3r committed Aug 12, 2023
1 parent 2c0bcbb commit c72d0b3
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ repositories {
}

ext {
spring = '6.0.9'
springBoot = '3.1.0'
spring = '6.0.11'
springBoot = '3.1.2'
acme4j = '2.16'
tomcatEmbed = '10.1.7'
jettyEmbed = '11.0.14'
Expand Down
34 changes: 34 additions & 0 deletions jetty/tests-spring-3.0/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation project(":jetty")
testImplementation project(":tests-common")

testImplementation ("org.springframework.boot:spring-boot-starter-web:3.0.0") {
exclude module: 'spring-boot-starter-tomcat'
}
testImplementation "org.springframework.boot:spring-boot-starter-jetty:3.0.0"
testImplementation "org.springframework.boot:spring-boot-starter-test:3.0.0"
// See https://github.com/spring-projects/spring-boot/issues/33044 for details
testImplementation('jakarta.servlet:jakarta.servlet-api') {
version {
strictly '5.0.0'
because "Jetty 11 does not support Servlet 6 yet"
}
}

testImplementation "org.awaitility:awaitility:$awaitability"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$jupiter"
testImplementation "org.testcontainers:junit-jupiter:$testContainers"
testImplementation "org.assertj:assertj-core:$assertj"
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.valb3r.letsencrypthelper.jetty;

import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@Configuration
public class DisableJettySniConfig implements JettyServerCustomizer {

@Override
public void customize(Server server) {
Arrays.stream(server.getConnectors())
.forEach(
connector -> connector.getConnectionFactory(HttpConnectionFactory.class)
.getHttpConfiguration()
.getCustomizer(SecureRequestCustomizer.class)
.setSniHostCheck(false)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.github.valb3r.letsencrypthelper.jetty;

import com.github.valb3r.letsencrypthelper.ExpiredKeyPebbleTest;
import org.springframework.context.annotation.Import;

@Import(DisableJettySniConfig.class)
class JettyExpiredKeyPebbleTest extends ExpiredKeyPebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.github.valb3r.letsencrypthelper.jetty;

import com.github.valb3r.letsencrypthelper.NoKeystorePebbleTest;
import org.springframework.context.annotation.Import;

@Import(DisableJettySniConfig.class)
class JettyNoKeystorePebbleTest extends NoKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.github.valb3r.letsencrypthelper.jetty;

import com.github.valb3r.letsencrypthelper.NotExpiredKeystorePebbleTest;
import org.springframework.context.annotation.Import;

@Import(DisableJettySniConfig.class)
class JettyNotExpiredKeystorePebbleTest extends NotExpiredKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.valb3r.letsencrypthelper.jetty.dummyapp;

import com.github.valb3r.letsencrypthelper.jetty.JettyWellKnownLetsEncryptChallengeEndpointConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import({JettyWellKnownLetsEncryptChallengeEndpointConfig.class})
public class DummyApp {

public static void main(String[] args) {
SpringApplication.run(DummyApp.class);
}
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ rootProject.name = 'letsencrypt-helper'
include 'tomcat'
include 'jetty'
include 'tests-common'
include 'tomcat:tests-spring-3.0'
include 'jetty:tests-spring-3.0'

project(":tomcat").projectDir = file("tomcat")
project(":jetty").projectDir = file("jetty")
Expand Down
24 changes: 24 additions & 0 deletions tomcat/tests-spring-3.0/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation project(":tomcat")
testImplementation project(":tests-common")
testImplementation "org.springframework.boot:spring-boot-starter-web:3.0.0"
testImplementation "org.springframework.boot:spring-boot-starter-tomcat:3.0.0"
testImplementation "org.springframework.boot:spring-boot-starter-test:3.0.0"

testImplementation "org.awaitility:awaitility:$awaitability"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$jupiter"
testImplementation "org.testcontainers:junit-jupiter:$testContainers"
testImplementation "org.assertj:assertj-core:$assertj"
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.ExpiredKeyPebbleTest;

class TomcatExpiredKeyPebbleTest extends ExpiredKeyPebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.NoKeystorePebbleTest;

class TomcatNoKeystorePebbleTest extends NoKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.NotExpiredKeystorePebbleTest;

class TomcatNotExpiredKeystorePebbleTest extends NotExpiredKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.valb3r.letsencrypthelper.tomcat.dummyapp;

import com.github.valb3r.letsencrypthelper.tomcat.TomcatWellKnownLetsEncryptChallengeEndpointConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import({TomcatWellKnownLetsEncryptChallengeEndpointConfig.class})
public class DummyApp {

public static void main(String[] args) {
SpringApplication.run(DummyApp.class);
}
}
25 changes: 25 additions & 0 deletions tomcat/tests-spring-3.2-m1/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
maven { url "https://repo.spring.io/milestone" }
}

dependencies {
testImplementation project(":tomcat")
testImplementation project(":tests-common")
testImplementation "org.springframework.boot:spring-boot-starter-web:3.2.0-M1"
testImplementation "org.springframework.boot:spring-boot-starter-tomcat:3.2.0-M1"
testImplementation "org.springframework.boot:spring-boot-starter-test:3.2.0-M1"

testImplementation "org.awaitility:awaitility:$awaitability"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$jupiter"
testImplementation "org.testcontainers:junit-jupiter:1.18.3"
testImplementation "org.assertj:assertj-core:$assertj"
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.ExpiredKeyPebbleTest;

class TomcatExpiredKeyPebbleTest extends ExpiredKeyPebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.NoKeystorePebbleTest;

class TomcatNoKeystorePebbleTest extends NoKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.valb3r.letsencrypthelper.tomcat;

import com.github.valb3r.letsencrypthelper.NotExpiredKeystorePebbleTest;

class TomcatNotExpiredKeystorePebbleTest extends NotExpiredKeystorePebbleTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.valb3r.letsencrypthelper.tomcat.dummyapp;

import com.github.valb3r.letsencrypthelper.tomcat.TomcatWellKnownLetsEncryptChallengeEndpointConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import({TomcatWellKnownLetsEncryptChallengeEndpointConfig.class})
public class DummyApp {

public static void main(String[] args) {
SpringApplication.run(DummyApp.class);
}
}

0 comments on commit c72d0b3

Please sign in to comment.