Usually I work on multiple tasks at a time, and I might not communicate as
well as I should. I will try to be a little more verbose.

Before I added DefaultTestServiceProducer to uc020, mvn clean install  was
working as expected "Tests run: 65, Failures: 0, Errors: 0, Skipped: 0"

By simply adding DefaultTestServiceProducer to uc020 I did not expect to
get "Tests run: 53, Failures: 6, Errors: 22, Skipped: 0"

1. At this point I am no longer focusing on getting my uc020 to pass, but
rather what the heck did I just do.....what caused this ? Is something else
bigger going on that will cause my use case to fail anyway ?

2. In parallel I am also working on a private branch to get  Alternate
Producers working....( again not working as expected ).

I am at a loss to explain what is going on in 1, and 2 I think should be
working, but is not.


Why did my DefaultTestServiceProducer create all this havoc ?




Failed tests:
  InterceptedBeanTest.classLevelInterception:52
  InterceptedBeanTest.methodLevelInterception:60
  TestServiceLabelYTest.resultY:44 expected:<[result-y]> but
was:<[default-result]>
  TestServiceTestLabelXTest.resultX:44 expected:<[result-x]> but
was:<[default-result]>
  LabeledServiceTest.resultLbl:45 expected:<[result-lbl]> but
was:<[alternative-result]>
  TestServiceLabelXTest.resultX:43 expected:<result-[x]> but
was:<result-[y]>
Tests in error:

MockedRequestScopedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc001.MockedRequestScopedBeanTest
» Deployment

MockedSessionScopedBeanAcrossMethodsTest.org.apache.deltaspike.test.testcontrol.mock.uc003.MockedSessionScopedBeanAcrossMethodsTest
» Deployment

MockedProducedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc005.MockedProducedBeanTest
» Deployment

MockedTypedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc008.MockedTypedBeanTest
» Deployment

MockedTypedProducedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc009.MockedTypedProducedBeanTest
» Deployment

MockedRequestScopedBeanWithInjectionTest.org.apache.deltaspike.test.testcontrol.mock.uc012.MockedRequestScopedBeanWithInjectionTest
» Deployment

MockedTypedProducedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc013.MockedTypedProducedBeanTest
» Deployment

MockedTypedProducedBeanTest.org.apache.deltaspike.test.testcontrol.mock.uc014.MockedTypedProducedBeanTest
» Deployment
org.apache.deltaspike.test.testcontrol.uc001.RequestAndSessionScopePerTestMethodTest.org.apache.deltaspike.test.testcontrol.uc001.RequestAndSessionScopePerTestMethodTest
  Run 1:
RequestAndSessionScopePerTestMethodTest.org.apache.deltaspike.test.testcontrol.uc001.RequestAndSessionScopePerTestMethodTest
» Deployment
  Run 2: RequestAndSessionScopePerTestMethodTest.finalCheckAndCleanup:99
IllegalState u...

org.apache.deltaspike.test.testcontrol.uc002.SessionScopePerTestClassTest.org.apache.deltaspike.test.testcontrol.uc002.SessionScopePerTestClassTest
  Run 1:
SessionScopePerTestClassTest.org.apache.deltaspike.test.testcontrol.uc002.SessionScopePerTestClassTest
» Deployment
  Run 2: SessionScopePerTestClassTest.finalCheckAndCleanup:93 IllegalState
unexpected i...


SessionScopePerTestClassTest.org.apache.deltaspike.test.testcontrol.uc003.SessionScopePerTestClassTest
» Deployment
org.apache.deltaspike.test.testcontrol.uc004.ProjectStageTestControlTest.org.apache.deltaspike.test.testcontrol.uc004.ProjectStageTestControlTest
  Run 1:
ProjectStageTestControlTest.org.apache.deltaspike.test.testcontrol.uc004.ProjectStageTestControlTest
» Deployment
  Run 2:
ProjectStageTestControlTest>RequestAndSessionScopePerTestMethodTest.finalCheckAndCleanup:99
» IllegalState


SkipExternalContainerTest.org.apache.deltaspike.test.testcontrol.uc006.SkipExternalContainerTest
» Deployment
  ExtendedTest.org.apache.deltaspike.test.testcontrol.uc007.ExtendedTest »
Deployment

JsfContainerPerTestMethodTest.org.apache.deltaspike.test.testcontrol.uc010.JsfContainerPerTestMethodTest
» Deployment

InterceptedBeanTest.org.apache.deltaspike.test.testcontrol.uc011.InterceptedBeanTest
» Deployment

TestServiceNoLabelTest.org.apache.deltaspike.test.testcontrol.uc014.TestServiceNoLabelTest
» Deployment

AlternativeServiceTest.org.apache.deltaspike.test.testcontrol.uc015.AlternativeServiceTest
» Deployment

TestServiceLabelYTest.org.apache.deltaspike.test.testcontrol.uc016.TestServiceLabelYTest
» Deployment
  TestServiceLabelBTest.resultB » AmbiguousResolution There is more than
one Bea...

TestServiceNoLabelTest.org.apache.deltaspike.test.testcontrol.uc020.TestServiceNoLabelTest
» Deployment

TestServiceTestLabelATest.org.apache.deltaspike.test.testcontrol.uc020.TestServiceTestLabelATest
» Deployment



On Mon, Apr 16, 2018 at 1:33 AM, Gerhard Petracek <
gerhard.petra...@gmail.com> wrote:

> hi stephen,
>
> you only have one producer-class:
> https://github.com/mores/deltaspike/blob/altProduces/
> deltaspike/modules/test-control/impl/src/test/java/
> org/apache/deltaspike/test/testcontrol/uc020/DefaultTestServiceProducer.
> java
>
> and @Alternative is only present at:
> https://github.com/mores/deltaspike/blob/altProduces/
> deltaspike/modules/test-control/impl/src/test/java/
> org/apache/deltaspike/test/testcontrol/uc020/TestServiceLabelA.java#L24
> and
> https://github.com/mores/deltaspike/blob/altProduces/
> deltaspike/modules/test-control/impl/src/test/java/
> org/apache/deltaspike/test/testcontrol/uc020/TestServiceLabelB.java#L24
>
> instead you need an alternative producer-class (to replace
> DefaultTestServiceProducer in your case).
>
> 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
>
> 2018-04-15 21:02 GMT+02:00 Stephen More <stephen.m...@gmail.com>:
>
> > Correct. I have a default producer and 1 alternate producer. I can enable
> > the alternate producer by updating beans.xml.
> > I am trying to do the same thing using labeledAlternatives....
> >
> > what changes should be made to META-INF/apache-deltaspike.properties
> when
> > using multiple alternate producers ?
> >
> >
> > labeledAlternatives[testLabelX].org.apache.deltaspike.test.testcontrol.
> > uc014.TestService=org.apache.deltaspike.test.testcontrol.uc014.
> > TestServiceLabelXProducer
> > labeledAlternatives[y].org.apache.deltaspike.test.
> > testcontrol.uc014.TestService=org.apache.deltaspike.test.
> > testcontrol.uc014.TestServiceLabelYProducer
> >
> >
> > ?
> >
> >
> >
> >
> > On Sun, Apr 15, 2018 at 1:22 PM, Gerhard Petracek <
> > gerhard.petra...@gmail.com> wrote:
> >
> > > hi stephen,
> > >
> > > as usual with cdi, you need to create an alternative-producer (= the
> > > producer-bean itself needs to be replaced).
> > >
> > > 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
> > >
> > >
> > >
> > > 2018-04-15 14:41 GMT+02:00 Stephen More <stephen.m...@gmail.com>:
> > >
> > > > "alternative-bean-x1 (instead of bean-x) in test1
> > > > and alternative-bean-x2  (instead of bean-x) in test2"
> > > >
> > > > Yes, this is exactly what I am going after, unfortunately I have not
> > > gotten
> > > > it to work yet. In my case bean-x comes from a producer.
> > > >
> > > > Not sure if that is my problem so I started working on a use case, I
> > > made a
> > > > clone of uc014 -> uc020 ( fixed name collisions in
> > > > apache-deltaspike.properties ) but many other test cases started to
> > fail
> > > > outside of uc020.  ( https://github.com/mores/
> > > deltaspike/tree/altProduces
> > > > )
> > > >
> > > > Is this a possible bug ?
> > > > -Thanks
> > > >
> > > >
> > > > p.s. when a typo is made in apache-deltaspike.properties no warning
> or
> > > > error was thrown that I could easily see
> > > >
> > > >
> > > >
> > > > On Sat, Apr 14, 2018 at 12:18 PM, Gerhard Petracek <
> > > > gerhard.petra...@gmail.com> wrote:
> > > >
> > > > > hi stephen,
> > > > >
> > > > > if your alternative-instance/behavior should be different for
> "every"
> > > > test
> > > > > and you can't use a mock-manager, you need to use a producer (for
> the
> > > > > original bean) and @Specializes it in the test-classpath.
> > > > > in your test you change the state of the test-producer with static
> > > > methods
> > > > > (e.g. set a flag or a whole instance which should be returned by
> the
> > > > > test-producer).
> > > > > -> it's std. cdi and/or java - no special concept is needed.
> > > > >
> > > > > if you would like to use alternative-bean-x1 (instead of bean-x) in
> > > test1
> > > > > and alternative-bean-x2  (instead of bean-x) in test2, you can use
> > > > labeled
> > > > > alternatives (provided by ds > v1.8.1) - see e.g. [1] and [2].
> > > > > it's based on the new AlternativeBeanClassProvider spi (which you
> > could
> > > > use
> > > > > as well to implement your own concepts) - see e.g. [3].
> > > > >
> > > > > regards,
> > > > > gerhard
> > > > >
> > > > > [1]
> > > > > https://github.com/apache/deltaspike/tree/master/
> > > > deltaspike/modules/test-
> > > > > control/impl/src/test/java/org/apache/deltaspike/test/
> > > testcontrol/uc014
> > > > > [2]
> > > > > https://github.com/apache/deltaspike/tree/master/
> > > > deltaspike/modules/test-
> > > > > control/impl/src/test/java/org/apache/deltaspike/test/
> > > testcontrol/uc015
> > > > > [3]
> > > > > https://github.com/apache/deltaspike/tree/master/
> > > > deltaspike/modules/test-
> > > > > control/impl/src/test/java/org/apache/deltaspike/test/
> > > testcontrol/uc016
> > > > >
> > > > >
> > > > >
> > > > > http://www.irian.at
> > > > >
> > > > > Your JavaEE powerhouse -
> > > > > JavaEE Consulting, Development and
> > > > > Courses in English and German
> > > > >
> > > > > Professional Support for Apache
> > > > > MyFaces, DeltaSpike and OpenWebBeans
> > > > >
> > > > > 2018-04-14 15:24 GMT+02:00 Stephen More <stephen.m...@gmail.com>:
> > > > >
> > > > > > I have a need to run some unit tests with @Alternative -
> > > mockedVersionA
> > > > > > and other tests with @Alternative - mockedVersionB
> > > > > > and other tests with @Alternative - mockedVersionC
> > > > > >
> > > > > > It looks like Arquillian can handle this utilizing ShrinkWrap and
> > > > > > @Deployment....
> > > > > > addAsManifestResource( "mockedVersionA.xml","beans.xml");
> > > > > > addAsManifestResource( "mockedVersionB.xml","beans.xml");
> > > > > >
> > > > > > Can I achieve the same functionality using CdiTestRunner ?
> > > > > > -Thanks
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to