Pārlūkot izejas kodu

Exclude TomcatServerConfig from integration tests in demo-authorizationserver sample

Joe Grandja 1 gadu atpakaļ
vecāks
revīzija
296c87b8ff

+ 2 - 0
samples/demo-authorizationserver/src/main/java/sample/config/TomcatServerConfig.java

@@ -21,11 +21,13 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor
 import org.springframework.boot.web.server.WebServerFactoryCustomizer;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
 
 /**
  * @author Joe Grandja
  * @since 1.3
  */
+@Profile("!test")	// Exclude this from DemoAuthorizationServerApplicationTests and DemoAuthorizationServerConsentTests
 @Configuration(proxyBeanMethods = false)
 public class TomcatServerConfig {
 

+ 2 - 2
samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerApplicationTests.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-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.
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author Daniel Garnier-Moiroux
  */
 @ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {"spring.profiles.include=test"})
 @AutoConfigureMockMvc
 public class DemoAuthorizationServerApplicationTests {
 	private static final String REDIRECT_URI = "http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc";

+ 2 - 2
samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerConsentTests.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-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.
@@ -48,7 +48,7 @@ import static org.mockito.Mockito.when;
  * @author Dmitriy Dubson
  */
 @ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {"spring.profiles.include=test"})
 @AutoConfigureMockMvc
 public class DemoAuthorizationServerConsentTests {