File tree 6 files changed +34
-9
lines changed
pgjdbc/src/test/java/org/postgresql
6 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ find -type f \( -name "*.jar" -or -name "*.class" \) | xargs rm -f
112
112
rm src/test/java/org/postgresql/test/jdbc2/DriverTest.java \
113
113
src/test/java/org/postgresql/util/OSUtilTest.java \
114
114
src/test/java/org/postgresql/util/PGPropertyPasswordParserTest.java \
115
+ src/test/java/org/postgresql/util/StubEnvironmentAndProperties.java \
115
116
src/test/java/org/postgresql/util/PGPropertyServiceParserTest.java
116
117
117
118
# compat symlink: requested by dtardon (libreoffice), reverts part of
Original file line number Diff line number Diff line change 17
17
import org .postgresql .PGEnvironment ;
18
18
import org .postgresql .PGProperty ;
19
19
import org .postgresql .test .TestUtil ;
20
+ import org .postgresql .util .StubEnvironmentAndProperties ;
20
21
import org .postgresql .util .URLCoder ;
21
22
22
23
import org .junit .jupiter .api .Test ;
23
- import org .junit .jupiter .api .extension .ExtendWith ;
24
24
import uk .org .webcompere .systemstubs .environment .EnvironmentVariables ;
25
- import uk .org .webcompere .systemstubs .jupiter .SystemStubsExtension ;
26
25
import uk .org .webcompere .systemstubs .properties .SystemProperties ;
27
26
import uk .org .webcompere .systemstubs .resource .Resources ;
28
27
43
42
* Tests the dynamically created class org.postgresql.Driver
44
43
*
45
44
*/
46
- @ ExtendWith ( SystemStubsExtension . class )
45
+ @ StubEnvironmentAndProperties
47
46
public class DriverTest {
48
47
49
48
@ Test
Original file line number Diff line number Diff line change 8
8
import static org .junit .jupiter .api .Assertions .assertEquals ;
9
9
10
10
import org .junit .jupiter .api .Test ;
11
- import org .junit .jupiter .api .extension .ExtendWith ;
12
11
import uk .org .webcompere .systemstubs .environment .EnvironmentVariables ;
13
- import uk .org .webcompere .systemstubs .jupiter .SystemStubsExtension ;
14
12
import uk .org .webcompere .systemstubs .properties .SystemProperties ;
15
13
import uk .org .webcompere .systemstubs .resource .Resources ;
16
14
17
15
import java .io .File ;
18
16
19
- @ ExtendWith ( SystemStubsExtension . class )
17
+ @ StubEnvironmentAndProperties
20
18
class OSUtilTest {
21
19
22
20
@ Test
Original file line number Diff line number Diff line change 26
26
*
27
27
* @author Marek Läll
28
28
*/
29
+ @ StubEnvironmentAndProperties
29
30
class PGPropertyPasswordParserTest {
30
31
31
32
// "org.postgresql.pgpassfile" : missing
Original file line number Diff line number Diff line change 13
13
import org .postgresql .PGEnvironment ;
14
14
15
15
import org .junit .jupiter .api .Test ;
16
- import org .junit .jupiter .api .extension .ExtendWith ;
17
16
import uk .org .webcompere .systemstubs .environment .EnvironmentVariables ;
18
- import uk .org .webcompere .systemstubs .jupiter .SystemStubsExtension ;
19
17
import uk .org .webcompere .systemstubs .properties .SystemProperties ;
20
18
import uk .org .webcompere .systemstubs .resource .Resources ;
21
19
30
28
*
31
29
* @author Marek Läll
32
30
*/
33
- @ ExtendWith ( SystemStubsExtension . class )
31
+ @ StubEnvironmentAndProperties
34
32
class PGPropertyServiceParserTest {
35
33
36
34
// "org.postgresql.pgservicefile" : missing
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2022, PostgreSQL Global Development Group
3
+ * See the LICENSE file in the project root for more information.
4
+ */
5
+
6
+ package org .postgresql .util ;
7
+
8
+ import org .junit .jupiter .api .extension .ExtendWith ;
9
+ import org .junit .jupiter .api .parallel .Isolated ;
10
+ import uk .org .webcompere .systemstubs .jupiter .SystemStubsExtension ;
11
+
12
+ import java .lang .annotation .ElementType ;
13
+ import java .lang .annotation .Retention ;
14
+ import java .lang .annotation .RetentionPolicy ;
15
+ import java .lang .annotation .Target ;
16
+
17
+ /**
18
+ * This annotation is used to mark a test method as a test that should be run with stubbing system
19
+ * calls like {@code System#getProperty} and {@code System#getenv}.
20
+ * <p>The tests should be run in isolation to prevent concurrent modification of properties and
21
+ * the environment.</p>
22
+ */
23
+ @ Isolated
24
+ @ ExtendWith (SystemStubsExtension .class )
25
+ @ Retention (RetentionPolicy .RUNTIME )
26
+ @ Target ({ElementType .METHOD , ElementType .TYPE })
27
+ public @interface StubEnvironmentAndProperties {
28
+ }
You can’t perform that action at this time.
0 commit comments