{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/comments/25432462","id":25432462,"diff_hunk":"@@ -0,0 +1,129 @@\n+/*\n+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n+ *\n+ * WSO2 Inc. licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.wso2.carbon.integration.tests.carbontools;\n+\n+import org.apache.commons.logging.Log;\n+import org.apache.commons.logging.LogFactory;\n+import org.apache.commons.net.telnet.TelnetClient;\n+import org.testng.annotations.AfterClass;\n+import org.testng.annotations.BeforeClass;\n+import org.testng.annotations.Test;\n+import org.wso2.carbon.automation.engine.context.AutomationContext;\n+import org.wso2.carbon.automation.extensions.servers.carbonserver.MultipleServersManager;\n+import org.wso2.carbon.integration.common.exception.CarbonToolsIntegrationTestException;\n+import org.wso2.carbon.integration.common.utils.CarbonIntegrationBaseTest;\n+import org.wso2.carbon.integration.tests.integration.test.servers.CarbonTestServerManager;\n+\n+import java.io.BufferedReader;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.InputStreamReader;\n+import java.io.PrintStream;\n+import java.io.UnsupportedEncodingException;\n+import java.net.InetAddress;\n+import java.net.SocketTimeoutException;\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+\n+import static org.testng.Assert.assertNotEquals;\n+\n+/**\n+ * This class is to test -DosgiConsole command by checking the active components\n+ */\n+public class OSGICommandDosgiConsoleTestCase extends CarbonIntegrationBaseTest {\n+\n+    private static final Log log = LogFactory.getLog(OSGICommandDosgiConsoleTestCase.class);\n+    private static int telnetPort = 2000;\n+    private TelnetClient telnet = new TelnetClient();\n+    private ArrayList<String> arrList = new ArrayList<String>();\n+    private ArrayList<String> activeList = new ArrayList<String>();\n+    private HashMap<String, String> serverPropertyMap = new HashMap<String, String>();\n+    private MultipleServersManager manager = new MultipleServersManager();\n+    private PrintStream out;\n+\n+    @BeforeClass(alwaysRun = true)\n+    public void init() throws Exception {\n+        // to start the server from a different port offset\n+        serverPropertyMap.put(\"-DportOffset\", \"1\");\n+        // start with OSGI component service\n+        serverPropertyMap.put(\"-DosgiConsole\", Integer.toString(telnetPort));\n+        AutomationContext autoCtx = new AutomationContext();\n+        CarbonTestServerManager server = new CarbonTestServerManager(\n+                autoCtx, System.getProperty(\"carbon.zip\"), serverPropertyMap);\n+        manager.startServers(server);\n+    }\n+\n+    @AfterClass(alwaysRun = true)\n+    public void stopServers() throws Exception {\n+        disconnect();  // telnet disconnection\n+        manager.stopAllServers();\n+    }\n+\n+    @Test(groups = \"wso2.all\", description = \"Identifying and storing active OSGI components\")\n+    public void testOSGIActiveComponents()\n+            throws CarbonToolsIntegrationTestException, IOException {\n+        telnet.connect(InetAddress.getLocalHost().getHostAddress(), telnetPort);\n+        telnet.setSoTimeout(10000);","path":"distribution/integration/tests-integration/src/test/java/org/wso2/carbon/integration/tests/carbontools/OSGICommandDosgiConsoleTestCase.java","position":82,"original_position":82,"commit_id":"c7fe0564438e84af329e1c774995e18322d910fa","original_commit_id":"c7fe0564438e84af329e1c774995e18322d910fa","user":{"login":"krishanthasamaraweera","id":6601948,"avatar_url":"https://avatars.githubusercontent.com/u/6601948?v=3","gravatar_id":"","url":"https://api.github.com/users/krishanthasamaraweera","html_url":"https://github.com/krishanthasamaraweera","followers_url":"https://api.github.com/users/krishanthasamaraweera/followers","following_url":"https://api.github.com/users/krishanthasamaraweera/following{/other_user}","gists_url":"https://api.github.com/users/krishanthasamaraweera/gists{/gist_id}","starred_url":"https://api.github.com/users/krishanthasamaraweera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krishanthasamaraweera/subscriptions","organizations_url":"https://api.github.com/users/krishanthasamaraweera/orgs","repos_url":"https://api.github.com/users/krishanthasamaraweera/repos","events_url":"https://api.github.com/users/krishanthasamaraweera/events{/privacy}","received_events_url":"https://api.github.com/users/krishanthasamaraweera/received_events","type":"User","site_admin":false},"body":"use constant to hold timeout value","created_at":"2015-02-26T15:01:22Z","updated_at":"2015-02-26T15:01:22Z","html_url":"https://github.com/wso2/carbon4-kernel/pull/149#discussion_r25432462","pull_request_url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/comments/25432462"},"html":{"href":"https://github.com/wso2/carbon4-kernel/pull/149#discussion_r25432462"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149","id":29973834,"html_url":"https://github.com/wso2/carbon4-kernel/pull/149","diff_url":"https://github.com/wso2/carbon4-kernel/pull/149.diff","patch_url":"https://github.com/wso2/carbon4-kernel/pull/149.patch","issue_url":"https://api.github.com/repos/wso2/carbon4-kernel/issues/149","number":149,"state":"open","locked":false,"title":"Carbon tools test automation","user":{"login":"irhamucsc","id":10667607,"avatar_url":"https://avatars.githubusercontent.com/u/10667607?v=3","gravatar_id":"","url":"https://api.github.com/users/irhamucsc","html_url":"https://github.com/irhamucsc","followers_url":"https://api.github.com/users/irhamucsc/followers","following_url":"https://api.github.com/users/irhamucsc/following{/other_user}","gists_url":"https://api.github.com/users/irhamucsc/gists{/gist_id}","starred_url":"https://api.github.com/users/irhamucsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irhamucsc/subscriptions","organizations_url":"https://api.github.com/users/irhamucsc/orgs","repos_url":"https://api.github.com/users/irhamucsc/repos","events_url":"https://api.github.com/users/irhamucsc/events{/privacy}","received_events_url":"https://api.github.com/users/irhamucsc/received_events","type":"User","site_admin":false},"body":"Test cases for carbon tools and startup arguments ","created_at":"2015-02-25T10:00:15Z","updated_at":"2015-02-26T15:01:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon4-kernel/issues/149/comments","statuses_url":"https://api.github.com/repos/wso2/carbon4-kernel/statuses/c7fe0564438e84af329e1c774995e18322d910fa","head":{"label":"irhamucsc:master","ref":"master","sha":"c7fe0564438e84af329e1c774995e18322d910fa","user":{"login":"irhamucsc","id":10667607,"avatar_url":"https://avatars.githubusercontent.com/u/10667607?v=3","gravatar_id":"","url":"https://api.github.com/users/irhamucsc","html_url":"https://github.com/irhamucsc","followers_url":"https://api.github.com/users/irhamucsc/followers","following_url":"https://api.github.com/users/irhamucsc/following{/other_user}","gists_url":"https://api.github.com/users/irhamucsc/gists{/gist_id}","starred_url":"https://api.github.com/users/irhamucsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irhamucsc/subscriptions","organizations_url":"https://api.github.com/users/irhamucsc/orgs","repos_url":"https://api.github.com/users/irhamucsc/repos","events_url":"https://api.github.com/users/irhamucsc/events{/privacy}","received_events_url":"https://api.github.com/users/irhamucsc/received_events","type":"User","site_admin":false},"repo":{"id":31296821,"name":"carbon4-kernel","full_name":"irhamucsc/carbon4-kernel","owner":{"login":"irhamucsc","id":10667607,"avatar_url":"https://avatars.githubusercontent.com/u/10667607?v=3","gravatar_id":"","url":"https://api.github.com/users/irhamucsc","html_url":"https://github.com/irhamucsc","followers_url":"https://api.github.com/users/irhamucsc/followers","following_url":"https://api.github.com/users/irhamucsc/following{/other_user}","gists_url":"https://api.github.com/users/irhamucsc/gists{/gist_id}","starred_url":"https://api.github.com/users/irhamucsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irhamucsc/subscriptions","organizations_url":"https://api.github.com/users/irhamucsc/orgs","repos_url":"https://api.github.com/users/irhamucsc/repos","events_url":"https://api.github.com/users/irhamucsc/events{/privacy}","received_events_url":"https://api.github.com/users/irhamucsc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/irhamucsc/carbon4-kernel","description":"","fork":true,"url":"https://api.github.com/repos/irhamucsc/carbon4-kernel","forks_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/forks","keys_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/teams","hooks_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/hooks","issue_events_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/issues/events{/number}","events_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/events","assignees_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/assignees{/user}","branches_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/branches{/branch}","tags_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/tags","blobs_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/git/refs{/sha}","trees_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/statuses/{sha}","languages_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/languages","stargazers_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/stargazers","contributors_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/contributors","subscribers_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/subscribers","subscription_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/subscription","commits_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/commits{/sha}","git_commits_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/git/commits{/sha}","comments_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/comments{/number}","issue_comment_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/issues/comments{/number}","contents_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/contents/{+path}","compare_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/merges","archive_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/downloads","issues_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/issues{/number}","pulls_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/pulls{/number}","milestones_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/milestones{/number}","notifications_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/labels{/name}","releases_url":"https://api.github.com/repos/irhamucsc/carbon4-kernel/releases{/id}","created_at":"2015-02-25T04:18:21Z","updated_at":"2015-02-26T03:49:35Z","pushed_at":"2015-02-26T03:49:35Z","git_url":"git://github.com/irhamucsc/carbon4-kernel.git","ssh_url":"git@github.com:irhamucsc/carbon4-kernel.git","clone_url":"https://github.com/irhamucsc/carbon4-kernel.git","svn_url":"https://github.com/irhamucsc/carbon4-kernel","homepage":null,"size":38211,"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":"wso2:master","ref":"master","sha":"69fb5507e108a2d22465cea2e491cb3641af3334","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":16162184,"name":"carbon4-kernel","full_name":"wso2/carbon4-kernel","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/carbon4-kernel","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon4-kernel","forks_url":"https://api.github.com/repos/wso2/carbon4-kernel/forks","keys_url":"https://api.github.com/repos/wso2/carbon4-kernel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon4-kernel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon4-kernel/teams","hooks_url":"https://api.github.com/repos/wso2/carbon4-kernel/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon4-kernel/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon4-kernel/events","assignees_url":"https://api.github.com/repos/wso2/carbon4-kernel/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon4-kernel/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon4-kernel/tags","blobs_url":"https://api.github.com/repos/wso2/carbon4-kernel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon4-kernel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon4-kernel/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon4-kernel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon4-kernel/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon4-kernel/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon4-kernel/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon4-kernel/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon4-kernel/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon4-kernel/subscription","commits_url":"https://api.github.com/repos/wso2/carbon4-kernel/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon4-kernel/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon4-kernel/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon4-kernel/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon4-kernel/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon4-kernel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon4-kernel/merges","archive_url":"https://api.github.com/repos/wso2/carbon4-kernel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon4-kernel/downloads","issues_url":"https://api.github.com/repos/wso2/carbon4-kernel/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon4-kernel/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon4-kernel/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon4-kernel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon4-kernel/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon4-kernel/releases{/id}","created_at":"2014-01-23T04:23:41Z","updated_at":"2015-02-25T14:43:00Z","pushed_at":"2015-02-25T14:43:00Z","git_url":"git://github.com/wso2/carbon4-kernel.git","ssh_url":"git@github.com:wso2/carbon4-kernel.git","clone_url":"https://github.com/wso2/carbon4-kernel.git","svn_url":"https://github.com/wso2/carbon4-kernel","homepage":null,"size":38211,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":112,"mirror_url":null,"open_issues_count":26,"forks":112,"open_issues":26,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149"},"html":{"href":"https://github.com/wso2/carbon4-kernel/pull/149"},"issue":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/issues/149"},"comments":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/issues/149/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/pulls/149/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon4-kernel/statuses/c7fe0564438e84af329e1c774995e18322d910fa"}}}}