[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-8590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14608225#comment-14608225
 ] 

ASF GitHub Bot commented on CLOUDSTACK-8590:
--------------------------------------------

GitHub user wilderrodrigues opened a pull request:

    https://github.com/apache/cloudstack/pull/546

    CLOUDSTACK-8590 Refactoring NiciraNVP resource

    Hi there,
    
    The motivation behind the refactor of the NiciraNvpResource class was to 
decouple the execute of the commands, which was handled into several private 
methods in the class.
    
    With the refactor, we were able to decouple all the commands by wrapping 
them with another class. The extra classes are declared with the 
ResourceWrapper annotation, which makes possible to get all the classes loaded 
into a map inside the implementation of the  RequestWrapper class, in that case 
the NiciraNvpRequestWrapper.
    
    New tests were added in order to increase test coverage. The current status 
is:
    
    * Resource package: 86.7% coverage
    * Utils package: 95.1% coverage
    * Wrapper package: 97.5% coverage
    
    In addition, the previous retry mechanism has been improved. Instead of 
having an instance variable to control the retries and the extra methods with 
the number of retries passed as parameter, we now have a Map which holds the 
commands and the number of retry. Once the number of retries reaches ZERO, the 
given command is removed from the Map.
    
    An issue has been created in order to follow up with this refactor: 
https://issues.apache.org/jira/browse/CLOUDSTACK-8590
    
    The changes do not affect the behaviour of the NiciraNvpResource. As a 
proof of that, all the existing tests worked without any change. This is a pure 
structural change on the code.  
    
    This PR consists of 11 commits. I tried to combine the work on the command 
wrappers, retry mechanism, unit tests and general stuff.
    
    Cheers,
    Wilder

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/schubergphilis/cloudstack 
refactor/nicira_resource

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/546.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #546
    
----
commit fd27b7f96b7e257e4220d072f91dafb2bbfe4fa4
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-22T13:57:15Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
      - Adding the NiciraNvpWrapper
      - This class will keep track of all Wrappers of the Nicira NVP Plugin

commit 2e0d01e6e90d100a8fc0eeebac22ef4d4f644d2c
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-23T07:20:47Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Refactoring NiciraNvpResource
       - Added NiciraNvpRequestWrapper
       - Removing 1 execute methods form NiciraNvpResource
       - Added 1 unit test

commit 8b9b3dc8a28dba60ac42cdaef51585c097d1223f
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-23T07:38:56Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Refactoring NiciraNvpResource
       - Added NiciraNvpMaintainCommandWrapper
       - Removing 1 execute methods form NiciraNvpResource
       - Added 1 unit test

commit bc349571e5c896f24b7fab941aa5a0832ebe0ce3
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-23T08:47:23Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Refactoring NiciraNvpResource
       - Added NiciraNvpUtilities and NiciraNvpCreateLogicalSwitchCommandWrapper
       - Removing 1 execute methods form NiciraNvpResource
       - Added 1 unit test

commit ea7c38311cb3ef1005d5e3a1d2c6c8ebe373b10e
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T07:47:57Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Adding command wrappers NiciraNvpCreateLogicalSwitchCommandWrapper and 
NiciraNvpDeleteLogicalSwitchCommandWrapper
       - Refactoring the retry mechanism
       - Applying the new retry mechanism to current wrappers and old methods 
in NiciraNvpResource
       - Adding 2 tests
       - Fixing the testRetries() in NiciraNvpResourceTest class

commit 40a320a267d4bdfabc03a76e59f12087fbd5c776
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T08:22:25Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Adding NiciraNvpCreateLogicalSwitchPortCommandWrapper
       - Removing unsued field from NiciraNvpResourceTest

commit 2a8332870d2528ffbef6a6fd3ab6f0ba3e0880d7
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T09:07:59Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Adding NiciraNvpDeleteLogicalSwitchPortCommandWrapper

commit 6f4f8a07991ab4e320842bb8c05c6d17cb7d2c06
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T09:18:58Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Adding NiciraNvpCreateLogicalRouterCommandWrapper
       - Adding NiciraNvpDeleteLogicalSwitchPortCommandWrapper
       - Adding NiciraNvpFindLogicalSwitchPortCommandWrapper
       - Adding NiciraNvpUpdateLogicalSwitchPortCommandWrapper
       - Decoupling private methods from NiciraNvpResource

commit b0dde6683b5269edb40da923893b65e88e33d9d9
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T09:34:29Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Adding remaining command wrappers

commit c9718f77060baa396ab435c37eeb168f7f0b0e7d
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T10:11:45Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Increasing test coverage
         - resource package: 86.7%
         - utils package: 95.1%
         - wrapper package: 97.5%

commit df6c70ee57ebd59246a9436f8d9878231e173472
Author: wilderrodrigues <wrodrig...@schubergphilis.com>
Date:   2015-06-30T10:35:43Z

    CLOUDSTACK-8590 - Refactoring NiciraNVP resource
    
       - Change the retry() method to return 
Answer.createUnsupportedCommandAnswer(command) instead of throwing an exception

----


> Refactoring NiciraNVP resource
> ------------------------------
>
>                 Key: CLOUDSTACK-8590
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8590
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Network Controller
>            Reporter: Wilder Rodrigues
>            Assignee: Wilder Rodrigues
>             Fix For: 4.6.0
>
>
> Apply the same technique that was used for the refactoring of the Libvirt and 
> XenServer hypervisors.
> All the commands will be wrapped by a ResourceWrapper annotated class. This 
> will reduce the amount of private methods in the NiciraNvpResource class and 
> also increase its testability, maintainability,  extensibility and 
> readability 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to