{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/comments/25676513","id":25676513,"diff_hunk":"@@ -0,0 +1,209 @@\n+/*\n+ * Copyright (c) 2014, 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.commons;\n+\n+import org.apache.axis2.AxisFault;\n+import org.apache.commons.logging.Log;\n+import org.apache.commons.logging.LogFactory;\n+import org.wso2.carbon.service.mgt.stub.ServiceAdminStub;\n+import org.wso2.carbon.service.mgt.stub.types.carbon.FaultyService;\n+import org.wso2.carbon.service.mgt.stub.types.carbon.FaultyServicesWrapper;\n+import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceMetaData;\n+import org.wso2.carbon.service.mgt.stub.types.carbon.ServiceMetaDataWrapper;\n+\n+import java.rmi.RemoteException;\n+\n+/**\n+ * This class is for managing all service operations\n+ */\n+public class ServiceAdminClient {\n+\n+    private static final Log log = LogFactory.getLog(ServiceAdminClient.class);\n+    private final String serviceName = \"ServiceAdmin\";\n+    private ServiceAdminStub serviceAdminStub;\n+\n+\n+    public ServiceAdminClient(String backEndUrl, String sessionCookie) throws AxisFault {\n+        String endPoint = backEndUrl + serviceName;\n+        serviceAdminStub = new ServiceAdminStub(endPoint);\n+        AuthenticateStubUtil.authenticateStub(sessionCookie, serviceAdminStub);\n+    }\n+\n+    /**\n+     * This method is to delete one or more services\n+     *\n+     * @param serviceGroup - services which has to be deleted\n+     * @throws RemoteException - Error when deleting service group\n+     */\n+    public void deleteService(String[] serviceGroup) throws RemoteException {\n+\n+        serviceAdminStub.deleteServiceGroups(serviceGroup);\n+\n+    }\n+\n+    /**\n+     * Delete faulty service\n+     *\n+     * @param serviceName - Service name to be deleted\n+     * @return boolean - deleted or not\n+     * @throws RemoteException - Error when deleting faulty service group\n+     */\n+    public boolean deleteFaultyServiceByServiceName(String serviceName) throws RemoteException {\n+        try {\n+            return serviceAdminStub.deleteFaultyServiceGroup(getFaultyData(serviceName).getArtifact());\n+        } catch (RemoteException e) {\n+            log.error(\"Faulty service deletion fails\", e);\n+            throw new RemoteException(\"Faulty service deletion fails\", e);\n+        }\n+    }\n+\n+    /**\n+     * Get all the services for a service name\n+     *\n+     * @param serviceName - service name to search\n+     * @return ServiceMetaDataWrapper - service list\n+     * @throws RemoteException - Error when list services.\n+     */\n+    public ServiceMetaDataWrapper listServices(String serviceName)\n+            throws RemoteException {\n+        ServiceMetaDataWrapper serviceMetaDataWrapper;\n+        serviceMetaDataWrapper = serviceAdminStub.listServices(\"ALL\", serviceName, 0);\n+        serviceAdminStub.getFaultyServiceArchives(0);\n+        return serviceMetaDataWrapper;\n+    }\n+\n+    /**\n+     * Get all the faulty services\n+     *\n+     * @return FaultyServicesWrapper - all faulty services.\n+     * @throws RemoteException - Error when getting faulty service archives\n+     */\n+    public FaultyServicesWrapper listFaultyServices() throws RemoteException {\n+        FaultyServicesWrapper faultyServicesWrapper;\n+\n+        faultyServicesWrapper = serviceAdminStub.getFaultyServiceArchives(0);\n+\n+        return faultyServicesWrapper;\n+    }\n+\n+    /**\n+     * Check whether service is available or not\n+     *\n+     * @param serviceName - service name\n+     * @return boolean - service is available or not\n+     * @throws RemoteException - Error when list services.\n+     */\n+    public boolean isServiceExists(String serviceName)\n+            throws RemoteException {\n+        boolean serviceState = false;\n+        ServiceMetaDataWrapper serviceMetaDataWrapper;\n+        ServiceMetaData[] serviceMetaDataList;\n+        serviceMetaDataWrapper = listServices(serviceName);\n+        serviceMetaDataList = serviceMetaDataWrapper.getServices();\n+        if (serviceMetaDataList == null || serviceMetaDataList.length == 0) {\n+            serviceState = false;\n+        } else {\n+            for (ServiceMetaData serviceData : serviceMetaDataList) {\n+                if (serviceData != null && serviceData.getName().equalsIgnoreCase(serviceName)) {\n+                    return true;\n+                }\n+            }\n+        }\n+        return serviceState;\n+    }\n+\n+    /**\n+     * Get service group by service name\n+     *\n+     * @param serviceName - service name\n+     * @return - service group\n+     * @throws RemoteException - Error when list services.\n+     */\n+    public String getServiceGroup(String serviceName) throws RemoteException {\n+        ServiceMetaDataWrapper serviceMetaDataWrapper;\n+        ServiceMetaData[] serviceMetaDataList;\n+        serviceMetaDataWrapper = listServices(serviceName);\n+        serviceMetaDataList = serviceMetaDataWrapper.getServices();\n+        if (serviceMetaDataList != null && serviceMetaDataList.length > 0) {","path":"features/feature-test/feature-test-suites/src/main/java/org/wso2/carbon/commons/ServiceAdminClient.java","position":null,"original_position":143,"commit_id":"b3ec5461290bcd5b72ca848f2a0bbe32232bda4a","original_commit_id":"be0995203ebc0d014e9e737d7893d0b1ea47f8de","user":{"login":"irham0019","id":8790160,"avatar_url":"https://avatars.githubusercontent.com/u/8790160?v=3","gravatar_id":"","url":"https://api.github.com/users/irham0019","html_url":"https://github.com/irham0019","followers_url":"https://api.github.com/users/irham0019/followers","following_url":"https://api.github.com/users/irham0019/following{/other_user}","gists_url":"https://api.github.com/users/irham0019/gists{/gist_id}","starred_url":"https://api.github.com/users/irham0019/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irham0019/subscriptions","organizations_url":"https://api.github.com/users/irham0019/orgs","repos_url":"https://api.github.com/users/irham0019/repos","events_url":"https://api.github.com/users/irham0019/events{/privacy}","received_events_url":"https://api.github.com/users/irham0019/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2015-03-03T10:28:31Z","updated_at":"2015-03-03T10:28:31Z","html_url":"https://github.com/wso2/carbon-deployment/pull/66#discussion_r25676513","pull_request_url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/comments/25676513"},"html":{"href":"https://github.com/wso2/carbon-deployment/pull/66#discussion_r25676513"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66","id":28021538,"html_url":"https://github.com/wso2/carbon-deployment/pull/66","diff_url":"https://github.com/wso2/carbon-deployment/pull/66.diff","patch_url":"https://github.com/wso2/carbon-deployment/pull/66.patch","issue_url":"https://api.github.com/repos/wso2/carbon-deployment/issues/66","number":66,"state":"open","locked":false,"title":"Feature level 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":"By creating a p2-repo with this features and dependent features and by install those features on carbon-core can have carbon-core alone with this feature to write test cases to feature level.","created_at":"2015-01-26T11:54:29Z","updated_at":"2015-03-03T10:28:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bfcab843c65a20c9c1738d3f5d797a8ec5c3058","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-deployment/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-deployment/issues/66/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-deployment/statuses/b3ec5461290bcd5b72ca848f2a0bbe32232bda4a","head":{"label":"irhamucsc:master","ref":"master","sha":"b3ec5461290bcd5b72ca848f2a0bbe32232bda4a","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":29857280,"name":"carbon-deployment","full_name":"irhamucsc/carbon-deployment","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/carbon-deployment","description":"","fork":true,"url":"https://api.github.com/repos/irhamucsc/carbon-deployment","forks_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/forks","keys_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/teams","hooks_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/hooks","issue_events_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/issues/events{/number}","events_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/events","assignees_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/assignees{/user}","branches_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/branches{/branch}","tags_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/tags","blobs_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/git/refs{/sha}","trees_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/statuses/{sha}","languages_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/languages","stargazers_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/stargazers","contributors_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/contributors","subscribers_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/subscribers","subscription_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/subscription","commits_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/commits{/sha}","git_commits_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/git/commits{/sha}","comments_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/comments{/number}","issue_comment_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/issues/comments{/number}","contents_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/contents/{+path}","compare_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/merges","archive_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/downloads","issues_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/issues{/number}","pulls_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/pulls{/number}","milestones_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/milestones{/number}","notifications_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/labels{/name}","releases_url":"https://api.github.com/repos/irhamucsc/carbon-deployment/releases{/id}","created_at":"2015-01-26T11:02:55Z","updated_at":"2015-03-03T06:39:24Z","pushed_at":"2015-03-03T06:39:24Z","git_url":"git://github.com/irhamucsc/carbon-deployment.git","ssh_url":"git@github.com:irhamucsc/carbon-deployment.git","clone_url":"https://github.com/irhamucsc/carbon-deployment.git","svn_url":"https://github.com/irhamucsc/carbon-deployment","homepage":null,"size":4051,"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":"d2f33ba74ca1f08af90a634eaf293123cccd53ce","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":16379759,"name":"carbon-deployment","full_name":"wso2/carbon-deployment","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/carbon-deployment","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-deployment","forks_url":"https://api.github.com/repos/wso2/carbon-deployment/forks","keys_url":"https://api.github.com/repos/wso2/carbon-deployment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-deployment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-deployment/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-deployment/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-deployment/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-deployment/events","assignees_url":"https://api.github.com/repos/wso2/carbon-deployment/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-deployment/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-deployment/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-deployment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-deployment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-deployment/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-deployment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-deployment/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-deployment/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-deployment/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-deployment/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-deployment/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-deployment/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-deployment/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-deployment/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-deployment/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-deployment/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-deployment/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-deployment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-deployment/merges","archive_url":"https://api.github.com/repos/wso2/carbon-deployment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-deployment/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-deployment/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-deployment/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-deployment/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-deployment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-deployment/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-deployment/releases{/id}","created_at":"2014-01-30T14:40:30Z","updated_at":"2015-02-25T16:03:18Z","pushed_at":"2015-02-25T16:03:18Z","git_url":"git://github.com/wso2/carbon-deployment.git","ssh_url":"git@github.com:wso2/carbon-deployment.git","clone_url":"https://github.com/wso2/carbon-deployment.git","svn_url":"https://github.com/wso2/carbon-deployment","homepage":null,"size":7988,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":9,"forks":33,"open_issues":9,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66"},"html":{"href":"https://github.com/wso2/carbon-deployment/pull/66"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-deployment/issues/66"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-deployment/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-deployment/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-deployment/statuses/b3ec5461290bcd5b72ca848f2a0bbe32232bda4a"}}}}