I submitted a patch based on my described approach for you to review:

https://issues.apache.org/jira/browse/SLING-2810

Mark Adamcin
http://adamcin.net/


On Wed, Apr 3, 2013 at 10:11 AM, Mark Adamcin <[email protected]> wrote:

> Thanks for your reply, Bertrand. It looks like FELIX-3152 may not be
> sufficient. The important operation is the "byte[] getExecutionData()"
> method. I need to be able to serialize that byte array straight to an
> output stream so that I can save it to a "jacoco.exec" file after
> integration test execution. It appears the JMXConsolePlugin in FELIX-3152
> will only convert that byte[] into a string representation and send it back
> as HTML.
>
> I think in this case I should create a simple REST endpoint for the jacoco
> agent at /system/sling/jacoco to expose:
>
> jacoco Agent Status
>
> -------------------------------------------------------------------------------------------
> HEAD /system/sling/jacoco.exec
> Content-Type: application/octet-stream
> 200: jacoco agent is attached and exposed through JMX
> 404: jacoco agent not found
>
> return IAgent.getExecutionData(false)
>
> -------------------------------------------------------------------------------------------
> GET /system/sling/jacoco.exec
> Content-Type: application/octet-stream
> 200: execution data returned as response entity
> 404: jacoco agent not found
>
> Reset execution data and return jacoco.exec file
> ----------------------------------------------------------------------
> POST /system/sling/jacoco.exec [optional param ":sessionId" to set a
> specific sessionId after reset]
> Content-Type: application/octet-stream
> 200: agent was reset (with new sessionId if specified) and prior execution
> data returned as response entity
> 404: jacoco agent not found
>
> Jacoco instrumentation for OSGi is rather limited in the sense that there
> is one agent per JVM, and resetting the execution data resets it across the
> board, which means that concurrent requests to this service on a shared
> integration test server will need to be restricted during test execution to
> avoid corrupting coverage data.
>
> Mark Adamcin
> http://adamcin.net/
>
>
> On Wed, Apr 3, 2013 at 2:28 AM, Bertrand Delacretaz <
> [email protected]> wrote:
>
>> Hi Mark,
>>
>> On Wed, Apr 3, 2013 at 1:41 AM, Mark Adamcin <[email protected]> wrote:
>> > I'd like to create a simple servlet to expose jacoco execution data and
>> a
>> > couple JMX operations over HTTP, in order to capture code coverage data
>> for
>> > Sling Junit tests...
>>
>> sounds interesting - are you aware of
>> https://issues.apache.org/jira/browse/FELIX-3152 ? That might help for
>> the JMX/HTTP part.
>>
>> >
>> > It would make sense to simply embed the org.jacoco.agent.rt.IAgent...
>> > ...but I'm not
>> > sure if there are any license implications that should be considered
>> first,
>> > since it is released under the Eclipse Public License....
>>
>> http://apache.org/legal/resolved.html has info about which licenses
>> are acceptable - weak copyleft licenses like EPL are ok if the
>> software is used in binary form and if the inclusion is "appropriately
>> labeled". We're using the Eclipse JDT compiler in the
>> org.apache.sling.commons.compiler bundle for example, not sure how
>> we're handling the "appropriate labeling" there.
>>
>> -Bertrand
>>
>
>

Reply via email to