• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbland / tomcat-servlet-testing-example / 6937041424 / 2
100%
main: 100%

Build:
DEFAULT BRANCH: main
Ran 20 Nov 2023 11:29PM UTC
Files 3
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Nov 2023 10:30PM UTC coverage: 100.0%. Remained the same
6937041424.2

push

github

mbland
Add Weld for Java dependency injection

Weld is the reference implementation of "CDI: Contexts and Dependency
Injection for the Java EE Platform."

- https://weld.cdi-spec.org/
- https://www.cdi-spec.org/

This is in preparation for introducing the StringCalculator interface,
which I'll use to inject different StringCalculator implementations into
the Servlet.

This involved:

- Adding implementation dependencies for:
  - org.jboss.weld.servlet:weld-servlet-core
  - io.smallrye:jandex (recommended for speeding up bean discovery)

- Adding new strcalc/src/main/webapp files to add to the servlet WAR
  file, not needed until now, configured according to
  https://docs.jboss.org/weld/reference/5.1.2.Final/en-US/html_single/#tomcat:
  - META-INF/context.xml
  - WEB-INF/web.xml

- Added strcalc/src/main/webapp/WEB-INF/beans.xml because Weld will skip
  initialization without it, with the warning:
  WELD-ENV-000028: Weld initialization skipped - no bean archive found

- Updating the TestTomcat helper to find these new files and to enable
  Java Naming and Directory Interface (JNDI), required by Weld:
  - https://docs.oracle.com/javase/tutorial/jndi/overview/index.html
  - https://docs.jboss.org/weld/reference/5.1.2.Final/en-US/html_single/#_binding_the_manager_in_jndi
  - https://tomcat.apache.org/tomcat-10.1-doc/api/org/apache/catalina/startup/Tomcat.html#enableNaming()

One silver lining was that adding JarScanner > JarScanFilter element to
META-INF/context.xml rendered the custom TestTomcat logic to disable the
JarScanner unnecessary.

Perhaps the other silver lining is that the TestTomcat now tracks
whatever's in src/main/webapp. This should enable the TestTomcat
configuration to remain in sync with the final WAR file.

---

And now for what I really came here to say: I hate Java. I _really_,
_really_, _really_ hate Java. Not so much the language itself, but the
entire culture and ecosystem that has festered around it for 28 years.

If the question is:

... (continued)

5 of 5 branches covered (100.0%)

Branch coverage included in aggregate %.

42 of 42 relevant lines covered (100.0%)

1.0 hits per line

Source Files on job 6937041424.2
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 6937041424
  • 0a4cd2c6 on github
  • Prev Job for on main (#6922109886.1)
  • Next Job for on main (#6948360705.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc