diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java index 205b5382..f69f1edb 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java @@ -33,7 +33,8 @@ import java.net.URL; */ public class AndroidDeviceManagementAPIJmeterTestCase { private static Log log = LogFactory.getLog(AndroidDeviceManagementAPIJmeterTestCase.class); - @Test() + + @Test(description = "Testing the response when sending different input parameters with different values") public void permutationTest() throws AutomationFrameworkException { URL url = Thread.currentThread().getContextClassLoader().getResource( "jmeter-scripts" + File.separator + "AndroidDeviceManagementAPIAdditionalPermutations.jmx"); @@ -43,7 +44,7 @@ public class AndroidDeviceManagementAPIJmeterTestCase { manager.runTest(script); } - @Test(dependsOnMethods = {"permutationTest"}) + @Test(description = "Testing the basic android device management API calls", dependsOnMethods = {"permutationTest"}) public void listServices() throws AutomationFrameworkException { URL url = Thread.currentThread().getContextClassLoader() .getResource("jmeter-scripts" + File.separator + "NewAndroidDeviceManagementAPI.jmx"); diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AppManagerJmeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AppManagerJmeterTestCase.java new file mode 100644 index 00000000..6a729d59 --- /dev/null +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/AppManagerJmeterTestCase.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.iot.integration.jmeter; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; +import org.wso2.carbon.automation.extensions.jmeter.JMeterTest; +import org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager; + +import java.io.File; +import java.net.URL; + +/** + * This test case tests the functionality of the app publisher-store functionality. + */ +public class AppManagerJmeterTestCase { + private static Log log = LogFactory.getLog(AppManagerJmeterTestCase.class); + + @Test(description = "This test case tests the flow of App Manager mobile-app creation and lifecycle") + public void GroupManagementTest() throws AutomationFrameworkException { + URL url = Thread.currentThread().getContextClassLoader() + .getResource("jmeter-scripts" + File.separator + "AppManagerTest.jmx"); + JMeterTest script = new JMeterTest(new File(url.getPath())); + JMeterTestManager manager = new JMeterTestManager(); + log.info("Running app manager mobile creation related test cases using jmeter scripts"); + manager.runTest(script); + } +} diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/AppManagerTest.jmx b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/AppManagerTest.jmx new file mode 100644 index 00000000..8d937ed7 --- /dev/null +++ b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/AppManagerTest.jmx @@ -0,0 +1,2255 @@ + + + + + + false + true + + + + + + + + + + server + localhost + = + + + port + 9443 + = + + + username + admin + = + + + password + admin + = + + + mobile-app + fakemobileapp1 + = + + + invalid-mobile-app + invalid_mobile_app + = + + + tenant_user_name + admin + Name of Tenant + = + + + domain_name + wso2.com + Name of Domain + = + + + password + admin + Password + = + + + email + abc@wso2.com + Email + = + + + firstName + firstName + First Name + = + + + lastName + lastName + Last Name + = + + + usagePlan + Demo + Usage Plan + = + + + createdDate + 2013-02-22T08:22:35+05:30 + Created Date + = + + + + + + continue + + false + 1 + + 1 + + 1342532280000 + 1342532280000 + false + + + + + + + false + rfc2109 + + + + + + + https://${server}:${port}/services/AuthenticationAdmin.AuthenticationAdminHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <aut:login> + <!--Optional:--> + <aut:username>admin</aut:username> + <!--Optional:--> + <aut:password>admin</aut:password> + <!--Optional:--> + <aut:remoteAddress>127.0.0.1</aut:remoteAddress> + </aut:login> + </soapenv:Body> +</soapenv:Envelope> + + urn:login + true + false + + + + + + + https://${server}:${port}/services/TenantMgtAdminService.TenantMgtAdminServiceHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.tenant.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <ser:getTenant> + <!--Optional:--> + <ser:tenantDomain>${domain_name}</ser:tenantDomain> + </ser:getTenant> + </soapenv:Body> +</soapenv:Envelope> + + urn:getTenant + true + false + + + + undefined + tenant_exists + //*[local-name()='active']/text() + false + false + true + tenant_exists + + + + false + true + true + false + + + + + ${tenant_exists}==false + false + + + + + + + https://${server}:${port}/services/TenantMgtAdminService.TenantMgtAdminServiceHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.tenant.carbon.wso2.org" xmlns:xsd="http://beans.common.stratos.carbon.wso2.org/xsd"> + <soapenv:Header/> + <soapenv:Body> + <ser:addTenant> + <!--Optional:--> + <ser:tenantInfoBean> + <!--Optional:--> + <xsd:active>1</xsd:active> + <!--Optional:--> + <xsd:admin>${tenant_user_name}</xsd:admin> + <!--Optional:--> + <xsd:adminPassword>${password}</xsd:adminPassword> + <!--Optional:--> + <xsd:createdDate>${createdDate}</xsd:createdDate> + <!--Optional:--> + <xsd:email>${email}</xsd:email> + <!--Optional:--> + <xsd:firstname>${firstName}</xsd:firstname> + <!--Optional:--> + <xsd:lastname>${lastName}</xsd:lastname> + <!--Optional:--> + <xsd:tenantDomain>${domain_name}</xsd:tenantDomain> + <!--Optional:--> + <xsd:tenantId>0</xsd:tenantId> + <!--Optional:--> + <xsd:usagePlan>${usagePlan}</xsd:usagePlan> + </ser:tenantInfoBean> + </ser:addTenant> + </soapenv:Body> +</soapenv:Envelope> + + urn:addTenant + true + false + + + + + + + + https://${server}:${port}/services/AuthenticationAdmin.AuthenticationAdminHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <aut:logout/> + </soapenv:Body> +</soapenv:Envelope> + + urn:logout + true + false + + + + + 202 + + Assertion.response_code + false + 1 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + /home/ace/Desktop/results_multi_user_multi_tenancy.jtl + + + + + continue + + false + 1 + + 1 + 1 + 1443769286000 + 1443769286000 + false + + + + + + false + + + import org.apache.jmeter.services.FileServer; + +String basePath = FileServer.getFileServer().getBaseDir() + File.separator; +vars.put("script-path", basePath); + + + + + + + var encoded = encodeURIComponent('Submit for Review'); +vars.put("encoded", encoded); + javascript + + + + + true + + + + 12 + + 1 + id + # + false + + + + + + + ${server} + ${port} + + + https + + publisher + GET + true + false + true + false + false + + + + + + SAMLRequest + //input[@type='hidden'][@name='SAMLRequest']/@value + false + true + false + + + + + RelayState + //input[@type='hidden'][@name='RelayState']/@value + false + true + false + + + + + SSOAuthSessionID + //input[@type='hidden'][@name='SSOAuthSessionID']/@value + false + true + false + + + + + + + + true + ${RelayState} + = + true + RelayState + + + true + ${SAMLRequest} + = + true + SAMLRequest + + + true + ${SSOAuthSessionID} + = + true + SSOAuthSessionID + + + + ${server} + ${port} + + + https + + samlsso + POST + true + false + true + false + HttpClient4 + false + + + + + + sessionDataKey + //input[@type='hidden'][@name='sessionDataKey']/@value + false + true + false + all + + + + + + + + true + ${RelayState} + = + true + RelayState + + + true + ${SAMLRequest} + = + true + SAMLRequest + + + true + ${SSOAuthSessionID} + = + true + SSOAuthSessionID + + + + ${server} + ${port} + + + https + + samlsso + POST + true + false + true + false + HttpClient4 + false + + + + + + sessionDataKey + //input[@type='hidden'][@name='sessionDataKey']/@value + false + true + false + all + + + + + + + + false + ${RelayState} + = + true + RelayState + + + false + ${sessionDataKey} + = + true + sessionDataKey + + + false + ${username} + = + true + username + + + false + ${password} + = + true + password + + + + ${server} + ${port} + + + https + + commonauth + GET + true + false + true + false + false + + + + + + RelayState1 + //input[@type='hidden'][@name='RelayState']/@value + false + true + false + + + + + SAMLResponse + //input[@type='hidden'][@name='SAMLResponse']/@value + false + true + false + + + + + You are now redirected back to + + Assertion.response_data + false + 16 + + + + + + + + true + ${RelayState1} + = + true + RelayState + + + true + ${SAMLResponse} + = + true + SAMLResponse + + + + ${server} + ${port} + + + https + + publisher/acs + POST + true + false + true + false + false + + + + + + Assertion.response_data + false + 16 + + + + + + + + ${server} + ${port} + + + https + + /publisher/csrf.js + GET + true + false + true + false + false + + + + + + + + ${server} + ${port} + + + https + + /publisher/csrf.js + POST + true + false + true + false + false + + + + + + + FETCH-CSRF-TOKEN + 1 + + + + + + false + X-CSRF-Token + X-CSRF-Token:(.*) + $1$ + no_token + + + + + + + + + ${script-path}test.apk + file + application/vnd.android.package-archive,.apk + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobileapp/upload + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + false + response + (?s)(^.*) + $1$ + + 1 + + + + + "package" : "com.apkpure.aegon", "version" : "1.1.10" + + Assertion.response_data + false + 16 + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobile/isexist?name=${mobile-app} + GET + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + {"isExist" : false} + + Assertion.response_data + false + 8 + + + + + + + + ${script-path}image.png + bannerFile + image/png + + + ${script-path}image.png + screenshot1File + image/png + + + ${script-path}image.png + iconFile + image/png + + + + + + + true + ${response} + = + true + appmeta + + + false + 1WSO2Mobile + = + true + provider + + + false + enterprise + = + true + markettype + + + false + android + = + true + platform + + + false + ${invalid-mobile-app} + = + true + name + + + false + ${invalid-mobile-app} + = + true + displayName + + + false + ${invalid-mobile-app} + = + true + description + + + false + 1.1.10 + = + true + version + + + false + business + = + true + category + + + false + mobileapp + = + true + mobileapp + + + true + + = + true + visibility + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/asset/mobileapp + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + "Special characters found in name" + + Assertion.response_data + false + 16 + + + + + + + + ${script-path}image.png + bannerFile + image/png + + + ${script-path}image.png + screenshot1File + image/png + + + ${script-path}image.png + iconFile + image/png + + + + + + + true + ${response} + = + true + appmeta + + + false + 1WSO2Mobile + = + true + provider + + + false + enterprise + = + true + markettype + + + false + android + = + true + platform + + + false + ${mobile-app} + = + true + name + + + false + ${mobile-app} + = + true + displayName + + + false + ${mobile-app} + = + true + description + + + false + 1.1.10 + = + true + version + + + false + business + = + true + category + + + false + mobileapp + = + true + mobileapp + + + true + + = + true + visibility + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/asset/mobileapp + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + "ok" : "true", "message" : "Asset created." + + Assertion.response_data + false + 16 + + + + false + id + "id" : "(.*)" + $1$ + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/lifecycle/${encoded}/mobileapp/${id} + PUT + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + '${mobile-app}' mobileapp submitted for review successfully + + Assertion.response_data + false + 16 + + + + false + id + "id":"(.*)" + $1$ + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobile/delete/${id} + DELETE + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/logout + GET + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + false + true + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + continue + + false + 1 + + 1 + 1 + 1443769286000 + 1443769286000 + false + + + + + + false + + + import org.apache.jmeter.services.FileServer; + +String basePath = FileServer.getFileServer().getBaseDir() + File.separator; +vars.put("script-path", basePath); + + + + + + + var encoded = encodeURIComponent('Submit for Review'); +vars.put("encoded", encoded); + javascript + + + + + true + + + + 12 + + 1 + id + # + false + + + + + + + ${server} + ${port} + + + https + + publisher + GET + true + false + true + false + false + + + + + + SAMLRequest + //input[@type='hidden'][@name='SAMLRequest']/@value + false + true + false + + + + + RelayState + //input[@type='hidden'][@name='RelayState']/@value + false + true + false + + + + + SSOAuthSessionID + //input[@type='hidden'][@name='SSOAuthSessionID']/@value + false + true + false + + + + + + + + true + ${RelayState} + = + true + RelayState + + + true + ${SAMLRequest} + = + true + SAMLRequest + + + true + ${SSOAuthSessionID} + = + true + SSOAuthSessionID + + + + ${server} + ${port} + + + https + + samlsso + POST + true + false + true + false + HttpClient4 + false + + + + + + sessionDataKey + //input[@type='hidden'][@name='sessionDataKey']/@value + false + true + false + all + + + + + + + + false + ${RelayState} + = + true + RelayState + + + false + ${sessionDataKey} + = + true + sessionDataKey + + + false + ${username}@${domain_name} + = + true + username + + + false + ${password} + = + true + password + + + + ${server} + ${port} + + + https + + commonauth + GET + true + false + true + false + false + + + + + + RelayState1 + //input[@type='hidden'][@name='RelayState']/@value + false + true + false + + + + + SAMLResponse + //input[@type='hidden'][@name='SAMLResponse']/@value + false + true + false + + + + + You are now redirected back to + + Assertion.response_data + false + 16 + + + + + + + + true + ${RelayState1} + = + true + RelayState + + + true + ${SAMLResponse} + = + true + SAMLResponse + + + + ${server} + ${port} + + + https + + publisher/acs + POST + true + false + true + false + false + + + + + + Assertion.response_data + false + 16 + + + + + + + + ${server} + ${port} + + + https + + /publisher/csrf.js + GET + true + false + true + false + false + + + + + + + + ${server} + ${port} + + + https + + /publisher/csrf.js + POST + true + false + true + false + false + + + + + + + FETCH-CSRF-TOKEN + 1 + + + + + + false + X-CSRF-Token + X-CSRF-Token:(.*) + $1$ + no_token + + + + + + + + + ${script-path}test.apk + file + application/vnd.android.package-archive,.apk + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobileapp/upload + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + false + response + (?s)(^.*) + $1$ + + 1 + + + + + "package" : "com.apkpure.aegon", "version" : "1.1.10" + + Assertion.response_data + false + 16 + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobile/isexist?name=${mobile-app} + GET + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + {"isExist" : false} + + Assertion.response_data + false + 8 + + + + + + + + ${script-path}image.png + bannerFile + image/png + + + ${script-path}image.png + screenshot1File + image/png + + + ${script-path}image.png + iconFile + image/png + + + + + + + true + ${response} + = + true + appmeta + + + false + 1WSO2Mobile + = + true + provider + + + false + enterprise + = + true + markettype + + + false + android + = + true + platform + + + false + ${invalid-mobile-app} + = + true + name + + + false + ${invalid-mobile-app} + = + true + displayName + + + false + ${invalid-mobile-app} + = + true + description + + + false + 1.1.10 + = + true + version + + + false + business + = + true + category + + + false + mobileapp + = + true + mobileapp + + + true + + = + true + visibility + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/asset/mobileapp + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + "Special characters found in name" + + Assertion.response_data + false + 16 + + + + + + + + ${script-path}image.png + bannerFile + image/png + + + ${script-path}image.png + screenshot1File + image/png + + + ${script-path}image.png + iconFile + image/png + + + + + + + true + ${response} + = + true + appmeta + + + false + 1WSO2Mobile + = + true + provider + + + false + enterprise + = + true + markettype + + + false + android + = + true + platform + + + false + ${mobile-app} + = + true + name + + + false + ${mobile-app} + = + true + displayName + + + false + ${mobile-app} + = + true + description + + + false + 1.1.10 + = + true + version + + + false + business + = + true + category + + + false + mobileapp + = + true + mobileapp + + + true + + = + true + visibility + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/asset/mobileapp + POST + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + "ok" : "true", "message" : "Asset created." + + Assertion.response_data + false + 16 + + + + false + id + "id" : "(.*)" + $1$ + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/lifecycle/${encoded}/mobileapp/${id} + PUT + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + '${mobile-app}' mobileapp submitted for review successfully + + Assertion.response_data + false + 16 + + + + false + id + "id":"(.*)" + $1$ + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/api/mobile/delete/${id} + DELETE + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + + + + ${server} + ${port} + + + https + UTF-8 + publisher/logout + GET + true + false + true + true + false + + + + + + + X-CSRF-Token + ${X-CSRF-Token} + + + X-Requested-With + XmlHttpRequest + + + + + + + false + true + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + + + + + + + + app_manager + true + false + false + false + + + + + diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/image.png b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/image.png new file mode 100644 index 00000000..df25ec4e Binary files /dev/null and b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/image.png differ diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/test.apk b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/test.apk new file mode 100644 index 00000000..541d1630 Binary files /dev/null and b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/test.apk differ diff --git a/modules/integration/tests-integration/src/test/resources/testng.xml b/modules/integration/tests-integration/src/test/resources/testng.xml index 299b8669..bdc46f60 100644 --- a/modules/integration/tests-integration/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/src/test/resources/testng.xml @@ -58,51 +58,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -123,6 +84,11 @@ + + + + +