You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Arata Yamamoto <ar...@gmail.com> on 2012/07/26 21:47:23 UTC

Unexpected and not-intentional switching of thread during a test method execution by maven-surefire-plugin

Dear group,

I would like to know whether the maven-surefire-plugin has been designed to
use multi threads automatically if possible during a test method execution?
(Please allow me to remind that I'm using default setting of
maven-surefire-plugin other than include and exclude optional parameters.)
If so, then how to disable it?

I'm facing the test failure caused by unexpected and not-my-intentional
switching of thread during a test method execution by surefire.

- Regarding the cause of the test failure:
The module under test is the event manager (utilizing AspectJ) that has one
of the features to decide whether handing over the event to object only
when the object has been instantiated in the same thread what yields the
event.
And the test failed because, in the middle of the test method execution,
other thread takes over the execution; I didn't expect this. Hence, the
event wasn't handed over to the object and ended as the test failure.
Please also take a look at the test method code and the test method log
snippet sections below for more info.

- Regarding reproduce-ability:
It always seems repro (when that test method is executed as a part of whole
test set).
This symptom causing the failure seems not to occur when I make the
surefire run only that test class or method but the rest of tests by using
-Dtest command line option.
Also, I didn't encounter this failure with the Eclipse's JUnit runner.

- Regarding configuration:
Maven version 3.0.1
maven-surefire-plugin version 2.11
I haven't set other than exclude and include optional parameters of
surefire.
JUnit 4.10
So, I believe that surefire is using junit 4 provider.
JRE version 1.6
OS: Windows XP

- Test method code snippet
// Test for field event from inherited field
--------------------------------------------------
@Test
public void testFieldEventFromChildEventProducer1() throws Throwable {
    // Instantiate EventRecipient object
------------------------------------------------------
    Object eventRecipientObj
    = EventManagerTestUtils.eventRecipientFactory(
childDelegationClassLoader);
    //
----------------------------------------------------------------------------------------
    // Instantiate EventRecipientChild object
-------------------------------------------------
// !!! According to test log, the thread was switched at here unexpectedly
!!!
    Object eventRecipientChildObj
    = EventManagerTestUtils.eventRecipientChildFactory(
childDelegationClassLoader);
    //
----------------------------------------------------------------------------------------
    // Instantiate EventRecipientGrandChild object
--------------------------------------------
    Object eventRecipientGrandChildObj
    = EventManagerTestUtils.eventRecipientGrandChildFactory(
childDelegationClassLoader);
    //
----------------------------------------------------------------------------------------

    // Execute EventProducer.setPrice method
-------------------------------------------------
    Object childEventProducer1Obj
    = EventManagerTestUtils.childEventProducer1Factory(
childDelegationClassLoader);
    Method setPriceMethod
    = EventManagerTestUtils.getEventProducerSetPriceMethod(
            EventManagerTestUtils.getEventProducerClass(
childDelegationClassLoader)
            );
    int priceValue = 88;
    setPriceMethod.invoke( childEventProducer1Obj, priceValue);
    //
----------------------------------------------------------------------------------------

    // Verifying methods executed
-------------------------------------------------------------
    Assert.assertEquals(
            EventManagerTestUtils.getEventTraceListDump( eventTraceList) +
"\n",
            4,
            eventTraceList.size()
            );
    ...


- Test method log snippet when it's failed
21:15:11.250 [main] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
21:15:11.343 [main] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.343 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.343 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
21:15:11.359 [main] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.onPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)

/* !!! Here it changed thread unexpectedly from main thread to Thread-1
thread !!! */

21:15:11.375 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
21:15:11.375 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
public static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.375 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
protected static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
protected static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
public void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [] event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
public void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
protected static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.staticListenerOfBothEvents(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent,
class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
21:15:11.390 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
public static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.406 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
protected static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
21:15:11.406 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - added
protected static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
21:15:11.437 [Thread-1] DEBUG c.n.a.e.t.EventProducerByStaticField -
Executing
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducerByStaticField.setPrice(EventProducerByStaticField.java:17)
21:15:11.453 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - Going to
execute @PreEvent type event listener method(s) for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event prior to setting value to the field below:
Type: no type info
Signature: int
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducerByStaticField.price
Arguments: ( 88 )
Called from:

21:15:11.484 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - No
@PreEvent type listener for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
21:15:11.484 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - Going to
execute @OnEvent type event listener method(s) for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event triggered from setting value to the field below:
Type: no type info
Signature: int
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducerByStaticField.price
Arguments: ( 88 )
Called from:

21:15:11.484 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.staticListenerOfBothEvents
event-listener static method (annotated with @OnEvent) at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
21:15:11.500 [Thread-1] DEBUG c.n.a.e.EventListenerInstanceTracker -
Listers of event:
{com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient@8c1dd9
=1}
21:15:11.500 [Thread-1] INFO  c.n.a.eventmanager.EventHandler -
amongInstancesInThread attribute setting of @OnEvent annotation is ignored
as
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange
is static method.
21:15:11.500 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange
event-listener static method (annotated with @OnEvent) at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
21:15:11.500 [Thread-1] DEBUG c.n.a.e.EventListenerInstanceTracker -
Listers of event:
{com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild@1d64c37
=9}
21:15:11.500 [Thread-1] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onPriceChange
event-listener method (annotated with @OnEvent) of
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild@1d64c37instance
at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event

Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.5 sec <<<
FAILURE!
...
Results :

Failed tests:
testFieldEventFromChildEventProducer1(com.newmainsoftech.aspectjutil.eventmanager.EventHandlerTestWithEventRecipientGrandChild):
Executed listen(..)

Tests run: 14, Failures: 1, Errors: 0, Skipped: 0


- Test method log snippet when the test method succeeds at having executed
as single individual test by specifying that test method with -Dtest
command line option
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running
com.newmainsoftech.aspectjutil.eventmanager.EventHandlerTestWithEventRecipientGrandChild
08:15:43.109 [main] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
08:15:44.203 [main] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.218 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.218 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
08:15:44.218 [main] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.onPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)

/* !!! No switching thread from main thread !!! */

08:15:44.281 [main] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
08:15:44.281 [main] DEBUG c.n.a.eventmanager.EventHandler - added public
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.281 [main] DEBUG c.n.a.eventmanager.EventHandler - added void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.296 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.296 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
08:15:44.312 [main] DEBUG c.n.a.eventmanager.EventHandler -
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.<clinit>
has been picked up (by AspectJ's staticinitialization) as annotated with
@EventListener
08:15:44.312 [main] DEBUG c.n.a.eventmanager.EventHandler - added public
void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [] event(s)
08:15:44.312 [main] DEBUG c.n.a.eventmanager.EventHandler - added public
void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
08:15:44.312 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.staticListenerOfBothEvents(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent,
class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
08:15:44.328 [main] DEBUG c.n.a.eventmanager.EventHandler - added public
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientChild.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.328 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfCalculationCompletion(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$CalculationEvent]
event(s)
08:15:44.359 [main] DEBUG c.n.a.eventmanager.EventHandler - added protected
static void
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange(com.newmainsoftech.aspectjutil.eventmanager.EventInfo)
static method to list of methods annotated with @OnEvent for [class
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange]
event(s)
08:15:44.421 [main] DEBUG c.n.a.e.testmodels.EventProducer - Executing
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducer.setPrice(EventProducer.java:20)

08:15:44.468 [main] DEBUG c.n.a.eventmanager.EventHandler - Going to
execute @PreEvent type event listener method(s) for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event prior to setting value to the field below:
Type:
com.newmainsoftech.aspectjutil.eventmanager.testmodels.ChildEventProducer1
Signature: int
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducer.price
Arguments: ( 88 )
Called from:

08:15:44.484 [main] DEBUG c.n.a.eventmanager.EventHandler - No @PreEvent
type listener for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
08:15:44.500 [main] DEBUG c.n.a.eventmanager.EventHandler - Going to
execute @OnEvent type event listener method(s) for
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event triggered from setting value to the field below:
Type:
com.newmainsoftech.aspectjutil.eventmanager.testmodels.ChildEventProducer1
Signature: int
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventProducer.price
Arguments: ( 88 )
Called from:

08:15:44.500 [main] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.staticListenerOfBothEvents
event-listener static method (annotated with @OnEvent) at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
08:15:44.531 [main] DEBUG c.n.a.e.EventListenerInstanceTracker - Listers of
event:
{com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient@1617189
=1}
08:15:44.531 [main] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.onPriceChange
event-listener method (annotated with @OnEvent) of
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient@1617189instance
at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
08:15:44.546 [main] INFO  c.n.a.eventmanager.EventHandler -
amongInstancesInThread attribute setting of @OnEvent annotation is ignored
as
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange
is static method.
08:15:44.546 [main] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipient.staticListenerOfPriceChange
event-listener static method (annotated with @OnEvent) at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
08:15:44.546 [main] DEBUG c.n.a.e.EventListenerInstanceTracker - Listers of
event:
{com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild@95c083
=1}
08:15:44.546 [main] DEBUG c.n.a.eventmanager.EventHandler - Invoked
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild.onPriceChange
event-listener method (annotated with @OnEvent) of
com.newmainsoftech.aspectjutil.eventmanager.testmodels.EventRecipientGrandChild@95c083instance
at
com.newmainsoftech.aspectjutil.eventmanager.testmodels.SampleEventClass$PriceChange
event
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.328 sec

Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Regards,
Arata

Re: Unexpected and not-intentional switching of thread during a test method execution by maven-surefire-plugin

Posted by Arata Yamamoto <ar...@gmail.com>.
Thank you for your replies and advises, Wayne and Kristian.

First, I must apologize. By the further analysis of the test log, I found
that the failure log snippet in my previous post wasn't the one of the
failed test. And found out that it's not switching the thread unexpectedly.
I'm really sorry.

And the test failure was not repro after updating the dependency and plugin.

> Can you try Maven 3.0.4 and Surefire 2.12?
It didn't repro after I updated the version of following dependency and
plugin:
    org.aspectj:aspectjtools:1.6.12 -> 1.7.0
    org.apache.maven.plugins:maven-compiler-plugin:2.3.2 -> 2.5.1
I also updated surefire to 2.12 from 2.11, but I encountered the test
failure with using surefire 2.12 at first. I just used 2.11 to check
whether this could repro when it executed as single test by using -Dtest
command line option since surefire 2.12's bug:
https://jira.codehaus.org/browser/SUREFIRE-827 (and SUREFIRE-760).

Warm regards,
Arata

On Thu, Jul 26, 2012 at 4:21 PM, Kristian Rosenvold <
kristian.rosenvold@gmail.com> wrote:

> The *only* way to make surefire use threads is to set the <parallel>
> attribute to some legal value. Use mvn help:effective-pom to see if
> this is set. I can see from your log output that this is not set, so
> this is something happening in your code/libs.
>
> I might suggest using -Dmaven.surefire.debug=true and attach a
> debugger to the tests in question to inspect the call stack/threads to
> find out WTF is going on.
>
> Kristian
>
>
> 2012/7/27 Wayne Fay <wa...@gmail.com>:
> >> Maven version 3.0.1
> >> maven-surefire-plugin version 2.11
> >> I haven't set other than exclude and include optional parameters of
> >> surefire.
> >> JUnit 4.10
> >> So, I believe that surefire is using junit 4 provider.
> >> JRE version 1.6
> >> OS: Windows XP
> >
> > Can you try Maven 3.0.4 and Surefire 2.12? Also perhaps try specifying
> > forkMode=never in Surefire. And finally check "mvn help:effective-pom"
> > to be certain there is not some additional Surefire configuration
> > coming in from a parent etc that you did not even realize is impacting
> > your build.
> >
> > Hopefully Kristian will see this thread, he is the expert in these
> areas... :)
> >
> > Wayne
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Unexpected and not-intentional switching of thread during a test method execution by maven-surefire-plugin

Posted by Kristian Rosenvold <kr...@gmail.com>.
The *only* way to make surefire use threads is to set the <parallel>
attribute to some legal value. Use mvn help:effective-pom to see if
this is set. I can see from your log output that this is not set, so
this is something happening in your code/libs.

I might suggest using -Dmaven.surefire.debug=true and attach a
debugger to the tests in question to inspect the call stack/threads to
find out WTF is going on.

Kristian


2012/7/27 Wayne Fay <wa...@gmail.com>:
>> Maven version 3.0.1
>> maven-surefire-plugin version 2.11
>> I haven't set other than exclude and include optional parameters of
>> surefire.
>> JUnit 4.10
>> So, I believe that surefire is using junit 4 provider.
>> JRE version 1.6
>> OS: Windows XP
>
> Can you try Maven 3.0.4 and Surefire 2.12? Also perhaps try specifying
> forkMode=never in Surefire. And finally check "mvn help:effective-pom"
> to be certain there is not some additional Surefire configuration
> coming in from a parent etc that you did not even realize is impacting
> your build.
>
> Hopefully Kristian will see this thread, he is the expert in these areas... :)
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Unexpected and not-intentional switching of thread during a test method execution by maven-surefire-plugin

Posted by Wayne Fay <wa...@gmail.com>.
> Maven version 3.0.1
> maven-surefire-plugin version 2.11
> I haven't set other than exclude and include optional parameters of
> surefire.
> JUnit 4.10
> So, I believe that surefire is using junit 4 provider.
> JRE version 1.6
> OS: Windows XP

Can you try Maven 3.0.4 and Surefire 2.12? Also perhaps try specifying
forkMode=never in Surefire. And finally check "mvn help:effective-pom"
to be certain there is not some additional Surefire configuration
coming in from a parent etc that you did not even realize is impacting
your build.

Hopefully Kristian will see this thread, he is the expert in these areas... :)

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org