karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: Unit tests and refactoring - karaf-maven-plugin - AssemblyMojo
Date Wed, 19 Apr 2017 05:58:17 GMT
Thanks, I gonna take a look.

Easymock is pretty similar to Mockito (Easymock.createMock() instead of 
Mockito.mock()), etc.

Regards
JB

On 04/19/2017 07:55 AM, kemitix wrote:
> Hi JB,
>
> The branch is at  https://github.com/kemitix/karaf/tree/assembly-mojo-test-coverage
>
> I'll need to do some reading on Easymock as I've not used it before.
>
> --
> Paul [W] Campbell     From: jbonofre [via Karaf] <ml+s922171n4050177h58@n3.nabble.com>
> Sent: Wed, 19 Apr 2017 6:42 AM
> To: kemitix <pcampbell@kemitix.net>
> Subject: Re: Unit tests and refactoring - karaf-maven-plugin - AssemblyMojo
>
> Hi Paul,
>
> Can I see a branch on github ?
>
> Can you use Easymock instead of Mockito (as we use Easymock in other part of
> Karaf) ?
>
> The @Parameters you mentioned were used in previous versions to generate the
> features and cfg file.
>
> Regards
> JB
>
> On 04/18/2017 11:44 PM, Paul Campbell wrote:
>
>>
>> Hi,
>>
>> Here is a progress update on my work with AssemblyMojo.
>>
>> I've been writing some exploratory tests to lock down the current behaviour of
>> the AssemblyMojo.
>>
>> 1/ Split AssemblyMojo into a parameter/configuration class and a behaviour class
>>
>> I have extracted the doExecute() method and supporting methods out of
>> AssemblyMojo and into AssemblyMojoExec. (That probably needs a better name:
>> AssemblyService?). This left all the @Parameter fields in AssemblyMojo, which is
>> now passed as a single parameter object: AssemblyMojoExec.doExecute(AssemblyMojo
>> mojo). This gives a clean separation between capturing 39 @Parameters and
>> performing the actual assembly.
>>
>> 2/ Upgraded Maven in the tooling package to 3.5.0
>>
>> This allows simplification of accessing the Maven API and avoids the need to use
>> reflection. Upgrading the rest of karaf is outside the current scope.
>>
>> 3/ Added jacoco for code coverage, without any minimum coverage requirements
>>
>> Jacoco is licensed under Eclipse Public License Version 1.0.
>>
>> 4/ Added mockito for test support
>>
>> Mockito is licensed under M.I.T. License.
>>
>> 5/ Added hamcrest for test support
>>
>> Hamcrest is licensed under BSD License.
>>
>> 6/ Write tests for AssemblyMojoExec covering 86% of branches.
>>
>> The remaining 14% of branches are in unreachable File IO or Reflection
>> exceptions and in switch statements.
>>
>> 7/ Identify unused @Parameters
>>
>> The following @Parameter fields in AssemblyMojo are unused and could be removed
>> without affecting the tests.
>>
>> * featuresCfgFile
>> * startupPropertiesFile
>> * systemDirectory
>> * defaultStartLevel
>> * blacklistedRepositories
>> * blacklistedFeatures
>> * startupBundles
>> * bootBundles
>> * installedBundles
>> * blacklistedBundles
>> * blacklistedProfiles
>>
>> Is there any reason to keep any of these @Parameters? They are configuration
>> items used by other Mojos. AssemblyMojo should really only ask for the
>> @Parameters that it uses.
>>
>> ---
>>
>> This current state is
>> in https://github.com/kemitix/karaf/tree/assembly-mojo-test-coverage
>>
>> Going on from here, I will be working in the assembly-mojo-refactoring branch to
>> clean up and simplify the mojo, using the AssemblyMojoExecTest to ensure that
>> behaviour remains consistent.
>>
>> Feedback welcome.
>>
>> --
>> Paul [W] Campbell
>>
>> --------------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the discussion below:
>> http://karaf.922171.n3.nabble.com/Unit-tests-and-refactoring-karaf-maven-plugin-AssemblyMojo-tp4050098p4050113.html
>>
>> To unsubscribe from Unit tests and refactoring - karaf-maven-plugin -
>> AssemblyMojo, click here
>> <
>>
>> NAML
>> < http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
>   If you reply to this email, your message will be added to the discussion below: http://karaf.922171.n3.nabble.com/Unit-tests-and-refactoring-karaf-maven-plugin-AssemblyMojo-tp4050098p4050177.html
To unsubscribe from Unit tests and refactoring - karaf-maven-plugin - AssemblyMojo, click
here.
> NAML
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Unit-tests-and-refactoring-karaf-maven-plugin-AssemblyMojo-tp4050098p4050178.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message