This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/deltaspike.git
The following commit(s) were added to refs/heads/master by this push:
new 861c140e0 try to fix transaction strategy
861c140e0 is described below
commit 861c140e0bf86814cbc77d2189d3fd1e6552dee7
Author: Thomas Andraschko <[email protected]>
AuthorDate: Tue Feb 20 16:33:41 2024 +0100
try to fix transaction strategy
---
.../data/test/TestTransactionStrategy.java | 33 ++++++++++++++++++++++
.../deltaspike/data/test/util/TestDeployments.java | 18 ++++--------
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git
a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/TestTransactionStrategy.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/TestTransactionStrategy.java
new file mode 100644
index 000000000..e8be960a6
--- /dev/null
+++
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/TestTransactionStrategy.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.data.test;
+
+import jakarta.annotation.Priority;
+import jakarta.enterprise.context.Dependent;
+import jakarta.enterprise.inject.Alternative;
+import jakarta.interceptor.Interceptor;
+import
org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy;
+
+@Dependent
+@Alternative
+@Priority(Interceptor.Priority.APPLICATION + 1)
+public class TestTransactionStrategy extends ResourceLocalTransactionStrategy
+{
+
+}
diff --git
a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java
index c61a6c5c4..0ea239123 100755
---
a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java
+++
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java
@@ -18,25 +18,21 @@
*/
package org.apache.deltaspike.data.test.util;
-import java.io.File;
-import java.net.URL;
-
+import org.apache.deltaspike.data.test.TestTransactionStrategy;
import org.apache.deltaspike.data.test.TransactionalTestCase;
import org.apache.deltaspike.data.test.domain.AuditedEntity;
import org.jboss.arquillian.container.test.spi.TestDeployment;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
-public abstract class TestDeployments {
+import java.io.File;
+import java.net.URL;
- public static String DS_PROPERTIES_WITH_ENV_AWARE_TX_STRATEGY
- =
"globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy="
- +
"org.apache.deltaspike.jpa.impl.transaction.EnvironmentAwareTransactionStrategy";
+public abstract class TestDeployments {
/**
* Create a basic deployment with dependencies, beans.xml and persistence
descriptor.
@@ -60,13 +56,11 @@ public abstract class TestDeployments {
WebArchive archive = ShrinkWrap
.create(WebArchive.class, "test.war")
// used by many tests, shouldn't interfere with others
- .addClasses(TransactionalTestCase.class, TestData.class)
+ .addClasses(TransactionalTestCase.class, TestData.class,
TestTransactionStrategy.class)
.addPackages(true, AuditedEntity.class.getPackage())
.addAsLibraries(getDeltaSpikeDataWithDependencies())
.addAsWebInfResource("test-persistence.xml",
"classes/META-INF/persistence.xml")
- .addAsWebInfResource(beansXmlAsset, "beans.xml")
- .addAsWebInfResource(new
StringAsset(DS_PROPERTIES_WITH_ENV_AWARE_TX_STRATEGY),
- "classes/META-INF/apache-deltaspike.properties");
+ .addAsWebInfResource(beansXmlAsset, "beans.xml");
if (addDefaultEntityManagerProducer)
{