From ed7e5749395637e0cd7a26cbd0e75dbf898c2f76 Mon Sep 17 00:00:00 2001 From: megala21 Date: Tue, 2 May 2017 13:16:55 +0530 Subject: [PATCH] Adding policy mangement test cases --- .../src/core/plugins/plugins-deployer.xml | 2 +- ...tificationManagementAPIJMeterTestCase.java | 18 + .../PolicyManagementJMeterTestCase.java | 46 + .../jmeter-scripts/PolicyManagementAPI.jmx | 3037 +++++++++++++++++ .../src/test/resources/testng.xml | 6 +- pom.xml | 4 +- 6 files changed, 3109 insertions(+), 4 deletions(-) create mode 100644 modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/PolicyManagementJMeterTestCase.java create mode 100644 modules/integration/tests-integration/src/test/resources/jmeter-scripts/PolicyManagementAPI.jmx diff --git a/modules/distribution/src/core/plugins/plugins-deployer.xml b/modules/distribution/src/core/plugins/plugins-deployer.xml index 0324d334..7c51e584 100644 --- a/modules/distribution/src/core/plugins/plugins-deployer.xml +++ b/modules/distribution/src/core/plugins/plugins-deployer.xml @@ -207,6 +207,6 @@ - 3.0.28 + 3.0.30 diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/NotificationManagementAPIJMeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/NotificationManagementAPIJMeterTestCase.java index 89025317..ffe40263 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/NotificationManagementAPIJMeterTestCase.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/NotificationManagementAPIJMeterTestCase.java @@ -1,3 +1,21 @@ +/* +* 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; diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/PolicyManagementJMeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/PolicyManagementJMeterTestCase.java new file mode 100644 index 00000000..f06d900c --- /dev/null +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/PolicyManagementJMeterTestCase.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 is used to run the jmeter test cases related with Policy Management APIs. + */ +public class PolicyManagementJMeterTestCase { + private static Log log = LogFactory.getLog(PolicyManagementJMeterTestCase.class); + + @Test(description = "This test case tests the Policy Management APIs") + public void PolicyManagementTest() throws AutomationFrameworkException { + URL url = Thread.currentThread().getContextClassLoader() + .getResource("jmeter-scripts" + File.separator + "PolicyManagementAPI.jmx"); + JMeterTest script = new JMeterTest(new File(url.getPath())); + JMeterTestManager manager = new JMeterTestManager(); + log.info("Running policy management api test cases using jmeter scripts"); + manager.runTest(script); + } +} diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/PolicyManagementAPI.jmx b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/PolicyManagementAPI.jmx new file mode 100644 index 00000000..1200b2dd --- /dev/null +++ b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/PolicyManagementAPI.jmx @@ -0,0 +1,3037 @@ + + + + + + false + false + + + + + + + + 9999 + 100 + + false + + randAppNum + + + + + + host + localhost + = + + + https_port + 8243 + = + + + http_port + 8280 + = + + + token_ep_host + localhost + = + + + token_ep_port + 8280 + = + + + group_name + Group 2 + = + + + new_group_name + New Group + = + + + role_name + group_sharing + = + + + DeviceID + 500 + = + + + DeviceIdentifier + policy_management_device + = + + + 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 + = + + + management_https_port + 9443 + Port for carbon management console + = + + + + + + continue + + false + 1 + + 1 + + 1342532280000 + 1342532280000 + false + + + + + + + false + rfc2109 + + + + + + + https://${host}:${management_https_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://${host}:${management_https_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://${host}:${management_https_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://${host}:${management_https_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 + 1465464058000 + 1465464058000 + false + + + + + + true + + + + false + { + "applicationName":"app_${randAppNum}", + "isAllowedToAllDomains":false, + "tags":["android", "device_management"], + "isMappingAnExistingOAuthApp":false +} + = + + + + ${host} + ${https_port} + + + https + + /api-application-registration/register + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Basic YWRtaW46YWRtaW4= + + + Host + localhost:9763 + + + Content-Type + application/json + + + + + + false + clientId + "client_id":"(.+?)" + $1$ + 0 + 1 + + + + false + clientSecret + "client_secret":"(.+?)" + $1$ + 0 + 1 + + + + + + clientId,clientSecret + false + import org.apache.commons.codec.binary.Base64; + +String clientId= vars.get("clientId"); +String clientSecret = vars.get("clientSecret"); +String toEncode = clientId + ":" + clientSecret; + +byte[] encryptedId = Base64.encodeBase64(toEncode.getBytes()); +vars.put("base64encodedId",new String(encryptedId)); + + + + + + + false + admin + = + true + username + + + false + admin + = + true + password + + + false + password + = + true + grant_type + + + false + perm:android:enroll perm:android:wipe perm:android:ring perm:android:lock-devices perm:android:configure-vpn perm:android:configure-wifi perm:android:enroll perm:android:uninstall-application perm:android:manage-configuration perm:android:location perm:android:install-application perm:android:mute perm:android:change-lock-code perm:android:blacklist-applications perm:android:set-password-policy perm:android:encrypt-storage perm:android:clear-password perm:android:enterprise-wipe perm:android:info perm:android:view-configuration perm:android:upgrade-firmware perm:android:set-webclip perm:android:send-notification perm:android:disenroll perm:android:update-application perm:android:unlock-devices perm:android:control-camera perm:android:reboot perm:android:logcat appm:subscribe perm:sign-csr perm:admin:devices:view perm:roles:add perm:roles:add-users perm:roles:update perm:roles:permissions perm:roles:details perm:roles:view perm:roles:create-combined-role perm:roles:delete perm:dashboard:vulnerabilities perm:dashboard:non-compliant-count perm:dashboard:non-compliant perm:dashboard:by-groups perm:dashboard:device-counts perm:dashboard:feature-non-compliant perm:dashboard:count-overview perm:dashboard:filtered-count perm:dashboard:details perm:get-activity perm:devices:delete perm:devices:applications perm:devices:effective-policy perm:devices:compliance-data perm:devices:features perm:devices:operations perm:devices:search perm:devices:details perm:devices:update perm:devices:view perm:view-configuration perm:manage-configuration perm:policies:remove perm:policies:priorities perm:policies:deactivate perm:policies:get-policy-details perm:policies:manage perm:policies:activate perm:policies:update perm:policies:changes perm:policies:get-details perm:users:add perm:users:details perm:users:count perm:users:delete perm:users:roles perm:users:user-details perm:users:credentials perm:users:search perm:users:is-exist perm:users:update perm:users:send-invitation perm:admin-users:view perm:groups:devices perm:groups:update perm:groups:add perm:groups:device perm:groups:devices-count perm:groups:remove perm:groups:groups perm:groups:groups-view perm:groups:share perm:groups:count perm:groups:roles perm:groups:devices-remove perm:groups:devices-add perm:groups:assign perm:device-types:features perm:device-types:types perm:applications:install perm:applications:uninstall perm:admin-groups:count perm:admin-groups:view perm:notifications:mark-checked perm:notifications:view perm:admin:certificates:delete perm:admin:certificates:details perm:admin:certificates:view perm:admin:certificates:add perm:admin:certificates:verify perm:ios:enroll perm:ios:view-device perm:ios:apn perm:ios:ldap perm:ios:enterprise-app perm:ios:store-application perm:ios:remove-application perm:ios:app-list perm:ios:profile-list perm:ios:lock perm:ios:enterprise-wipe perm:ios:device-info perm:ios:restriction perm:ios:email perm:ios:cellular perm:ios:applications perm:ios:wifi perm:ios:ring perm:ios:location perm:ios:notification perm:ios:airplay perm:ios:caldav perm:ios:cal-subscription perm:ios:passcode-policy perm:ios:webclip perm:ios:vpn perm:ios:per-app-vpn perm:ios:app-to-per-app-vpn perm:ios:app-lock perm:ios:clear-passcode perm:ios:remove-profile perm:ios:get-restrictions perm:ios:wipe-data perm:admin perm:android:applications + = + true + scope + + + false + + = + true + + + + + ${host} + ${https_port} + + + https + + /token + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Basic ${base64encodedId} + + + Content-Type + application/x-www-form-urlencoded + + + + + + false + access_token + "access_token":"(.+?)" + $1$ + no_token + 1 + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"${DeviceIdentifier}", + "enrolmentInfo":{ + "id":1000${DeviceID}, + "device":{ + + }, + "dateOfEnrolment":0, + "dateOfLastUpdate":0, + "ownership":"BYOD", + "status":"CREATED", + "owner":"admin" + }, + "features":[ + { + "id":10, + "code":"aaaa1111", + "name":"newfeature1", + "description":"this is the new feature 1", + "deviceType":"android", + "metadataEntries":[ + { + "id":10, + "value":{ + + } + } + ] + } + ], + "properties":[ + { + "name":"property1", + "value":"value1" + } + ], + "deviceInfo":{ + "deviceModel":"S6", + "vendor":"SAMSUNG", + "osVersion":"5.1", + "batteryLevel":1, + "internalTotalMemory":32, + "internalAvailableMemory":24, + "externalTotalMemory":64, + "externalAvailableMemory":60, + "operator":"dialog", + "connectionType":"GSM", + "mobileSignalStrength":1, + "ssid":"picassowifi", + "cpuUsage":0, + "totalRAMMemory":2, + "availableRAMMemory":1, + "pluggedIn":false, + "location":{ + "deviceId":0, + "deviceIdentifier":{ + "id":"string", + "type":"string" + }, + "latitude":0, + "longitude":0, + "street1":"string", + "street2":"string", + "city":"string", + "state":"string", + "zip":"string", + "country":"string" + }, + "deviceDetailsMap":{ + + }, + "imei":"string", + "imsi":"string" + }, + "applications":[ + { + "id":0, + "platform":"string", + "category":"string", + "name":"string", + "locationUrl":"string", + "imageUrl":"string", + "version":"string", + "type":"string", + "appProperties":{ + + }, + "applicationIdentifier":"string", + "memoryUsage":0 + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "count":0 + + Assertion.response_data + false + 2 + + + + + true + + + + false + { + "policyName":"policy1", + "description":"This is a policy", + "compliance":"enforce", + "ownershipType":null, + "active":false, + "profile":{ + "profileName":"policy1", + "deviceType":"android", + "profileFeaturesList":[ + { + "featureCode":"PASSCODE_POLICY", + "deviceType":"android", + "content":{ + "allowSimple":true, + "requireAlphanumeric":true, + "minLength":null, + "minComplexChars":null, + "maxPINAgeInDays":null, + "pinHistory":null, + "maxFailedAttempts":null + } + } + ] + }, + "roles":["ANY"] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 201 + + Assertion.response_code + false + 2 + + + + + "id" + "profileId" + + Assertion.response_data + false + 2 + + + + false + policyId + "id":(.+?) + $1$ + 0 + 1 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "count":1 + + Assertion.response_data + false + 2 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/activate-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Selected policies have been successfully activated" + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/apply-changes + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Changes have been successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/effective-policy/android/${DeviceIdentifier} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "id":${policyId} + + Assertion.response_data + false + 2 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/deactivate-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Selected policies have been successfully deactivated" + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/apply-changes + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Changes have been successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/effective-policy/android/${DeviceIdentifier} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 404 + + Assertion.response_code + true + 2 + + + + + ${policyId} + + Assertion.response_data + false + 6 + + + + + true + + + + false + [ + { + "id": ${policyId}, + "priority": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/priorities + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Policy Priorities successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "id":${policyId},"priorityId":0 + + Assertion.response_data + false + 2 + + + + + true + + + + false + { + "policyName":"policy1", + "description":"This is a policy", + "compliance":"enforce", + "ownershipType":null, + "active":false, + "profile":{ + "profileName":"policy1", + "deviceType":"android", + "profileFeaturesList":[ + { + "featureCode":"PASSCODE_POLICY", + "deviceType":"android", + "content":{ + "allowSimple":true, + "requireAlphanumeric":true, + "minLength":null, + "minComplexChars":null, + "maxPINAgeInDays":null, + "pinHistory":null, + "maxFailedAttempts":null + } + } + ] + }, + "roles":["admin"] +} + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Policy has successfully been updated." + + Assertion.response_data + false + 2 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "roles":["admin"] + + Assertion.response_data + false + 16 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/remove-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 404 + + Assertion.response_code + true + 8 + + + + + + tenant_user_name,domain_name,password + false + import org.apache.commons.codec.binary.Base64; + +String tenant_user= vars.get("tenant_user_name") + "@" + vars.get("domain_name") ; +String password= vars.get("password"); +String toEncode = tenant_user + ":" + password; + +byte[] encryptedId = Base64.encodeBase64(toEncode.getBytes()); +vars.put("encodedUserPassword","Basic " + new String(encryptedId)); + + + + true + + + + false + { + "applicationName":"app_hello", + "isAllowedToAllDomains":false, + "tags":["android", "device_management"], + "isMappingAnExistingOAuthApp":false +} + = + + + + ${host} + ${https_port} + + + https + + /api-application-registration/register + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + ${encodedUserPassword} + + + Host + localhost:9763 + + + Content-Type + application/json + + + + + + false + clientId + "client_id":"(.+?)" + $1$ + 0 + 1 + + + + false + clientSecret + "client_secret":"(.+?)" + $1$ + 0 + 1 + + + + + + clientId,clientSecret + false + import org.apache.commons.codec.binary.Base64; + +String clientId= vars.get("clientId"); +String clientSecret = vars.get("clientSecret"); +String toEncode = clientId + ":" + clientSecret; + +byte[] encryptedId = Base64.encodeBase64(toEncode.getBytes()); +vars.put("base64encodedId",new String(encryptedId)); + + + + + + + false + ${tenant_user_name}@${domain_name} + = + true + username + + + false + ${password} + = + true + password + + + false + password + = + true + grant_type + + + false + perm:android:enroll perm:android:wipe perm:android:ring perm:android:lock-devices perm:android:configure-vpn perm:android:configure-wifi perm:android:enroll perm:android:uninstall-application perm:android:manage-configuration perm:android:location perm:android:install-application perm:android:mute perm:android:change-lock-code perm:android:blacklist-applications perm:android:set-password-policy perm:android:encrypt-storage perm:android:clear-password perm:android:enterprise-wipe perm:android:info perm:android:view-configuration perm:android:upgrade-firmware perm:android:set-webclip perm:android:send-notification perm:android:disenroll perm:android:update-application perm:android:unlock-devices perm:android:control-camera perm:android:reboot perm:android:logcat appm:subscribe perm:sign-csr perm:admin:devices:view perm:roles:add perm:roles:add-users perm:roles:update perm:roles:permissions perm:roles:details perm:roles:view perm:roles:create-combined-role perm:roles:delete perm:dashboard:vulnerabilities perm:dashboard:non-compliant-count perm:dashboard:non-compliant perm:dashboard:by-groups perm:dashboard:device-counts perm:dashboard:feature-non-compliant perm:dashboard:count-overview perm:dashboard:filtered-count perm:dashboard:details perm:get-activity perm:devices:delete perm:devices:applications perm:devices:effective-policy perm:devices:compliance-data perm:devices:features perm:devices:operations perm:devices:search perm:devices:details perm:devices:update perm:devices:view perm:view-configuration perm:manage-configuration perm:policies:remove perm:policies:priorities perm:policies:deactivate perm:policies:get-policy-details perm:policies:manage perm:policies:activate perm:policies:update perm:policies:changes perm:policies:get-details perm:users:add perm:users:details perm:users:count perm:users:delete perm:users:roles perm:users:user-details perm:users:credentials perm:users:search perm:users:is-exist perm:users:update perm:users:send-invitation perm:admin-users:view perm:groups:devices perm:groups:update perm:groups:add perm:groups:device perm:groups:devices-count perm:groups:remove perm:groups:groups perm:groups:groups-view perm:groups:share perm:groups:count perm:groups:roles perm:groups:devices-remove perm:groups:devices-add perm:groups:assign perm:device-types:features perm:device-types:types perm:applications:install perm:applications:uninstall perm:admin-groups:count perm:admin-groups:view perm:notifications:mark-checked perm:notifications:view perm:admin:certificates:delete perm:admin:certificates:details perm:admin:certificates:view perm:admin:certificates:add perm:admin:certificates:verify perm:ios:enroll perm:ios:view-device perm:ios:apn perm:ios:ldap perm:ios:enterprise-app perm:ios:store-application perm:ios:remove-application perm:ios:app-list perm:ios:profile-list perm:ios:lock perm:ios:enterprise-wipe perm:ios:device-info perm:ios:restriction perm:ios:email perm:ios:cellular perm:ios:applications perm:ios:wifi perm:ios:ring perm:ios:location perm:ios:notification perm:ios:airplay perm:ios:caldav perm:ios:cal-subscription perm:ios:passcode-policy perm:ios:webclip perm:ios:vpn perm:ios:per-app-vpn perm:ios:app-to-per-app-vpn perm:ios:app-lock perm:ios:clear-passcode perm:ios:remove-profile perm:ios:get-restrictions perm:ios:wipe-data perm:admin perm:android:applications + = + true + scope + + + false + + = + true + + + + + ${host} + ${https_port} + + + https + + /token + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Basic ${base64encodedId} + + + Content-Type + application/x-www-form-urlencoded + + + + + + false + access_token + "access_token":"(.+?)" + $1$ + no_token + 1 + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"${DeviceIdentifier}", + "enrolmentInfo":{ + "id":1000${DeviceID}, + "device":{ + + }, + "dateOfEnrolment":0, + "dateOfLastUpdate":0, + "ownership":"BYOD", + "status":"CREATED", + "owner":"admin" + }, + "features":[ + { + "id":10, + "code":"aaaa1111", + "name":"newfeature1", + "description":"this is the new feature 1", + "deviceType":"android", + "metadataEntries":[ + { + "id":10, + "value":{ + + } + } + ] + } + ], + "properties":[ + { + "name":"property1", + "value":"value1" + } + ], + "deviceInfo":{ + "deviceModel":"S6", + "vendor":"SAMSUNG", + "osVersion":"5.1", + "batteryLevel":1, + "internalTotalMemory":32, + "internalAvailableMemory":24, + "externalTotalMemory":64, + "externalAvailableMemory":60, + "operator":"dialog", + "connectionType":"GSM", + "mobileSignalStrength":1, + "ssid":"picassowifi", + "cpuUsage":0, + "totalRAMMemory":2, + "availableRAMMemory":1, + "pluggedIn":false, + "location":{ + "deviceId":0, + "deviceIdentifier":{ + "id":"string", + "type":"string" + }, + "latitude":0, + "longitude":0, + "street1":"string", + "street2":"string", + "city":"string", + "state":"string", + "zip":"string", + "country":"string" + }, + "deviceDetailsMap":{ + + }, + "imei":"string", + "imsi":"string" + }, + "applications":[ + { + "id":0, + "platform":"string", + "category":"string", + "name":"string", + "locationUrl":"string", + "imageUrl":"string", + "version":"string", + "type":"string", + "appProperties":{ + + }, + "applicationIdentifier":"string", + "memoryUsage":0 + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "count":0 + + Assertion.response_data + false + 2 + + + + + true + + + + false + { + "policyName":"policy1", + "description":"This is a policy", + "compliance":"enforce", + "ownershipType":null, + "active":false, + "profile":{ + "profileName":"policy1", + "deviceType":"android", + "profileFeaturesList":[ + { + "featureCode":"PASSCODE_POLICY", + "deviceType":"android", + "content":{ + "allowSimple":true, + "requireAlphanumeric":true, + "minLength":null, + "minComplexChars":null, + "maxPINAgeInDays":null, + "pinHistory":null, + "maxFailedAttempts":null + } + } + ] + }, + "roles":["ANY"] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 201 + + Assertion.response_code + false + 2 + + + + + "id" + "profileId" + + Assertion.response_data + false + 2 + + + + false + policyId + "id":(.+?) + $1$ + 0 + 1 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "count":1 + + Assertion.response_data + false + 2 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/activate-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Selected policies have been successfully activated" + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/apply-changes + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Changes have been successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/effective-policy/android/${DeviceIdentifier} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + ${policyId} + + Assertion.response_data + false + 2 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/deactivate-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Selected policies have been successfully deactivated" + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/apply-changes + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Changes have been successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/policies/effective-policy/android/${DeviceIdentifier} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 404 + + Assertion.response_code + true + 2 + + + + + "id":${policyId} + + Assertion.response_data + false + 6 + + + + + true + + + + false + [ + { + "id": ${policyId}, + "priority": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/priorities + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Policy Priorities successfully updated." + + Assertion.response_data + false + 8 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "id":${policyId},"priorityId":0 + + Assertion.response_data + false + 2 + + + + + true + + + + false + { + "policyName":"policy1", + "description":"This is a policy", + "compliance":"enforce", + "ownershipType":null, + "active":false, + "profile":{ + "profileName":"policy1", + "deviceType":"android", + "profileFeaturesList":[ + { + "featureCode":"PASSCODE_POLICY", + "deviceType":"android", + "content":{ + "allowSimple":true, + "requireAlphanumeric":true, + "minLength":null, + "minComplexChars":null, + "maxPINAgeInDays":null, + "pinHistory":null, + "maxFailedAttempts":null + } + } + ] + }, + "roles":["admin"] +} + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "Policy has successfully been updated." + + Assertion.response_data + false + 2 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + "roles":["admin"] + + Assertion.response_data + false + 16 + + + + + true + + + + false + [${policyId}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/remove-policy + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/policies/${policyId} + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 404 + + Assertion.response_code + true + 8 + + + + + 1000 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + Results + true + false + true + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + + diff --git a/modules/integration/tests-integration/src/test/resources/testng.xml b/modules/integration/tests-integration/src/test/resources/testng.xml index 07db3e63..299b8669 100644 --- a/modules/integration/tests-integration/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/src/test/resources/testng.xml @@ -107,7 +107,6 @@ - @@ -119,6 +118,11 @@ + + + + + diff --git a/pom.xml b/pom.xml index 2bcd276e..13480efe 100644 --- a/pom.xml +++ b/pom.xml @@ -1513,7 +1513,7 @@ - 2.0.53 + 2.0.54 [2.0.0, 3.0.0) @@ -1521,7 +1521,7 @@ - 3.0.29 + 3.0.30 6.1.80