dev@glassfish.java.net

Re: Hk2 JUnit integration

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 27 May 2010 17:44:05 -0700

OK. There was a 1-arg constructor in the AppTest, so no default one.

Where does the console output go? I see in both, the output and the
target/surefire-reports/com.sun.enterprise.transaction.jts.AppTest.txt
only the summary of the result...

thanks,
-marina

Marina Vatkina wrote:
> It's a lot of traces :(
>
> What kind of constructor does it need?
>
> Caused by: java.lang.InstantiationException:
> com.sun.enterprise.transaction.jts.AppTest
> at java.lang.Class.newInstance0(Class.java:340)
> at java.lang.Class.newInstance(Class.java:308)
> at
> com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:68)
>
> thanks,
> -marina
>
> Jerome Dochez wrote:
>> actually what you see below is just traces, I don't see the real
>> reason for the failure.
>>
>> you need to look into
>> target/surefire-reports/com.sun.enterprise.transaction.jts.AppTest.txt
>> for the real reason...
>>
>>
>> On 05/26/2010 04:34 PM, Marina Vatkina wrote:
>>> Hi Jerome,
>>>
>>> I tried to add @RunWith(Hk2Runner.class) to get a hold of the
>>> habitat in one of my junit tests, but it failed with a lot of
>>> messages in the console output like this:
>>>
>>> Beginning parsing ...
>>> Ignoring service-less ...
>>>
>>> then it came to these lines (what is car?) and failed:
>>>
>>> Finished introspecting hk2-core-1.0.19.jar
>>> Finished introspecting test-classes
>>> Finished introspecting auto-depends-1.0.19.jar
>>> Finished introspecting osgi-adapter-1.0.19.jar
>>> Finished introspecting annotation-framework-3.1-SNAPSHOT.jar
>>> Finished introspecting ejb-internal-api-3.1-SNAPSHOT.jar
>>> Starting to introspect
>>> finished introspecting
>>> Starting to introspect
>>> finished introspecting
>>> Found contract : com.sun.enterprise.connectors.ActiveResourceAdapter
>>> --> com.sun.enterprise.connectors.ActiveResourceAdapterImpl {index:
>>> {com.sun.enterprise.connectors.ActiveResourceAdapter,}
>>> class: {com.sun.enterprise.connectors.ActiveResourceAdapterImpl,}
>>> }
>>> <...>
>>> -->
>>> com.sun.enterprise.deployment.annotation.introspection.AppClientPersistenceDependencyAnnotationScanner
>>> {index: {com.sun.enterpr
>>> ise.deployment.annotation.introspection.AnnotationScanner:car,}
>>> class:
>>> {com.sun.enterprise.deployment.annotation.introspection.AppClientPersistenceDependencyAnnotationScanner,}
>>>
>>> com.sun.enterprise.deployment.annotation.introspection.AnnotationScanner:
>>> {car,}
>>> }
>>>
>>> -------------------------------------------------------
>>> T E S T S
>>> -------------------------------------------------------
>>> Running com.sun.enterprise.transaction.jts.AppTest
>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
>>> 0.138 sec <<< FAILURE!
>>>
>>> Results :
>>>
>>> Tests in error:
>>> com.sun.enterprise.transaction.jts.AppTest
>>>
>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
>>>
>>> thanks,
>>> -marina
>>>
>>> Jerome Dochez wrote:
>>>> I have made good progress integrating Hk2 injection inside JUnit
>>>> tests so I have written a wiki page on how to better unit test your
>>>> modules with JUnit and Hk2.
>>>>
>>>> http://wiki.glassfish.java.net/Wiki.jsp?page=TestingWithHk2
>>>>
>>>> Now you can use @Inject inside junit tests and have habitat
>>>> services injected and tested. It should simplify the testing of
>>>> individual modules, please try to use this as soon as possible for
>>>> unit testing.
>>>> I believe we should be able to do the same with TestNG but I have
>>>> no cycles for that, if anyone wants to pick that up, it would be
>>>> great...
>>>>
>>>> jerome
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>