Upgrade to OpenWebBeans 2.

Original Pull Request #1737 
Closes #1736
This commit is contained in:
Peter-Josef Meisch 2021-03-21 21:31:14 +01:00 committed by GitHub
parent 843fd4db85
commit a3e87a8525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 9 deletions

32
pom.xml
View File

@ -173,6 +173,7 @@
</exclusions>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
@ -198,6 +199,21 @@
</dependency>
<!-- CDI -->
<!-- Dependency order required to build against CDI 1.0 and test with CDI 2.0 -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_2.0_spec</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
@ -206,6 +222,20 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-api}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<version>${webbeans}</version>
<scope>test</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework</groupId>
@ -242,6 +272,7 @@
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
@ -258,6 +289,7 @@
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>org.skyscreamer</groupId>

View File

@ -24,8 +24,9 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.webbeans.cditest.CdiTestContainer;
import org.apache.webbeans.cditest.CdiTestContainerLoader;
import javax.enterprise.inject.se.SeContainer;
import javax.enterprise.inject.se.SeContainerInitializer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@ -48,7 +49,9 @@ import org.springframework.lang.Nullable;
@IntegrationTest
public class CdiRepositoryTests {
@Nullable private static CdiTestContainer cdiContainer;
@Nullable private static SeContainer container;
// @Nullable private static CdiTestContainer cdiContainer;
private CdiProductRepository repository;
private SamplePersonRepository personRepository;
private QualifiedProductRepository qualifiedProductRepository;
@ -56,22 +59,24 @@ public class CdiRepositoryTests {
@BeforeAll
public static void init() throws Exception {
cdiContainer = CdiTestContainerLoader.getCdiContainer();
cdiContainer.startApplicationScope();
cdiContainer.bootContainer();
container = SeContainerInitializer.newInstance() //
.disableDiscovery()//
.addPackages(CdiRepositoryTests.class) //
.initialize();
}
@AfterAll
public static void shutdown() throws Exception {
cdiContainer.stopContexts();
cdiContainer.shutdownContainer();
if (container != null) {
container.close();
}
}
@BeforeEach
public void setUp() {
CdiRepositoryClient client = cdiContainer.getInstance(CdiRepositoryClient.class);
CdiRepositoryClient client = container.select(CdiRepositoryClient.class).get();
repository = client.getRepository();
personRepository = client.getSamplePersonRepository();
repository.deleteAll();