JCLOUDS-1072 - Add support for environment-specific run lists to Role and Role.Builder
I would like to have this commit backported to the 1.9.x branch since that's the version of jClouds that we're currently using. * Support for manipulating environment-specific run lists has been added to the RoleBuilder class, via the envRunList and envRunListElement methods. * The Role class includes a new member variable (envRunList) that holds the environment-specific run lists. This variable is serialized as 'env_run_lists'. This variable is also incorporated into the equals, hashCode and toString methods. * The constructor for the Role class now includes a new argument (envRunList) that's mapped to the 'env_run_lists' property in the JSON representation of a Role that's generated by Chef. * I try to adhere to the mantra "If you write a line of code, then you write a test for that line of code". With that in mind, this pull request includes a RoleTest class that exercises all of the code that I added or modified. One thing that I feel compelled to draw attention to is the creation of the immutable envRunList in the build() method of the Role.Builder class. I found nothing in the Google collections framework to handle nested, immutable collections, like what is needed to maintain the map of environment-specific run lists that are collected via the envRunList and envRunListElement methods in the Role.Builder class. So, those methods manipulate a mutable java.util.Map whose values are instances of mutable java.util.List objects. A separate immutable map, with nested immutable lists is created in the build() method and used when instantiating the final Role object. You can view, comment on, or merge this pull request online at: https://github.com/jclouds/jclouds/pull/912 -- Commit Summary -- * JCLOUDS-1072 -- File Changes -- M apis/chef/src/main/java/org/jclouds/chef/domain/Role.java (62) M apis/chef/src/test/java/org/jclouds/chef/ChefApiTest.java (18) A apis/chef/src/test/java/org/jclouds/chef/domain/RoleTest.java (117) -- Patch Links -- https://github.com/jclouds/jclouds/pull/912.patch https://github.com/jclouds/jclouds/pull/912.diff --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/912
