You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Me Self <wm...@gmail.com> on 2021/10/08 10:43:35 UTC
Test valve with tomcat-embed 9?
I would like to test a custom tomcat valve with tomcat-embed and junit. Is
that possible?
Found a few tomcat-embed samples on the web but most seem to only deal with
setting up a webapp - something along the lines:
@BeforeAll
public static void setup() throws LifecycleException {
Tomcat tomcat = new Tomcat();
tomcat.setPort(...);
StandardContext ctx = (StandardContext) tomcat.addWebapp("/", new
File("src/main/webapp/").getAbsolutePath());
What would I need to do to add a valve? And btw. it's a maven project so
the valve is compiled to "target/classes".
Re: Test valve with tomcat-embed 9?
Posted by Mark Thomas <ma...@apache.org>.
On 08/10/2021 11:43, Me Self wrote:
> I would like to test a custom tomcat valve with tomcat-embed and junit. Is
> that possible?
>
> Found a few tomcat-embed samples on the web but most seem to only deal with
> setting up a webapp - something along the lines:
>
> @BeforeAll
> public static void setup() throws LifecycleException {
> Tomcat tomcat = new Tomcat();
> tomcat.setPort(...);
> StandardContext ctx = (StandardContext) tomcat.addWebapp("/", new
> File("src/main/webapp/").getAbsolutePath());
>
> What would I need to do to add a valve? And btw. it's a maven project so
> the valve is compiled to "target/classes".
https://github.com/apache/tomcat/tree/main/test/org/apache/catalina/valves
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org