Skip to content

Commit 4be605e

Browse files
committed
Revert "Fix tests"
This reverts commit 07e9f80.
1 parent d6ba525 commit 4be605e

9 files changed

+47
-71
lines changed

spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTests.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,11 +30,7 @@
3030
import org.springframework.test.annotation.DirtiesContext;
3131
import org.springframework.test.annotation.DirtiesContext.ClassMode;
3232
import org.springframework.test.context.ContextConfiguration;
33-
import org.springframework.test.context.TestExecutionListeners;
3433
import org.springframework.test.context.junit4.SpringRunner;
35-
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
36-
import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener;
37-
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
3834

3935
import static org.junit.Assert.*;
4036
import static org.springframework.test.context.cache.ContextCacheTestUtils.*;
@@ -150,14 +146,6 @@ public static void verifyFinalCacheState() {
150146

151147
@RunWith(SpringRunner.class)
152148
@ContextConfiguration
153-
// Ensure that we do not include the EventPublishingTestExecutionListener
154-
// since it will access the ApplicationContext for each method in the
155-
// TestExecutionListener API, thus distorting our cache hit/miss results.
156-
@TestExecutionListeners({
157-
DirtiesContextBeforeModesTestExecutionListener.class,
158-
DependencyInjectionTestExecutionListener.class,
159-
DirtiesContextTestExecutionListener.class
160-
})
161149
static abstract class BaseTestCase {
162150

163151
@Configuration

spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/DirtiesContextInterfaceTests.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,11 +27,7 @@
2727
import org.springframework.beans.factory.annotation.Autowired;
2828
import org.springframework.context.ApplicationContext;
2929
import org.springframework.context.annotation.Configuration;
30-
import org.springframework.test.context.TestExecutionListeners;
3130
import org.springframework.test.context.junit4.SpringRunner;
32-
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
33-
import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener;
34-
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
3531

3632
import static org.junit.Assert.*;
3733
import static org.springframework.test.context.cache.ContextCacheTestUtils.*;
@@ -76,14 +72,6 @@ private void runTestClassAndAssertStats(Class<?> testClass, int expectedTestCoun
7672

7773

7874
@RunWith(SpringRunner.class)
79-
// Ensure that we do not include the EventPublishingTestExecutionListener
80-
// since it will access the ApplicationContext for each method in the
81-
// TestExecutionListener API, thus distorting our cache hit/miss results.
82-
@TestExecutionListeners({
83-
DirtiesContextBeforeModesTestExecutionListener.class,
84-
DependencyInjectionTestExecutionListener.class,
85-
DirtiesContextTestExecutionListener.class
86-
})
8775
public static class ClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase
8876
implements DirtiesContextTestInterface {
8977

spring-test/src/test/java/org/springframework/test/context/jdbc/DataSourceOnlySqlScriptsTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -85,8 +85,8 @@ static class Config {
8585
@Bean
8686
public DataSource dataSource() {
8787
return new EmbeddedDatabaseBuilder()//
88-
.generateUniqueName(true)//
89-
.build();
88+
.setName("empty-sql-scripts-without-tx-mgr-test-db")//
89+
.build();
9090
}
9191
}
9292

spring-test/src/test/java/org/springframework/test/context/jdbc/EmptyDatabaseConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,8 +41,8 @@ public PlatformTransactionManager transactionManager() {
4141
@Bean
4242
public DataSource dataSource() {
4343
return new EmbeddedDatabaseBuilder()//
44-
.generateUniqueName(true)//
45-
.build();
44+
.setName("empty-sql-scripts-test-db")//
45+
.build();
4646
}
4747

4848
}

spring-test/src/test/java/org/springframework/test/context/jdbc/InferredDataSourceSqlScriptsTests.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -97,19 +97,19 @@ public PlatformTransactionManager txMgr2() {
9797
@Bean
9898
public DataSource dataSource1() {
9999
return new EmbeddedDatabaseBuilder()//
100-
.generateUniqueName(true)//
101-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
102-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
103-
.build();
100+
.setName("database1")//
101+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
102+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
103+
.build();
104104
}
105105

106106
@Bean
107107
public DataSource dataSource2() {
108108
return new EmbeddedDatabaseBuilder()//
109-
.generateUniqueName(true)//
110-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
111-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
112-
.build();
109+
.setName("database2")//
110+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
111+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
112+
.build();
113113
}
114114
}
115115

spring-test/src/test/java/org/springframework/test/context/jdbc/InferredDataSourceTransactionalSqlScriptsTests.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -100,19 +100,19 @@ public PlatformTransactionManager txMgr2() {
100100
@Bean
101101
public DataSource dataSource1() {
102102
return new EmbeddedDatabaseBuilder()//
103-
.generateUniqueName(true)//
104-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
105-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
106-
.build();
103+
.setName("database1")//
104+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
105+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
106+
.build();
107107
}
108108

109109
@Bean
110110
public DataSource dataSource2() {
111111
return new EmbeddedDatabaseBuilder()//
112-
.generateUniqueName(true)//
113-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
114-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
115-
.build();
112+
.setName("database2")//
113+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
114+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
115+
.build();
116116
}
117117
}
118118

spring-test/src/test/java/org/springframework/test/context/jdbc/MultipleDataSourcesAndTransactionManagersSqlScriptsTests.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -96,19 +96,19 @@ public PlatformTransactionManager txMgr2() {
9696
@Bean
9797
public DataSource dataSource1() {
9898
return new EmbeddedDatabaseBuilder()//
99-
.generateUniqueName(true)//
100-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
101-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
102-
.build();
99+
.setName("database1")//
100+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
101+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
102+
.build();
103103
}
104104

105105
@Bean
106106
public DataSource dataSource2() {
107107
return new EmbeddedDatabaseBuilder()//
108-
.generateUniqueName(true)//
109-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
110-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
111-
.build();
108+
.setName("database2")//
109+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
110+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
111+
.build();
112112
}
113113

114114
}

spring-test/src/test/java/org/springframework/test/context/jdbc/MultipleDataSourcesAndTransactionManagersTransactionalSqlScriptsTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ public PlatformTransactionManager txMgr2() {
9797
@Bean
9898
public DataSource dataSource1() {
9999
return new EmbeddedDatabaseBuilder()//
100-
.generateUniqueName(true)//
101-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
102-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
103-
.build();
100+
.setName("database1")//
101+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
102+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
103+
.build();
104104
}
105105

106106
@Bean
107107
public DataSource dataSource2() {
108108
return new EmbeddedDatabaseBuilder()//
109-
.generateUniqueName(true)//
110-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
111-
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
112-
.build();
109+
.setName("database2")//
110+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql")//
111+
.addScript("classpath:/org/springframework/test/context/jdbc/data.sql")//
112+
.build();
113113
}
114114

115115
}

spring-test/src/test/java/org/springframework/test/context/jdbc/PopulatedSchemaDatabaseConfig.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@ public PlatformTransactionManager transactionManager() {
4343
@Bean
4444
public DataSource dataSource() {
4545
return new EmbeddedDatabaseBuilder()//
46-
.generateUniqueName(true)//
47-
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql") //
48-
.build();
46+
.setName("populated-sql-scripts-test-db")//
47+
.addScript("classpath:/org/springframework/test/context/jdbc/schema.sql") //
48+
.build();
4949
}
5050

5151
@Bean

0 commit comments

Comments
 (0)