Frage

I realize that some of the classes that are not added to my shrinkWrap archive are used during running the arquillian test cases which cause problems.

I have a boot function in my application config with a signature like this

public void boot(@Observes StartupEvent startupEvent, ExternalContext externalContext, Application application, ProjectStage deltaspikeProjectStage)

(startUpEvent is sent when JSF is ready and up and running) and this is not added my ShrinkWrap, but when I am running testcases they calls my boot function. This unnecessary call ruin every things. When I am commenting this function, my test cases is working fine.

I was thinking that available classes for my test cases should be added to the ShrinkWrap archive with commands like

WebArchive webArchive=  ShrinkWrap
                    .create(WebArchive.class, "ROOT.war")
                    .addClasses(CdiTestBean.class,PersistenceListener.class)

but it seems that I am wrong. What should I do to make a class unavailable to a shrinkWrap archive!!

War es hilfreich?

Lösung

If you are using embedded container that might be the problem, as all your CDI beans are on the same classpath. Therefore they probably are scanned by the embedded container/cdi implementation. Try with managed version if possible, this should give you proper isolation.

Andere Tipps

Before returning the webArchive add this line:

new ZipExporterImpl(webArchive).exportTo(new File(System.getProperty("java.io.tmpdir"), "myWebArchive.war"), true);

it's going to save your web archive into a file in Java's temp system folder.

Extract the war to inspect if all required classes are there.

Calling a method addClasses(Class... classes) should add the classes to a war.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top