Skip to content

Upgrade to OpenWebBeans 2 #1737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
</exclusions>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -242,6 +272,7 @@
<scope>test</scope>
</dependency>

<!--
<dependency>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
Expand All @@ -258,6 +289,7 @@
</exclusion>
</exclusions>
</dependency>
-->

<dependency>
<groupId>org.skyscreamer</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
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;
Expand All @@ -48,30 +49,34 @@
@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;

@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();
Expand Down