See gh-35872
This commit is contained in:
Johnny Lim
2023-06-14 00:57:27 +09:00
committed by Jonatan Ivanov
parent ca0e894dad
commit 06157837e5
9 changed files with 17 additions and 16 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.core.annotation.Order;
/**
* {@link BeanFactoryPostProcessor} to prevent {@link AutoCloseable} destruction calls so
* that {@link TestcontainersLifecycleBeanFactoryPostProcessor} can be smarter about which
* that {@link TestcontainersLifecycleBeanPostProcessor} can be smarter about which
* containers to close.
*
* @author Phillip Webb

View File

@@ -56,7 +56,7 @@ class TestcontainersLifecycleBeanPostProcessor implements DestructionAwareBeanPo
private static final Log logger = LogFactory.getLog(TestcontainersLifecycleBeanPostProcessor.class);
private ConfigurableListableBeanFactory beanFactory;
private final ConfigurableListableBeanFactory beanFactory;
private volatile boolean containersInitialized = false;

View File

@@ -32,8 +32,8 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
/**
* Tests for {@link TestcontainersLifecycleApplicationContextInitializer} and
* {@link TestcontainersLifecycleBeanPostProcessor} and
* Tests for {@link TestcontainersLifecycleApplicationContextInitializer},
* {@link TestcontainersLifecycleBeanPostProcessor}, and
* {@link TestcontainersLifecycleBeanFactoryPostProcessor}.
*
* @author Stephane Nicoll

View File

@@ -39,8 +39,8 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link TestcontainersLifecycleApplicationContextInitializer} to
* ensure create and destroy events happen in the correct order.
* Integration tests for {@link TestcontainersLifecycleBeanPostProcessor} to ensure create
* and destroy events happen in the correct order.
*
* @author Phillip Webb
*/
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@ContextConfiguration(classes = { TestConfig.class, ContainerConfig.class })
@DirtiesContext
@DisabledIfDockerUnavailable
public class TestcontainersLifecycleOrderIntegrationTests {
class TestcontainersLifecycleOrderIntegrationTests {
static List<String> events = Collections.synchronizedList(new ArrayList<>());

View File

@@ -110,7 +110,7 @@ class ServiceConnectionContextCustomizerTests {
ServiceConnectionContextCustomizer n3 = new ServiceConnectionContextCustomizer(
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "namex",
annotation1, () -> container1)));
assertThat(n1.hashCode()).isEqualTo(n2.hashCode());
assertThat(n1.hashCode()).isEqualTo(n2.hashCode()).isNotEqualTo(n3.hashCode());
assertThat(n1).isEqualTo(n2).isNotEqualTo(n3);
// Connection Details Types
ServiceConnectionContextCustomizer t1 = new ServiceConnectionContextCustomizer(
@@ -122,7 +122,7 @@ class ServiceConnectionContextCustomizerTests {
ServiceConnectionContextCustomizer t3 = new ServiceConnectionContextCustomizer(
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
annotation3, () -> container1)));
assertThat(t1.hashCode()).isEqualTo(t2.hashCode());
assertThat(t1.hashCode()).isEqualTo(t2.hashCode()).isNotEqualTo(t3.hashCode());
assertThat(t1).isEqualTo(t2).isNotEqualTo(t3);
// Container
ServiceConnectionContextCustomizer c1 = new ServiceConnectionContextCustomizer(
@@ -134,7 +134,7 @@ class ServiceConnectionContextCustomizerTests {
ServiceConnectionContextCustomizer c3 = new ServiceConnectionContextCustomizer(
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
annotation1, () -> container2)));
assertThat(c1.hashCode()).isEqualTo(c2.hashCode());
assertThat(c1.hashCode()).isEqualTo(c2.hashCode()).isNotEqualTo(c3.hashCode());
assertThat(c1).isEqualTo(c2).isNotEqualTo(c3);
}