{"action":"created","comment":{"url":"https://api.github.com/repos/sw360/sw360portal/pulls/comments/63148401","id":63148401,"diff_hunk":"@@ -0,0 +1,149 @@\n+/*\n+ * Copyright (c) Bosch Software Innovations GmbH 2015.\n+ *\n+ * This program is free software; you can redistribute it and/or modify it under\n+ * the terms of the GNU General Public License Version 2.0 as published by the\n+ * Free Software Foundation with classpath exception.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2.0 for\n+ * more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along with\n+ * this program (please see the COPYING file); if not, write to the Free\n+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n+ * 02110-1301, USA.\n+ */\n+\n+package com.bosch.osmi.bdp.access.mock.generator;\n+\n+import com.bosch.osmi.bdp.access.api.model.BdpEntity;\n+import com.bosch.osmi.bdp.access.api.model.User;\n+import com.bosch.osmi.bdp.access.impl.BdpApiAccessImpl;\n+import com.bosch.osmi.bdp.access.impl.util.Util;\n+import com.google.gson.*;\n+import org.apache.logging.log4j.LogManager;\n+import org.apache.logging.log4j.Logger;\n+\n+import java.io.File;\n+import java.io.FileWriter;\n+import java.io.IOException;\n+import java.io.Writer;\n+import java.lang.reflect.InvocationTargetException;\n+import java.lang.reflect.Method;\n+import java.util.Collection;\n+import java.util.Properties;\n+\n+/**\n+ * The MockDataGenerator iterates over all public methods of all api entities and stores the return values in a json\n+ * file. It uses the Java Reflection API to inspect the bdp-access-api and google.gson to serialize the result.\n+ *\n+ * @author muj1be\n+ * @since 11/19/15.\n+ */\n+public class MockDataGenerator {\n+\n+    private static final Logger LOGGER = LogManager.getLogger(MockDataGenerator.class);\n+\n+    private String userName;\n+    private String password;\n+    private String serverUrl;\n+\n+    public static void main(String[] args) throws IOException, InvocationTargetException, IllegalAccessException {\n+        MockDataGenerator generator = new MockDataGenerator();\n+        generator.generateMockData();\n+    }\n+\n+    public MockDataGenerator(){\n+        try {\n+            readProperties();\n+        } catch (IOException e) {\n+            e.printStackTrace();\n+        }\n+    }\n+\n+    private void readProperties() throws IOException {\n+        Properties props = Util.readBdpAccessImplProperties();\n+        userName = props.getProperty(\"user\");\n+        password = props.getProperty(\"password\");\n+        serverUrl= props.getProperty(\"bdp.url\");\n+    }\n+\n+    public void generateMockData() throws IOException, InvocationTargetException, IllegalAccessException {\n+        LOGGER.info(\"Start mock data generation ...\");\n+        LOGGER.info(\"Try to initialize API access for user \"+ userName + \" at server \" + serverUrl +\".\");\n+        LOGGER.info(\"Initialize API access.\");\n+        BdpApiAccessImpl access = new BdpApiAccessImpl(serverUrl, userName, password);\n+\n+        LOGGER.info(\"Retrieve user \" + userName);\n+        User user = access.retrieveUser();\n+        JsonObject resultStore = new JsonObject();\n+        LOGGER.info(\"Start bdp-access-api evaluation\");\n+        evaluate(user, resultStore);\n+\n+        writeToJsonFile(resultStore);\n+    }\n+\n+    private void writeToJsonFile(JsonObject resultStore) throws IOException {\n+        String path = Util.getHomeDir() + File.separator + \".bdp-access-files\" + File.separator + \"mockdata.json\";\n+        File file = new File(path);\n+        boolean dirExist = file.getParentFile().mkdirs();","path":"libraries/bdp-access-proxy/bdp-access-api-capture/src/main/java/com/bosch/osmi/bdp/access/mock/generator/MockDataGenerator.java","position":91,"original_position":91,"commit_id":"a4583dce18e1093b76ac8c6f8abcc49350ea6a88","original_commit_id":"435cce4a2f88228b253fe2eceaba26ae26cb93d1","user":{"login":"alex-evo","id":16780167,"avatar_url":"https://avatars.githubusercontent.com/u/16780167?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-evo","html_url":"https://github.com/alex-evo","followers_url":"https://api.github.com/users/alex-evo/followers","following_url":"https://api.github.com/users/alex-evo/following{/other_user}","gists_url":"https://api.github.com/users/alex-evo/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-evo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-evo/subscriptions","organizations_url":"https://api.github.com/users/alex-evo/orgs","repos_url":"https://api.github.com/users/alex-evo/repos","events_url":"https://api.github.com/users/alex-evo/events{/privacy}","received_events_url":"https://api.github.com/users/alex-evo/received_events","type":"User","site_admin":false},"body":"`mkdirs()` \"Returns: true if and only if the directory was created, along with all necessary parent directories; false otherwise\"\r\nSo, maybe a more fitting name for this variable would be `dirCreated`. Which also means that the condition in the next line should be negated.","created_at":"2016-05-13T08:25:07Z","updated_at":"2016-05-13T08:25:07Z","html_url":"https://github.com/sw360/sw360portal/pull/167#discussion_r63148401","pull_request_url":"https://api.github.com/repos/sw360/sw360portal/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/comments/63148401"},"html":{"href":"https://github.com/sw360/sw360portal/pull/167#discussion_r63148401"},"pull_request":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/sw360/sw360portal/pulls/167","id":69548710,"html_url":"https://github.com/sw360/sw360portal/pull/167","diff_url":"https://github.com/sw360/sw360portal/pull/167.diff","patch_url":"https://github.com/sw360/sw360portal/pull/167.patch","issue_url":"https://api.github.com/repos/sw360/sw360portal/issues/167","number":167,"state":"open","locked":false,"title":"Contrib/bdp importer","user":{"login":"bs-jokri","id":13886571,"avatar_url":"https://avatars.githubusercontent.com/u/13886571?v=3","gravatar_id":"","url":"https://api.github.com/users/bs-jokri","html_url":"https://github.com/bs-jokri","followers_url":"https://api.github.com/users/bs-jokri/followers","following_url":"https://api.github.com/users/bs-jokri/following{/other_user}","gists_url":"https://api.github.com/users/bs-jokri/gists{/gist_id}","starred_url":"https://api.github.com/users/bs-jokri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bs-jokri/subscriptions","organizations_url":"https://api.github.com/users/bs-jokri/orgs","repos_url":"https://api.github.com/users/bs-jokri/repos","events_url":"https://api.github.com/users/bs-jokri/events{/privacy}","received_events_url":"https://api.github.com/users/bs-jokri/received_events","type":"User","site_admin":false},"body":"This is the contribution of the BD Prot. Feature","created_at":"2016-05-10T17:49:11Z","updated_at":"2016-05-13T08:25:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5f0a7d4e55e8ff40b4c80e54132c8cd66d7a9f6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sw360/sw360portal/pulls/167/commits","review_comments_url":"https://api.github.com/repos/sw360/sw360portal/pulls/167/comments","review_comment_url":"https://api.github.com/repos/sw360/sw360portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sw360/sw360portal/issues/167/comments","statuses_url":"https://api.github.com/repos/sw360/sw360portal/statuses/a4583dce18e1093b76ac8c6f8abcc49350ea6a88","head":{"label":"bsinno:contrib/bdpImporter","ref":"contrib/bdpImporter","sha":"a4583dce18e1093b76ac8c6f8abcc49350ea6a88","user":{"login":"bsinno","id":9215699,"avatar_url":"https://avatars.githubusercontent.com/u/9215699?v=3","gravatar_id":"","url":"https://api.github.com/users/bsinno","html_url":"https://github.com/bsinno","followers_url":"https://api.github.com/users/bsinno/followers","following_url":"https://api.github.com/users/bsinno/following{/other_user}","gists_url":"https://api.github.com/users/bsinno/gists{/gist_id}","starred_url":"https://api.github.com/users/bsinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsinno/subscriptions","organizations_url":"https://api.github.com/users/bsinno/orgs","repos_url":"https://api.github.com/users/bsinno/repos","events_url":"https://api.github.com/users/bsinno/events{/privacy}","received_events_url":"https://api.github.com/users/bsinno/received_events","type":"Organization","site_admin":false},"repo":{"id":58447065,"name":"sw360portal","full_name":"bsinno/sw360portal","owner":{"login":"bsinno","id":9215699,"avatar_url":"https://avatars.githubusercontent.com/u/9215699?v=3","gravatar_id":"","url":"https://api.github.com/users/bsinno","html_url":"https://github.com/bsinno","followers_url":"https://api.github.com/users/bsinno/followers","following_url":"https://api.github.com/users/bsinno/following{/other_user}","gists_url":"https://api.github.com/users/bsinno/gists{/gist_id}","starred_url":"https://api.github.com/users/bsinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsinno/subscriptions","organizations_url":"https://api.github.com/users/bsinno/orgs","repos_url":"https://api.github.com/users/bsinno/repos","events_url":"https://api.github.com/users/bsinno/events{/privacy}","received_events_url":"https://api.github.com/users/bsinno/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bsinno/sw360portal","description":"A software component catalogue application - designed to work with FOSSology.","fork":true,"url":"https://api.github.com/repos/bsinno/sw360portal","forks_url":"https://api.github.com/repos/bsinno/sw360portal/forks","keys_url":"https://api.github.com/repos/bsinno/sw360portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsinno/sw360portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsinno/sw360portal/teams","hooks_url":"https://api.github.com/repos/bsinno/sw360portal/hooks","issue_events_url":"https://api.github.com/repos/bsinno/sw360portal/issues/events{/number}","events_url":"https://api.github.com/repos/bsinno/sw360portal/events","assignees_url":"https://api.github.com/repos/bsinno/sw360portal/assignees{/user}","branches_url":"https://api.github.com/repos/bsinno/sw360portal/branches{/branch}","tags_url":"https://api.github.com/repos/bsinno/sw360portal/tags","blobs_url":"https://api.github.com/repos/bsinno/sw360portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsinno/sw360portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsinno/sw360portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsinno/sw360portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsinno/sw360portal/statuses/{sha}","languages_url":"https://api.github.com/repos/bsinno/sw360portal/languages","stargazers_url":"https://api.github.com/repos/bsinno/sw360portal/stargazers","contributors_url":"https://api.github.com/repos/bsinno/sw360portal/contributors","subscribers_url":"https://api.github.com/repos/bsinno/sw360portal/subscribers","subscription_url":"https://api.github.com/repos/bsinno/sw360portal/subscription","commits_url":"https://api.github.com/repos/bsinno/sw360portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsinno/sw360portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsinno/sw360portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsinno/sw360portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsinno/sw360portal/contents/{+path}","compare_url":"https://api.github.com/repos/bsinno/sw360portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsinno/sw360portal/merges","archive_url":"https://api.github.com/repos/bsinno/sw360portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsinno/sw360portal/downloads","issues_url":"https://api.github.com/repos/bsinno/sw360portal/issues{/number}","pulls_url":"https://api.github.com/repos/bsinno/sw360portal/pulls{/number}","milestones_url":"https://api.github.com/repos/bsinno/sw360portal/milestones{/number}","notifications_url":"https://api.github.com/repos/bsinno/sw360portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsinno/sw360portal/labels{/name}","releases_url":"https://api.github.com/repos/bsinno/sw360portal/releases{/id}","deployments_url":"https://api.github.com/repos/bsinno/sw360portal/deployments","created_at":"2016-05-10T09:20:06Z","updated_at":"2016-05-10T09:20:09Z","pushed_at":"2016-05-12T15:33:36Z","git_url":"git://github.com/bsinno/sw360portal.git","ssh_url":"git@github.com:bsinno/sw360portal.git","clone_url":"https://github.com/bsinno/sw360portal.git","svn_url":"https://github.com/bsinno/sw360portal","homepage":null,"size":4261,"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":"sw360:master","ref":"master","sha":"ad0ddb456f044d72702aa95cc69452d9ac1371e8","user":{"login":"sw360","id":16389175,"avatar_url":"https://avatars.githubusercontent.com/u/16389175?v=3","gravatar_id":"","url":"https://api.github.com/users/sw360","html_url":"https://github.com/sw360","followers_url":"https://api.github.com/users/sw360/followers","following_url":"https://api.github.com/users/sw360/following{/other_user}","gists_url":"https://api.github.com/users/sw360/gists{/gist_id}","starred_url":"https://api.github.com/users/sw360/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sw360/subscriptions","organizations_url":"https://api.github.com/users/sw360/orgs","repos_url":"https://api.github.com/users/sw360/repos","events_url":"https://api.github.com/users/sw360/events{/privacy}","received_events_url":"https://api.github.com/users/sw360/received_events","type":"Organization","site_admin":false},"repo":{"id":43326581,"name":"sw360portal","full_name":"sw360/sw360portal","owner":{"login":"sw360","id":16389175,"avatar_url":"https://avatars.githubusercontent.com/u/16389175?v=3","gravatar_id":"","url":"https://api.github.com/users/sw360","html_url":"https://github.com/sw360","followers_url":"https://api.github.com/users/sw360/followers","following_url":"https://api.github.com/users/sw360/following{/other_user}","gists_url":"https://api.github.com/users/sw360/gists{/gist_id}","starred_url":"https://api.github.com/users/sw360/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sw360/subscriptions","organizations_url":"https://api.github.com/users/sw360/orgs","repos_url":"https://api.github.com/users/sw360/repos","events_url":"https://api.github.com/users/sw360/events{/privacy}","received_events_url":"https://api.github.com/users/sw360/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sw360/sw360portal","description":"A software component catalogue application - designed to work with FOSSology.","fork":false,"url":"https://api.github.com/repos/sw360/sw360portal","forks_url":"https://api.github.com/repos/sw360/sw360portal/forks","keys_url":"https://api.github.com/repos/sw360/sw360portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sw360/sw360portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sw360/sw360portal/teams","hooks_url":"https://api.github.com/repos/sw360/sw360portal/hooks","issue_events_url":"https://api.github.com/repos/sw360/sw360portal/issues/events{/number}","events_url":"https://api.github.com/repos/sw360/sw360portal/events","assignees_url":"https://api.github.com/repos/sw360/sw360portal/assignees{/user}","branches_url":"https://api.github.com/repos/sw360/sw360portal/branches{/branch}","tags_url":"https://api.github.com/repos/sw360/sw360portal/tags","blobs_url":"https://api.github.com/repos/sw360/sw360portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sw360/sw360portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sw360/sw360portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/sw360/sw360portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sw360/sw360portal/statuses/{sha}","languages_url":"https://api.github.com/repos/sw360/sw360portal/languages","stargazers_url":"https://api.github.com/repos/sw360/sw360portal/stargazers","contributors_url":"https://api.github.com/repos/sw360/sw360portal/contributors","subscribers_url":"https://api.github.com/repos/sw360/sw360portal/subscribers","subscription_url":"https://api.github.com/repos/sw360/sw360portal/subscription","commits_url":"https://api.github.com/repos/sw360/sw360portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/sw360/sw360portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/sw360/sw360portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/sw360/sw360portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/sw360/sw360portal/contents/{+path}","compare_url":"https://api.github.com/repos/sw360/sw360portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sw360/sw360portal/merges","archive_url":"https://api.github.com/repos/sw360/sw360portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sw360/sw360portal/downloads","issues_url":"https://api.github.com/repos/sw360/sw360portal/issues{/number}","pulls_url":"https://api.github.com/repos/sw360/sw360portal/pulls{/number}","milestones_url":"https://api.github.com/repos/sw360/sw360portal/milestones{/number}","notifications_url":"https://api.github.com/repos/sw360/sw360portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sw360/sw360portal/labels{/name}","releases_url":"https://api.github.com/repos/sw360/sw360portal/releases{/id}","deployments_url":"https://api.github.com/repos/sw360/sw360portal/deployments","created_at":"2015-09-28T20:56:14Z","updated_at":"2016-05-07T23:34:37Z","pushed_at":"2016-05-12T15:33:36Z","git_url":"git://github.com/sw360/sw360portal.git","ssh_url":"git@github.com:sw360/sw360portal.git","clone_url":"https://github.com/sw360/sw360portal.git","svn_url":"https://github.com/sw360/sw360portal","homepage":null,"size":4036,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":46,"forks":11,"open_issues":46,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/167"},"html":{"href":"https://github.com/sw360/sw360portal/pull/167"},"issue":{"href":"https://api.github.com/repos/sw360/sw360portal/issues/167"},"comments":{"href":"https://api.github.com/repos/sw360/sw360portal/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sw360/sw360portal/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/sw360/sw360portal/statuses/a4583dce18e1093b76ac8c6f8abcc49350ea6a88"}}}}