Skip to content

Commit a3e87a8

Browse files
authored
Upgrade to OpenWebBeans 2.
Original Pull Request #1737 Closes #1736
1 parent 843fd4d commit a3e87a8

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

Diff for: pom.xml

+32
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
</exclusions>
174174
</dependency>
175175

176+
<!-- Logging -->
176177
<dependency>
177178
<groupId>org.slf4j</groupId>
178179
<artifactId>log4j-over-slf4j</artifactId>
@@ -198,6 +199,21 @@
198199
</dependency>
199200

200201
<!-- CDI -->
202+
<!-- Dependency order required to build against CDI 1.0 and test with CDI 2.0 -->
203+
<dependency>
204+
<groupId>org.apache.geronimo.specs</groupId>
205+
<artifactId>geronimo-jcdi_2.0_spec</artifactId>
206+
<version>1.0.1</version>
207+
<scope>test</scope>
208+
</dependency>
209+
210+
<dependency>
211+
<groupId>javax.interceptor</groupId>
212+
<artifactId>javax.interceptor-api</artifactId>
213+
<version>1.2.1</version>
214+
<scope>test</scope>
215+
</dependency>
216+
201217
<dependency>
202218
<groupId>javax.enterprise</groupId>
203219
<artifactId>cdi-api</artifactId>
@@ -206,6 +222,20 @@
206222
<optional>true</optional>
207223
</dependency>
208224

225+
<dependency>
226+
<groupId>javax.annotation</groupId>
227+
<artifactId>javax.annotation-api</artifactId>
228+
<version>${javax-annotation-api}</version>
229+
<scope>test</scope>
230+
</dependency>
231+
232+
<dependency>
233+
<groupId>org.apache.openwebbeans</groupId>
234+
<artifactId>openwebbeans-se</artifactId>
235+
<version>${webbeans}</version>
236+
<scope>test</scope>
237+
</dependency>
238+
209239
<!-- Test -->
210240
<dependency>
211241
<groupId>org.springframework</groupId>
@@ -242,6 +272,7 @@
242272
<scope>test</scope>
243273
</dependency>
244274

275+
<!--
245276
<dependency>
246277
<groupId>org.apache.openwebbeans.test</groupId>
247278
<artifactId>cditest-owb</artifactId>
@@ -258,6 +289,7 @@
258289
</exclusion>
259290
</exclusions>
260291
</dependency>
292+
-->
261293

262294
<dependency>
263295
<groupId>org.skyscreamer</groupId>

Diff for: src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiRepositoryTests.java

+14-9
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
import java.util.Map;
2525
import java.util.Optional;
2626

27-
import org.apache.webbeans.cditest.CdiTestContainer;
28-
import org.apache.webbeans.cditest.CdiTestContainerLoader;
27+
import javax.enterprise.inject.se.SeContainer;
28+
import javax.enterprise.inject.se.SeContainerInitializer;
29+
2930
import org.junit.jupiter.api.AfterAll;
3031
import org.junit.jupiter.api.BeforeAll;
3132
import org.junit.jupiter.api.BeforeEach;
@@ -48,30 +49,34 @@
4849
@IntegrationTest
4950
public class CdiRepositoryTests {
5051

51-
@Nullable private static CdiTestContainer cdiContainer;
52+
@Nullable private static SeContainer container;
53+
54+
// @Nullable private static CdiTestContainer cdiContainer;
5255
private CdiProductRepository repository;
5356
private SamplePersonRepository personRepository;
5457
private QualifiedProductRepository qualifiedProductRepository;
5558

5659
@BeforeAll
5760
public static void init() throws Exception {
5861

59-
cdiContainer = CdiTestContainerLoader.getCdiContainer();
60-
cdiContainer.startApplicationScope();
61-
cdiContainer.bootContainer();
62+
container = SeContainerInitializer.newInstance() //
63+
.disableDiscovery()//
64+
.addPackages(CdiRepositoryTests.class) //
65+
.initialize();
6266
}
6367

6468
@AfterAll
6569
public static void shutdown() throws Exception {
6670

67-
cdiContainer.stopContexts();
68-
cdiContainer.shutdownContainer();
71+
if (container != null) {
72+
container.close();
73+
}
6974
}
7075

7176
@BeforeEach
7277
public void setUp() {
7378

74-
CdiRepositoryClient client = cdiContainer.getInstance(CdiRepositoryClient.class);
79+
CdiRepositoryClient client = container.select(CdiRepositoryClient.class).get();
7580
repository = client.getRepository();
7681
personRepository = client.getSamplePersonRepository();
7782
repository.deleteAll();

0 commit comments

Comments
 (0)