{"action":"created","comment":{"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments/60556979","id":60556979,"diff_hunk":"@@ -68,7 +97,66 @@ private void configureWithResolvedConfigKey(FlagUtils.FlagConfigKeyAndValueRecor\n         }\n     }\n \n-    private void setUnusedKeysAsAnonymousKeys(EntitySpec spec, Set<String> keyNamesUsed, ConfigBag bag){\n+    private Optional<Object> joinOldAndNewSpecConfigValues(Optional<Object> oldValue,\n+                                                           Optional<Object> newValue) {\n+        Optional<Object> result;\n+\n+        if ((newValue.isPresent()) && (oldValue.isPresent())) {\n+            result = Optional.of(\n+                    joinOldAndNewValues(oldValue.get(), newValue.get()));\n+        } else if (newValue.isPresent()) {\n+            result = newValue;\n+        } else if (oldValue.isPresent()) {\n+            result = oldValue;\n+        } else {\n+            result = Optional.absent();\n+        }\n+        return result;\n+    }\n+\n+    protected Object joinOldAndNewValues(Object oldValue, Object newValue) {\n+        if ((oldValue instanceof Map) && (newValue instanceof Map)) {\n+            return combineCurrentAndResolvedValueMaps((Map) oldValue, (Map) newValue);\n+        } else if ((oldValue instanceof List) && (newValue instanceof List)) {\n+            return combineCurrentAndResolvedValueList((List) oldValue, (List) newValue);\n+        } else if ((oldValue instanceof String) && (newValue instanceof String)) {\n+            return newValue;\n+        } else {\n+            LOG.warn(\"Types of oldValue {} and newValue {} are not the same, so {} is not able \" +","path":"brooklyn-tosca-transformer/src/main/java/io/cloudsoft/tosca/a4c/brooklyn/spec/ConfigKeyModifier.java","position":131,"original_position":131,"commit_id":"a7068153206cc8691d01131b605d76b50432edf2","original_commit_id":"a7068153206cc8691d01131b605d76b50432edf2","user":{"login":"sjcorbett","id":837527,"avatar_url":"https://avatars.githubusercontent.com/u/837527?v=3","gravatar_id":"","url":"https://api.github.com/users/sjcorbett","html_url":"https://github.com/sjcorbett","followers_url":"https://api.github.com/users/sjcorbett/followers","following_url":"https://api.github.com/users/sjcorbett/following{/other_user}","gists_url":"https://api.github.com/users/sjcorbett/gists{/gist_id}","starred_url":"https://api.github.com/users/sjcorbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjcorbett/subscriptions","organizations_url":"https://api.github.com/users/sjcorbett/orgs","repos_url":"https://api.github.com/users/sjcorbett/repos","events_url":"https://api.github.com/users/sjcorbett/events{/privacy}","received_events_url":"https://api.github.com/users/sjcorbett/received_events","type":"User","site_admin":false},"body":"This isn't worth a warning - probably trace, maybe debug. I don't think there's any need to special case String either.","created_at":"2016-04-21T10:13:19Z","updated_at":"2016-04-21T10:13:19Z","html_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/103#discussion_r60556979","pull_request_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments/60556979"},"html":{"href":"https://github.com/cloudsoft/brooklyn-tosca/pull/103#discussion_r60556979"},"pull_request":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103","id":66823958,"html_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/103","diff_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/103.diff","patch_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/103.patch","issue_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/103","number":103,"state":"open","locked":false,"title":"Fix/relations override prop collections","user":{"login":"kiuby88","id":3704424,"avatar_url":"https://avatars.githubusercontent.com/u/3704424?v=3","gravatar_id":"","url":"https://api.github.com/users/kiuby88","html_url":"https://github.com/kiuby88","followers_url":"https://api.github.com/users/kiuby88/followers","following_url":"https://api.github.com/users/kiuby88/following{/other_user}","gists_url":"https://api.github.com/users/kiuby88/gists{/gist_id}","starred_url":"https://api.github.com/users/kiuby88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiuby88/subscriptions","organizations_url":"https://api.github.com/users/kiuby88/orgs","repos_url":"https://api.github.com/users/kiuby88/repos","events_url":"https://api.github.com/users/kiuby88/events{/privacy}","received_events_url":"https://api.github.com/users/kiuby88/received_events","type":"User","site_admin":false},"body":"When a relationship is configured the a `ConfigKey` value (maybe a `Flag`) is added to the EntitySpec`. However, this value addition does not take in account any old config value which might have configured previously. For example, \r\n\r\n```\r\n   tomcat_server:\r\n      type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer\r\n      properties:\r\n        java.sysprops:\r\n          key1: value1\r\n      requirements:\r\n        - endpoint_configuration:\r\n            node: backend\r\n            relationship: brooklyn.relationships.Configure\r\n            properties:\r\n              prop.collection: java.sysprops\r\n              prop.name: key2\r\n              prop.value: value2\r\n```\r\n\r\nThe generated `EntitySpec` has to contains two entries in  `java.sysprops` configuration field.\r\n - `key1`: `value1``\r\n - `key2`: `value2`\r\n\r\nHowever, currently the generated entity just contains the `key2: value2` entry. \r\nCurrently, `RelationshipModifier` adds a configuration to an spec invoking `ConfigKeyModifier.configureConfigKeysSpec` method,  which replace the previous values of any `EntitySpec`'s configuration. \r\nIt looks that `ConfigKeyModifier.configureConfigKeysSpec` mustn't be used for this task, because this method adds a configuration value to an entity spec, and if the entity spec already contains a  value for this configuration `ConfigKeyModifier.configureConfigKeysSpec` should replace the old value. \r\n\r\nRelation management transformation process has not  to replace a configuration of an entity, it has to update the entities config values. Then, it is necessary a new method which represents this concept . In this case, `ConfigKeyModifier.updateConfigKeysSpec` allows to add new values to any `EntitySpec`'s configuration maintaining the old values.","created_at":"2016-04-18T09:38:23Z","updated_at":"2016-04-21T10:13:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfb9168be0e0456ac66243d36fe8f5555e8471ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103/commits","review_comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103/comments","review_comment_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/103/comments","statuses_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/a7068153206cc8691d01131b605d76b50432edf2","head":{"label":"kiuby88:fix/relations-override-prop-collections","ref":"fix/relations-override-prop-collections","sha":"a7068153206cc8691d01131b605d76b50432edf2","user":{"login":"kiuby88","id":3704424,"avatar_url":"https://avatars.githubusercontent.com/u/3704424?v=3","gravatar_id":"","url":"https://api.github.com/users/kiuby88","html_url":"https://github.com/kiuby88","followers_url":"https://api.github.com/users/kiuby88/followers","following_url":"https://api.github.com/users/kiuby88/following{/other_user}","gists_url":"https://api.github.com/users/kiuby88/gists{/gist_id}","starred_url":"https://api.github.com/users/kiuby88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiuby88/subscriptions","organizations_url":"https://api.github.com/users/kiuby88/orgs","repos_url":"https://api.github.com/users/kiuby88/repos","events_url":"https://api.github.com/users/kiuby88/events{/privacy}","received_events_url":"https://api.github.com/users/kiuby88/received_events","type":"User","site_admin":false},"repo":{"id":43336070,"name":"brooklyn-tosca","full_name":"kiuby88/brooklyn-tosca","owner":{"login":"kiuby88","id":3704424,"avatar_url":"https://avatars.githubusercontent.com/u/3704424?v=3","gravatar_id":"","url":"https://api.github.com/users/kiuby88","html_url":"https://github.com/kiuby88","followers_url":"https://api.github.com/users/kiuby88/followers","following_url":"https://api.github.com/users/kiuby88/following{/other_user}","gists_url":"https://api.github.com/users/kiuby88/gists{/gist_id}","starred_url":"https://api.github.com/users/kiuby88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiuby88/subscriptions","organizations_url":"https://api.github.com/users/kiuby88/orgs","repos_url":"https://api.github.com/users/kiuby88/repos","events_url":"https://api.github.com/users/kiuby88/events{/privacy}","received_events_url":"https://api.github.com/users/kiuby88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kiuby88/brooklyn-tosca","description":"","fork":true,"url":"https://api.github.com/repos/kiuby88/brooklyn-tosca","forks_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/forks","keys_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/teams","hooks_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/hooks","issue_events_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/issues/events{/number}","events_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/events","assignees_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/assignees{/user}","branches_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/branches{/branch}","tags_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/tags","blobs_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/git/refs{/sha}","trees_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/statuses/{sha}","languages_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/languages","stargazers_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/stargazers","contributors_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/contributors","subscribers_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/subscribers","subscription_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/subscription","commits_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/commits{/sha}","git_commits_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/git/commits{/sha}","comments_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/comments{/number}","issue_comment_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/issues/comments{/number}","contents_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/contents/{+path}","compare_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/merges","archive_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/downloads","issues_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/issues{/number}","pulls_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/pulls{/number}","milestones_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/milestones{/number}","notifications_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/labels{/name}","releases_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/releases{/id}","deployments_url":"https://api.github.com/repos/kiuby88/brooklyn-tosca/deployments","created_at":"2015-09-29T00:56:08Z","updated_at":"2016-04-04T15:40:46Z","pushed_at":"2016-04-21T09:07:45Z","git_url":"git://github.com/kiuby88/brooklyn-tosca.git","ssh_url":"git@github.com:kiuby88/brooklyn-tosca.git","clone_url":"https://github.com/kiuby88/brooklyn-tosca.git","svn_url":"https://github.com/kiuby88/brooklyn-tosca","homepage":null,"size":1238,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudsoft:master","ref":"master","sha":"137b5928da296f2adb8efdd50f7ac5473a9297ee","user":{"login":"cloudsoft","id":831459,"avatar_url":"https://avatars.githubusercontent.com/u/831459?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudsoft","html_url":"https://github.com/cloudsoft","followers_url":"https://api.github.com/users/cloudsoft/followers","following_url":"https://api.github.com/users/cloudsoft/following{/other_user}","gists_url":"https://api.github.com/users/cloudsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudsoft/subscriptions","organizations_url":"https://api.github.com/users/cloudsoft/orgs","repos_url":"https://api.github.com/users/cloudsoft/repos","events_url":"https://api.github.com/users/cloudsoft/events{/privacy}","received_events_url":"https://api.github.com/users/cloudsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":42243454,"name":"brooklyn-tosca","full_name":"cloudsoft/brooklyn-tosca","owner":{"login":"cloudsoft","id":831459,"avatar_url":"https://avatars.githubusercontent.com/u/831459?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudsoft","html_url":"https://github.com/cloudsoft","followers_url":"https://api.github.com/users/cloudsoft/followers","following_url":"https://api.github.com/users/cloudsoft/following{/other_user}","gists_url":"https://api.github.com/users/cloudsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudsoft/subscriptions","organizations_url":"https://api.github.com/users/cloudsoft/orgs","repos_url":"https://api.github.com/users/cloudsoft/repos","events_url":"https://api.github.com/users/cloudsoft/events{/privacy}","received_events_url":"https://api.github.com/users/cloudsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudsoft/brooklyn-tosca","description":"","fork":false,"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca","forks_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/forks","keys_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/teams","hooks_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/hooks","issue_events_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/events{/number}","events_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/events","assignees_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/assignees{/user}","branches_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/branches{/branch}","tags_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/tags","blobs_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/languages","stargazers_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/stargazers","contributors_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/contributors","subscribers_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/subscribers","subscription_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/subscription","commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/contents/{+path}","compare_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/merges","archive_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/downloads","issues_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues{/number}","pulls_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/labels{/name}","releases_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/releases{/id}","deployments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/deployments","created_at":"2015-09-10T12:36:54Z","updated_at":"2016-02-05T09:35:35Z","pushed_at":"2016-04-21T09:07:46Z","git_url":"git://github.com/cloudsoft/brooklyn-tosca.git","ssh_url":"git@github.com:cloudsoft/brooklyn-tosca.git","clone_url":"https://github.com/cloudsoft/brooklyn-tosca.git","svn_url":"https://github.com/cloudsoft/brooklyn-tosca","homepage":null,"size":1240,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":4,"forks":13,"open_issues":4,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103"},"html":{"href":"https://github.com/cloudsoft/brooklyn-tosca/pull/103"},"issue":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/103"},"comments":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/a7068153206cc8691d01131b605d76b50432edf2"}}}}