Getting Started page gives you already a lot of inputs but you caneven go further.
You can reuse existing file descriptors using @Descriptors
. The name is the file name
and the path either a classpath path or a file path:
// runner if needed etc...
@Descriptors(@Descriptor(name = "persistence.xml", path = "META-INF/persistence.xml"))
public class MyTest {
//...
}
Note: this can be put in a @Module
method as well.
If you want to test a JAXRS or JAXWS service you need to activate these services.
To do so just add the needed dependency and use @EnableServices
:
// runner if needed etc...
@EnableService("jaxrs") // jaxws supported as well
public class MyTest {
//...
}
Services like JAXRS and JAXWS relies on HTTP. Often it is nice to have a random port to be able to deploy multiple tests/projects on the same CI platform at the same time.
To shortcut all the needed logic you can use @RandomPort
. It is simply an injection giving
you either the port (int
) or the root context (URL
):
// runner, services if needed etc...
public class MyTest {
@RandomPort("http")
private int port;
}
Note: you can generate this way multiple ports. The value is the name of the service it will apply on (being said http is an alias for httpejbd which is our embedded http layer).
@SimpleLog
annotation allows you to have one liner logs
@JaxrsProvider
allows you to specify on a @Module
method the list of JAXRS provider you want to use.
@Jars
allows you to add dependencies (scanned) to your application automatically (like CDI libraries):
@Module
@Classes(cdi = true, value = { C1.class, C2.class, E1.class })
@Jars("deltaspike-")
public WebApp app() {
return new WebApp();
}
@Default
automatically adds in the application target/classes
as binaries and src/main/webapp
as resources for maven projects.
This annotation allows you to control which extensions are activated during the test.
This annotation allows injection of few particular test resources like:
AppModule
(application meta)Context
(JNDI)ApplicationComposers
(underlying runner)ContextProvider
: allow to mock JAXRS contextsAllows to mock EJB injections. It decorates a dedicated method returning an instance (or Class) implementing FallbackPropertyInjector
.
Allow for web application to add folders containing web resources.