{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/product-apim/pulls/comments/30386348","id":30386348,"diff_hunk":"@@ -0,0 +1,222 @@\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.am.admin.clients.mediation;\n+\n+\n+import org.apache.axiom.om.OMElement;\n+import org.apache.axiom.om.impl.builder.StAXOMBuilder;\n+import org.apache.axis2.AxisFault;\n+import org.apache.commons.logging.Log;\n+import org.apache.commons.logging.LogFactory;\n+import org.w3c.dom.Document;\n+import org.wso2.am.admin.clients.client.utils.AuthenticateStub;\n+import org.wso2.carbon.mediation.configadmin.stub.ConfigServiceAdminStub;\n+import org.wso2.carbon.mediation.configadmin.stub.types.carbon.ConfigurationInformation;\n+import org.wso2.carbon.mediation.configadmin.stub.types.carbon.ValidationError;\n+import org.xml.sax.SAXException;\n+\n+import javax.servlet.ServletException;\n+import javax.xml.parsers.DocumentBuilder;\n+import javax.xml.parsers.DocumentBuilderFactory;\n+import javax.xml.parsers.ParserConfigurationException;\n+import javax.xml.stream.XMLInputFactory;\n+import javax.xml.stream.XMLStreamException;\n+import javax.xml.stream.XMLStreamReader;\n+import javax.xml.transform.Transformer;\n+import javax.xml.transform.TransformerException;\n+import javax.xml.transform.TransformerFactory;\n+import javax.xml.transform.dom.DOMSource;\n+import javax.xml.transform.stream.StreamResult;\n+import java.io.File;\n+import java.io.IOException;\n+import java.io.StringReader;\n+import java.io.StringWriter;\n+import java.rmi.RemoteException;\n+\n+/**\n+ * This class exposing ConfigServiceAdmin operations to the test cases.\n+ */\n+public class SynapseConfigAdminClient {\n+\n+    private static final Log log = LogFactory.getLog(SynapseConfigAdminClient.class);\n+\n+    private ConfigServiceAdminStub configServiceAdminStub;\n+    private final String serviceName = \"ConfigServiceAdmin\";\n+\n+    public SynapseConfigAdminClient(String backEndUrl, String sessionCookie) throws AxisFault {\n+\n+        String endPoint = backEndUrl + serviceName;\n+        configServiceAdminStub = new ConfigServiceAdminStub(endPoint);\n+        AuthenticateStub.authenticateStub(sessionCookie, configServiceAdminStub);\n+    }\n+\n+    public SynapseConfigAdminClient(String backEndUrl, String userName, String password)\n+            throws AxisFault {\n+\n+        String endPoint = backEndUrl + serviceName;\n+        configServiceAdminStub = new ConfigServiceAdminStub(endPoint);\n+        AuthenticateStub.authenticateStub(userName, password, configServiceAdminStub);\n+    }\n+\n+    /**\n+     * Activating service\n+     *\n+     * @param serviceName - service name need to be activated\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public void activateService(String serviceName) throws RemoteException {\n+        configServiceAdminStub.activate(serviceName);\n+    }\n+\n+    /**\n+     * Adding more configuration to the existing service\n+     *\n+     * @param serviceName - service name\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public void addExistingConfiguration(String serviceName) throws RemoteException {\n+        configServiceAdminStub.addExistingConfiguration(serviceName);\n+    }\n+\n+    /**\n+     * @param serviceName - service name\n+     * @param description - service description\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public void create(String serviceName, String description) throws RemoteException {\n+        configServiceAdminStub.create(serviceName, description);\n+    }\n+\n+    /**\n+     * Deleting synapse configuration\n+     *\n+     * @param serviceName - service name\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public void deleteConfiguration(String serviceName) throws RemoteException {\n+        configServiceAdminStub.deleteConfiguration(serviceName);\n+    }\n+\n+    /**\n+     * Get current synapse configuration\n+     *\n+     * @return synapse configuration\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public String getConfiguration() throws RemoteException {\n+        return configServiceAdminStub.getConfiguration();\n+    }\n+\n+    /**\n+     * @return configuration list\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public ConfigurationInformation[] getConfigurationList() throws RemoteException {\n+        return configServiceAdminStub.getConfigurationList();\n+    }\n+\n+    /**\n+     * save synapse configuration\n+     *\n+     * @throws java.rmi.RemoteException throwable exception\n+     */\n+    public void saveConfigurationToDisk() throws RemoteException {\n+        configServiceAdminStub.saveConfigurationToDisk();\n+    }\n+\n+    /**\n+     * update synapse configuration\n+     *\n+     * @param configuration - synapse configuration\n+     * @return configuration update status\n+     * @throws java.rmi.RemoteException            throwable exception\n+     * @throws javax.servlet.ServletException      throwable exception\n+     * @throws javax.xml.stream.XMLStreamException throwable exception\n+     */\n+    public boolean updateConfiguration(String configuration)\n+            throws XMLStreamException, ServletException, RemoteException {\n+        return configServiceAdminStub.updateConfiguration(createOMElement(configuration));\n+    }\n+\n+    /**\n+     * Uploads synapse config bu using a file\n+     *\n+     * @param file -File that contains the synapse configuration\n+     * @return\n+     */\n+    public boolean updateConfiguration(File file)\n+            throws IOException, SAXException, ParserConfigurationException, TransformerException,\n+            XMLStreamException, ServletException {\n+        boolean success = false;\n+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n+        DocumentBuilder docBuilder = factory.newDocumentBuilder();\n+        if (file.exists()) {\n+            Document doc = docBuilder.parse(file);\n+            String fileContent = getStringFromDocument(doc);\n+            success = configServiceAdminStub.updateConfiguration(createOMElement(fileContent));\n+        }\n+        return success;\n+    }\n+\n+    /**\n+     * update synapse configuration\n+     *\n+     * @param configuration - synapse configuration\n+     * @return configuration update status\n+     * @throws java.rmi.RemoteException            throwable exception\n+     * @throws javax.servlet.ServletException      throwable exception\n+     * @throws javax.xml.stream.XMLStreamException throwable exception\n+     */\n+    public boolean updateConfiguration(OMElement configuration)\n+            throws XMLStreamException, ServletException, RemoteException {\n+        return configServiceAdminStub.updateConfiguration(configuration);\n+    }\n+\n+    /**\n+     * Validate configuration","path":"modules/integration/tests-common/admin-clients/src/main/java/org/wso2/am/admin/clients/mediation/SynapseConfigAdminClient.java","position":null,"original_position":192,"commit_id":"65bf0e1db2ac681e103728bad3f8b3c154a15d87","original_commit_id":"a8cd3228906ae02db2b776b7beaa4aba5f88954b","user":{"login":"sanethd","id":9712144,"avatar_url":"https://avatars.githubusercontent.com/u/9712144?v=3","gravatar_id":"","url":"https://api.github.com/users/sanethd","html_url":"https://github.com/sanethd","followers_url":"https://api.github.com/users/sanethd/followers","following_url":"https://api.github.com/users/sanethd/following{/other_user}","gists_url":"https://api.github.com/users/sanethd/gists{/gist_id}","starred_url":"https://api.github.com/users/sanethd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanethd/subscriptions","organizations_url":"https://api.github.com/users/sanethd/orgs","repos_url":"https://api.github.com/users/sanethd/repos","events_url":"https://api.github.com/users/sanethd/events{/privacy}","received_events_url":"https://api.github.com/users/sanethd/received_events","type":"User","site_admin":false},"body":"done","created_at":"2015-05-15T05:45:20Z","updated_at":"2015-05-15T05:45:20Z","html_url":"https://github.com/wso2/product-apim/pull/67#discussion_r30386348","pull_request_url":"https://api.github.com/repos/wso2/product-apim/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/comments/30386348"},"html":{"href":"https://github.com/wso2/product-apim/pull/67#discussion_r30386348"},"pull_request":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/product-apim/pulls/67","id":31736394,"html_url":"https://github.com/wso2/product-apim/pull/67","diff_url":"https://github.com/wso2/product-apim/pull/67.diff","patch_url":"https://github.com/wso2/product-apim/pull/67.patch","issue_url":"https://api.github.com/repos/wso2/product-apim/issues/67","number":67,"state":"open","locked":false,"title":"API manager lifecycle Test cases phase 3","user":{"login":"sanethd","id":9712144,"avatar_url":"https://avatars.githubusercontent.com/u/9712144?v=3","gravatar_id":"","url":"https://api.github.com/users/sanethd","html_url":"https://github.com/sanethd","followers_url":"https://api.github.com/users/sanethd/followers","following_url":"https://api.github.com/users/sanethd/following{/other_user}","gists_url":"https://api.github.com/users/sanethd/gists{/gist_id}","starred_url":"https://api.github.com/users/sanethd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanethd/subscriptions","organizations_url":"https://api.github.com/users/sanethd/orgs","repos_url":"https://api.github.com/users/sanethd/repos","events_url":"https://api.github.com/users/sanethd/events{/privacy}","received_events_url":"https://api.github.com/users/sanethd/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-23T14:26:31Z","updated_at":"2015-05-15T05:45:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2cae7896789a737c9acd07e0707688df852cd0b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/product-apim/pulls/67/commits","review_comments_url":"https://api.github.com/repos/wso2/product-apim/pulls/67/comments","review_comment_url":"https://api.github.com/repos/wso2/product-apim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/product-apim/issues/67/comments","statuses_url":"https://api.github.com/repos/wso2/product-apim/statuses/65bf0e1db2ac681e103728bad3f8b3c154a15d87","head":{"label":"sanethd:master","ref":"master","sha":"65bf0e1db2ac681e103728bad3f8b3c154a15d87","user":{"login":"sanethd","id":9712144,"avatar_url":"https://avatars.githubusercontent.com/u/9712144?v=3","gravatar_id":"","url":"https://api.github.com/users/sanethd","html_url":"https://github.com/sanethd","followers_url":"https://api.github.com/users/sanethd/followers","following_url":"https://api.github.com/users/sanethd/following{/other_user}","gists_url":"https://api.github.com/users/sanethd/gists{/gist_id}","starred_url":"https://api.github.com/users/sanethd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanethd/subscriptions","organizations_url":"https://api.github.com/users/sanethd/orgs","repos_url":"https://api.github.com/users/sanethd/repos","events_url":"https://api.github.com/users/sanethd/events{/privacy}","received_events_url":"https://api.github.com/users/sanethd/received_events","type":"User","site_admin":false},"repo":{"id":32708203,"name":"product-apim","full_name":"sanethd/product-apim","owner":{"login":"sanethd","id":9712144,"avatar_url":"https://avatars.githubusercontent.com/u/9712144?v=3","gravatar_id":"","url":"https://api.github.com/users/sanethd","html_url":"https://github.com/sanethd","followers_url":"https://api.github.com/users/sanethd/followers","following_url":"https://api.github.com/users/sanethd/following{/other_user}","gists_url":"https://api.github.com/users/sanethd/gists{/gist_id}","starred_url":"https://api.github.com/users/sanethd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanethd/subscriptions","organizations_url":"https://api.github.com/users/sanethd/orgs","repos_url":"https://api.github.com/users/sanethd/repos","events_url":"https://api.github.com/users/sanethd/events{/privacy}","received_events_url":"https://api.github.com/users/sanethd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sanethd/product-apim","description":"","fork":true,"url":"https://api.github.com/repos/sanethd/product-apim","forks_url":"https://api.github.com/repos/sanethd/product-apim/forks","keys_url":"https://api.github.com/repos/sanethd/product-apim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanethd/product-apim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanethd/product-apim/teams","hooks_url":"https://api.github.com/repos/sanethd/product-apim/hooks","issue_events_url":"https://api.github.com/repos/sanethd/product-apim/issues/events{/number}","events_url":"https://api.github.com/repos/sanethd/product-apim/events","assignees_url":"https://api.github.com/repos/sanethd/product-apim/assignees{/user}","branches_url":"https://api.github.com/repos/sanethd/product-apim/branches{/branch}","tags_url":"https://api.github.com/repos/sanethd/product-apim/tags","blobs_url":"https://api.github.com/repos/sanethd/product-apim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanethd/product-apim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanethd/product-apim/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanethd/product-apim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanethd/product-apim/statuses/{sha}","languages_url":"https://api.github.com/repos/sanethd/product-apim/languages","stargazers_url":"https://api.github.com/repos/sanethd/product-apim/stargazers","contributors_url":"https://api.github.com/repos/sanethd/product-apim/contributors","subscribers_url":"https://api.github.com/repos/sanethd/product-apim/subscribers","subscription_url":"https://api.github.com/repos/sanethd/product-apim/subscription","commits_url":"https://api.github.com/repos/sanethd/product-apim/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanethd/product-apim/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanethd/product-apim/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanethd/product-apim/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanethd/product-apim/contents/{+path}","compare_url":"https://api.github.com/repos/sanethd/product-apim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanethd/product-apim/merges","archive_url":"https://api.github.com/repos/sanethd/product-apim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanethd/product-apim/downloads","issues_url":"https://api.github.com/repos/sanethd/product-apim/issues{/number}","pulls_url":"https://api.github.com/repos/sanethd/product-apim/pulls{/number}","milestones_url":"https://api.github.com/repos/sanethd/product-apim/milestones{/number}","notifications_url":"https://api.github.com/repos/sanethd/product-apim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanethd/product-apim/labels{/name}","releases_url":"https://api.github.com/repos/sanethd/product-apim/releases{/id}","created_at":"2015-03-23T03:01:46Z","updated_at":"2015-04-21T12:41:07Z","pushed_at":"2015-05-14T09:01:58Z","git_url":"git://github.com/sanethd/product-apim.git","ssh_url":"git@github.com:sanethd/product-apim.git","clone_url":"https://github.com/sanethd/product-apim.git","svn_url":"https://github.com/sanethd/product-apim","homepage":null,"size":56201,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"ab71f768db4f0e3d8b2f17aa1dd39b5b8fa2d2d9","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":20717348,"name":"product-apim","full_name":"wso2/product-apim","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/product-apim","description":"","fork":false,"url":"https://api.github.com/repos/wso2/product-apim","forks_url":"https://api.github.com/repos/wso2/product-apim/forks","keys_url":"https://api.github.com/repos/wso2/product-apim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/product-apim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/product-apim/teams","hooks_url":"https://api.github.com/repos/wso2/product-apim/hooks","issue_events_url":"https://api.github.com/repos/wso2/product-apim/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/product-apim/events","assignees_url":"https://api.github.com/repos/wso2/product-apim/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/product-apim/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/product-apim/tags","blobs_url":"https://api.github.com/repos/wso2/product-apim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/product-apim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/product-apim/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/product-apim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/product-apim/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/product-apim/languages","stargazers_url":"https://api.github.com/repos/wso2/product-apim/stargazers","contributors_url":"https://api.github.com/repos/wso2/product-apim/contributors","subscribers_url":"https://api.github.com/repos/wso2/product-apim/subscribers","subscription_url":"https://api.github.com/repos/wso2/product-apim/subscription","commits_url":"https://api.github.com/repos/wso2/product-apim/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/product-apim/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/product-apim/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/product-apim/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/product-apim/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/product-apim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/product-apim/merges","archive_url":"https://api.github.com/repos/wso2/product-apim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/product-apim/downloads","issues_url":"https://api.github.com/repos/wso2/product-apim/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/product-apim/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/product-apim/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/product-apim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/product-apim/labels{/name}","releases_url":"https://api.github.com/repos/wso2/product-apim/releases{/id}","created_at":"2014-06-11T08:05:00Z","updated_at":"2015-05-08T08:25:49Z","pushed_at":"2015-05-15T04:59:21Z","git_url":"git://github.com/wso2/product-apim.git","ssh_url":"git@github.com:wso2/product-apim.git","clone_url":"https://github.com/wso2/product-apim.git","svn_url":"https://github.com/wso2/product-apim","homepage":null,"size":69462,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":60,"mirror_url":null,"open_issues_count":11,"forks":60,"open_issues":11,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/67"},"html":{"href":"https://github.com/wso2/product-apim/pull/67"},"issue":{"href":"https://api.github.com/repos/wso2/product-apim/issues/67"},"comments":{"href":"https://api.github.com/repos/wso2/product-apim/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/product-apim/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/product-apim/statuses/65bf0e1db2ac681e103728bad3f8b3c154a15d87"}}}}