Skip to content

Commit a30a13d

Browse files
committed
DATAES-395 - Downgrade to CDI 1.0.
1 parent e0d85f0 commit a30a13d

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

pom.xml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<commonslang>2.6</commonslang>
2222
<elasticsearch>5.5.0</elasticsearch>
2323
<springdata.commons>2.0.0.BUILD-SNAPSHOT</springdata.commons>
24-
<java-module-name>spring.data.elasticsearch</java-module-name>
24+
<java-module-name>spring.data.elasticsearch</java-module-name>
2525
</properties>
2626

2727
<dependencies>
@@ -129,19 +129,37 @@
129129
</exclusions>
130130
</dependency>
131131

132-
<dependency>
133-
<groupId>javax.annotation</groupId>
134-
<artifactId>javax.annotation-api</artifactId>
135-
<version>${javax-annotation-api}</version>
136-
<scope>test</scope>
137-
</dependency>
132+
<dependency>
133+
<groupId>org.apache.openwebbeans.test</groupId>
134+
<artifactId>cditest-owb</artifactId>
135+
<version>1.2.8</version>
136+
<scope>test</scope>
137+
<exclusions>
138+
<exclusion>
139+
<groupId>org.apache.geronimo.specs</groupId>
140+
<artifactId>geronimo-jcdi_1.0_spec</artifactId>
141+
</exclusion>
142+
<exclusion>
143+
<groupId>org.apache.geronimo.specs</groupId>
144+
<artifactId>geronimo-atinject_1.0_spec</artifactId>
145+
</exclusion>
146+
</exclusions>
147+
</dependency>
148+
149+
<!-- Upgrade xbean to 4.5 to prevent incompatibilities due to ASM versions -->
150+
<dependency>
151+
<groupId>org.apache.xbean</groupId>
152+
<artifactId>xbean-asm5-shaded</artifactId>
153+
<version>4.5</version>
154+
<scope>test</scope>
155+
</dependency>
138156

139-
<dependency>
140-
<groupId>org.apache.openwebbeans</groupId>
141-
<artifactId>openwebbeans-se</artifactId>
142-
<version>${webbeans}</version>
143-
<scope>test</scope>
144-
</dependency>
157+
<dependency>
158+
<groupId>javax.servlet</groupId>
159+
<artifactId>servlet-api</artifactId>
160+
<version>3.0-alpha-1</version>
161+
<scope>test</scope>
162+
</dependency>
145163

146164
<dependency>
147165
<!-- required by elasticsearch -->

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020

2121
import java.util.Optional;
2222

23-
import javax.enterprise.inject.se.SeContainer;
24-
import javax.enterprise.inject.se.SeContainerInitializer;
25-
23+
import org.apache.webbeans.cditest.CdiTestContainer;
24+
import org.apache.webbeans.cditest.CdiTestContainerLoader;
2625
import org.junit.AfterClass;
2726
import org.junit.Before;
2827
import org.junit.BeforeClass;
@@ -36,29 +35,30 @@
3635
*/
3736
public class CdiRepositoryTests {
3837

39-
private static SeContainer cdiContainer;
38+
private static CdiTestContainer cdiContainer;
4039
private CdiProductRepository repository;
4140
private SamplePersonRepository personRepository;
4241
private QualifiedProductRepository qualifiedProductRepository;
4342

4443
@BeforeClass
45-
public static void init() {
44+
public static void init() throws Exception {
4645

47-
cdiContainer = SeContainerInitializer.newInstance() //
48-
.disableDiscovery() //
49-
.addPackages(CdiRepositoryClient.class) //
50-
.initialize();
46+
cdiContainer = CdiTestContainerLoader.getCdiContainer();
47+
cdiContainer.startApplicationScope();
48+
cdiContainer.bootContainer();
5149
}
5250

5351
@AfterClass
54-
public static void shutdown() {
55-
cdiContainer.close();
52+
public static void shutdown() throws Exception {
53+
54+
cdiContainer.stopContexts();
55+
cdiContainer.shutdownContainer();
5656
}
5757

5858
@Before
5959
public void setUp() {
6060

61-
CdiRepositoryClient client = cdiContainer.select(CdiRepositoryClient.class).get();
61+
CdiRepositoryClient client = cdiContainer.getInstance(CdiRepositoryClient.class);
6262
repository = client.getRepository();
6363
personRepository = client.getSamplePersonRepository();
6464
repository.deleteAll();

src/test/resources/META-INF/beans.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://java.sun.com/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
5+
</beans>

0 commit comments

Comments
 (0)