From 5f804903329854f10f042fb4504a2742274ec20a Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sat, 17 Jun 2017 18:54:59 +0530 Subject: [PATCH] added device type test case --- .../iot/integration/common/Constants.java | 6 +- .../DeviceTypeManagementJMeterTestCase.java | 126 ++ .../samples/VirtualFireAlarmTestCase.java | 5 +- .../DeviceTypeManagementAPI.jmx | 1744 +++++++++++++++++ .../NewAndroidDeviceManagementAPI.jmx | 137 +- .../src/test/resources/testng.xml | 1 + pom.xml | 2 +- 7 files changed, 1880 insertions(+), 141 deletions(-) create mode 100644 modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java create mode 100644 modules/integration/tests-integration/src/test/resources/jmeter-scripts/DeviceTypeManagementAPI.jmx diff --git a/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/Constants.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/Constants.java index 824e2c7d..6fe29ad9 100644 --- a/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/Constants.java +++ b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/Constants.java @@ -91,7 +91,9 @@ public final class Constants { + "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:firealarm:enroll"; + + "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; @@ -126,7 +128,7 @@ public final class Constants { + " 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"; + + "perm:users:search perm:users:send-invitation perm:users:update perm:users:user-details perm:device:publish-event perm:view-configuration"; private APIApplicationRegistration() { throw new AssertionError(); diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java new file mode 100644 index 00000000..33160ee6 --- /dev/null +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.iot.integration.jmeter; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; +import junit.framework.Assert; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; +import org.wso2.carbon.automation.engine.context.TestUserMode; +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 org.wso2.carbon.automation.test.utils.http.client.HttpResponse; +import org.wso2.iot.integration.common.Constants; +import org.wso2.iot.integration.common.MqttSubscriberClient; +import org.wso2.iot.integration.common.PayloadGenerator; +import org.wso2.iot.integration.common.RestClient; +import org.wso2.iot.integration.common.TestBase; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; + +/** + * This test case is used to run the jmeter test cases related with DeviceType Management APIs. + */ +public class DeviceTypeManagementJMeterTestCase extends TestBase { + private static Log log = LogFactory.getLog(DeviceTypeManagementJMeterTestCase.class); + private String broker = "tcp://localhost:1886"; + private RestClient restClient; + + @BeforeClass(alwaysRun = true) + public void initTest() throws Exception { + super.init(TestUserMode.SUPER_TENANT_ADMIN); + restClient = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString); + + } + @Test(description = "This test case tests the Device Type/Device Management/Device Agent APIs") + public void DeviceTypeManagementTest() throws AutomationFrameworkException { + URL url = Thread.currentThread().getContextClassLoader() + .getResource("jmeter-scripts" + File.separator + "DeviceTypeManagementAPI.jmx"); + JMeterTest script = new JMeterTest(new File(url.getPath())); + JMeterTestManager manager = new JMeterTestManager(); + log.info("Running Device Type/Device Management/Device Agent management api test cases using jmeter scripts"); + manager.runTest(script); + log.info("Completed DeviceType API service test using jmeter scripts"); + } + + @Test(description = "Test whether the policy publishing from the server to device works", dependsOnMethods = + {"DeviceTypeManagementTest"} ) + public void testMqttFlow() throws Exception { + String deviceId = "123422578912"; + String deviceType = "firealarmmqtt"; + String payload = "{\"deviceIdentifiers\":[123422578912],\"operation\":{\"code\":\"ring\",\"type\":\"CONFIG\"," + + "\"payLoad\":\"volume:30%\"}}"; + String topic = automationContext.getContextTenant().getDomain() + "/"+deviceType+"/" + deviceId + "/operation/#"; + String clientId = deviceId + ":firealarmmqtt"; + MqttSubscriberClient mqttDeviceSubscriberClient = new MqttSubscriberClient(broker, clientId, topic, accessToken); + restClient.post("/api/device-mgt/v1.0/devices/" + deviceType + "/operations", payload); + + // Allow some time for message delivery + Thread.sleep(10000); + ArrayList mqttMessages = mqttDeviceSubscriberClient.getMqttMessages(); + Assert.assertEquals("listener did not recieve mqtt messages ", 1, mqttMessages.size()); + + String topicPub = automationContext.getContextTenant().getDomain() + "/"+deviceType+"/"+deviceId+"/events"; + int qos = 2; + String clientIdPub = deviceId + ":firealarmmqttpub"; + MemoryPersistence persistence = new MemoryPersistence(); + MqttClient sampleClient = new MqttClient(broker, clientIdPub, persistence); + MqttConnectOptions connOpts = new MqttConnectOptions(); + connOpts.setUserName(accessToken); + connOpts.setPassword("".toCharArray()); + connOpts.setKeepAliveInterval(120); + connOpts.setCleanSession(false); + log.info("Connecting to broker: " + broker); + sampleClient.connect(connOpts); + log.info("Connected"); + payload = "{\"temperature\":10,\"status\":\"workingh\",\"humidity\":20}"; + String payload2 = "{\"temperature\":100,\"status\":\"workingh\",\"humidity\":20}"; + MqttMessage message = new MqttMessage(payload.getBytes()); + message.setQos(qos); + MqttMessage message2 = new MqttMessage(payload2.getBytes()); + message.setQos(qos); + sampleClient.publish(topicPub, message2); + sampleClient.publish(topicPub, message2); + log.info("Message is published to Mqtt Client"); + sampleClient.disconnect(); + log.info("Mqtt Client is Disconnected"); + // Allow some time for message delivery + Thread.sleep(20000); + HttpResponse response = restClient.get("/api/device-mgt/v1.0/events/last-known/"+deviceType+"/"+deviceId); + Assert.assertEquals("No published event found (mqtt)", HttpStatus.SC_OK, + response.getResponseCode()); + Assert.assertTrue("Event count does not match published event count, " + response.getData() , + response.getData().contains("\"count\":2")); + + } +} diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/samples/VirtualFireAlarmTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/samples/VirtualFireAlarmTestCase.java index e0852e58..59b2f904 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/samples/VirtualFireAlarmTestCase.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/samples/VirtualFireAlarmTestCase.java @@ -172,7 +172,7 @@ public class VirtualFireAlarmTestCase extends TestBase { {"testEnrollment"} ) public void testPolicyPublishing() throws Exception { String deviceId2 = userMode == TestUserMode.TENANT_ADMIN ? tenantDeviceId2 : VirtualFireAlarmTestCase.deviceId2; - String topic = automationContext.getContextTenant().getDomain() + "/" + DEVICE_TYPE + "/" + deviceId2 + "/#"; + String topic = automationContext.getContextTenant().getDomain() + "/" + DEVICE_TYPE + "/" + deviceId2 + "/operation/#"; String clientId = deviceId2 + ":" + DEVICE_TYPE; HttpResponse response = restClient.post("/api/device-mgt/v1.0/policies", PayloadGenerator .getJsonPayload(Constants.VirtualFireAlarmConstants.PAYLOAD_FILE, @@ -194,8 +194,7 @@ public class VirtualFireAlarmTestCase extends TestBase { // Allow some time for message delivery Thread.sleep(20000); ArrayList mqttMessages = mqttSubscriberClient.getMqttMessages(); - Assert.assertEquals("Policy published message is not received by the mqtt listener. ", 1, mqttMessages.size()); - + Assert.assertEquals("Policy published message is not received by the mqtt listener. ", 2, mqttMessages.size()); } } diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/DeviceTypeManagementAPI.jmx b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/DeviceTypeManagementAPI.jmx new file mode 100644 index 00000000..e98ca76c --- /dev/null +++ b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/DeviceTypeManagementAPI.jmx @@ -0,0 +1,1744 @@ + + + + + + false + false + + + + + + + + 9999 + 100 + + false + + randAppNum + + + + + + host + localhost + = + + + https_port + 8243 + = + + + http_port + 8280 + = + + + token_ep_host + localhost + = + + + token_ep_port + 8280 + = + + + group_name + Group 2 + = + + + new_group_name + New Group + = + + + role_name + group_sharing + = + + + DeviceID + 500 + = + + + DeviceIdentifier + policy_management_device + = + + + tenant_user_name + admin + Name of Tenant + = + + + domain_name + wso2.com + Name of Domain + = + + + password + admin + Password + = + + + email + abc@wso2.com + Email + = + + + firstName + firstName + First Name + = + + + lastName + lastName + Last Name + = + + + usagePlan + Demo + Usage Plan + = + + + createdDate + 2013-02-22T08:22:35+05:30 + Created Date + = + + + management_https_port + 9443 + Port for carbon management console + = + + + + + + continue + + false + 1 + + 1 + + 1342532280000 + 1342532280000 + false + + + + + + + false + rfc2109 + + + + + + + https://${host}:${management_https_port}/services/AuthenticationAdmin.AuthenticationAdminHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <aut:login> + <!--Optional:--> + <aut:username>admin</aut:username> + <!--Optional:--> + <aut:password>admin</aut:password> + <!--Optional:--> + <aut:remoteAddress>127.0.0.1</aut:remoteAddress> + </aut:login> + </soapenv:Body> +</soapenv:Envelope> + + urn:login + true + false + + + + + + + https://${host}:${management_https_port}/services/TenantMgtAdminService.TenantMgtAdminServiceHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.tenant.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <ser:getTenant> + <!--Optional:--> + <ser:tenantDomain>${domain_name}</ser:tenantDomain> + </ser:getTenant> + </soapenv:Body> +</soapenv:Envelope> + + urn:getTenant + true + false + + + + undefined + tenant_exists + //*[local-name()='active']/text() + false + false + true + tenant_exists + + + + false + true + true + false + + + + + ${tenant_exists}==false + false + + + + + + + https://${host}:${management_https_port}/services/TenantMgtAdminService.TenantMgtAdminServiceHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.tenant.carbon.wso2.org" xmlns:xsd="http://beans.common.stratos.carbon.wso2.org/xsd"> + <soapenv:Header/> + <soapenv:Body> + <ser:addTenant> + <!--Optional:--> + <ser:tenantInfoBean> + <!--Optional:--> + <xsd:active>1</xsd:active> + <!--Optional:--> + <xsd:admin>${tenant_user_name}</xsd:admin> + <!--Optional:--> + <xsd:adminPassword>${password}</xsd:adminPassword> + <!--Optional:--> + <xsd:createdDate>${createdDate}</xsd:createdDate> + <!--Optional:--> + <xsd:email>${email}</xsd:email> + <!--Optional:--> + <xsd:firstname>${firstName}</xsd:firstname> + <!--Optional:--> + <xsd:lastname>${lastName}</xsd:lastname> + <!--Optional:--> + <xsd:tenantDomain>${domain_name}</xsd:tenantDomain> + <!--Optional:--> + <xsd:tenantId>0</xsd:tenantId> + <!--Optional:--> + <xsd:usagePlan>${usagePlan}</xsd:usagePlan> + </ser:tenantInfoBean> + </ser:addTenant> + </soapenv:Body> +</soapenv:Envelope> + + urn:addTenant + true + false + + + + + + + + https://${host}:${management_https_port}/services/AuthenticationAdmin.AuthenticationAdminHttpsSoap11Endpoint/ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org"> + <soapenv:Header/> + <soapenv:Body> + <aut:logout/> + </soapenv:Body> +</soapenv:Envelope> + + urn:logout + true + false + + + + + 202 + + Assertion.response_code + false + 1 + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + true + + + /home/ace/Desktop/results_multi_user_multi_tenancy.jtl + + + + + continue + + false + 1 + + 1 + 1 + 1465464058000 + 1465464058000 + false + + + + + + true + + + + false + { + "applicationName":"app_${randAppNum}", + "isAllowedToAllDomains":false, + "tags":["device_agent", "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:devices:change-status 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:devices:operations perm:device:publish-event + = + 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 + { + "name":"firealarm", + "deviceTypeMetaDefinition":{ + "properties":[ + "buildingId", + "floorId" + ], + "features":[ + { + "code":"bulb", + "name":"control bulb", + "description":"on the bulb" + }, + { + "code":"ring", + "name":"ring", + "description":"this can be used test" + } + ], + "description":"this is a new remote control firealarm" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/admin/device-types + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "eventAttributes":{ + "attributes":[ + { + "name":"temperature", + "type":"DOUBLE" + }, + { + "name":"status", + "type":"STRING" + }, + { + "name":"humidity", + "type":"FLOAT" + } + ] + }, + "transport":"HTTP" +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/events/firealarm + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "name":"myhomealarmx1", + "type":"firealarm", + "description":"this alarm is placed in my house", + "deviceIdentifier":"123422", + "enrolmentInfo":{ + "ownership":"BYOD", + "status":"ACTIVE", + "owner":"admin" + }, + "properties":[ + { + "name":"buildingId", + "value":"wso2" + }, + { + "name":"floorId", + "value":"2" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/enroll + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "name":"myhomealarmx1", + "type":"firealarm", + "description":"this alarm is placed in my house", + "deviceIdentifier":"123422578912", + "enrolmentInfo":{ + "ownership":"BYOD", + "status":"ACTIVE", + "owner":"admin" + }, + "properties":[ + { + "name":"buildingId", + "value":"wso2" + }, + { + "name":"floorId", + "value":"2" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/enroll + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "deviceIdentifiers":[ + 123422 + ], + "operation":{ + "code":"ring", + "type":"CONFIG", + "payLoad":"volume:30%" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/firealarm/operations + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 201 + + Assertion.response_code + false + 2 + + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/pending/operations/firealarm/123422 + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "temperature":10, + "status":"workingh", + "humidity":20 +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/events/publish/firealarm/123422 + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "temperature":20, + "status":"workingh", + "humidity":20 +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/events/publish/firealarm/123422 + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + 10000 + + + + true + + + + false + + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/events/last-known/firealarm/123422 + GET + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + {"temperature":20.0,"humidity":20.0,"_version":"1.0.0","meta_deviceId":"123422","status":"workingh"} + + Assertion.response_data + false + 2 + + + + + true + + + + false + { + "name":"firealarmhttp", + "deviceTypeMetaDefinition":{ + "properties":[ + "buildingId", + "floorId" + ], + "features":[ + { + "code":"bulb", + "name":"control bulb", + "description":"on the bulb" + }, + { + "code":"ring", + "name":"ring", + "description":"this can be used test" + } + ], + "description":"this is a new remote control firealarm", + "pushNotificationConfig":{ + "type":"HTTP", + "properties":{ + "url":"https://localhost:8243/echo", + "authorization":"test" + } + }, + "initialOperationConfig":{ + "operations":[ + "bulb" + ] + } + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/admin/device-types + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "name":"myhomealarmx1", + "type":"firealarmhttp", + "description":"this alarm is placed in my house", + "deviceIdentifier":"123422578912", + "enrolmentInfo":{ + "ownership":"BYOD", + "status":"ACTIVE", + "owner":"admin" + }, + "properties":[ + { + "name":"buildingId", + "value":"wso2" + }, + { + "name":"floorId", + "value":"2" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/enroll + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "deviceIdentifiers":[ + 123422578912 + ], + "operation":{ + "code":"ring", + "type":"CONFIG", + "payLoad":"volume:30%" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/firealarmhttp/operations + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 201 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "name":"firealarmmqtt", + "deviceTypeMetaDefinition":{ + "properties":[ + "buildingId", + "floorId" + ], + "features":[ + { + "code":"bulb", + "name":"control bulb", + "description":"on the bulb" + }, + { + "code":"ring", + "name":"ring", + "description":"this can be used test" + } + ], + "description":"this is a new remote control firealarm", + "pushNotificationConfig":{ + "type":"MQTT" + } + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/admin/device-types + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "name":"myhomealarmx1", + "type":"firealarmmqtt", + "description":"this alarm is placed in my house", + "deviceIdentifier":"123422578912", + "enrolmentInfo":{ + "ownership":"BYOD", + "status":"ACTIVE", + "owner":"admin" + }, + "properties":[ + { + "name":"buildingId", + "value":"wso2" + }, + { + "name":"floorId", + "value":"2" + } + ] +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/device/agent/enroll + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "deviceIdentifiers":[ + 123422578912 + ], + "operation":{ + "code":"ring", + "type":"CONFIG", + "payLoad":"volume:30%" + } +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/devices/firealarmmqtt/operations + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 201 + + Assertion.response_code + false + 2 + + + + + true + + + + false + { + "eventAttributes":{ + "attributes":[ + { + "name":"temperature", + "type":"DOUBLE" + }, + { + "name":"status", + "type":"STRING" + }, + { + "name":"humidity", + "type":"FLOAT" + } + ] + }, + "transport":"MQTT" +} + = + + + + ${host} + ${https_port} + + + https + + /api/device-mgt/v1.0/events/firealarmmqtt + POST + false + false + true + false + HttpClient4 + false + + + + + + + Authorization + Bearer ${access_token} + + + Content-Type + application/json + + + + + + + 200 + + Assertion.response_code + false + 2 + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + Results + true + false + true + false + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + false + false + false + false + false + 0 + true + true + + + + + + + + diff --git a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/NewAndroidDeviceManagementAPI.jmx b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/NewAndroidDeviceManagementAPI.jmx index 1bc60a8e..c48f0eab 100644 --- a/modules/integration/tests-integration/src/test/resources/jmeter-scripts/NewAndroidDeviceManagementAPI.jmx +++ b/modules/integration/tests-integration/src/test/resources/jmeter-scripts/NewAndroidDeviceManagementAPI.jmx @@ -1,5 +1,5 @@ - + @@ -304,6 +304,7 @@ false 0 true + true /home/ace/Desktop/results_multi_user_multi_tenancy.jtl @@ -2127,73 +2128,6 @@ GEL4ZNjZ+jnwSkzwBU5vh/QS", - - true - - - - false - [ - { - "code": "aaa", - "properties": {}, - "type": "CONFIG", - "id": 0, - "status": "IN_PROGRESS", - "control": "REPEAT", - "receivedTimeStamp": "string", - "createdTimeStamp": "string", - "payLoad": {}, - "operationResponse": "string", - "activityId": "string", - "responses": [ - { - "response": "string", - "receivedTimeStamp": "string" - } - ], - "enabled": false - } -] - = - - - - ${host} - ${https_port} - - - https - UTF-8 - /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/pending-operations - PUT - true - false - true - false - HttpClient4 - false - - - - - - - Authorization - Bearer ${access_token} - - - Content-Type - application/json - - - Accept - application/json - - - - - @@ -6400,73 +6334,6 @@ GEL4ZNjZ+jnwSkzwBU5vh/QS", - - true - - - - false - [ - { - "code": "aaa", - "properties": {}, - "type": "CONFIG", - "id": 0, - "status": "IN_PROGRESS", - "control": "REPEAT", - "receivedTimeStamp": "string", - "createdTimeStamp": "string", - "payLoad": {}, - "operationResponse": "string", - "activityId": "string", - "responses": [ - { - "response": "string", - "receivedTimeStamp": "string" - } - ], - "enabled": false - } -] - = - - - - ${host} - ${https_port} - - - https - UTF-8 - /api/device-mgt/android/v1.0/devices/d24f870f390352a41000${DeviceID}/pending-operations - PUT - true - false - true - false - HttpClient4 - false - - - - - - - Authorization - Bearer ${access_token} - - - Content-Type - application/json - - - Accept - application/json - - - - - diff --git a/modules/integration/tests-integration/src/test/resources/testng.xml b/modules/integration/tests-integration/src/test/resources/testng.xml index 2c08cfc8..bda7be11 100644 --- a/modules/integration/tests-integration/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/src/test/resources/testng.xml @@ -34,6 +34,7 @@ + diff --git a/pom.xml b/pom.xml index 6e9a6c1b..d9db96ff 100644 --- a/pom.xml +++ b/pom.xml @@ -1511,7 +1511,7 @@ 4.7.0 - 2.0.76-SNAPSHOT + 3.0.0-SNAPSHOT [2.0.0, 3.0.0)