Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
000d84ee
Commit
000d84ee
authored
May 14, 2021
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4.x'
Closes gh-26461
parents
83668f96
c2ef7578
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
10 deletions
+25
-10
.gitignore
.gitignore
+0
-1
AbstractJpaAutoConfigurationTests.java
...oconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java
+5
-1
JtaAutoConfigurationTests.java
...oconfigure/transaction/jta/JtaAutoConfigurationTests.java
+14
-6
build.gradle
...ke-tests/spring-boot-smoke-test-jta-atomikos/build.gradle
+1
-0
SampleAtomikosApplicationTests.java
...va/smoketest/atomikos/SampleAtomikosApplicationTests.java
+5
-2
No files found.
.gitignore
View file @
000d84ee
...
@@ -36,7 +36,6 @@ manifest.yml
...
@@ -36,7 +36,6 @@ manifest.yml
out
out
overridedb.*
overridedb.*
target
target
transaction-logs
.flattened-pom.xml
.flattened-pom.xml
secrets.yml
secrets.yml
.gradletasknamecache
.gradletasknamecache
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java
View file @
000d84ee
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
orm
.
jpa
;
package
org
.
springframework
.
boot
.
autoconfigure
.
orm
.
jpa
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -39,6 +40,7 @@ import org.springframework.boot.test.context.assertj.AssertableApplicationContex
...
@@ -39,6 +40,7 @@ import org.springframework.boot.test.context.assertj.AssertableApplicationContex
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.ContextConsumer
;
import
org.springframework.boot.test.context.runner.ContextConsumer
;
import
org.springframework.boot.test.context.runner.WebApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.WebApplicationContextRunner
;
import
org.springframework.boot.testsupport.BuildOutput
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -71,7 +73,9 @@ abstract class AbstractJpaAutoConfigurationTests {
...
@@ -71,7 +73,9 @@ abstract class AbstractJpaAutoConfigurationTests {
protected
AbstractJpaAutoConfigurationTests
(
Class
<?>
autoConfiguredClass
)
{
protected
AbstractJpaAutoConfigurationTests
(
Class
<?>
autoConfiguredClass
)
{
this
.
autoConfiguredClass
=
autoConfiguredClass
;
this
.
autoConfiguredClass
=
autoConfiguredClass
;
this
.
contextRunner
=
new
ApplicationContextRunner
()
this
.
contextRunner
=
new
ApplicationContextRunner
()
.
withPropertyValues
(
"spring.datasource.generate-unique-name=true"
)
.
withPropertyValues
(
"spring.datasource.generate-unique-name=true"
,
"spring.jta.log-dir="
+
new
File
(
new
BuildOutput
(
getClass
()).
getRootLocation
(),
"transaction-logs"
))
.
withUserConfiguration
(
TestConfiguration
.
class
).
withConfiguration
(
.
withUserConfiguration
(
TestConfiguration
.
class
).
withConfiguration
(
AutoConfigurations
.
of
(
DataSourceAutoConfiguration
.
class
,
TransactionAutoConfiguration
.
class
,
AutoConfigurations
.
of
(
DataSourceAutoConfiguration
.
class
,
TransactionAutoConfiguration
.
class
,
SqlInitializationAutoConfiguration
.
class
,
autoConfiguredClass
));
SqlInitializationAutoConfiguration
.
class
,
autoConfiguredClass
));
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java
View file @
000d84ee
...
@@ -45,6 +45,7 @@ import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
...
@@ -45,6 +45,7 @@ import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import
org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor
;
import
org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor
;
import
org.springframework.boot.jta.atomikos.AtomikosProperties
;
import
org.springframework.boot.jta.atomikos.AtomikosProperties
;
import
org.springframework.boot.test.util.TestPropertyValues
;
import
org.springframework.boot.test.util.TestPropertyValues
;
import
org.springframework.boot.testsupport.BuildOutput
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -66,6 +67,9 @@ import static org.mockito.Mockito.mock;
...
@@ -66,6 +67,9 @@ import static org.mockito.Mockito.mock;
*/
*/
class
JtaAutoConfigurationTests
{
class
JtaAutoConfigurationTests
{
private
final
File
atomikosLogs
=
new
File
(
new
BuildOutput
(
JtaAutoConfigurationTests
.
class
).
getRootLocation
(),
"atomikos-logs"
);
private
AnnotationConfigApplicationContext
context
;
private
AnnotationConfigApplicationContext
context
;
@AfterEach
@AfterEach
...
@@ -96,7 +100,10 @@ class JtaAutoConfigurationTests {
...
@@ -96,7 +100,10 @@ class JtaAutoConfigurationTests {
@Test
@Test
void
atomikosSanityCheck
()
{
void
atomikosSanityCheck
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
(
JtaProperties
.
class
,
AtomikosJtaConfiguration
.
class
);
this
.
context
=
new
AnnotationConfigApplicationContext
();
TestPropertyValues
.
of
(
"spring.jta.log-dir:"
+
this
.
atomikosLogs
).
applyTo
(
this
.
context
);
this
.
context
.
register
(
JtaProperties
.
class
,
AtomikosJtaConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
getBean
(
AtomikosProperties
.
class
);
this
.
context
.
getBean
(
AtomikosProperties
.
class
);
this
.
context
.
getBean
(
UserTransactionService
.
class
);
this
.
context
.
getBean
(
UserTransactionService
.
class
);
this
.
context
.
getBean
(
UserTransactionManager
.
class
);
this
.
context
.
getBean
(
UserTransactionManager
.
class
);
...
@@ -123,7 +130,8 @@ class JtaAutoConfigurationTests {
...
@@ -123,7 +130,8 @@ class JtaAutoConfigurationTests {
void
atomikosConnectionFactoryPoolConfiguration
()
{
void
atomikosConnectionFactoryPoolConfiguration
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
TestPropertyValues
.
of
(
"spring.jta.atomikos.connectionfactory.minPoolSize:5"
,
TestPropertyValues
.
of
(
"spring.jta.atomikos.connectionfactory.minPoolSize:5"
,
"spring.jta.atomikos.connectionfactory.maxPoolSize:10"
).
applyTo
(
this
.
context
);
"spring.jta.atomikos.connectionfactory.maxPoolSize:10"
,
"spring.jta.log-dir:"
+
this
.
atomikosLogs
)
.
applyTo
(
this
.
context
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
PoolConfiguration
.
class
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
PoolConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
AtomikosConnectionFactoryBean
connectionFactory
=
this
.
context
.
getBean
(
AtomikosConnectionFactoryBean
.
class
);
AtomikosConnectionFactoryBean
connectionFactory
=
this
.
context
.
getBean
(
AtomikosConnectionFactoryBean
.
class
);
...
@@ -134,8 +142,8 @@ class JtaAutoConfigurationTests {
...
@@ -134,8 +142,8 @@ class JtaAutoConfigurationTests {
@Test
@Test
void
atomikosDataSourcePoolConfiguration
()
{
void
atomikosDataSourcePoolConfiguration
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
TestPropertyValues
TestPropertyValues
.
of
(
"spring.jta.atomikos.datasource.minPoolSize:5"
,
.
of
(
"spring.jta.atomikos.datasource.minPoolSize:5"
,
"spring.jta.atomikos.datasource.maxPoolSize:10"
)
"spring.jta.atomikos.datasource.maxPoolSize:10"
,
"spring.jta.log-dir:"
+
this
.
atomikosLogs
)
.
applyTo
(
this
.
context
);
.
applyTo
(
this
.
context
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
PoolConfiguration
.
class
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
PoolConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
...
@@ -147,8 +155,8 @@ class JtaAutoConfigurationTests {
...
@@ -147,8 +155,8 @@ class JtaAutoConfigurationTests {
@Test
@Test
void
atomikosCustomizeJtaTransactionManagerUsingProperties
()
{
void
atomikosCustomizeJtaTransactionManagerUsingProperties
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
TestPropertyValues
TestPropertyValues
.
of
(
"spring.transaction.default-timeout:30"
,
.
of
(
"spring.transaction.default-timeout:30"
,
"spring.transaction.rollback-on-commit-failure:true"
)
"spring.transaction.rollback-on-commit-failure:true"
,
"spring.jta.log-dir:"
+
this
.
atomikosLogs
)
.
applyTo
(
this
.
context
);
.
applyTo
(
this
.
context
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
TransactionAutoConfiguration
.
class
);
this
.
context
.
register
(
AtomikosJtaConfiguration
.
class
,
TransactionAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/build.gradle
View file @
000d84ee
...
@@ -9,6 +9,7 @@ dependencies {
...
@@ -9,6 +9,7 @@ dependencies {
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-artemis"
))
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-artemis"
))
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-data-jpa"
))
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-data-jpa"
))
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-jta-atomikos"
))
implementation
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-jta-atomikos"
))
implementation
(
project
(
":spring-boot-project:spring-boot-tools:spring-boot-test-support"
))
if
(
JavaVersion
.
current
().
java9Compatible
)
{
if
(
JavaVersion
.
current
().
java9Compatible
)
{
implementation
(
"jakarta.xml.bind:jakarta.xml.bind-api"
)
implementation
(
"jakarta.xml.bind:jakarta.xml.bind-api"
)
}
}
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/src/test/java/smoketest/atomikos/SampleAtomikosApplicationTests.java
View file @
000d84ee
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
smoketest
.
atomikos
;
package
smoketest
.
atomikos
;
import
java.io.File
;
import
java.util.function.Consumer
;
import
java.util.function.Consumer
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -23,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
...
@@ -23,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import
org.springframework.boot.test.system.CapturedOutput
;
import
org.springframework.boot.test.system.CapturedOutput
;
import
org.springframework.boot.test.system.OutputCaptureExtension
;
import
org.springframework.boot.test.system.OutputCaptureExtension
;
import
org.springframework.boot.testsupport.BuildOutput
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -37,7 +39,8 @@ class SampleAtomikosApplicationTests {
...
@@ -37,7 +39,8 @@ class SampleAtomikosApplicationTests {
@Test
@Test
void
testTransactionRollback
(
CapturedOutput
output
)
throws
Exception
{
void
testTransactionRollback
(
CapturedOutput
output
)
throws
Exception
{
SampleAtomikosApplication
.
main
(
new
String
[]
{});
File
logDir
=
new
File
(
new
BuildOutput
(
getClass
()).
getRootLocation
(),
"atomikos-logs"
);
SampleAtomikosApplication
.
main
(
new
String
[]
{
"--spring.jta.log-dir="
+
logDir
});
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"---->"
,
1
));
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"---->"
,
1
));
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"----> josh"
,
1
));
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"----> josh"
,
1
));
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"Count is 1"
,
2
));
assertThat
(
output
).
satisfies
(
numberOfOccurrences
(
"Count is 1"
,
2
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment