{"action":"created","issue":{"url":"https://api.github.com/repos/apache/cloudstack/issues/1331","repository_url":"https://api.github.com/repos/apache/cloudstack","labels_url":"https://api.github.com/repos/apache/cloudstack/issues/1331/labels{/name}","comments_url":"https://api.github.com/repos/apache/cloudstack/issues/1331/comments","events_url":"https://api.github.com/repos/apache/cloudstack/issues/1331/events","html_url":"https://github.com/apache/cloudstack/pull/1331","id":126275654,"number":1331,"title":"Fix Sync of template.properties in Swift","user":{"login":"syed","id":55854,"avatar_url":"https://avatars.githubusercontent.com/u/55854?v=3","gravatar_id":"","url":"https://api.github.com/users/syed","html_url":"https://github.com/syed","followers_url":"https://api.github.com/users/syed/followers","following_url":"https://api.github.com/users/syed/following{/other_user}","gists_url":"https://api.github.com/users/syed/gists{/gist_id}","starred_url":"https://api.github.com/users/syed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syed/subscriptions","organizations_url":"https://api.github.com/users/syed/orgs","repos_url":"https://api.github.com/users/syed/repos","events_url":"https://api.github.com/users/syed/events{/privacy}","received_events_url":"https://api.github.com/users/syed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2016-01-12T21:07:12Z","updated_at":"2016-04-11T12:35:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/1331","html_url":"https://github.com/apache/cloudstack/pull/1331","diff_url":"https://github.com/apache/cloudstack/pull/1331.diff","patch_url":"https://github.com/apache/cloudstack/pull/1331.patch"},"body":"When using Swift as a secondary storage, we create a template.properties file which stores the metadata about the template. Currently the data which is present in the file is incorrect which leads to templates becoming unavailable after they are downloaded. This fix makes sure that the template.properties has the correct \"path\" set so that templates are available. \r\n\r\nI've also done a bit of cleanup and made the code bit more clean. \r\n"},"comment":{"url":"https://api.github.com/repos/apache/cloudstack/issues/comments/208318739","html_url":"https://github.com/apache/cloudstack/pull/1331#issuecomment-208318739","issue_url":"https://api.github.com/repos/apache/cloudstack/issues/1331","id":208318739,"user":{"login":"rafaelweingartner","id":4129005,"avatar_url":"https://avatars.githubusercontent.com/u/4129005?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelweingartner","html_url":"https://github.com/rafaelweingartner","followers_url":"https://api.github.com/users/rafaelweingartner/followers","following_url":"https://api.github.com/users/rafaelweingartner/following{/other_user}","gists_url":"https://api.github.com/users/rafaelweingartner/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelweingartner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelweingartner/subscriptions","organizations_url":"https://api.github.com/users/rafaelweingartner/orgs","repos_url":"https://api.github.com/users/rafaelweingartner/repos","events_url":"https://api.github.com/users/rafaelweingartner/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelweingartner/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T12:35:16Z","updated_at":"2016-04-11T12:35:16Z","body":"@syed, you can change the method to be protected.\r\nIMO every single method that has some logic in it should be tested without any discrimination among private and non-private ones.\r\n\r\nTo write a test for this method, you can use Mockito; you can use the spy method into the object that you want to test (NfsSecondaryStorageResource), then you can force an exception to be thrown when the \"execute\" method is called with “deleteCommand” object.\r\nTo check if the exception was treated properly you can use Mockito to mock the s_logger object and check if the “debug” method was called after the exception is thrown\r\n\r\nThis way, if someone changes the logic and let the exception be re-thrown, the test case will catch. Also, if someone silences the exception, the test case will catch.\r\n\r\nIf you have doubts/problems when writing the test case, just call me.\r\n"}}