List of usage examples for org.json JSONObject append
public JSONObject append(String key, Object value) throws JSONException
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with maxResults,orderBy,fields optional parameter. */// w w w . j a va2s . c o m @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and maxResults,orderBy,fields optional parameters.") public void testSearchActivityWithThreeOptionalParams6() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "pageToken" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with maxResults,pageToken,fields optional parameter. *//*w ww.ja v a 2 s . co m*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and maxResults,pageToken,fields optional parameters.") public void testSearchActivityWithThreeOptionalParams7() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "orderBy" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with orderBy,pageToken,fields optional parameter. *//*from w ww .j a va2 s .com*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and orderBy,pageToken,fields optional parameters.") public void testSearchActivityWithThreeOptionalParams8() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with language,maxResults,orderBy. *//*from ww w . j a va 2 s . c o m*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and language,maxResults,orderBy optional parameters.") public void testSearchActivityWithThreeOptionalParams9() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "pageToken", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with language,maxResults,pageToken optional parameter *///from w ww .j a v a2 s . co m @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and language,maxResults,pageToken optional parameters.") public void testSearchActivityWithThreeOptionalParams10() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "orderBy", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with orderBy,pageToken optional parameter. *///w w w .j a v a 2 s . c om @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and orderBy,pageToken optional parameters.") public void testSearchActivityWithTwoOptionalParams1() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "maxResults", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with maxResults,fields optional parameter. */// w w w. j a va 2 s.c om @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "googleplus {searchActivities} integration test with mandatory and maxResults,fields optional parameters.") public void testSearchActivityWithTwoOptionalParams2() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "orderBy", "pageToken" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with maxResults,pageToken optional parameter. *//*from ww w .ja va 2s . c om*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and maxResults,pageToken optional parameters.") public void testSearchActivityWithTwoOptionalParams3() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "orderBy", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with maxResults,orderBy. *///from www . j a v a2 s .c om @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and maxResults,orderBy optional parameters.") public void testSearchActivityWithTwoOptionalParams4() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "language", "pageToken", "fields" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }
From source file:org.wso2.carbon.connector.integration.test.gplus.GooglePlusTestCase.java
/** * Optional parameter test case for searchActivities method with language,fields optional parameter *//*from w w w . j av a2 s . c om*/ @Test(groups = { "wso2.esb" }, dependsOnMethods = { "testSearchActivityWithMandatoryParams" }, description = "GooglePlus {searchActivities} integration test with mandatory and language,fields optional parameters.") public void testSearchActivityWithTwoOptionalParams5() throws Exception { String jsonRequestFilePath = pathToRequestsDirectory + "searchActivitiesOptionalParams.txt"; String methodName = "searchActivities"; final String requestJsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath); final String proxyFilePath = "file:///" + pathToProxiesDirectory + methodName + ".xml"; proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath))); JSONObject jsonObject = new JSONObject(requestJsonString); jsonObject.append("pageToken", googlePlusConnectorProperties.getProperty("searchActivitiesPageToken")); jsonObject.append("apiUrl", googlePlusConnectorProperties.getProperty("apiUrl")); jsonObject.append("clientId", googlePlusConnectorProperties.getProperty("clientId")); jsonObject.append("clientSecret", googlePlusConnectorProperties.getProperty("clientSecret")); jsonObject.append("refreshToken", googlePlusConnectorProperties.getProperty("refreshToken")); String modifiedJsonString = jsonObject.toString().replace("[", "").replace("]", ""); try { String[] unneededOptionalParameters = { "maxResults", "orderBy", "pageToken" }; String requiredJsonString = ConnectorIntegrationUtil.getRequiredJsonString(modifiedJsonString, unneededOptionalParameters); JSONObject responseJson = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), requiredJsonString); Assert.assertEquals("plus#activityFeed", responseJson.getString("kind")); } finally { proxyAdmin.deleteProxy(methodName); } }