diff --git a/integration-test/iot-community/pom.xml b/integration-test/iot-community/pom.xml new file mode 100644 index 0000000..71974af --- /dev/null +++ b/integration-test/iot-community/pom.xml @@ -0,0 +1,238 @@ + + + + + io.entgra.product.community + integration-test + 5.1.3-SNAPSHOT + ../pom.xml + + + 4.0.0 + io.entgra.product.community.iot.test.integration + Entgra IoT Community - Integration Test Module + Integration Tests for Entgra IoT Community Product + jar + + + + + maven-surefire-plugin + false + + -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m + + + src/test/resources/testng-server-mgt.xml + src/test/resources/testng.xml + + + ${skipTests} + + + + maven.test.haltafterfailure + false + + + java.io.tmpdir + ${project.build.directory}/ + + + carbon.zip + + ${basedir}/../../distribution/iot-community/target/${entgra-iot-community}.zip + + + + framework.resource.location + + ${basedir}/src/test/resources/ + + + + server.list + + IOT + + + + usedefaultlisteners + false + + ${project.build.directory}/security-verifier/ + ${basedir}/src/test/resources/instrumentation.txt + ${basedir}/src/test/resources/filters.txt + + ${basedir}/target + + + + maven-dependency-plugin + + + copy-secVerifier + compile + + copy-dependencies + + + ${project.build.directory}/security-verifier + aar + SecVerifier + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + test-jar + + + + + + maven-resources-plugin + 2.6 + + + copy-resources-jks + compile + + copy-resources + + + ${basedir}/src/test/resources/keystores/products + + + + + ${project.build.directory}/tobeCopied/${entgra-iot-community}/repository/resources/security/ + + + **/*.jks + + + + + + + copy-stratos-jks + compile + + copy-resources + + + ${basedir}/src/test/resources/keystores/stratos + + + + + ${project.build.directory}/tobeCopied/${entgra-iot-community}/repository/resources/security/ + + + **/*.jks + + + + + + + copy-axis2files + compile + + copy-resources + + + ${basedir}/src/test/resources/axis2config + + + + + ${project.build.directory}/tobeCopied/${entgra-iot-community}/repository/conf/axis2/ + + + **/*.xml + + + + + + + copy-resources-mar + compile + + copy-resources + + + ${basedir}/src/test/resources/client/modules + + + + + ${project.build.directory}/tobeCopied/${entgra-iot-community}/repository/deployment/client/modules + + + **/*.mar + + + + + + + + + + + + + org.wso2.carbon.automation + org.wso2.carbon.automation.engine + + + org.wso2.carbon.automation + org.wso2.carbon.automation.test.utils + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.extensions + + + com.google.code.gson + gson + + + org.wso2.carbon.automation + org.wso2.carbon.automation.extensions + + + + + false + + + diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/AssertUtil.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/AssertUtil.java new file mode 100644 index 0000000..8736739 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/AssertUtil.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.testng.Assert; + +/** + * This class contains methods to make assertions easier and which are not available out of the box, from testng. + */ +public class AssertUtil { + /** + * This can be used to compare if to json strings are matched or not. + * + * @param expectedJsonPayload the expected json string. + * @param realPayload real json string. + * @param mustMatch If the real and expected must match, in order to become the test successful or not. + */ + public static void jsonPayloadCompare(String expectedJsonPayload, String realPayload, boolean mustMatch) { + JsonElement jsonElement = new JsonParser().parse(expectedJsonPayload); + JsonObject expectedPayloadObject = jsonElement.getAsJsonObject(); + jsonElement = new JsonParser().parse(realPayload); + JsonObject realPayloadObject = jsonElement.getAsJsonObject(); + if (mustMatch) { + Assert.assertTrue(realPayloadObject.equals(expectedPayloadObject)); + } else { + Assert.assertFalse(realPayloadObject.equals(expectedPayloadObject)); + } + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/Constants.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/Constants.java new file mode 100644 index 0000000..c1ec412 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/Constants.java @@ -0,0 +1,510 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import java.io.File; + +/** + * Constants used through out the test suite are defined here. + */ +public final class Constants { + public static final String DEVICE_ID = "d24f870f390352a41234"; + public static final String NUMBER_NOT_EQUAL_TO_DEVICE_ID = "1111"; + public static final String DEVICE_IMEI = "123123123"; + public static final String AUTOMATION_CONTEXT = "IOT"; + public static final String APPLICATION_JSON = "application/json"; + public static final String APPLICATION_ZIP = "application/zip"; + public static final String APPLICATION_URL_ENCODED = "application/x-www-form-urlencoded"; + public static final String OAUTH_CLIENT_ID = "client_id"; + public static final String OAUTH_CLIENT_SECRET = "client_secret"; + public static final String OAUTH_ACCESS_TOKEN = "access_token"; + public static final String SCOPE = "scope"; + public static final String ANDROID_DEVICE_TYPE = "android"; + public static final String HTTP_METHOD_POST = "POST"; + public static final String HTTP_METHOD_PUT = "PUT"; + public static final String HTTP_METHOD_GET = "GET"; + public static final String HTTP_METHOD_DELETE = "DELETE"; + public static final String DEVICE_IDENTIFIER_KEY = "deviceIdentifier"; + public static final String DEVICE_IDENTIFIERS_KEY = "deviceIDs"; + public static final String CONTENT_TYPE = "Content-Type"; + public static final String APPLICATION_SOAP_XML = "application/soap+xml; charset=utf-8"; + public static final String UTF8 = "UTF-8"; + public static final int HTTPS_ANALYTICS_PORT = 9445; + + public static final String HTTPS = "https"; + public static final String HTTP = "http"; + + public static final int HTTPS_GATEWAY_PORT = 8243; + public static final int HTTP_GATEWAY_PORT = 8280; + + public static final class APIApplicationRegistration { + public static final String API_APP_REGISTRATION_ENDPOINT = "/api-application-registration/register"; + public static final String TOKEN_ENDPOINT = "/token"; + public static final String MULTI_TENANT_OAUTH_TOKEN_PAYLOAD = "&grant_type=password&scope=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:read 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 perm:devicetype:deployment " + + "perm:android-sense:enroll perm:admin:device-type perm:device-types:events " + + "perm:device-types:events:view perm:device-types:types perm:device:enroll perm:device:disenroll " + + + "perm:device:modify perm:device:operations perm:device:publish-event perm:devices:operations " + + "perm:devices:operations perm:firealarm:enroll "; + + public static final String OAUTH_TOKEN_PAYLOAD = "username=admin&password=admin" + + MULTI_TENANT_OAUTH_TOKEN_PAYLOAD; + private static StringBuffer dynamicClientPayloadBuffer = new StringBuffer(); + public static final String API_APP_REGISTRATION_PAYLOAD = dynamicClientPayloadBuffer.append("{ \n" + + + " \"applicationName\":\"app_123456\",\n" + + " \"isAllowedToAllDomains\":false,\n" + + + " \"tags\":[\"android\", \"device_management\"],\n" + + " \"isMappingAnExistingOAuthApp\":false\n" + + "}") + .toString(); + public static final String PERMISSION_LIST = + "appm:read appm:subscribe perm:admin-groups:count perm:admin-groups:view perm:admin-users:view " + + "perm:admin:certificates:add perm:admin:certificates:delete perm:admin:certificates:details " + + "perm:admin:certificates:verify perm:admin:certificates:view perm:admin:device-type " + + "perm:admin:devices:view perm:android-sense:enroll perm:android:applications " + + "perm:android:blacklist-applications perm:android:change-lock-code " + + "perm:android:clear-password perm:android:configure-vpn perm:android:configure-wifi " + + "perm:android:control-camera perm:android:disenroll perm:android:encrypt-storage " + + "perm:android:enroll perm:android:enterprise-wipe perm:android:info " + + "perm:android:install-application perm:android:location perm:android:lock-devices " + + "perm:android:logcat perm:android:manage-configuration perm:android:mute perm:android:reboot " + + "perm:android:ring perm:android:send-notification perm:android:set-password-policy " + + "perm:android:set-webclip perm:android:uninstall-application perm:android:unlock-devices " + + "perm:android:update-application perm:android:upgrade-firmware " + + "perm:android:view-configuration perm:android:wipe perm:applications:install " + + "perm:applications:uninstall perm:device-types:events perm:device-types:events:view " + + "perm:device-types:features perm:device-types:types perm:device:disenroll perm:device:enroll " + + "perm:device:modify perm:device:operations perm:device:publish-event " + + "perm:devices:applications perm:devices:compliance-data perm:devices:delete " + + "perm:devices:details perm:devices:effective-policy perm:devices:features " + + "perm:devices:operations perm:devices:search perm:devices:update perm:devices:view " + + "perm:devicetype:deployment perm:firealarm:enroll perm:get-activity perm:groups:add " + + "perm:groups:assign perm:groups:count perm:groups:device perm:groups:devices " + + "perm:groups:devices-add perm:groups:devices-count perm:groups:devices-remove " + + "perm:groups:groups perm:groups:groups-view perm:groups:remove perm:groups:roles " + + "perm:groups:share perm:groups:update perm:manage-configuration " + + "perm:notifications:mark-checked perm:notifications:view perm:policies:activate " + + "perm:policies:changes perm:policies:deactivate perm:policies:get-details " + + "perm:policies:get-policy-details perm:policies:manage perm:policies:priorities " + + "perm:policies:remove perm:policies:update perm:roles:add perm:roles:add-users " + + "perm:roles:create-combined-role perm:roles:delete perm:roles:details perm:roles:permissions " + + "perm:roles:update perm:roles:view perm:users:add perm:users:count perm:users:credentials " + + "perm:users:delete perm:users:details perm:users:is-exist perm:users:roles perm:users:search " + + "perm:users:send-invitation perm:users:update perm:users:user-details perm:view-configuration"; + + private APIApplicationRegistration() { + throw new AssertionError(); + } + } + + public static final class AndroidEnrollment { + public static final String ENROLLMENT_PAYLOAD_FILE_NAME = "android-enrollment-payloads.json"; + public static final String ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME = "android-enrollment-response-payloads.json"; + public static final String ENROLLMENT_ENDPOINT = "/api/device-mgt/android/v1.0/devices"; + public static final String ENROLLMENT_GROUP = "android-enrollment"; + public static final String UPDATE_APPLICATION_METHOD = "UPDATE_APPLICATIONS"; + public static final String ANDROID_DEVICE_TYPE = "android"; + public static final String GET_PENDING_OPERATIONS_METHOD = "GET_PENDING_OPERATIONS"; + + private AndroidEnrollment() { + throw new AssertionError(); + } + } + + public static final class AndroidPolicy { + public static final String POLICY_RESPONSE_PAYLOAD_FILE_NAME = "android-policy-response-payloads.json"; + public static final String POLICY_ENDPOINT = "/mdm-android-agent/policy/"; + public static final String POLICY_GROUP = "android-policy"; + public static final String GET_EFFECTIVE_POLICY = "getEffectivePolicy"; + + private AndroidPolicy() { + throw new AssertionError(); + } + } + + public static final class WindowsEnrollment { + public static final String DISCOVERY_GET_URL = "/mdm-windows-agent/services/discovery/get"; + public static final String DISCOVERY_POST_URL = "/mdm-windows-agent/services/discovery/post"; + public static final String BSD_URL = "/mdm-windows-agent/services/federated/bst/authentication"; + public static final String MS_EXCEP = "/mdm-windows-agent/services/certificatepolicy/xcep"; + public static final String WINDOWS_ENROLLMENT_GROUP = "windows-enrollment"; + public static final String WSTEP_URL = "/mdm-windows-agent/services/deviceenrolment/wstep"; + public static final String SYNC_ML_URL = "/mdm-windows-agent/services/syncml/devicemanagement/request"; + public static final String DISCOVERY_POST_FILE = "windows" + File.separator + "enrollment" + File + .separator + "discovery-post.xml"; + public static final String MS_XCEP_FILE = + "windows" + File.separator + "enrollment" + File.separator + "ms_xcep.xml"; + public static final String WS_STEP_FILE = + "windows" + File.separator + "enrollment" + File.separator + "wstep.xml"; + public static final String BSD_PAYLOAD = + "{\"credentials\" : {\"username\" : \"admin\", \"email\" : \"admin@wso2.com\", " + + "\"password\" : \"admin\", \"ownership\" : \"BYOD\", " + + "\"token\" : \"cbe53efd46ec612c456540f8dfef5428\"}}"; + + private WindowsEnrollment() { + throw new AssertionError(); + } + } + + public static final class AndroidOperations { + public static final String PAYLOAD_COMMON = "[" + DEVICE_ID + "]"; + + public static final String OPERATION_PAYLOAD_FILE_NAME = "android-operation-payloads.json"; + public static final String OPERATIONS_GROUP = "operations"; + + public static final String CAMERA_OPERATION = "control-camera"; + public static final String CAMERA_OPERATION_PAYLOAD = "{\n" + " \"operation\": {\n" + + " \"enabled\": false\n" + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\" \n" + + " ]\n" + "}"; + + public static final String WIPE_DATA_OPERATION = "wipe_data"; + public static final String WIPE_DATA_OPERATION_PAYLOAD = "wipe_data"; + + public static final String INSTALL_APPS_OPERATION = "install_apps"; + public static final String NOTIFICATION_OPERATION = "notification"; + public static final String WIFI_OPERATION = "wifi"; + public static final String ENCRYPT_OPERATION = "encrypt"; + public static final String CHANGE_LOCK_OPERATION = "unlock-devices"; + public static final String PASSWORD_POLICY_OPERATION = "password_policy"; + public static final String WEB_CLIP_OPERATION = "web_clip"; + public static final String OPERATION_ENDPOINT = "/api/device-mgt/android/v1.0/admin/devices/"; + public static final String UNLOCK_ENDPOINT = "unlock-devices"; + public static final String UNLOCK_OPERATION_PAYLOAD = PAYLOAD_COMMON; + + public static final String LOCK_ENDPOINT = "lock-devices"; + public static final String LOCK_OPERATION_PAYLOAD = "{ \"deviceIDs\": [\"" + DEVICE_ID + "\"]," + + "\"operation\": { \"message\": \"string\", \"hardLockEnabled\": false }}"; + + public static final String LOCATION_ENDPOINT = "location"; + public static final String LOCATION_PAYLOAD = PAYLOAD_COMMON; + + public static final String CLEAR_PASSWORD_ENDPOINT = "clear-password"; + public static final String CLEAR_PASSWORD_PAYLOAD = PAYLOAD_COMMON; + + public static final String DEVICE_INFO_ENDPOINT = "info"; + public static final String DEVICE_INFO_PAYLOAD = "[\"" + DEVICE_ID + "\"]"; + + public static final String DEVICE_LOGCAT_ENDPOINT = "logcat"; + + public static final String ENTERPRISE_WIPE_ENDPOINT = "enterprise-wipe"; + public static final String ENTERPRISE_WIPE_PAYLOAD = PAYLOAD_COMMON; + + public static final String WIPE_DATA_ENDPOINT = "wipe"; + public static final String WIPE_DATA_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"pin\": \"string\"\n" + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; + + public static final String APPLICATION_LIST_ENDPOINT = "applications"; + public static final String APPLICATION_LIST_PAYLOAD = PAYLOAD_COMMON; + + public static final String RING_ENDPOINT = "ring"; + public static final String RING_PAYLOAD = PAYLOAD_COMMON; + + public static final String MUTE_ENDPOINT = "mute"; + public static final String MUTE_PAYLOAD = PAYLOAD_COMMON; + + public static final String INSTALL_APPS_ENDPOINT = "install-application"; + public static final String UPDATE_APPS_ENDPOINT = "update-application"; + public static final String INSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + + " ],\n" + " \"operation\": {\n" + " \"appIdentifier\": \"string\",\n" + + " \"type\": \"string\",\n" + " \"url\": \"string\"\n" + " }\n" + "}"; + + public static final String UNINSTALL_APPS_ENDPOINT = "uninstall-application"; + public static final String UNINSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + + " \"" + DEVICE_ID + "\"\n" + " ],\n" + " \"operation\": {\n" + + " \"appIdentifier\": \"string\",\n" + " \"type\": \"enterprise\"} }"; + + public static final String BLACKLIST_APPS_ENDPOINT = "blacklist-applications"; + public static final String BLACKLIST_OPERATION = "black_list_application"; + + public static final String UPGRADE_FIRMWARE_ENDPOINT = "upgrade-firmware"; + public static final String UPGRADE_FIRMWARE_OPERATION = "upgrade-firmware"; + + public static final String VPN_ENDPOINT = "configure-vpn"; + public static final String VPN_OPERATION = "vpn"; + + public static final String NOTIFICATION_ENDPOINT = "send-notification"; + public static final String NOTIFICATION_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + + " ],\n" + " \"operation\": {\n" + " \"messageText\": \"string\",\n" + + " \"messageTitle\": \"string\"\n" + " }\n" + "}"; + + public static final String WIFI_ENDPOINT = "configure-wifi"; + public static final String WIFI_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"ssid\": \"string\",\n" + + " \"password\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + + " ]\n" + "}"; + + public static final String ENCRYPT_ENDPOINT = "encrypt-storage"; + public static final String ENCRYPT_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"encrypted\": false\n" + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; + + public static final String REBOOT_ENDPOINT = "reboot"; + public static final String REBOOT_PAYLOAD = PAYLOAD_COMMON; + ; + + public static final String CHANGE_LOCK_ENDPOINT = "change-lock-code"; + public static final String CHANGE_LOCK_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"lockCode\": \"0000\"\n" + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}\n"; + + public static final String PASSWORD_POLICY_ENDPOINT = "set-password-policy"; + public static final String PASSWORD_POLICY_PAYLOAD = "{\n" + " \"operation\": {\n" + + " \"maxFailedAttempts\": 0,\n" + " \"minLength\": 0,\n" + " \"pinHistory\": 0,\n" + + " \"minComplexChars\": 0,\n" + " \"maxPINAgeInDays\": 0,\n" + + " \"requireAlphanumeric\": false,\n" + " \"allowSimple\": false\n" + " },\n" + + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; + + public static final String WEB_CLIP_ENDPOINT = "set-webclip"; + public static final String WEB_CLIP_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"identity\": \"string\",\n" + + " \"title\": \"string\",\n" + " \"type\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" + + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; + + private AndroidOperations() { + throw new AssertionError(); + } + } + + + public static final class AndroidConfigurationManagement { + public static final String DEVICE_CONFIGURATION_GROUP = "android-config-mgt"; + public static final String CONFIG_MGT_ENDPOINT = "/api/device-mgt/android/v1.0/configuration/"; + public static final String LICENSE_ENDPOINT = "license"; + public static final String PAYLOAD_FILE_NAME = "android-configuration-payloads.json"; + public static final String RESPONSE_PAYLOAD_FILE_NAME = "android-config-response-payloads.json"; + + private AndroidConfigurationManagement() { + throw new AssertionError(); + } + } + + public static final class OperationManagement { + public static final String PATH_APPS = "/apps"; + public static final String OPERATION_MANAGEMENT_GROUP = "api-policy-mgt"; + public static final String GET_DEVICE_APPS_ENDPOINT = "/mdm-admin/operations/android/"; + public static final String GET_DEVICE_OPERATIONS_ENDPOINT = "/mdm-admin/operations/android/"; + + private OperationManagement() { + throw new AssertionError(); + } + } + + public static final class MobileDeviceManagement { + public static final String MOBILE_DEVICE_MANAGEMENT_GROUP = "mobile-device-mgt"; + public static final String GET_DEVICE_COUNT_ENDPOINT = "/api/device-mgt/v1.0/devices"; + public static final String CHANGE_DEVICE_STATUS_ENDPOINT = "/api/device-mgt/v1.0/devices/"; + public static final String NO_OF_DEVICES = "1"; + public static final String GET_ALL_DEVICES_ENDPOINT = "/api/device-mgt/v1.0/devices/"; + public static final String USER_DEVICE_ENDPOINT = "user-devices"; + public static final String ADVANCE_SEARCH_ENDPOINT = "search-devices"; + public static final String ADVANCE_SEARCH_OPERATION = "ADVANCE_SEARCH"; + public static final String REQUEST_PAYLOAD_FILE_NAME = "mobile-device-mgt-payloads.json"; + public static final String UPDATE_PAYLOAD_OPERATION = "UPDATE_DEVICE_INFO"; + public static final String VIEW_DEVICE_TYPES_ENDPOINT = "/mdm-admin/devices/types"; + public static final String NO_DEVICE = "{\"devices\":[],\"count\":0}"; + + private MobileDeviceManagement() { + throw new AssertionError(); + } + } + + + public static final class UserManagement { + public static final String USER_MANAGEMENT_GROUP = "user-mgt"; + public static final String USER_NAME = "username123"; + public static final String USER_ENDPOINT = "/api/device-mgt/v1.0/users"; + public static final String USER_PAYLOAD_FILE_NAME = "user-payloads.json"; + public static final String USER_RESPONSE_PAYLOAD_FILE_NAME = "user-response-payloads.json"; + public static final String GET_ROLES_METHOD = "GET_ROLES"; + public static final String RESET_PASSWORD_PAYLOAD = "RESET_PASSWORD"; + + private UserManagement() { + throw new AssertionError(); + } + + } + + public static final class RoleManagement { + public static final String ROLE_MANAGEMENT_GROUP = "role-mgt"; + public static final String ROLE_MANAGEMENT_END_POINT = "/api/device-mgt/v1.0/roles"; + public static final String ROLE_PAYLOAD_FILE_NAME = "role-payloads.json"; + public static final String ROLE_RESPONSE_PAYLOAD_FILE_NAME = "role-response-payloads.json"; + public static final String GET_FILTERED_ROLED_METHOD = "GET_FILTERED_ROLES"; + public static final String UPDATE_ROLES_METHOD = "UPDATE_USERS"; + + private RoleManagement() { + throw new AssertionError(); + } + + } + + public static final class PolicyManagement { + public static final String POLICY_MANAGEMENT_GROUP = "policy-mgt"; + public static final String ADD_POLICY_ENDPOINT = "/mdm-admin/policies/active-policy"; + public static final String POLICY_PAYLOAD_FILE_NAME = "policy-payloads.json"; + public static final String POLICY_RESPONSE_PAYLOAD_FILE_NAME = "policy-response-payloads.json"; + public static final String UPDATE_POLICY_ENDPOINT = "/mdm-admin/policies/1"; + public static final String REMOVE_POLICY_ENDPOINT = "/mdm-admin/policies/bulk-remove"; + public static final String REMOVE_POLICY_PAYLOAD_FILE_NAME = "[1]"; + public static final String VIEW_POLICY_LIST_ENDPOINT = "/api/device-mgt/v1.0/policies"; + + private PolicyManagement() { + throw new AssertionError(); + } + } + + public static final class FeatureManagement { + public static final String FEATURE_MANAGEMENT_GROUP = "feature-mgt"; + public static final String VIEW_FEATURES_ENDPOINT = "/mdm-admin/features/android"; + + private FeatureManagement() { + throw new AssertionError(); + } + } + + public static final class LicenseManagement { + public static final String LICENSE_MANAGEMENT_GROUP = "license-mgt"; + public static final String GET_LICENSE_ENDPOINT = "/mdm-admin/license/android/en_US"; + public static final String LICENSE_RESPONSE_PAYLOAD_FILE_NAME = "license-response-payloads.json"; + + private LicenseManagement() { + throw new AssertionError(); + } + + } + + public static final class ConfigurationManagement { + public static final String CONFIGURATION_MANAGEMENT_GROUP = "configuration-mgt"; + public static final String CONFIGURATION_ENDPOINT = "/mdm-admin/configuration"; + public static final String CONFIGURATION_PAYLOAD_FILE_NAME = "configuration-payloads.json"; + public static final String CONFIGURATION_RESPONSE_PAYLOAD_FILE_NAME = "configuration-response-payloads.json"; + + private ConfigurationManagement() { + throw new AssertionError(); + } + } + + public static final class NotificationManagement { + public static final String NOTIFICATION_MANAGEMENT_GROUP = "notification-mgt"; + public static final String NOTIFICATION_ENDPOINT = "/mdm-admin/notifications"; + public static final String NOTIFICATION_PAYLOAD_FILE_NAME = "notification-payloads.json"; + public static final String NOTIFICATION_RESPONSE_PAYLOAD_FILE_NAME = "notification-response-payloads.json"; + public static final String NOTIFICATION_UPDATE_ENDPOINT = "/mdm-admin/notifications/1234/NEW"; + + private NotificationManagement() { + throw new AssertionError(); + } + } + + public static final class AndroidSenseEnrollment { + public static final String ENROLLMENT_ENDPOINT = "/android_sense/1.0.0/device/"; + public static final String RETRIEVER_ENDPOINT = "analytics/tables/"; + public static final String ANALYTICS_ARTIFACTS_DEPLOYMENT_ENDPOINT = + "/api/device-mgt/v1.0/admin/publish-artifact/1.0.0/deploy/android_sense"; + public static final String ENROLLMENT_PAYLOAD_FILE_NAME = "android-sense-enrollment-payloads.json"; + public static final String PUBLISH_DATA_OPERATION = "PUBLISH_DATA"; + public static final String BATTERY_STATS_TABLE_NAME = "ORG_WSO2_IOT_ANDROID_BATTERY_STATS"; + public static final String IS_TABLE_EXIST_CHECK_URL = "analytics/table_exists"; + + private AndroidSenseEnrollment() { + throw new AssertionError(); + } + } + + public static final class QSGManagement { + public static final String GET_MOBILE_APPS_ENDPONT = "/api/appm/publisher/v1.1/apps/mobileapp"; + + private QSGManagement() { + throw new AssertionError(); + } + } + + public static final class VirtualFireAlarmConstants { + public static final String ENROLLMENT_ENDPOINT = "/virtual_firealarm/1.0.0/device/download"; + public static final String STATS_ENDPOINT = "/virtual_firealarm/1.0.0/device/stats"; + public static final String PAYLOAD_FILE = "virtual-fire-alarm-enrollment-payloads.json"; + public static final String ANALYTICS_ARTIFACTS_DEPLOYMENT_ENDPOINT = + "/api/device-mgt/v1.0/admin/publish-artifact/1.0.0/deploy/virtual_firealarm"; + public static final String POLICY_DATA = "POLICY_DATA"; + public static final String ACTIVATE_POLICY_ENDPOINT = "/api/device-mgt/v1.0/policies/activate-policy"; + public static final String APPLY_CHANGES_ENDPOINT = "/api/device-mgt/v1.0/policies/apply-changes"; + + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTHttpClient.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTHttpClient.java new file mode 100644 index 0000000..4f6b518 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTHttpClient.java @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + + +import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.HashMap; +import java.util.Map; + +/** + * This class creates a customised Http Client Class + */ +public class IOTHttpClient { + + private static final String AUTHORIZATION = "Authorization"; + private static Log log = LogFactory.getLog(IOTHttpClient.class); + private String backEndUrl; + private String authorizationString; + private Map requestHeaders = new HashMap(); + + public IOTHttpClient(String backEndUrl, String contentType, String authorization) { + + this.backEndUrl = backEndUrl; + this.requestHeaders.put(Constants.CONTENT_TYPE, contentType); + if (authorization != null || !authorization.isEmpty()) { + this.authorizationString = authorization; + this.requestHeaders.put(AUTHORIZATION, authorization); + } + } + + public String getAuthorizationString() { + return authorizationString; + } + + public void setAuthorizationString(String authorizationString) { + this.authorizationString = authorizationString; + } + + public void setHttpHeader(String headerName, String value) { + this.requestHeaders.put(headerName, value); + } + + public String getHttpHeader(String headerName) { + return this.requestHeaders.get(headerName); + } + + public void removeHttpHeader(String headerName) { + this.requestHeaders.remove(headerName); + } + + public IOTResponse post(String endpoint, String body) { + HttpClient client = new HttpClient(); + try { + ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory(); + Protocol https = new Protocol(Constants.HTTPS, socketFactory, Constants.HTTPS_GATEWAY_PORT); + Protocol.registerProtocol(Constants.HTTPS, https); + String url = backEndUrl + endpoint; + PostMethod method = new PostMethod(url); + method.setRequestHeader(AUTHORIZATION, authorizationString); + StringRequestEntity requestEntity = new StringRequestEntity(body, + requestHeaders.get(Constants.CONTENT_TYPE), Constants.UTF8); + method.setRequestEntity(requestEntity); + IOTResponse iotResponse = new IOTResponse(); + iotResponse.setStatus(client.executeMethod(method)); + iotResponse.setBody(method.getResponseBodyAsString()); + return iotResponse; + + } catch (GeneralSecurityException e) { + log.error("Failure occurred at IOTResponse post for GeneralSecurityException", e); + } catch (IOException e) { + log.error("Failure occurred at IOTResponse post for IOException", e); + } + return null; + } + + public IOTResponse put(String endpoint, String body) { + HttpClient client = new HttpClient(); + try { + ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory(); + Protocol https = new Protocol(Constants.HTTPS, socketFactory, Constants.HTTPS_GATEWAY_PORT); + Protocol.registerProtocol(Constants.HTTPS, https); + String url = backEndUrl + endpoint; + PutMethod method = new PutMethod(url); + method.setRequestHeader(AUTHORIZATION, authorizationString); + StringRequestEntity requestEntity = new StringRequestEntity( + body, requestHeaders.get(Constants.CONTENT_TYPE), Constants.UTF8); + method.setRequestEntity(requestEntity); + IOTResponse iotResponse = new IOTResponse(); + iotResponse.setStatus(client.executeMethod(method)); + iotResponse.setBody(method.getResponseBodyAsString()); + return iotResponse; + + } catch (GeneralSecurityException e) { + log.error("Failure occurred at IOTResponse put for GeneralSecurityException", e); + } catch (IOException e) { + log.error("Failure occurred at IOTResponse put for IO Exception", e); + } + return null; + } + + public IOTResponse get(String endpoint) { + HttpClient client = new HttpClient(); + try { + ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory(); + + Protocol https = new Protocol(Constants.HTTPS, socketFactory, Constants.HTTPS_GATEWAY_PORT); + Protocol.registerProtocol(Constants.HTTPS, https); + String url = backEndUrl + endpoint; + GetMethod method = new GetMethod(url); + method.setRequestHeader(AUTHORIZATION, authorizationString); + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, + new DefaultHttpMethodRetryHandler(3, false)); + IOTResponse iotResponse = new IOTResponse(); + iotResponse.setStatus(client.executeMethod(method)); + iotResponse.setBody(new String(method.getResponseBody())); + return iotResponse; + + } catch (GeneralSecurityException e) { + log.error("Failure occurred at IOTResponse get for GeneralSecurityException", e); + } catch (IOException e) { + log.error("Failure occurred at IOTResponse get for IOException", e); + } + + return null; + } + + public IOTResponse delete(String endpoint) { + + HttpClient client = new HttpClient(); + + try { + ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory(); + + Protocol https = new Protocol(Constants.HTTPS, socketFactory, Constants.HTTPS_GATEWAY_PORT); + Protocol.registerProtocol(Constants.HTTPS, https); + + String url = backEndUrl + endpoint; + + DeleteMethod method = new DeleteMethod(url); + method.setRequestHeader(AUTHORIZATION, authorizationString); + method.setRequestHeader(Constants.CONTENT_TYPE, requestHeaders.get(Constants.CONTENT_TYPE)); + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, + new DefaultHttpMethodRetryHandler(3, false)); + + IOTResponse iotResponse = new IOTResponse(); + iotResponse.setStatus(client.executeMethod(method)); + iotResponse.setBody(method.getResponseBodyAsString()); + return iotResponse; + + } catch (GeneralSecurityException e) { + log.error("Failure occurred at IOTResponse delete for GeneralSecurityException", e); + } catch (IOException e) { + log.error("Failure occurred at IOTResponse delete for IOException", e); + } + return null; + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTResponse.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTResponse.java new file mode 100644 index 0000000..732d5a3 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/IOTResponse.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +/** + * This class contains the functions to handle a HTTP Response + */ +public class IOTResponse { + + private int status; + private String body; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java new file mode 100644 index 0000000..2b162b1 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import org.apache.commons.net.util.Base64; +import org.json.JSONObject; +import org.wso2.carbon.automation.test.utils.http.client.HttpResponse; + +/** + * This Util class holds method necessary to get an OAuth token. + */ +public class OAuthUtil { + + + public static String getScopes(String backendHTTPURL, String backendHTTPSURL) throws Exception { + return getOAuthTokenPair(backendHTTPURL, backendHTTPSURL).get(Constants.SCOPE).toString(); + } + + public static String getOAuthToken(String backendHTTPURL, String backendHTTPSURL) throws Exception { + return getOAuthTokenPair(backendHTTPURL, backendHTTPSURL).get(Constants.OAUTH_ACCESS_TOKEN).toString(); + } + + public static JSONObject getOAuthTokenPair(String backendHTTPURL, String backendHTTPSURL) throws Exception { + String AuthString = "Basic YWRtaW46YWRtaW4="; + RestClient client = new RestClient(backendHTTPURL, Constants.APPLICATION_JSON, AuthString); + HttpResponse oAuthData = client.post(Constants.APIApplicationRegistration.API_APP_REGISTRATION_ENDPOINT, + Constants.APIApplicationRegistration.API_APP_REGISTRATION_PAYLOAD); + JSONObject jsonObj = new JSONObject(oAuthData.getData()); + String clientId = jsonObj.get(Constants.OAUTH_CLIENT_ID).toString(); + String clientSecret = jsonObj.get(Constants.OAUTH_CLIENT_SECRET).toString(); + byte[] bytesEncoded = Base64.encodeBase64((clientId + ":" + clientSecret).getBytes()); + String basicAuthString = "Basic " + new String(bytesEncoded); + //Initiate a RestClient to get OAuth token + client = new RestClient(backendHTTPSURL, Constants.APPLICATION_URL_ENCODED, basicAuthString); + oAuthData = client.post(Constants.APIApplicationRegistration.TOKEN_ENDPOINT, + Constants.APIApplicationRegistration.OAUTH_TOKEN_PAYLOAD); + jsonObj = new JSONObject(oAuthData.getData()); + return jsonObj; + } + + /** + * To get the oauth token pair for the given auth string which is encoded in base64 format. + * @param authString encoded auth string + * @param backendHTTPURL backend http URL + * @param backendHTTPSURL backend https URL + * @return a JSON object which consist of oauth token pair + * @throws Exception Exception + */ + public static String getOAuthTokenPair(String authString, String backendHTTPURL, String backendHTTPSURL, + String username, String password) throws Exception { + RestClient client = new RestClient(backendHTTPURL, Constants.APPLICATION_JSON, "Basic " + authString); + HttpResponse oAuthData = client.post(Constants.APIApplicationRegistration.API_APP_REGISTRATION_ENDPOINT, + Constants.APIApplicationRegistration.API_APP_REGISTRATION_PAYLOAD); + JSONObject jsonObj = new JSONObject(oAuthData.getData()); + String clientId = jsonObj.get(Constants.OAUTH_CLIENT_ID).toString(); + String clientSecret = jsonObj.get(Constants.OAUTH_CLIENT_SECRET).toString(); + byte[] bytesEncoded = Base64.encodeBase64((clientId + ":" + clientSecret).getBytes()); + String basicAuthString = "Basic " + new String(bytesEncoded); + //Initiate a RestClient to get OAuth token + client = new RestClient(backendHTTPSURL, Constants.APPLICATION_URL_ENCODED, basicAuthString); + oAuthData = client.post(Constants.APIApplicationRegistration.TOKEN_ENDPOINT, + "username=" + username + "&password=" + password + Constants.APIApplicationRegistration.MULTI_TENANT_OAUTH_TOKEN_PAYLOAD); + jsonObj = new JSONObject(oAuthData.getData()); + return jsonObj.get(Constants.OAUTH_ACCESS_TOKEN).toString(); + + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/PayloadGenerator.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/PayloadGenerator.java new file mode 100644 index 0000000..9f3a6ce --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/PayloadGenerator.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.apache.commons.io.IOUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.net.URL; + +/** + * This class is used to load the necessary payloads from payload files for integration tests. + */ +public class PayloadGenerator { + + private static final String PAYLOAD_LOCATION = "payloads/"; + private static JsonParser parser = new JsonParser(); + + public static JsonObject getJsonPayload(String fileName, String method) + throws FileNotFoundException { + URL url = PayloadGenerator.class.getClassLoader().getResource(PAYLOAD_LOCATION + fileName); + JsonObject jsonObject = parser.parse(new FileReader(url.getPath())).getAsJsonObject(); + return jsonObject.get(method).getAsJsonObject(); + } + + public static String getJsonPayloadToString(String fileName) throws IOException { + URL url = Thread.currentThread().getContextClassLoader().getResource(PAYLOAD_LOCATION + fileName); + FileInputStream fisTargetFile = new FileInputStream(new File(url.getPath())); + String returnString = IOUtils.toString(fisTargetFile, Constants.UTF8); + return returnString; + } + + /** + * Create a Json Array from a specific method in the file + * @param fileName Name of the file + * @param method Method name + * @return Json Arry created from the specific method in the file + * @throws FileNotFoundException File Not found exception + */ + public static JsonArray getJsonArray(String fileName, String method) + throws FileNotFoundException { + URL url = PayloadGenerator.class.getClassLoader().getResource(PAYLOAD_LOCATION + fileName); + JsonObject jsonObject = parser.parse(new FileReader(url.getPath())).getAsJsonObject(); + return jsonObject.get(method).getAsJsonArray(); + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/RestClient.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/RestClient.java new file mode 100644 index 0000000..c4f09f0 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/RestClient.java @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; +import org.wso2.carbon.automation.test.utils.http.client.HttpRequestUtil; +import org.wso2.carbon.automation.test.utils.http.client.HttpResponse; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * This is the rest client that is used to calls to APIs. + */ +public class RestClient { + + private static final String AUTHORIZATION = "Authorization"; + private String backEndUrl; + private String authrizationString; + private Map requestHeaders = new HashMap(); + + public RestClient(String backEndUrl, String contentType) { + this.backEndUrl = backEndUrl; + this.requestHeaders.put(Constants.CONTENT_TYPE, contentType); + } + + public RestClient(String backEndUrl, String contentType, String authorization) { + this.backEndUrl = backEndUrl; + this.requestHeaders.put(Constants.CONTENT_TYPE, contentType); + if (authorization != null || !authorization.isEmpty()) { + this.authrizationString = authorization; + this.requestHeaders.put(AUTHORIZATION, authorization); + } + } + + public String getAuthrizationString() { + return authrizationString; + } + + public void setAuthrizationString(String authrizationString) { + this.authrizationString = authrizationString; + } + + public void setHttpHeader(String headerName, String value) { + this.requestHeaders.put(headerName, value); + } + + public String getHttpHeader(String headerName) { + return this.requestHeaders.get(headerName); + } + + public void removeHttpHeader(String headerName) { + this.requestHeaders.remove(headerName); + } + + public HttpResponse post(String endpoint, String body) throws MalformedURLException, AutomationFrameworkException { + return HttpRequestUtil.doPost(new URL(backEndUrl + endpoint), body, requestHeaders); + } + + public HttpResponse put(String endpoint, String body) throws Exception { + HttpURLConnection urlConnection = null; + try { + urlConnection = (HttpURLConnection) new URL(backEndUrl + endpoint).openConnection(); + try { + urlConnection.setRequestMethod("PUT"); + } catch (ProtocolException e) { + throw new Exception("Shouldn\'t happen: HttpURLConnection doesn\'t support POST?? " + e.getMessage(), + e); + } + + urlConnection.setDoOutput(true); + urlConnection.setDoInput(true); + urlConnection.setUseCaches(false); + urlConnection.setAllowUserInteraction(false); + Iterator entryIterator = this.requestHeaders.entrySet().iterator(); + while (entryIterator.hasNext()) { + Map.Entry sb = (Map.Entry) entryIterator.next(); + urlConnection.setRequestProperty((String) sb.getKey(), (String) sb.getValue()); + } + OutputStream outputStream = urlConnection.getOutputStream(); + try { + OutputStreamWriter sb1 = new OutputStreamWriter(outputStream, "UTF-8"); + sb1.write(body); + sb1.close(); + } catch (IOException e) { + throw new Exception("IOException while sending data " + e.getMessage(), e); + } finally { + if (outputStream != null) { + outputStream.close(); + } + } + StringBuilder sb2 = new StringBuilder(); + BufferedReader rd = null; + try { + rd = new BufferedReader( + new InputStreamReader(urlConnection.getInputStream(), Charset.defaultCharset())); + String itr; + while ((itr = rd.readLine()) != null) { + sb2.append(itr); + } + } catch (FileNotFoundException e) { + throw new Exception("IOException while reading put request data " + e.getMessage(), e); + } finally { + if (rd != null) { + rd.close(); + } + } + Iterator iterator = urlConnection.getHeaderFields().keySet().iterator(); + HashMap responseHeaders = new HashMap(); + while (iterator.hasNext()) { + String key = (String) iterator.next(); + if (key != null) { + responseHeaders.put(key, urlConnection.getHeaderField(key)); + } + } + HttpResponse httpResponse = + new HttpResponse(sb2.toString(), urlConnection.getResponseCode(), responseHeaders); + return httpResponse; + } catch (IOException e) { + throw new Exception("Connection error (Is server running at " + endpoint + " ?): " + e.getMessage(), e); + } finally { + if (urlConnection != null) { + urlConnection.disconnect(); + } + + } + } + + public HttpResponse get(String endpoint) throws Exception { + return HttpRequestUtil.doGet(backEndUrl + endpoint, requestHeaders); + } + + public HttpResponse delete(String endpoint) throws Exception { + HttpURLConnection conn = null; + + HttpResponse httpResponse1; + try { + URL url = new URL(backEndUrl + endpoint); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("DELETE"); + conn.setDoOutput(true); + conn.setReadTimeout(30000); + Iterator entryIterator = this.requestHeaders.entrySet().iterator(); + + while (entryIterator.hasNext()) { + Map.Entry rd = (Map.Entry) entryIterator.next(); + conn.setRequestProperty((String) rd.getKey(), (String) rd.getValue()); + } + + conn.connect(); + StringBuilder sb1 = new StringBuilder(); + BufferedReader rd1 = null; + + HttpResponse httpResponse; + try { + rd1 = new BufferedReader(new InputStreamReader(conn.getInputStream(), Charset.defaultCharset())); + + String ignored; + while ((ignored = rd1.readLine()) != null) { + sb1.append(ignored); + } + + httpResponse = new HttpResponse(sb1.toString(), conn.getResponseCode()); + httpResponse.setResponseMessage(conn.getResponseMessage()); + } catch (IOException e) { + rd1 = new BufferedReader(new InputStreamReader(conn.getErrorStream(), Charset.defaultCharset())); + + String line; + while ((line = rd1.readLine()) != null) { + sb1.append(line); + } + + httpResponse = new HttpResponse(sb1.toString(), conn.getResponseCode()); + httpResponse.setResponseMessage(conn.getResponseMessage()); + } finally { + if (rd1 != null) { + rd1.close(); + } + + } + + httpResponse1 = httpResponse; + } finally { + if (conn != null) { + conn.disconnect(); + } + + } + + return httpResponse1; + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/TestBase.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/TestBase.java new file mode 100644 index 0000000..e75d496 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/TestBase.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common; + +import org.apache.commons.net.util.Base64; +import org.testng.annotations.DataProvider; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.context.TestUserMode; +import org.wso2.carbon.automation.engine.context.beans.User; +import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil; +import org.wso2.carbon.integration.common.utils.LoginLogoutClient; + +import javax.xml.xpath.XPathExpressionException; + +/** + * This is the base test class that provides common details necessary for other test cases. + */ +public class TestBase { + protected AutomationContext automationContext; + protected String backendHTTPSURL; + protected String backendHTTPURL; + protected String accessTokenString; + protected String accessToken; + protected TestUserMode userMode; + + protected void init(TestUserMode userMode) throws Exception { + automationContext = new AutomationContext(Constants.AUTOMATION_CONTEXT, userMode); + String tenantDomain = automationContext.getContextTenant().getDomain(); + backendHTTPSURL = automationContext.getContextUrls().getWebAppURLHttps().replace("9443", String.valueOf(Constants + .HTTPS_GATEWAY_PORT)).replace("/t/" + tenantDomain , ""); + backendHTTPURL = automationContext.getContextUrls().getWebAppURL().replace("9763", String.valueOf(Constants + .HTTP_GATEWAY_PORT)).replace("/t/" + tenantDomain , ""); + User currentUser = getAutomationContext().getContextTenant().getContextUser(); + byte[] bytesEncoded = Base64 + .encodeBase64((currentUser.getUserName() + ":" + currentUser.getPassword()).getBytes()); + String encoded = new String(bytesEncoded); + accessToken = OAuthUtil.getOAuthTokenPair(encoded, backendHTTPSURL, backendHTTPSURL, currentUser.getUserName(), + currentUser.getPassword()); + accessTokenString = "Bearer " + accessToken; + } + + protected void initPublisher(String productGroupName, String instanceName, + TestUserMode userMode) + throws XPathExpressionException { + automationContext = new AutomationContext(productGroupName, instanceName, userMode); + backendHTTPSURL = automationContext.getContextUrls().getBackEndUrl(); + } + + public String getBackendHTTPURL() { + return backendHTTPURL; + } + + public void setBackendHTTPURL(String backendHTTPURL) { + this.backendHTTPURL = backendHTTPURL; + } + + protected String getBackendHTTPSURL() throws XPathExpressionException { + return backendHTTPSURL; + } + + protected String getSessionCookie() throws Exception { + LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext); + return loginLogoutClient.login(); + } + + protected String getServiceURL() throws XPathExpressionException { + return automationContext.getContextUrls().getServiceUrl(); + } + + protected AutomationContext getAutomationContext() { + return automationContext; + } + + protected String getTestArtifactLocation() { + return FrameworkPathUtil.getSystemResourceLocation(); + } + + @DataProvider + public static Object[][] userModeProvider() { + return new TestUserMode[][]{ + new TestUserMode[]{TestUserMode.SUPER_TENANT_ADMIN}, + new TestUserMode[]{TestUserMode.TENANT_ADMIN} + }; + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java new file mode 100644 index 0000000..a765718 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common.extensions; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.context.ContextXpathConstants; +import org.wso2.carbon.automation.engine.context.TestUserMode; +import org.wso2.carbon.automation.engine.extensions.ExecutionListenerExtension; +import org.wso2.carbon.automation.extensions.ExtensionConstants; +import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension; + +import javax.xml.xpath.XPathExpressionException; + +/** + * Test Automation server extension to start the DAS. + * This will set the carbon_home to {carbonHome}/core and port offset : 2 + */ +public class AnalyticsServerExtension extends ExecutionListenerExtension { + + private CustomTestServerManager serverManager; + private static final Log log = LogFactory.getLog(CarbonServerExtension.class); + private String executionEnvironment; + private AutomationContext automationContext; + private final String ANALYTICS_PORT_OFFSET = "2"; + + @Override + public void initiate() { + try { + automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); + if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { + getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, ANALYTICS_PORT_OFFSET); + } + serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); + executionEnvironment = + automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); + + } catch (XPathExpressionException e) { + throw new RuntimeException("Error while initiating test environment", e); + } + } + + @Override + public void onExecutionStart() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + String carbonHome = serverManager.startServer("analytics"); + } + } catch (Exception e) { + throw new RuntimeException("Fail to start carbon server ", e); + } + } + + @Override + public void onExecutionFinish() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + serverManager.stopServer(); + } + } catch (Exception e) { + throw new RuntimeException("Fail to stop carbon server ", e); + } + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java new file mode 100644 index 0000000..3052044 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common.extensions; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.context.ContextXpathConstants; +import org.wso2.carbon.automation.engine.context.TestUserMode; +import org.wso2.carbon.automation.engine.extensions.ExecutionListenerExtension; +import org.wso2.carbon.automation.extensions.ExtensionConstants; +import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension; + +import javax.xml.xpath.XPathExpressionException; + +/** + * Test Automation server extension to start the Broker. + * This will set the carbon_home to {carbonHome}/core and port offset : 3 + */ +public class BrokerServerExtension extends ExecutionListenerExtension { + + private CustomTestServerManager serverManager; + private static final Log log = LogFactory.getLog(CarbonServerExtension.class); + private String executionEnvironment; + private AutomationContext automationContext; + private final String BROKER_PORT_OFFSET = "3"; + + @Override + public void initiate() { + try { + automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); + if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { + getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, BROKER_PORT_OFFSET); + } + serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); + executionEnvironment = + automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); + + } catch (XPathExpressionException e) { + throw new RuntimeException("Error while initiating test environment", e); + } + } + + @Override + public void onExecutionStart() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + String carbonHome = serverManager.startServer("broker"); + log.info(carbonHome); + System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); + } + } catch (Exception e) { + throw new RuntimeException("Fail to start carbon server ", e); + } + } + + @Override + public void onExecutionFinish() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + serverManager.stopServer(); + } + } catch (Exception e) { + throw new RuntimeException("Fail to stop carbon server ", e); + } + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CarbonServerManagerExtension.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CarbonServerManagerExtension.java new file mode 100644 index 0000000..ad8423d --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CarbonServerManagerExtension.java @@ -0,0 +1,428 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common.extensions; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.DirectoryFileFilter; +import org.apache.commons.io.filefilter.RegexFileFilter; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.context.beans.User; +import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; +import org.wso2.carbon.automation.engine.frameworkutils.CodeCoverageUtils; +import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil; +import org.wso2.carbon.automation.engine.frameworkutils.ReportGenerator; +import org.wso2.carbon.automation.engine.frameworkutils.TestFrameworkUtils; +import org.wso2.carbon.automation.extensions.servers.utils.ArchiveExtractor; +import org.wso2.carbon.automation.extensions.servers.utils.ClientConnectionUtil; +import org.wso2.carbon.automation.extensions.servers.utils.FileManipulator; +import org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader; + +import javax.xml.xpath.XPathExpressionException; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + + +public class CarbonServerManagerExtension { + private static final Log log = LogFactory.getLog(CarbonServerManagerExtension.class); + private Process process; + private String carbonHome; + private AutomationContext automationContext; + private ServerLogReader inputStreamHandler; + private ServerLogReader errorStreamHandler; + private boolean isCoverageEnable = false; + private String coverageDumpFilePath; + private int portOffset = 0; + private static final String SERVER_SHUTDOWN_MESSAGE = "Halting JVM"; + private static final String SERVER_STARTUP_MESSAGE = "Mgt Console URL"; + private static final long DEFAULT_START_STOP_WAIT_MS = 900000L; + private static final String CMD_ARG = "cmdArg"; + private static int defaultHttpPort = Integer.parseInt("9763"); + private static int defaultHttpsPort = Integer.parseInt("9443"); + private static final long COVERAGE_DUMP_WAIT_TIME = 30000; + + public CarbonServerManagerExtension(AutomationContext context) { + this.automationContext = context; + } + + public synchronized void startServerUsingCarbonHome(String carbonHome, Map commandMap) throws AutomationFrameworkException { + if(this.process == null) { + this.portOffset = this.checkPortAvailability(commandMap); + Process tempProcess = null; + + try { + if(!commandMap.isEmpty() && this.getPortOffsetFromCommandMap(commandMap) == 0) { + System.setProperty("carbon.home", carbonHome); + } + + File commandDir = new File(carbonHome); + log.info("Starting carbon server............. "); + String scriptName = TestFrameworkUtils.getStartupScriptFileName(carbonHome); + String[] parameters = this.expandServerStartupCommandList(commandMap); + String[] cmdArray; + if(System.getProperty("os.name").toLowerCase().contains("windows")) { + commandDir = new File(carbonHome + File.separator + "bin"); + cmdArray = new String[]{"cmd.exe", "/c", scriptName + ".bat"}; + cmdArray = this.mergePropertiesToCommandArray(parameters, cmdArray); + tempProcess = Runtime.getRuntime().exec(cmdArray, (String[])null, commandDir); + } else { + cmdArray = new String[]{"sh", "bin/" + scriptName + ".sh"}; + cmdArray = this.mergePropertiesToCommandArray(parameters, cmdArray); + tempProcess = Runtime.getRuntime().exec(cmdArray, (String[])null, commandDir); + } + + this.errorStreamHandler = new ServerLogReader("errorStream", tempProcess.getErrorStream()); + this.inputStreamHandler = new ServerLogReader("inputStream", tempProcess.getInputStream()); + this.inputStreamHandler.start(); + this.errorStreamHandler.start(); + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + CarbonServerManagerExtension.this.serverShutdown(CarbonServerManagerExtension.this.portOffset); + } catch (Exception var2) { + CarbonServerManagerExtension.log.error("Error while server shutdown ..", var2); + } + + } + }); + ClientConnectionUtil.waitForPort(defaultHttpPort + this.portOffset, DEFAULT_START_STOP_WAIT_MS, false, (String)this + .automationContext.getInstance().getHosts().get("default")); + long time = System.currentTimeMillis() + 60000L; + +// while(true) { +// if(this.inputStreamHandler.getOutput().contains("Mgt Console URL") || System.currentTimeMillis() >= time) { +// int httpsPort = defaultHttpsPort + this.portOffset; +// String backendURL = this.automationContext.getContextUrls().getSecureServiceUrl().replaceAll("(:\\d+)", ":" + httpsPort); +// User superUser = this.automationContext.getSuperTenant().getTenantAdmin(); +// ClientConnectionUtil.waitForLogin(backendURL, superUser); +// log.info("Server started successfully."); +// break; +// } +// } + int httpsPort = defaultHttpsPort + this.portOffset; + String backendURL = this.automationContext.getContextUrls().getSecureServiceUrl().replaceAll("(:\\d+)", ":" + httpsPort); + User superUser = this.automationContext.getSuperTenant().getTenantAdmin(); + ClientConnectionUtil.waitForLogin(backendURL, superUser); + } catch (XPathExpressionException | IOException var13) { + throw new IllegalStateException("Unable to start server", var13); + } + + this.process = tempProcess; + } + } + + private int checkPortAvailability(Map commandMap) throws AutomationFrameworkException { + int portOffset = this.getPortOffsetFromCommandMap(commandMap); + if(ClientConnectionUtil.isPortOpen(defaultHttpPort + portOffset)) { + throw new AutomationFrameworkException("Unable to start carbon server on port " + (defaultHttpPort + portOffset) + " : Port already in use"); + } else if(ClientConnectionUtil.isPortOpen(defaultHttpsPort + portOffset)) { + throw new AutomationFrameworkException("Unable to start carbon server on port " + (defaultHttpsPort + portOffset) + " : Port already in use"); + } else { + return portOffset; + } + } + + private String[] mergePropertiesToCommandArray(String[] parameters, String[] cmdArray) { + if(parameters != null) { + cmdArray = this.mergerArrays(cmdArray, parameters); + } + + return cmdArray; + } + + /** + * Unzip carbon zip file and return the carbon home. Based on the coverage configuration in automation.xml + * This method will inject jacoco agent to the carbon server startup scripts. + * + * @param carbonServerZipFile - Carbon zip file, which should be specified in test module pom + * @return - carbonHome - carbon home + * @throws IOException - If pack extraction fails + */ + public synchronized String setUpCarbonHome(String carbonServerZipFile) throws IOException, AutomationFrameworkException { + if(this.process != null) { + return this.carbonHome; + } else { + int indexOfZip = carbonServerZipFile.lastIndexOf(".zip"); + if(indexOfZip == -1) { + throw new IllegalArgumentException(carbonServerZipFile + " is not a zip file"); + } else { + String fileSeparator = File.separator.equals("\\")?"\\":"/"; + if(fileSeparator.equals("\\")) { + carbonServerZipFile = carbonServerZipFile.replace("/", "\\"); + } + + String extractedCarbonDir = carbonServerZipFile.substring(carbonServerZipFile.lastIndexOf(fileSeparator) + 1, indexOfZip); + FileManipulator.deleteDir(extractedCarbonDir); + String extractDir = "carbontmp" + System.currentTimeMillis(); + String baseDir = System.getProperty("basedir", ".") + File.separator + "target"; + log.info("Extracting carbon zip file.. "); + (new ArchiveExtractor()).extractFile(carbonServerZipFile, baseDir + File.separator + extractDir); + this.carbonHome = (new File(baseDir)).getAbsolutePath() + File.separator + extractDir + File.separator + extractedCarbonDir; + + try { + this.isCoverageEnable = Boolean.parseBoolean(this.automationContext.getConfigurationValue("//coverage")); + } catch (XPathExpressionException var8) { + throw new AutomationFrameworkException("Coverage configuration not found in automation.xml", var8); + } + + if(this.isCoverageEnable) { + this.instrumentForCoverage(); + } + + return this.carbonHome; + } + } + } + + public synchronized void serverShutdown(int portOffset) throws AutomationFrameworkException { + if(this.process != null) { + log.info("Shutting down server.."); + if(ClientConnectionUtil.isPortOpen(Integer.parseInt("9443") + portOffset)) { + int httpsPort = defaultHttpsPort + portOffset; + String url = null; + + try { + url = this.automationContext.getContextUrls().getBackEndUrl(); + } catch (XPathExpressionException var10) { + throw new AutomationFrameworkException("Get context failed", var10); + } + + String backendURL = url.replaceAll("(:\\d+)", ":" + httpsPort); + + try { + ClientConnectionUtil.sendForcefulShutDownRequest(backendURL, this.automationContext.getSuperTenant().getContextUser().getUserName(), this.automationContext.getSuperTenant().getContextUser().getPassword()); + } catch (AutomationFrameworkException var8) { + throw new AutomationFrameworkException("Get context failed", var8); + } catch (XPathExpressionException var9) { + throw new AutomationFrameworkException("Get context failed", var9); + } + + long time = System.currentTimeMillis() + 300000L; + +// while(!this.inputStreamHandler.getOutput().contains("Halting JVM") && System.currentTimeMillis() < time) { +// ; +// } + + log.info("Server stopped successfully..."); + } + + this.inputStreamHandler.stop(); + this.errorStreamHandler.stop(); + this.process.destroy(); + this.process = null; + if(this.isCoverageEnable) { + try { + log.info("Generating Jacoco code coverage..."); + this.generateCoverageReport(new File(this.carbonHome + File.separator + "repository" + + File.separator + "components" + File.separator + "plugins" + File.separator)); + } catch (IOException var7) { + log.error("Failed to generate code coverage ", var7); + throw new AutomationFrameworkException("Failed to generate code coverage ", var7); + } + } + + if(portOffset == 0) { + System.clearProperty("carbon.home"); + } + } + + } + + private void generateCoverageReport(File classesDir) throws IOException, AutomationFrameworkException { + checkJacocoDataFileSizes(FrameworkPathUtil.getJacocoCoverageHome()); + CodeCoverageUtils.executeMerge(FrameworkPathUtil.getJacocoCoverageHome(), FrameworkPathUtil.getCoverageMergeFilePath()); + ReportGenerator reportGenerator = new ReportGenerator(new File(FrameworkPathUtil.getCoverageMergeFilePath()), classesDir, new File(CodeCoverageUtils.getJacocoReportDirectory()), (File)null); + reportGenerator.create(); + log.info("Jacoco coverage dump file path : " + FrameworkPathUtil.getCoverageDumpFilePath()); + log.info("Jacoco class file path : " + classesDir); + log.info("Jacoco coverage HTML report path : " + CodeCoverageUtils.getJacocoReportDirectory() + File.separator + "index.html"); + } + + public synchronized void restartGracefully() throws AutomationFrameworkException { + try { + int httpsPort = defaultHttpsPort + this.portOffset; + String backendURL = this.automationContext.getContextUrls().getSecureServiceUrl().replaceAll("(:\\d+)", ":" + httpsPort); + User superUser = this.automationContext.getSuperTenant().getTenantAdmin(); + ClientConnectionUtil.sendGraceFullRestartRequest(backendURL, superUser.getUserName(), superUser.getPassword()); + } catch (XPathExpressionException var5) { + throw new AutomationFrameworkException("restart failed", var5); + } + + long time = System.currentTimeMillis() + 300000L; + +// while(!this.inputStreamHandler.getOutput().contains("Halting JVM") && System.currentTimeMillis() < time) { +// ; +// } + + time = System.currentTimeMillis(); + + while(System.currentTimeMillis() < time + 5000L) { + ; + } + + try { + ClientConnectionUtil.waitForPort(Integer.parseInt((String)this.automationContext.getInstance().getPorts().get("https")), (String)this.automationContext.getInstance().getHosts().get("default")); + ClientConnectionUtil.waitForLogin(this.automationContext); + } catch (XPathExpressionException var4) { + throw new AutomationFrameworkException("Connection attempt to carbon server failed", var4); + } + } + + private String[] expandServerStartupCommandList(Map commandMap) { + if(commandMap != null && commandMap.size() != 0) { + String[] cmdParaArray = null; + String cmdArg = null; + if(commandMap.containsKey("cmdArg")) { + cmdArg = (String)commandMap.get("cmdArg"); + cmdParaArray = cmdArg.trim().split("\\s+"); + commandMap.remove("cmdArg"); + } + + String[] parameterArray = new String[commandMap.size()]; + int arrayIndex = 0; + Set> entries = commandMap.entrySet(); + + String parameter; + for(Iterator i$ = entries.iterator(); i$.hasNext(); parameterArray[arrayIndex++] = parameter) { + Map.Entry entry = (Map.Entry)i$.next(); + String key = (String)entry.getKey(); + String value = (String)entry.getValue(); + if(value != null && !value.isEmpty()) { + parameter = key + "=" + value; + } else { + parameter = key; + } + } + + if(cmdArg != null) { + commandMap.put("cmdArg", cmdArg); + } + + if(cmdParaArray != null && cmdParaArray.length != 0) { + return (String[]) ArrayUtils.addAll(parameterArray, cmdParaArray); + } else { + return parameterArray; + } + } else { + return null; + } + } + + private int getPortOffsetFromCommandMap(Map commandMap) { + return commandMap.containsKey("-DportOffset")?Integer.parseInt((String)commandMap.get("-DportOffset")):0; + } + + private String[] mergerArrays(String[] array1, String[] array2) { + return (String[])ArrayUtils.addAll(array1, array2); + } + + /** + * This methods will insert jacoco agent settings into startup script under JAVA_OPTS + * + * @param scriptName - Name of the startup script + * @throws IOException - throws if shell script edit fails + */ + private void insertJacocoAgentToShellScript(String scriptName) throws IOException { + String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); + this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); + CodeCoverageUtils.insertStringToFile(new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".sh"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".sh"), "-Dwso2.server.standalone=true", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":") + " \\"); + } + + /** + * This methods will insert jacoco agent settings into windows bat script + * + * @param scriptName - Name of the startup script + * @throws IOException - throws if shell script edit fails + */ + private void insertJacocoAgentToBatScript(String scriptName) throws IOException { + String jacocoAgentFile = CodeCoverageUtils.getJacocoAgentJarLocation(); + this.coverageDumpFilePath = FrameworkPathUtil.getCoverageDumpFilePath(); + CodeCoverageUtils.insertJacocoAgentToStartupBat(new File(this.carbonHome + File.separator + "bin" + File.separator + scriptName + ".bat"), new File(this.carbonHome + File.separator + "tmp" + File.separator + scriptName + ".bat"), "-Dcatalina.base", "-javaagent:" + jacocoAgentFile + "=destfile=" + this.coverageDumpFilePath + "" + ",append=true,includes=" + CodeCoverageUtils.getInclusionJarsPattern(":")); + } + + /** + * This method will check the OS and edit server startup script to inject jacoco agent + * + * @throws IOException - If agent insertion fails. + */ + private void instrumentForCoverage() throws IOException, AutomationFrameworkException { + String scriptName = TestFrameworkUtils.getStartupScriptFileName(this.carbonHome); + if(System.getProperty("os.name").toLowerCase().contains("windows")) { + this.insertJacocoAgentToBatScript(scriptName); + if(log.isDebugEnabled()) { + log.debug("Included files " + CodeCoverageUtils.getInclusionJarsPattern(":")); + log.debug("Excluded files " + CodeCoverageUtils.getExclusionJarsPattern(":")); + } + } else { + this.insertJacocoAgentToShellScript(scriptName); + } + + } + + /** + * To check jacoco file sizes and wait for them to get created.. + * + * @param filePath File Path of the jacoco data files. + */ + private void checkJacocoDataFileSizes(String filePath) { + Collection fileSetsCollection = FileUtils + .listFiles(new File(filePath), new RegexFileFilter("[^s]+(." + "(?i)(exec))$"), + DirectoryFileFilter.DIRECTORY); + + for (File inputFile : fileSetsCollection) { + if (inputFile.isDirectory()) { + continue; + } + //retry to check whether exec data file is non empty. + waitForCoverageDumpFileCreation(inputFile); + } + } + + /** + * This is to wait for jacoco exe file creation. + * + * @param file File that need to be created. + */ + private void waitForCoverageDumpFileCreation(File file) { + long currentTime = System.currentTimeMillis(); + long waitTime = currentTime + COVERAGE_DUMP_WAIT_TIME; + + while (waitTime > System.currentTimeMillis()) { + if (file.length() > 0) { + log.info("Execution data file non empty file size in KB : " + file.length() / 1024); + break; + } else { + try { + log.warn("Execution data file is empty file size in KB : " + file.length() / 1024); + Thread.sleep(500); + } catch (InterruptedException ignored) { + log.warn("Sleep interrupted ", ignored); + } + } + } + } + +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java new file mode 100644 index 0000000..6595dc7 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common.extensions; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.automation.engine.FrameworkConstants; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException; +import org.wso2.carbon.automation.extensions.ExtensionConstants; + +import javax.xml.xpath.XPathExpressionException; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class CustomTestServerManager { + protected CarbonServerManagerExtension carbonServer; + protected String carbonZip; + protected int portOffset; + protected Map commandMap = new HashMap(); + private static final Log log = LogFactory.getLog(CustomTestServerManager.class); + protected String carbonHome; + + public CustomTestServerManager(AutomationContext context) { + carbonServer = new CarbonServerManagerExtension(context); + } + + public CustomTestServerManager(AutomationContext context, String carbonZip) { + carbonServer = new CarbonServerManagerExtension(context); + this.carbonZip = carbonZip; + } + + public CustomTestServerManager(AutomationContext context, int portOffset) { + carbonServer = new CarbonServerManagerExtension(context); + this.portOffset = portOffset; + commandMap.put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, String.valueOf(portOffset)); + } + + public CustomTestServerManager(AutomationContext context, String carbonZip, + Map commandMap) { + carbonServer = new CarbonServerManagerExtension(context); + this.carbonZip = carbonZip; + if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { + this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); + } else { + throw new IllegalArgumentException("portOffset value must be set in command list"); + } + this.commandMap = commandMap; + } + + public String getCarbonZip() { + return carbonZip; + } + + public String getCarbonHome() { + return carbonHome; + } + + public int getPortOffset() { + return portOffset; + } + + public void configureServer() throws AutomationFrameworkException { + + } + + public Map getCommands() { + return commandMap; + } + + /** + * This method is called for starting a Carbon server in preparation for execution of a + * TestSuite + *

+ * Add the @BeforeSuite TestNG annotation in the method overriding this method + * + * @param server : The server which needs to be start. + * @return The CARBON_HOME + * @throws IOException If an error occurs while copying the deployment artifacts into the + * Carbon server + */ + public synchronized String startServer(String server) + throws AutomationFrameworkException, IOException, XPathExpressionException, InterruptedException { + if (carbonHome == null) { + if (carbonZip == null) { + carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION); + } + if (carbonZip == null) { + throw new IllegalArgumentException("carbon zip file cannot find in the given location"); + } + String extractedDir = getExistingExtractedDir(); + if (server.equalsIgnoreCase("core")) { + if (extractedDir == null) { + carbonHome = carbonServer.setUpCarbonHome(carbonZip); + } else { + carbonHome = extractedDir; + } + } else if (server.equalsIgnoreCase("analytics") || server.equalsIgnoreCase("broker")) { + if (extractedDir == null) { + carbonHome = carbonServer.setUpCarbonHome(carbonZip) + File.separator + "wso2" + File.separator + server; + } else { + carbonHome = extractedDir + File.separator + "wso2" + File.separator + server; + } + } else { + throw new IllegalArgumentException("Unsupported server type provided - " + server); + } + configureServer(); + } + log.info("Carbon Home - " + carbonHome); + if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { + this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); + } else { + this.portOffset = 0; + } + + carbonServer.startServerUsingCarbonHome(carbonHome, commandMap); + return carbonHome; + } + + private String getExistingExtractedDir() { + File zipDir = new File(System.getProperty("basedir", ".") + File.separator + "target"); + File[] subFiles = zipDir.listFiles(); + if (subFiles != null) { + for (File subFile : subFiles) { + if (subFile.getName().startsWith("carbontmp")) { + File[] carbonServerFiles = subFile.listFiles(); + if (carbonServerFiles != null) { + for (File file : carbonServerFiles) { + if (file.getName().startsWith("entgra-iot")) { + return file.getAbsolutePath(); + } + } + } + } + } + } + return null; + } + + /** + * Restarting server already started by the method startServer + * + * @throws AutomationFrameworkException + */ + public void restartGracefully() throws AutomationFrameworkException { + if (carbonHome == null) { + throw new AutomationFrameworkException("No Running Server found to restart. " + + "Please make sure whether server is started"); + } + carbonServer.restartGracefully(); + } + + /** + * This method is called for stopping a Carbon server + *

+ * Add the @AfterSuite annotation in the method overriding this method + * + * @throws AutomationFrameworkException If an error occurs while shutting down the server + */ + public void stopServer() throws AutomationFrameworkException { + carbonServer.serverShutdown(portOffset); + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java new file mode 100644 index 0000000..34a1037 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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.common.extensions; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment; +import org.wso2.carbon.automation.engine.context.AutomationContext; +import org.wso2.carbon.automation.engine.context.ContextXpathConstants; +import org.wso2.carbon.automation.engine.context.TestUserMode; +import org.wso2.carbon.automation.engine.extensions.ExecutionListenerExtension; +import org.wso2.carbon.automation.extensions.ExtensionConstants; +import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension; + +import javax.xml.xpath.XPathExpressionException; + +/** + * Test Automation server extension to start the IOT core. + * This will set the carbon_home to {carbonHome}/core and port offset : 0 + */ +public class IOTServerExtension extends ExecutionListenerExtension { + + private CustomTestServerManager serverManager; + private static final Log log = LogFactory.getLog(CarbonServerExtension.class); + private String executionEnvironment; + private AutomationContext automationContext; + private final String IOT_CORE_PORT_OFFSET = "0"; + + @Override + public void initiate() { + try { + automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); + if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { + getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, IOT_CORE_PORT_OFFSET); + } + serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); + executionEnvironment = + automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); + + } catch (XPathExpressionException e) { + throw new RuntimeException("Error while initiating test environment", e); + } + } + + @Override + public void onExecutionStart() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + String carbonHome = serverManager.startServer("core"); + log.info(carbonHome); + System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); + + // Need to give time for the apis to be added to the synapse configurations. + Thread.sleep(200000); + } + } catch (Exception e) { + throw new RuntimeException("Fail to start carbon server ", e); + } + } + + @Override + public void onExecutionFinish() { + try { + if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { + serverManager.stopServer(); + } + } catch (Exception e) { + throw new RuntimeException("Fail to stop carbon server ", e); + } + } +} diff --git a/integration-test/iot-community/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java new file mode 100644 index 0000000..180bfe5 --- /dev/null +++ b/integration-test/iot-community/src/test/java/org/wso2/iot/integration/jmeter/AndroidDeviceManagementAPIJmeterTestCase.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 - 2022 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * + * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. + * + * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://entgra.io/licenses/entgra-commercial/1.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; + +/** + * JMeter Test cases for Device Management APIs. + */ +public class AndroidDeviceManagementAPIJmeterTestCase { + private static Log log = LogFactory.getLog(AndroidDeviceManagementAPIJmeterTestCase.class); + + @Test(description = "Testing the android device management functionalities") + public void permutationTest() throws AutomationFrameworkException { + URL url = Thread.currentThread().getContextClassLoader().getResource( + "jmeter-scripts" + File.separator + "AndroidDeviceManagementAPI.jmx"); + JMeterTest script = new JMeterTest(new File(url.getPath())); + JMeterTestManager manager = new JMeterTestManager(); + log.info("Running permutation test using jmeter scripts"); + manager.runTest(script); + } +} diff --git a/integration-test/iot-community/src/test/resources/automation.xml b/integration-test/iot-community/src/test/resources/automation.xml new file mode 100644 index 0000000..8d21bb5 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/automation.xml @@ -0,0 +1,225 @@ + + + + + + + + + 100000 + + standalone + + false + + false + + + + + + + http://10.100.2.51:4444/wd/hub/ + + + + firefox + + /home/test/name/webDriver + + + + + + + jdbc:h2:testDB + wso2carbon + wso2carbon + org.h2.Driver + + + jdbc:h2:testDB + wso2carbon + wso2carbon + org.h2.Driver + + + + + + + keystores/products/wso2carbon.jks + + JKS + + wso2carbon + + wso2carbon + + wso2carbon + + + + + client-truststore.jks + + JKS + + wso2carbon + + + + + + https://wso2.org/repo + file:///home/krishantha/test + + + + + + + + + + admin + admin + + + + + testuser11 + testuser11 + + + testuser21 + testuser21 + + + + + + + + + admin + admin + + + + + testuser11 + testuser11 + + + testuser21 + testuser21 + + + + + + + + + + + + + localhost + + + 9763 + + 9443 + + + + + + + + + + + + + + + + + org.wso2.iot.integration.common.extensions.IOTServerExtension + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/integration-test/iot-community/src/test/resources/automationSchema.xsd b/integration-test/iot-community/src/test/resources/automationSchema.xsd new file mode 100644 index 0000000..c3bd1b3 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/automationSchema.xsd @@ -0,0 +1,565 @@ + + + + + + + + + ================================================= + Parameters ================================================= + Browser type with used by framework to execute UI test, supported types + - chrome|firefox|opera|ie|htmlUnit + + + + + + + Change this to edit wait time for test + artifact deployment + + + + + + Change this to product|platform/cloud to + execute test on specific environment + + + + + + Change this to user/tenant to execute test + with user mode or tenant mode + + + + + + Change this to true if you want to generate + coverage statistics + + + + + + Change this to true if you want to enable + framework dashboard + + + + + + + + + + + + + + + Change to enable remote webDriver + URL of remote webDriver server + + + + + + + + + + + + + Type of the browser selenium tests + are running" + + + + + + + + path to webDriver + executable - required only for + chrome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KeyStore which will be used for + encrypting/decrypting passwords + and other sensitive information. + + + + + + + Keystore file location + + + + + + Keystore type (JKS/PKCS12 etc.) + + + + + + Keystore password + + + + + + Private Key alias + + + + + + Private Key password + + + + + + + + + + System wide trust-store which is used to + maintain the certificates of all + the trusted parties. + + + + + + + trust-store file location + + + + + + trust-store type (JKS/PKCS12 + etc.) + + + + + + trust-store password + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/integration-test/iot-community/src/test/resources/client/modules/addressing-1.6.1-wso2v20.mar b/integration-test/iot-community/src/test/resources/client/modules/addressing-1.6.1-wso2v20.mar new file mode 100644 index 0000000..d28b3a0 Binary files /dev/null and b/integration-test/iot-community/src/test/resources/client/modules/addressing-1.6.1-wso2v20.mar differ diff --git a/integration-test/iot-community/src/test/resources/filters.txt b/integration-test/iot-community/src/test/resources/filters.txt new file mode 100644 index 0000000..8813e63 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/filters.txt @@ -0,0 +1,23 @@ +-org.wso2.carbon.caching.core.identity.* +-org.wso2.carbon.caching.core.permissiontree.* +-org.wso2.carbon.caching.infinispan.* +-org.wso2.carbon.event.core.internal.delivery.jms.* +-org.wso2.carbon.event.core.qpid.* +-org.wso2.carbon.registry.synchronization.* +-*.stub* +-*.stub_ +-*.stub_4.0.0 +-*.stub- +-org.eclipse.* +-*.equinox.* +-org.wso2.carbon.user.core.* +-samples.* +-*.log4j* +-*.axis2* +-*.ui* +-*.tenant* +-*.stratos* +-*.eventing* +-*tests-transports* +-org.wso2.carbon.mediation.statistics* +-*startup* diff --git a/integration-test/iot-community/src/test/resources/instrumentation.txt b/integration-test/iot-community/src/test/resources/instrumentation.txt new file mode 100644 index 0000000..4d643d7 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/instrumentation.txt @@ -0,0 +1,8 @@ +io.entgra.power.meter.logger_ +io.entgra.meter.request_ +io.entgra.device.mgt.plugin.power.meter_ +io.entgra.tableau.integration_ +io.entgra.iot.ami.communication.adaptor_ +io.entgra.iot.dlms_ +io.entgra.iot.iec_ +io.entgra.iot.sms_ \ No newline at end of file diff --git a/integration-test/iot-community/src/test/resources/jmeter-scripts/AndroidDeviceManagementAPI.jmx b/integration-test/iot-community/src/test/resources/jmeter-scripts/AndroidDeviceManagementAPI.jmx new file mode 100644 index 0000000..331dfd2 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/jmeter-scripts/AndroidDeviceManagementAPI.jmx @@ -0,0 +1,9174 @@ + + + + + + false + false + + + + host + 172.17.0.1 + = + + + http_port + 9763 + = + + + https_port + 9443 + = + + + + + + + + 9999 + 100 + + false + + randAppNum + + + + + + host + localhost + = + + + https_port + 8243 + = + + + http_port + 8280 + = + + + token_ep_host + localhost + = + + + token_ep_port + 8280 + = + + + 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 + true + + + /home/ace/Desktop/results_multi_user_multi_tenancy.jtl + + + + + continue + + false + 1 + + 1 + 1 + 1676462131000 + 1676462131000 + 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@wso2.com</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/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 + + + + + + continue + + false + 1 + + 1 + 1 + 1465464058000 + 1465464058000 + false + + + + + + 1 + + 1 + DeviceID + # + 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":10${DeviceID}, + "name":"androiddevice${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a4${DeviceID}", + "enrolmentInfo":{ + "id":10${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 + + + + + + + + + + false + 0 + = + true + offset + + + false + 1 + = + true + limit + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [ + { + "serial": "qwe12-23fdf-2s332-53fv3-sfs33", + "pem": " +MIIEXjCCA0agAwIBAgIJAPocSteC87XUMA0GCSqGSIb3DQEBBQUAMHwxCzAJBgNV +BAYTAlNMMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMRIwEAYD +VQQKEwlXU08yIEluYy4xHzAdBgkqhkiG9w0BCQEWEHRlY2hvcHNAd3NvMi5jb20x +FDASBgNVBAMTC1dTTzIgUmFkaXVzMB4XDTEzMDYyNzAzMzA0NFoXDTIzMDYyNTAz +MzA0NFowfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgTB0NvbG9tYm8xEDAOBgNVBAcT +B0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEfMB0GCSqGSIb3DQEJARYQdGVj +aG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBSYWRpdXMwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDNmhw12cF0H2UGE/XtWVt238oGxn19+n/HkM2B +cDNQgnStqI+g/K2HBtjmvVPBh17Mt+dU2BIathn06amza+LI+hHgeLUSv30jutv4 +L5zD2laAU9A/I0Wtrxu5FlsevRPSiY7buLjTbjP7IMn9vdwb+9nBQCGxVpO6AK2A +gsFJ5udnp7L+jNsHmHFt36AYZouihgD+/RGVLBAhtPoU6XFB1JoGFM+4qxklJLPh +k86WollG4cFvHXSbO1P95n6Jb/V3hfM0PvwFZswRPVnW8ngqm889C/JEk5rK4FHy +xk9MgeFRW6zA+3rVnyPdhy6/q4EerBLMfBEWpzFHyHDKMGanAgMBAAGjgeIwgd8w +HQYDVR0OBBYEFKRxtF0CWPwL7jRvA4NSIzploUgrMIGvBgNVHSMEgacwgaSAFKRx +tF0CWPwL7jRvA4NSIzploUgroYGApH4wfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgT +B0NvbG9tYm8xEDAOBgNVBAcTB0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEf +MB0GCSqGSIb3DQEJARYQdGVjaG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBS +YWRpdXOCCQD6HErXgvO11DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB +AQCDQV9wy8rfuFp4uByqYhnrQjzBN75VbNcgpdYocOxQPLnjWRM5qdJHELrt4FEl +rDMGd1BpP7QMAEYJUIcpDHPbs9HVCeEV6hdOrLgGxNDB0YVa2Fr5k2U8gsNIgKZo +fKxscx0w5OM71IQbuppAgIHK29DBVBVppO+zduIbVtSoBo/gcVIqVGXQXf8TFtoV +xyfGUTYdBDP4fT4p8uLASXmdaFyegQOhkjSuchVPGSJOZD6TvOjE6ZvBu9eC7sqh +oTPY56Ld0GscWJmAuj+8vmWGu0md8MnM2DE0SIYE3bo/sPp3yEIbCAnHmcveG8hn +GEL4ZNjZ+jnwSkzwBU5vh/QS", + "tenantId": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + false + 0 + = + true + offset + + + false + 1 + = + true + limit + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates/qwe12-23fdf-2s332-53fv3-sfs338 + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + false + qwe12-23fdf-2s332-53fv3-sfs33 + = + true + serialNumber + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + DELETE + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "serial": "qwe12-23fdf-2s332-53fv3-sfs33", + "pem": " +MIIEXjCCA0agAwIBAgIJAPocSteC87XUMA0GCSqGSIb3DQEBBQUAMHwxCzAJBgNV +BAYTAlNMMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMRIwEAYD +VQQKEwlXU08yIEluYy4xHzAdBgkqhkiG9w0BCQEWEHRlY2hvcHNAd3NvMi5jb20x +FDASBgNVBAMTC1dTTzIgUmFkaXVzMB4XDTEzMDYyNzAzMzA0NFoXDTIzMDYyNTAz +MzA0NFowfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgTB0NvbG9tYm8xEDAOBgNVBAcT +B0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEfMB0GCSqGSIb3DQEJARYQdGVj +aG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBSYWRpdXMwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDNmhw12cF0H2UGE/XtWVt238oGxn19+n/HkM2B +cDNQgnStqI+g/K2HBtjmvVPBh17Mt+dU2BIathn06amza+LI+hHgeLUSv30jutv4 +L5zD2laAU9A/I0Wtrxu5FlsevRPSiY7buLjTbjP7IMn9vdwb+9nBQCGxVpO6AK2A +gsFJ5udnp7L+jNsHmHFt36AYZouihgD+/RGVLBAhtPoU6XFB1JoGFM+4qxklJLPh +k86WollG4cFvHXSbO1P95n6Jb/V3hfM0PvwFZswRPVnW8ngqm889C/JEk5rK4FHy +xk9MgeFRW6zA+3rVnyPdhy6/q4EerBLMfBEWpzFHyHDKMGanAgMBAAGjgeIwgd8w +HQYDVR0OBBYEFKRxtF0CWPwL7jRvA4NSIzploUgrMIGvBgNVHSMEgacwgaSAFKRx +tF0CWPwL7jRvA4NSIzploUgroYGApH4wfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgT +B0NvbG9tYm8xEDAOBgNVBAcTB0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEf +MB0GCSqGSIb3DQEJARYQdGVjaG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBS +YWRpdXOCCQD6HErXgvO11DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB +AQCDQV9wy8rfuFp4uByqYhnrQjzBN75VbNcgpdYocOxQPLnjWRM5qdJHELrt4FEl +rDMGd1BpP7QMAEYJUIcpDHPbs9HVCeEV6hdOrLgGxNDB0YVa2Fr5k2U8gsNIgKZo +fKxscx0w5OM71IQbuppAgIHK29DBVBVppO+zduIbVtSoBo/gcVIqVGXQXf8TFtoV +xyfGUTYdBDP4fT4p8uLASXmdaFyegQOhkjSuchVPGSJOZD6TvOjE6ZvBu9eC7sqh +oTPY56Ld0GscWJmAuj+8vmWGu0md8MnM2DE0SIYE3bo/sPp3yEIbCAnHmcveG8hn +GEL4ZNjZ+jnwSkzwBU5vh/QS", + "tenantId": 0 + } + = + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates/verify/android + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + invalid + + Assertion.response_data + false + 16 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "type": "android", + "configuration": [ + { + "name": "notifierType", + "value": "1", + "contentType": "text" + }, + { + "name": "notifierFrequency", + "value": "500000", + "contentType": "text" + }, + { + "name": "androidEula", + "value": "This End User License Agreement is Eula.", + "contentType": "text" + } + ] + } + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/configuration + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "conditions": [ + { + "key": "deviceIdentifier", + "value": "d24f870f390352a4${DeviceID}", + "operator": "=", + "state": "AND" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/search-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID} + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/applications + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/effective-policy + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/device-type/android/features + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + false + admin + = + true + owner + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/operations + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/compliance-data + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/user-devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + false + activityId + "activityId":"(.+?)" + $1$ + 1 + 1 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities/${activityId} + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/admin/devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device-types + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "type": "android", + "configuration": [ + { + "name": "SampleConfiguration", + "contentType": "text", + "value": "This is a sample Configuration" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/configuration + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/configuration/license + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice1000${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a41000${DeviceID}", + "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 + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice1000${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a41000${DeviceID}", + "enrolmentInfo":{ + "id":1000${DeviceID}, + "device":{ + + }, + "dateOfEnrolment":0, + "dateOfLastUpdate":0, + "ownership":"BYOD", + "status":"CREATED", + "owner":"admin" + }, + "features":[ + { + "id":10, + "code":"aaaa1111", + "name":"newfeature2", + "description":"this is the new feature 2", + "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 + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID} + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [ + { + "id": 10, + "platform": "android", + "category": "Business", + "name": "Graphical", + "locationUrl": "string", + "imageUrl": "string", + "version": "1.0.0", + "type": "string", + "appProperties": {}, + "applicationIdentifier": "string", + "memoryUsage": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/applications + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/status + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + Status of android device that carries the id \u0027d24f870f390352a41000${DeviceID}\u0027 is CREATED + + Assertion.response_data + false + 16 + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"APPLICATION_LIST","type":"COMMAND","id":1,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:01:57.915","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "appIdentifier": [ + "ANGRYBIRD" + ] + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/blacklist-applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "operation": { + "lockCode": "0000" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/change-lock-code + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"CHANGE_LOCK_CODE","type":"PROFILE","id":2,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:14:19.718","isEnabled":true,"payLoad":"{\"lockCode\":\"0000\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/clear-password + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"CLEAR_PASSWORD","type":"COMMAND","id":3,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:18:40.233","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "serverAddress": "231.168.10.1", + "serverPort": "1701", + "sharedSecret": "YWRtaW4=", + "dnsServer": "8.8.8.8" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/configure-vpn + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "operation": { + "ssid": "string", + "password": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/configure-wifi + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"WIFI","type":"PROFILE","id":4,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:24:20.315","isEnabled":true,"payLoad":"{\"ssid\":\"string\",\"password\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "enabled": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/control-camera + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"CAMERA","type":"COMMAND","id":5,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:28:02.864","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "encrypted": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/encrypt-storage + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"ENCRYPT_STORAGE","type":"COMMAND","id":6,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:31:15.288","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/enterprise-wipe + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"ENTERPRISE_WIPE","type":"COMMAND","id":7,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:42:12.406","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "https://www.youtube.com", + "name": "youtube" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/install-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"INSTALL_APPLICATION","type":"PROFILE","id":8,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:55:15.452","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/location + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_LOCATION","type":"COMMAND","id":9,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:59:05.927","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "message": "string", + "hardLockEnabled": false + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/lock-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"DEVICE_LOCK","type":"PROFILE","id":10,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:53:28.008","isEnabled":true,"payLoad":"{\"message\":\"string\",\"isHardLockEnabled\":false}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/mute + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":true,"code":"DEVICE_MUTE","type":"COMMAND","id":11,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:56:54.703","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/reboot + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"REBOOT","type":"COMMAND","id":12,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:59:03.554","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/ring + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_RING","type":"COMMAND","id":13,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:00:54.603","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "messageText": "string", + "messageTitle": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/send-notification + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"NOTIFICATION","type":"PROFILE","id":14,"status":"IN_PROGRESS","createdTimeStamp":"2016-08-03 14:02:55.003","isEnabled":true,"payLoad":"{\"messageText\":\"string\",\"messageTitle\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [{"code":"NOTIFICATION","type":"PROFILE","id":14,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:02:55.003","isEnabled":true,"payLoad":"{\"messageText\":\"string\",\"messageTitle\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "maxFailedAttempts": 0, + "minLength": 0, + "pinHistory": 0, + "minComplexChars": 0, + "maxPINAgeInDays": 0, + "requireAlphanumeric": false, + "allowSimple": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/set-password-policy + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"PASSCODE_POLICY","type":"PROFILE","id":15,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:07:01.2","isEnabled":true,"payLoad":"{\"maxFailedAttempts\":0,\"minLength\":0,\"pinHistory\":0,\"minComplexChars\":0,\"maxPINAgeInDays\":0,\"requireAlphanumeric\":false,\"allowSimple\":false}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "identity": "string", + "title": "string", + "type": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/set-webclip + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"WEBCLIP","type":"PROFILE","id":16,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:26:04.822","isEnabled":true,"payLoad":"{\"identity\":\"string\",\"title\":\"string\",\"type\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "string", + "name": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/uninstall-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UNINSTALL_APPLICATION","type":"PROFILE","id":17,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:28:26.049","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\",\"name\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/unlock-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":true,"code":"DEVICE_UNLOCK","type":"COMMAND","id":18,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:35:07.994","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "https://www.youtube.com", + "name": "youtube", + "schedule": "" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/update-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UPDATE_APPLICATION","type":"PROFILE","id":19,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:39:32.714","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\",\"schedule\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "schedule": "", + "server": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/upgrade-firmware + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UPGRADE_FIRMWARE","type":"PROFILE","id":20,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:43:25.406","isEnabled":true,"payLoad":"{\"schedule\":\"string\",\"server\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "pin": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/wipe + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"APPLICATION_LIST","type":"COMMAND","id":22,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:55:18.118","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/info + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_INFO","type":"COMMAND","id":23,"status":"COMPLETED","createdTimeStamp":"2016-08-03 15:30:16.779","isEnabled":false, "operationResponse" : '{ "id": 101234, "name": "androiddevice1234","type": "android", "description": "this is an android device","deviceIdentifier": "d24f870f390352a4${DeviceID}","enrolmentInfo": {"id": 101234,"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": "DEVICE_MODEL","value": "S6"},{"name" : "VENDOR","value" : "SAMSUNG"}],"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 + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [{"code":"WIPE_DATA","type":"PROFILE","id":21,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:45:49.198","isEnabled":true,"payLoad":"{\"pin\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 1000 + + + + false + true + false + + + + + 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":"test_005", + "username":"admin@wso2.com", + "grantTypes":"client_credentials password refresh_token", + "callBackUrl":"www.example.com", + "isSaasApp":true, + "tags": ["device_management", "application_management", "subscription_management", "review_management"] +} + = + + + + ${host} + 9443 + + + https + + /api-key-management/dynamic-client-registration + 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 + + + + + false + true + false + + + + true + + + + false + { + "id":10${DeviceID}, + "name":"androiddevice${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a4${DeviceID}", + "enrolmentInfo":{ + "id":10${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 + + + + + + + + + + false + 0 + = + true + offset + + + false + 1 + = + true + limit + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [ + { + "serial": "qwe12-23fdf-2s332-53fv3-sfs33", + "pem": " +MIIEXjCCA0agAwIBAgIJAPocSteC87XUMA0GCSqGSIb3DQEBBQUAMHwxCzAJBgNV +BAYTAlNMMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMRIwEAYD +VQQKEwlXU08yIEluYy4xHzAdBgkqhkiG9w0BCQEWEHRlY2hvcHNAd3NvMi5jb20x +FDASBgNVBAMTC1dTTzIgUmFkaXVzMB4XDTEzMDYyNzAzMzA0NFoXDTIzMDYyNTAz +MzA0NFowfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgTB0NvbG9tYm8xEDAOBgNVBAcT +B0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEfMB0GCSqGSIb3DQEJARYQdGVj +aG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBSYWRpdXMwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDNmhw12cF0H2UGE/XtWVt238oGxn19+n/HkM2B +cDNQgnStqI+g/K2HBtjmvVPBh17Mt+dU2BIathn06amza+LI+hHgeLUSv30jutv4 +L5zD2laAU9A/I0Wtrxu5FlsevRPSiY7buLjTbjP7IMn9vdwb+9nBQCGxVpO6AK2A +gsFJ5udnp7L+jNsHmHFt36AYZouihgD+/RGVLBAhtPoU6XFB1JoGFM+4qxklJLPh +k86WollG4cFvHXSbO1P95n6Jb/V3hfM0PvwFZswRPVnW8ngqm889C/JEk5rK4FHy +xk9MgeFRW6zA+3rVnyPdhy6/q4EerBLMfBEWpzFHyHDKMGanAgMBAAGjgeIwgd8w +HQYDVR0OBBYEFKRxtF0CWPwL7jRvA4NSIzploUgrMIGvBgNVHSMEgacwgaSAFKRx +tF0CWPwL7jRvA4NSIzploUgroYGApH4wfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgT +B0NvbG9tYm8xEDAOBgNVBAcTB0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEf +MB0GCSqGSIb3DQEJARYQdGVjaG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBS +YWRpdXOCCQD6HErXgvO11DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB +AQCDQV9wy8rfuFp4uByqYhnrQjzBN75VbNcgpdYocOxQPLnjWRM5qdJHELrt4FEl +rDMGd1BpP7QMAEYJUIcpDHPbs9HVCeEV6hdOrLgGxNDB0YVa2Fr5k2U8gsNIgKZo +fKxscx0w5OM71IQbuppAgIHK29DBVBVppO+zduIbVtSoBo/gcVIqVGXQXf8TFtoV +xyfGUTYdBDP4fT4p8uLASXmdaFyegQOhkjSuchVPGSJOZD6TvOjE6ZvBu9eC7sqh +oTPY56Ld0GscWJmAuj+8vmWGu0md8MnM2DE0SIYE3bo/sPp3yEIbCAnHmcveG8hn +GEL4ZNjZ+jnwSkzwBU5vh/QS", + "tenantId": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + false + 0 + = + true + offset + + + false + 1 + = + true + limit + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates/qwe12-23fdf-2s332-53fv3-sfs33 + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "serial": "qwe12-23fdf-2s332-53fv3-sfs33", + "pem": " +MIIEXjCCA0agAwIBAgIJAPocSteC87XUMA0GCSqGSIb3DQEBBQUAMHwxCzAJBgNV +BAYTAlNMMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMRIwEAYD +VQQKEwlXU08yIEluYy4xHzAdBgkqhkiG9w0BCQEWEHRlY2hvcHNAd3NvMi5jb20x +FDASBgNVBAMTC1dTTzIgUmFkaXVzMB4XDTEzMDYyNzAzMzA0NFoXDTIzMDYyNTAz +MzA0NFowfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgTB0NvbG9tYm8xEDAOBgNVBAcT +B0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEfMB0GCSqGSIb3DQEJARYQdGVj +aG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBSYWRpdXMwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDNmhw12cF0H2UGE/XtWVt238oGxn19+n/HkM2B +cDNQgnStqI+g/K2HBtjmvVPBh17Mt+dU2BIathn06amza+LI+hHgeLUSv30jutv4 +L5zD2laAU9A/I0Wtrxu5FlsevRPSiY7buLjTbjP7IMn9vdwb+9nBQCGxVpO6AK2A +gsFJ5udnp7L+jNsHmHFt36AYZouihgD+/RGVLBAhtPoU6XFB1JoGFM+4qxklJLPh +k86WollG4cFvHXSbO1P95n6Jb/V3hfM0PvwFZswRPVnW8ngqm889C/JEk5rK4FHy +xk9MgeFRW6zA+3rVnyPdhy6/q4EerBLMfBEWpzFHyHDKMGanAgMBAAGjgeIwgd8w +HQYDVR0OBBYEFKRxtF0CWPwL7jRvA4NSIzploUgrMIGvBgNVHSMEgacwgaSAFKRx +tF0CWPwL7jRvA4NSIzploUgroYGApH4wfDELMAkGA1UEBhMCU0wxEDAOBgNVBAgT +B0NvbG9tYm8xEDAOBgNVBAcTB0NvbG9tYm8xEjAQBgNVBAoTCVdTTzIgSW5jLjEf +MB0GCSqGSIb3DQEJARYQdGVjaG9wc0B3c28yLmNvbTEUMBIGA1UEAxMLV1NPMiBS +YWRpdXOCCQD6HErXgvO11DAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB +AQCDQV9wy8rfuFp4uByqYhnrQjzBN75VbNcgpdYocOxQPLnjWRM5qdJHELrt4FEl +rDMGd1BpP7QMAEYJUIcpDHPbs9HVCeEV6hdOrLgGxNDB0YVa2Fr5k2U8gsNIgKZo +fKxscx0w5OM71IQbuppAgIHK29DBVBVppO+zduIbVtSoBo/gcVIqVGXQXf8TFtoV +xyfGUTYdBDP4fT4p8uLASXmdaFyegQOhkjSuchVPGSJOZD6TvOjE6ZvBu9eC7sqh +oTPY56Ld0GscWJmAuj+8vmWGu0md8MnM2DE0SIYE3bo/sPp3yEIbCAnHmcveG8hn +GEL4ZNjZ+jnwSkzwBU5vh/QS", + "tenantId": 0 + } + = + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates/verify/android + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + invalid + + Assertion.response_data + false + 16 + + + + + + + + false + qwe12-23fdf-2s332-53fv3-sfs33 + = + true + serialNumber + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + DELETE + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/certificate-mgt/v1.0/admin/certificates + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "type": "android", + "configuration": [ + { + "name": "notifierType", + "value": "1", + "contentType": "text" + }, + { + "name": "notifierFrequency", + "value": "500000", + "contentType": "text" + }, + { + "name": "androidEula", + "value": "This End User License Agreement is Eula.", + "contentType": "text" + } + ] + } + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/v1.0/configuration + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "conditions": [ + { + "key": "deviceIdentifier", + "value": "d24f870f390352a4${DeviceID}", + "operator": "=", + "state": "AND" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/search-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID} + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/applications + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/effective-policy + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/device-type/android/features + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + false + admin + = + true + owner + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/operations + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/android/d24f870f390352a4${DeviceID}/compliance-data + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/user-devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + false + activityId + "activityId":"(.+?)" + $1$ + 1 + 1 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities/${activityId} + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/admin/devices + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + 401 + + Assertion.response_code + true + 8 + + + + + "Current logged in user is not authorized to perform this operation" + + Assertion.response_data + true + 16 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device-types + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/configuration + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "type": "android", + "configuration": [ + { + "name": "SampleConfiguration", + "contentType": "text", + "value": "This is a sample Configuration" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/configuration + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/configuration/license + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice1000${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a41000${DeviceID}", + "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 + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "id":1000${DeviceID}, + "name":"androiddevice1000${DeviceID}", + "type":"android", + "description":"this is an android device", + "deviceIdentifier":"d24f870f390352a41000${DeviceID}", + "enrolmentInfo":{ + "id":1000${DeviceID}, + "device":{ + + }, + "dateOfEnrolment":0, + "dateOfLastUpdate":0, + "ownership":"BYOD", + "status":"CREATED", + "owner":"admin" + }, + "features":[ + { + "id":10, + "code":"aaaa1111", + "name":"newfeature2", + "description":"this is the new feature 2", + "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 + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID} + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [ + { + "id": 10, + "platform": "android", + "category": "Business", + "name": "Graphical", + "locationUrl": "string", + "imageUrl": "string", + "version": "1.0.0", + "type": "string", + "appProperties": {}, + "applicationIdentifier": "string", + "memoryUsage": 0 + } +] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/applications + PUT + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/status + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"APPLICATION_LIST","type":"COMMAND","id":1,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:01:57.915","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "appIdentifier": [ + "ANGRYBIRD" + ] + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/blacklist-applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "operation": { + "lockCode": "0000" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/change-lock-code + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"CHANGE_LOCK_CODE","type":"PROFILE","id":2,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:14:19.718","isEnabled":true,"payLoad":"{\"lockCode\":\"0000\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/clear-password + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"CLEAR_PASSWORD","type":"COMMAND","id":3,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:18:40.233","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "serverAddress": "231.168.10.1", + "serverPort": "1701", + "sharedSecret": "YWRtaW4=", + "dnsServer": "8.8.8.8" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/configure-vpn + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + { + "operation": { + "ssid": "string", + "password": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/configure-wifi + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"WIFI","type":"PROFILE","id":4,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:24:20.315","isEnabled":true,"payLoad":"{\"ssid\":\"string\",\"password\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "enabled": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/control-camera + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"CAMERA","type":"COMMAND","id":5,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:28:02.864","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "encrypted": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/encrypt-storage + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"ENCRYPT_STORAGE","type":"COMMAND","id":6,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:31:15.288","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/enterprise-wipe + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"ENTERPRISE_WIPE","type":"COMMAND","id":7,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:42:12.406","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "https://www.youtube.com", + "name": "youtube" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/install-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"INSTALL_APPLICATION","type":"PROFILE","id":8,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:55:15.452","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/location + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_LOCATION","type":"COMMAND","id":9,"status":"COMPLETED","createdTimeStamp":"2016-08-03 12:59:05.927","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "message": "string", + "hardLockEnabled": false + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/lock-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"DEVICE_LOCK","type":"PROFILE","id":10,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:53:28.008","isEnabled":true,"payLoad":"{\"message\":\"string\",\"isHardLockEnabled\":false}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/mute + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":true,"code":"DEVICE_MUTE","type":"COMMAND","id":11,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:56:54.703","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/reboot + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"REBOOT","type":"COMMAND","id":12,"status":"COMPLETED","createdTimeStamp":"2016-08-03 13:59:03.554","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/ring + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_RING","type":"COMMAND","id":13,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:00:54.603","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "messageText": "string", + "messageTitle": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/send-notification + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"NOTIFICATION","type":"PROFILE","id":14,"status":"IN_PROGRESS","createdTimeStamp":"2016-08-03 14:02:55.003","isEnabled":true,"payLoad":"{\"messageText\":\"string\",\"messageTitle\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [{"code":"NOTIFICATION","type":"PROFILE","id":14,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:02:55.003","isEnabled":true,"payLoad":"{\"messageText\":\"string\",\"messageTitle\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "maxFailedAttempts": 0, + "minLength": 0, + "pinHistory": 0, + "minComplexChars": 0, + "maxPINAgeInDays": 0, + "requireAlphanumeric": false, + "allowSimple": false + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/set-password-policy + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"PASSCODE_POLICY","type":"PROFILE","id":15,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:07:01.2","isEnabled":true,"payLoad":"{\"maxFailedAttempts\":0,\"minLength\":0,\"pinHistory\":0,\"minComplexChars\":0,\"maxPINAgeInDays\":0,\"requireAlphanumeric\":false,\"allowSimple\":false}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "identity": "string", + "title": "string", + "type": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/set-webclip + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"WEBCLIP","type":"PROFILE","id":16,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:26:04.822","isEnabled":true,"payLoad":"{\"identity\":\"string\",\"title\":\"string\",\"type\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "string", + "name": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/uninstall-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UNINSTALL_APPLICATION","type":"PROFILE","id":17,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:28:26.049","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\",\"name\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/unlock-devices + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":true,"code":"DEVICE_UNLOCK","type":"COMMAND","id":18,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:35:07.994","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "appIdentifier": "string", + "type": "enterprise", + "url": "https://www.youtube.com", + "name": "youtube", + "schedule": "" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/update-application + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UPDATE_APPLICATION","type":"PROFILE","id":19,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:39:32.714","isEnabled":true,"payLoad":"{\"appIdentifier\":\"string\",\"type\":\"string\",\"url\":\"string\",\"schedule\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ], + "operation": { + "schedule": "", + "server": "string" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/upgrade-firmware + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"code":"UPGRADE_FIRMWARE","type":"PROFILE","id":20,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:43:25.406","isEnabled":true,"payLoad":"{\"schedule\":\"string\",\"server\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + { + "operation": { + "pin": "string" + }, + "deviceIDs": [ + "d24f870f390352a4${DeviceID}" + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/wipe + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/applications + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"APPLICATION_LIST","type":"COMMAND","id":22,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:55:18.118","isEnabled":false}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/activities + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + ["d24f870f390352a4${DeviceID}"] + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/admin/devices/info + POST + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + true + + + + false + [{"enabled":false,"code":"DEVICE_INFO","type":"COMMAND","id":23,"status":"COMPLETED","createdTimeStamp":"2016-08-03 15:30:16.779","isEnabled":false, "operationResponse" : '{ "id": 101234, "name": "androiddevice1234","type": "android", "description": "this is an android device","deviceIdentifier": "d24f870f390352a4${DeviceID}","enrolmentInfo": {"id": 101234,"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": "DEVICE_MODEL","value": "S6"},{"name" : "VENDOR","value" : "SAMSUNG"}],"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 + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + true + + + + false + [{"code":"WIPE_DATA","type":"PROFILE","id":21,"status":"COMPLETED","createdTimeStamp":"2016-08-03 14:45:49.198","isEnabled":true,"payLoad":"{\"pin\":\"string\"}"}] + = + + + + ${host} + ${https_port} + + + https + UTF-8 + /api/device-mgt/android/v1.0/devices/d24f870f390352a4${DeviceID}/pending-operations + PUT + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID} + DELETE + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + Android device that carries id \u0027d24f870f390352a41000${DeviceID}\u0027 is successfully dis-enrolled + + Assertion.response_data + false + 16 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/status + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + Status of android device that carries the id \u0027d24f870f390352a41000${DeviceID}\u0027 is REMOVED + + Assertion.response_data + false + 16 + + + + + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/android/v1.0/devices/d24f870f390352sssa4${DeviceID}/status + GET + true + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + Accept + application/json + + + + + + + No Android device is found upon the id \u0027d24f870f390352sssa4${DeviceID}\u0027 + + Assertion.response_data + true + 16 + + + + + 404 + + Assertion.response_code + false + 8 + + + + + + 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 + false + false + false + false + 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 + + + + + + + + diff --git a/integration-test/iot-community/src/test/resources/keystores/products/client-truststore.jks b/integration-test/iot-community/src/test/resources/keystores/products/client-truststore.jks new file mode 100644 index 0000000..71adf40 Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/products/client-truststore.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/products/client-truststores.jks b/integration-test/iot-community/src/test/resources/keystores/products/client-truststores.jks new file mode 100644 index 0000000..c477431 Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/products/client-truststores.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/products/wso2carbon.jks b/integration-test/iot-community/src/test/resources/keystores/products/wso2carbon.jks new file mode 100644 index 0000000..357b9db Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/products/wso2carbon.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/products/wso2certs.jks b/integration-test/iot-community/src/test/resources/keystores/products/wso2certs.jks new file mode 100644 index 0000000..c1e9ace Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/products/wso2certs.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/products/wso2mdm.jks b/integration-test/iot-community/src/test/resources/keystores/products/wso2mdm.jks new file mode 100644 index 0000000..66b68ea Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/products/wso2mdm.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststore.jks b/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststore.jks new file mode 100644 index 0000000..71adf40 Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststore.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststores.jks b/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststores.jks new file mode 100644 index 0000000..c477431 Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/stratos/client-truststores.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/stratos/wso2carbon.jks b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2carbon.jks new file mode 100644 index 0000000..357b9db Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2carbon.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/stratos/wso2certs.jks b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2certs.jks new file mode 100644 index 0000000..c1e9ace Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2certs.jks differ diff --git a/integration-test/iot-community/src/test/resources/keystores/stratos/wso2emm.jks b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2emm.jks new file mode 100644 index 0000000..ae5670b Binary files /dev/null and b/integration-test/iot-community/src/test/resources/keystores/stratos/wso2emm.jks differ diff --git a/integration-test/iot-community/src/test/resources/log4j.properties b/integration-test/iot-community/src/test/resources/log4j.properties new file mode 100644 index 0000000..3044bf0 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/log4j.properties @@ -0,0 +1,37 @@ +# +# Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved. +# +# Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. +# +# Licensed under the Entgra Commercial License, Version 1.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://entgra.io/licenses/entgra-commercial/1.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. +# + +log4j.rootLogger=INFO, console, Default + +log4j.logger.org.wso2=INFO +log4j.logger.org.apache.axis2.deployment.ModuleDeployer=ERROR +#Automation file apender +log4j.appender.Default=org.apache.log4j.RollingFileAppender +log4j.appender.Default.File=logs/automation.log +log4j.appender.Default.Append=true +log4j.appender.Default.MaxFileSize=10MB +log4j.appender.Default.MaxBackupIndex=10 +log4j.appender.Default.layout=org.apache.log4j.PatternLayout +log4j.appender.Default.layout.ConversionPattern=%d{ISO8601} %-5p [%c] - %m%n + + +#Automation console apender +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-5p [%c] - %m%n diff --git a/integration-test/iot-community/src/test/resources/testng-server-mgt.xml b/integration-test/iot-community/src/test/resources/testng-server-mgt.xml new file mode 100644 index 0000000..559bcaa --- /dev/null +++ b/integration-test/iot-community/src/test/resources/testng-server-mgt.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/integration-test/iot-community/src/test/resources/testng.xml b/integration-test/iot-community/src/test/resources/testng.xml new file mode 100644 index 0000000..569dec6 --- /dev/null +++ b/integration-test/iot-community/src/test/resources/testng.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/integration-test/pom.xml b/integration-test/pom.xml new file mode 100644 index 0000000..7be384a --- /dev/null +++ b/integration-test/pom.xml @@ -0,0 +1,39 @@ + + + + + + + io.entgra.product.community + product-parent + 5.1.3-SNAPSHOT + ../pom.xml + + + 4.0.0 + integration-test + pom + Entgra IoT - Integration Tests + + + iot-community + + + diff --git a/pom.xml b/pom.xml index 522e8e0..4edd93d 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,7 @@ iot-core p2-profile distribution + integration-test @@ -101,6 +102,255 @@ entgra-iot-core ${project.version} + + org.wso2.carbon.automation + org.wso2.carbon.automation.engine + ${platform.integration.utils.version} + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + test + + + org.wso2.carbon.automation + org.wso2.carbon.automation.test.utils + ${test.framework.version} + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + test + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.utils + ${test.framework.version} + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + test + + + org.wso2.carbon.automation + org.wso2.carbon.automation.extensions + ${platform.integration.utils.version} + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + org.apache.ftpserver + ftpserver-core + + + org.apache.activemq + activemq-all + + + org.apache.tomcat.embed + tomcat-embed-core + + + org.apache.tomcat.embed + tomcat-embed-logging-juli + + + org.springframework.ws.wso2 + spring.framework + + + org.apache.cxf + cxf-rt-frontend-jaxrs + + + org.seleniumhq.selenium + selenium-java + + + com.opera + operadriver + + + com.saucelabs.selenium + sauce-ondemand-driver + + + com.saucelabs.selenium + selenium-client-factory + + + org.apache.axis2.wso2 + axis2 + + + org.apache.ws.commons.axiom.wso2 + axiom + + + net.lingala.zip4j + zip4j + + + test + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.extensions + ${automation.utils.version} + test + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + org.apache.ftpserver + ftpserver-core + + + org.apache.activemq + activemq-all + + + org.apache.tomcat.embed + tomcat-embed-core + + + org.apache.tomcat.embed + tomcat-embed-logging-juli + + + org.springframework.ws.wso2 + spring.framework + + + org.apache.cxf + cxf-rt-frontend-jaxrs + + + org.seleniumhq.selenium + selenium-java + + + com.opera + operadriver + + + org.apache.jmeter + ApacheJMeter_core + + + com.saucelabs.selenium + sauce-ondemand-driver + + + com.saucelabs.selenium + selenium-client-factory + + + org.apache.axis2.wso2 + axis2 + + + org.apache.ws.commons.axiom.wso2 + axiom + + + net.lingala.zip4j + zip4j + + + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.admin.client + ${automation.utils.version} + test + + + org.slf4j + slf4j-api + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + org.wso2.carbon.commons + org.wso2.carbon.user.mgt.stub + + + org.wso2.carbon.commons + org.wso2.carbon.ndatasource.stub + + + org.wso2.carbon.commons + org.wso2.carbon.authenticator.stub + + + org.wso2.carbon + org.wso2.carbon.utils + + + + + com.google.code.gson + gson + ${google.gson.version} + @@ -123,6 +373,11 @@ 6.0.16-SNAPSHOT + + 2.8.5 + 4.4.3 + 4.4.2 + 4.4.2