deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen More <stephen.m...@gmail.com>
Subject Re: Adding DeltaSpike support to Jglue CDI-Unit
Date Wed, 06 Jul 2016 12:14:20 GMT
I think it would be helpful to update the docs:
https://deltaspike.apache.org/documentation/test-control.html

3. Complete Additional Project Configuration

From:

Add a beans.xml file in the project test module (e.g.
src/test/resources/META-INF/beans.xml ).
To:
Make sure you have two beans.xml files in the project (e.g.
src/main/resources/META-INF/beans.xml AND
src/test/resources/META-INF/beans.xml ). beans.xml in WEB-INF will be
ignored when testing.


On Wed, Jul 6, 2016 at 4:09 AM, Gerhard Petracek <gerhard.petracek@gmail.com
> wrote:

> hi stephen,
>
> ee-containers support both, but libs like test-control usually just support
> META-INF/beans.xml.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache
> MyFaces, DeltaSpike and OpenWebBeans
>
>
>
> 2016-07-05 21:56 GMT+02:00 Stephen More <stephen.more@gmail.com>:
>
> > I finally got to the bottom of the issue - but is it a bug or a feature ?
> >
> > My runtime beans file is: src/main/webapp/WEB-INF/beans.xml  [1]
> >
> > I followed instructions by creating a
> > src/test/resources/META-INF/beans.xml.
> >
> > If "src/main/resources/META-INF/beans.xml" is missing it will throw the
> > errors that I am seeing.
> > If you delete src/main/resources/META-INF/beans.xml from
> > javase-cdi-ds-project-template it will fail too.
> >
> >
> > [1] Configuring a CDI Application -
> > http://docs.oracle.com/javaee/6/tutorial/doc/gjbnz.html
> >
> > An application that uses CDI must have a file named beans.xml. The file
> can
> > be completely empty (it has content only in certain limited situations),
> > but it must be present. For a web application, the beans.xml file must be
> > in the WEB-INF directory. For EJB modules or JAR files, the beans.xml
> file
> > must be in the META-INF directory.
> >
> >
> > On Tue, Jul 5, 2016 at 2:47 PM, Gerhard Petracek <gpetracek@apache.org>
> > wrote:
> >
> > > hi stephen,
> > >
> > > ok - i thought it might be something different.
> > > it works for me once i copy your classes to [1].
> > > (+ replace CdiRunner with CdiTestRunner + drop the parts related to
> > > CdiRunner.)
> > >
> > > please follow the previous hints and check the required dependencies
> (see
> > > e.g. [2]) to enable the jsf-support for junit-tests.
> > >
> > > regards,
> > > gerhard
> > >
> > > [1] https://github.com/os890/javase-cdi-ds-project-template
> > > [2]
> > >
> >
> https://github.com/CDIatWork/IdeaFork/blob/master/ideafork_ee6/pom.xml#L526
> > >
> > >
> > >
> > > 2016-07-05 19:57 GMT+02:00 Stephen More <stephen.more@gmail.com>:
> > >
> > > > I did provide the link.
> > > >
> > > > Root project of maven examples:
> > https://github.com/mores/maven-examples
> > > > Directory that contains the example:
> > > > https://github.com/mores/maven-examples/tree/master/prime-codi
> > > >
> > > > TestCase - org.jglue.cdiunit -
> > > >
> > > >
> > >
> >
> https://github.com/mores/maven-examples/blob/master/prime-codi/src/test/java/org/test/TestMultiplication.java
> > > > TestCase - org.apache.deltaspike.testcontrol -
> > > >
> > > >
> > >
> >
> https://github.com/mores/maven-examples/blob/master/prime-codi/src/test/java/org/test/TestControl.java
> > > >
> > > >
> > > > On Tue, Jul 5, 2016 at 1:41 PM, Gerhard Petracek <
> > > > gerhard.petracek@gmail.com
> > > > > wrote:
> > > >
> > > > > hi stephen,
> > > > >
> > > > > please provide a link to an example which illustrates the issue.
> > > > >
> > > > > regards,
> > > > > gerhard
> > > > >
> > > > >
> > > > >
> > > > > 2016-07-05 17:29 GMT+02:00 Stephen More <stephen.more@gmail.com>:
> > > > >
> > > > > > Here is a non-working example:
> > > > > > https://github.com/mores/maven-examples/tree/master/prime-codi
> > > > > >
> > > > > > TestMultiplication.java - uses org.jglue.cdiunit and works as
> > > expected
> > > > > > TestControl.java - same test but uses testcontrol - error:
> > > > > >
> > > > > > Jul 05, 2016 11:24:35 AM
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.deltaspike.testcontrol.api.junit.CdiTestSuiteRunner$LogRunListener
> > > > > > testFailure
> > > > > > INFO: [failed] org.test.TestControl#null message: Exception
List
> > > with 3
> > > > > > exceptions:
> > > > > > Exception 0 :
> > > > > > org.jboss.weld.exceptions.DeploymentException: WELD-001408:
> > > Unsatisfied
> > > > > > dependencies for type Product with qualifiers @Default
> > > > > >   at injection point [BackedAnnotatedField] @Inject
> > > > > > org.test.TestMultiplication.product
> > > > > >   at
> org.test.TestMultiplication.product(TestMultiplication.java:0)
> > > > > >
> > > > > >
> > > > > > On Tue, Jul 5, 2016 at 10:55 AM, Stephen More <
> > > stephen.more@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > I am now trying to do the same thing with
> > > > > > > deltaspike-test-control-module-api, but I am receiving:
> > > > > > >
> > > > > > > org.jboss.weld.exceptions.DeploymentException: WELD-001408:
> > > > Unsatisfied
> > > > > > > dependencies for type Import with qualifiers @Default
> > > > > > >   at injection point [BackedAnnotatedField] @Inject private
> > > > > > org.Test.Import
> > > > > > >   at org.Test.Import(Test.java:0)
> > > > > > >
> > > > > > > Is there a working example using
> > deltaspike-test-control-module-api
> > > > > > > somewhere ?
> > > > > > >
> > > > > > >
> > > > > > > On Sat, Jun 25, 2016 at 4:59 PM, Ludovic Pénet <
> l.penet@senat.fr
> > >
> > > > > wrote:
> > > > > > >
> > > > > > >> I took a look at Jglue and did not understand what
it does
> that
> > > > > > >> deltaspike test control does not
> > > > > > >>
> > > > > > >> https://deltaspike.apache.org/documentation/test-control.html
> > > > > > >>
> > > > > > >> Can you please explain me ?
> > > > > > >>
> > > > > > >> With kind regards,
> > > > > > >>
> > > > > > >> Ludovic
> > > > > > >>
> > > > > > >>
> > > > > > >> Le 25 juin 2016 21:41:37 GMT+02:00, Stephen More <
> > > > > > stephen.more@gmail.com>
> > > > > > >> a écrit :
> > > > > > >>>
> > > > > > >>> I found a tool that allows me to JUnit4 test my
CDI JSF
> backing
> > > > beans
> > > > > > >>> http://jglue.org/cdi-unit/ !
> > > > > > >>> Right now I know it supports
> > > javax.enterprise.context.SessionScoped
> > > > > and
> > > > > > >>> javax.faces.view.ViewScoped.
> > > > > > >>> It does not currently support
> > > > > > >>> org.apache.deltaspike.core.api.scope.WindowScoped
:-(
> > > > > > >>>
> > > > > > >>> I opened up issue:
> > > https://github.com/BrynCooke/cdi-unit/issues/91
> > > > > > >>>
> > > > > > >>> Can anyone help with a pull request to get DeltaSpike
support
> > > into
> > > > > > CDI-Unit
> > > > > > >>> ?
> > > > > > >>>
> > > > > > >>> -Thanks
> > > > > > >>> Stephen More
> > > > > > >>>
> > > > > > >>>
> > > > > > >> --
> > > > > > >> Envoyé de mon appareil Android avec K-9 Mail. Veuillez
excuser
> > ma
> > > > > > >> brièveté.
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message