Skip to content

Commit

Permalink
test(api-tests): enable CDI for api-tests ocpsoft#345
Browse files Browse the repository at this point in the history
With CDI 4.0 and Faces 4.0 you need to explicitly enable
CDI by providing at least an empty beans.xml file.

Adding this to the test deployment makes the test run again.
  • Loading branch information
poikilotherm committed Oct 18, 2022
1 parent 2257b09 commit 9c5ee5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public static WebArchive getDeployment()
.getDeployment()
.addPackages(true, Root.class.getPackage())
.setWebXML(new File("src/test/webapp/WEB-INF/web.xml"))
// This is necessary as of Faces 4.0 - CDI needs to be enabled explicitly!
// See also https://github.com/eclipse-ee4j/glassfish/issues/23917
.addAsWebInfResource(new File("src/test/webapp/WEB-INF/beans.xml"))
.addAsServiceProvider(ConfigurationProvider.class, LocaleTranspositionConfigurationProvider.class)
.addAsWebResource(new StringAsset("search page"), "search")
.addAsWebResource(new StringAsset("library page"), "library")
Expand Down
7 changes: 7 additions & 0 deletions api-tests/src/test/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd">
<!-- CDI configuration here. -->
</beans>

0 comments on commit 9c5ee5e

Please sign in to comment.