diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java index 920bd879..6badb24d 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java @@ -24,7 +24,7 @@ import java.io.File; */ public final class Constants { - public static final String DEVICE_ID = "1234"; + public static final String DEVICE_ID = "24f870f390352a41234"; 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"; @@ -33,6 +33,7 @@ public final class Constants { 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"; @@ -61,6 +62,36 @@ public final class Constants { + " \"applicationName\":\"app_12345\",\n" + " \"isAllowedToAllDomains\":false,\n" + " \"tags\":[\"android\", \"device_management\"],\n" + " \"isMappingAnExistingOAuthApp\":false\n" + "}").toString(); + public static final String PERMISSION_LIST = "default 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:devices:view 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:dashboard:by-groups " + + "perm:dashboard:count-overview perm:dashboard:details perm:dashboard:device-counts " + + "perm:dashboard:feature-non-compliant perm:dashboard:filtered-count perm:dashboard:non-compliant " + + "perm:dashboard:non-compliant-count perm:dashboard:vulnerabilities perm:device-types:features " + + "perm:device-types:types 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: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(); @@ -202,6 +233,7 @@ public final class Constants { public static final String VIEW_DEVICE_TYPES_ENDPOINT = "/mdm-admin/devices/types"; public static final String VIEW_DEVICE_RESPONSE_PAYLOAD_FILE_NAME = "mobile-device-mgt-view-device-types-response-payloads.json"; + public static final String NO_DEVICE = "{\"devices\":[],\"count\":0}"; private MobileDeviceManagement() { throw new AssertionError(); diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java index dc93dedf..b2b7a93f 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java @@ -27,10 +27,17 @@ import org.wso2.carbon.automation.test.utils.http.client.HttpResponse; */ public class OAuthUtil { - public static String getOAuthToken(String backendHTTPURL, String backendHTTPSURL) - throws Exception { - RestClient client = new RestClient(backendHTTPURL, Constants.APPLICATION_JSON); - client.setHttpHeader("Authorization", "Basic YWRtaW46YWRtaW4="); + 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()); @@ -44,6 +51,6 @@ public class OAuthUtil { Constants.APIApplicationRegistration.OAUTH_TOKEN_PAYLOAD); System.out.println(oAuthData.getData()); jsonObj = new JSONObject(oAuthData.getData()); - return jsonObj.get(Constants.OAUTH_ACCESS_TOKEN).toString(); + return jsonObj; } } diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java index 620d59b6..5767f486 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java @@ -17,11 +17,13 @@ */ 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.*; import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.nio.charset.Charset; @@ -73,7 +75,7 @@ public class RestClient { this.requestHeaders.remove(headerName); } - public HttpResponse post(String endpoint, String body) throws Exception { + public HttpResponse post(String endpoint, String body) throws MalformedURLException, AutomationFrameworkException { return HttpRequestUtil.doPost(new URL(backEndUrl + endpoint), body, requestHeaders); } diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java index 33c9d2bb..a4f2c05e 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java @@ -19,7 +19,6 @@ package org.wso2.iot.integration.common; import org.wso2.carbon.automation.engine.context.AutomationContext; import org.wso2.carbon.automation.engine.context.TestUserMode; -import org.wso2.carbon.automation.engine.frameworkutils.CodeCoverageUtils; import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil; import org.wso2.carbon.integration.common.utils.LoginLogoutClient; @@ -29,7 +28,6 @@ import javax.xml.xpath.XPathExpressionException; * This is the base test class that provides common details necessary for other test cases. */ public class TestBase { - static String accessToken; protected AutomationContext automationContext; protected String backendHTTPSURL; protected String backendHTTPURL; diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/device/enrollment/AndroidEnrollment.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/device/enrollment/AndroidEnrollment.java index cf806cea..4687ad44 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/device/enrollment/AndroidEnrollment.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/device/enrollment/AndroidEnrollment.java @@ -17,7 +17,9 @@ */ package org.wso2.iot.integration.device.enrollment; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import junit.framework.Assert; import org.apache.commons.httpclient.HttpStatus; import org.testng.annotations.BeforeClass; @@ -32,8 +34,10 @@ import org.wso2.iot.integration.common.*; */ public class AndroidEnrollment extends TestBase { private RestClient client; + private String deviceId; - @BeforeClass(alwaysRun = true, groups = { Constants.AndroidEnrollment.ENROLLMENT_GROUP}) + @BeforeClass(alwaysRun = true, groups = { Constants.AndroidEnrollment.ENROLLMENT_GROUP}, dependsOnGroups = + Constants.MobileDeviceManagement.MOBILE_DEVICE_MANAGEMENT_GROUP) public void initTest() throws Exception { super.init(TestUserMode.SUPER_TENANT_ADMIN); String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPURL, backendHTTPSURL); @@ -42,17 +46,23 @@ public class AndroidEnrollment extends TestBase { @Test(description = "Test an Android device enrollment.") public void testEnrollment() throws Exception { - String enrollmentData = PayloadGenerator.getJsonPayloadToString(Constants.AndroidEnrollment - .ENROLLMENT_PAYLOAD_FILE_NAME); + String enrollmentData = PayloadGenerator.getJsonPayload(Constants.AndroidEnrollment + .ENROLLMENT_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST).toString(); HttpResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData); + JsonParser jsonParser = new JsonParser(); + JsonElement element = jsonParser.parse(response.getData()); + JsonObject jsonObject = element.getAsJsonObject(); + JsonElement msg = jsonObject.get("responseMessage"); + deviceId = msg.getAsString().split("\'")[1].split("\'")[0]; Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode()); - AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayloadToString( - Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME), response.getData(), true); + AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload( + Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, + Constants.HTTP_METHOD_POST).toString(), response.getData(), true); } @Test(description = "Test an Android device is enrolled.", dependsOnMethods = {"testEnrollment"}) public void testIsEnrolled() throws Exception { - HttpResponse response = client.get(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + Constants.DEVICE_ID); + HttpResponse response = client.get(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + "/" + deviceId + "/status"); Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode()); AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, @@ -64,21 +74,19 @@ public class AndroidEnrollment extends TestBase { JsonObject enrollmentData = PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_PUT); - enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID); - HttpResponse response = client.put(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + Constants.DEVICE_ID, + HttpResponse response = client.put(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + "/" + deviceId, enrollmentData.toString()); AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_PUT).toString(), response.getData(), true); } - @Test(description = "Test disenrollment.", dependsOnMethods = {"testModifyEnrollment"}) + @Test(description = "Test disEnrollment.", dependsOnMethods = {"testModifyEnrollment"}) public void testDisEnrollDevice() throws Exception { - HttpResponse response = client.delete(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + Constants.DEVICE_ID); + HttpResponse response = client.delete(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + "/" + deviceId); Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode()); AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload( - Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, - Constants.HTTP_METHOD_DELETE).toString(), - response.getData(), true); + Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, + Constants.HTTP_METHOD_DELETE).toString(), response.getData(), true); } } diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java index caf575f6..9f9db680 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java @@ -41,8 +41,7 @@ public class MobileDeviceManagement extends TestBase { @Test(description = "Add an Android device.") public void addEnrollment() throws Exception { JsonObject enrollmentData = PayloadGenerator.getJsonPayload( - Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, - Constants.HTTP_METHOD_POST); + Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST); enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID); IOTResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString()); Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); @@ -55,7 +54,7 @@ public class MobileDeviceManagement extends TestBase { public void testCountDevices() throws Exception { IOTResponse response = client.get(Constants.MobileDeviceManagement.GET_DEVICE_COUNT_ENDPOINT); Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); - Assert.assertTrue(response.getBody().toString().equals(Constants.MobileDeviceManagement.NO_OF_DEVICES)); + Assert.assertTrue(response.getBody().equals(Constants.MobileDeviceManagement.NO_OF_DEVICES)); } diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagementWithNoDevices.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagementWithNoDevices.java index d29a3a08..b2e76bea 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagementWithNoDevices.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagementWithNoDevices.java @@ -20,20 +20,40 @@ package org.wso2.iot.integration.mobileDevice; import junit.framework.Assert; import org.apache.commons.httpclient.HttpStatus; +import org.junit.experimental.theories.Theories; import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; import org.wso2.carbon.automation.engine.context.TestUserMode; import org.wso2.iot.integration.common.*; +import java.util.concurrent.TimeUnit; + /** * This class contains integration tests for API Mobile Device Management with No Devices Enrolled. */ public class MobileDeviceManagementWithNoDevices extends TestBase { private IOTHttpClient client; + /** + * @BeforeSuite annotation is added to run this verification before the test suite starts. + * As in IoT server, apis are published after the server startup. Due to that the generated token doesn't get + * required scope. + * This method delays test suit startup until the tokens get required scopes. + * @throws Exception + */ + @BeforeSuite + public void verifyApiPublishing() throws Exception { + super.init(TestUserMode.SUPER_TENANT_ADMIN); + + while (!checkScopes(Constants.APIApplicationRegistration.PERMISSION_LIST)) { + TimeUnit.SECONDS.sleep(5); + } + } + @BeforeClass(alwaysRun = true, groups = { Constants.MobileDeviceManagement.MOBILE_DEVICE_MANAGEMENT_GROUP}) public void initTest() throws Exception { - super.init(TestUserMode.SUPER_TENANT_ADMIN); + String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPSURL, backendHTTPSURL); this.client = new IOTHttpClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString); } @@ -42,14 +62,12 @@ public class MobileDeviceManagementWithNoDevices extends TestBase { public void testCountDevicesWithNoDevices() throws Exception { IOTResponse response = client.get(Constants.MobileDeviceManagement.GET_DEVICE_COUNT_ENDPOINT); Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); - Assert.assertEquals(Constants.ZERO, response.getBody()); + Assert.assertEquals(Constants.MobileDeviceManagement.NO_DEVICE, response.getBody()); } -// @Test(description = "Test view devices with no added devices") -// public void testViewDevicesWithNoDevices() throws Exception { -// IOTResponse response = client.get(Constants.MobileDeviceManagement.GET_ALL_DEVICES_ENDPOINT); -// Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); -// Assert.assertEquals(response.getBody(), Constants.NULL); -// } + private boolean checkScopes(String permissionsList) throws Exception { + String tokenString = OAuthUtil.getScopes(backendHTTPSURL, backendHTTPSURL); + return tokenString.contains(permissionsList); + } } \ No newline at end of file diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/RestartTest.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/RestartTest.java deleted file mode 100644 index e991592c..00000000 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/RestartTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.wso2.iot.integration.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.BeforeClass; -import org.testng.Assert; -import org.testng.annotations.Test; -import org.wso2.carbon.automation.engine.context.TestUserMode; -import org.wso2.carbon.integration.common.admin.client.LogViewerClient; -import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException; -import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; -import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException; -import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; -import org.wso2.iot.integration.common.TestBase; - -import javax.xml.xpath.XPathExpressionException; -import java.net.MalformedURLException; -import java.rmi.RemoteException; -import java.util.concurrent.*; - -public class RestartTest extends TestBase { - - private Log log = LogFactory.getLog(RestartTest.class); - private LogViewerClient logViewerClient; - - @BeforeClass - public void initTest() throws Exception { - super.init(TestUserMode.SUPER_TENANT_ADMIN); - logViewerClient = new LogViewerClient(getBackendHTTPSURL(), getSessionCookie()); - } - - @Test(description = "Test restarting the server") - public void serverRestartTest() { - ServerConfigurationManager serverManager; - try { - serverManager = new ServerConfigurationManager(automationContext); - log.info("Restart Triggered -------------------------------------------------------------------"); - serverManager.restartGracefully(); - logViewerClient.getAllRemoteSystemLogs(); - waitForRestart(); - } catch (AutomationUtilException | XPathExpressionException | MalformedURLException e) { - log.error("Restart failed due to : " + e.getLocalizedMessage()); - } catch (RemoteException | LogViewerLogViewerException e) { - log.error("Cannot get server log due to : " + e.getLocalizedMessage()); - } - } - - /** - * Wait until the server restarts. - * This method looks for "Mgt console URL:" to be appeared in the terminal. - * If it does not appear within the given timeout an Exception will be thrown. - */ - private void waitForRestart() { - ExecutorService service = Executors.newSingleThreadExecutor(); - try { - Runnable r = new Runnable() { - @Override - public void run() { - try { - LogEvent[] logEvents = logViewerClient.getAllRemoteSystemLogs(); - for (LogEvent event : logEvents) { - log.info(event.getMessage() + " @ " + event.getLogTime()); - if (event.getMessage().contains("Mgt Console URL : " )){ - log.info("Server restarted successfully"); - Assert.assertTrue(true); - } - } - } catch (RemoteException | LogViewerLogViewerException e) { - log.error("Error reading logs. \n" + e.getMessage()); - Assert.assertTrue(false); - } - } - }; - - Future f = service.submit(r); - - f.get(30, TimeUnit.MINUTES); - } catch (final InterruptedException e) { - log.error("Interrupted "+e.getMessage()); - Assert.assertTrue(false); - } catch (final TimeoutException e) { - log.error("Timeout " + e.getMessage()); - Assert.assertTrue(false); - } catch (final ExecutionException e) { - log.error("Execution failed " + e.getMessage()); - Assert.assertTrue(false); - } finally { - service.shutdown(); - } - } - -} diff --git a/modules/integration/tests-integration/src/test/resources/automation.xml b/modules/integration/tests-integration/src/test/resources/automation.xml index b538772d..5e6200ee 100644 --- a/modules/integration/tests-integration/src/test/resources/automation.xml +++ b/modules/integration/tests-integration/src/test/resources/automation.xml @@ -24,7 +24,7 @@ - 300000 + 100000 diff --git a/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-payloads.json b/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-payloads.json index f246be2f..ca0c8a6b 100644 --- a/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-payloads.json +++ b/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-payloads.json @@ -1,92 +1,186 @@ { - "id": 101234, - "name": "androiddevice1234", - "type": "android", - "description": "this is an android device", - "deviceIdentifier": "d24f870f390352a41234", - "enrolmentInfo": { + "POST": { "id": 101234, - "device": { + "name": "androiddevice1234", + "type": "android", + "description": "this is an android device", + "deviceIdentifier": "d24f870f390352a41234", + "enrolmentInfo": { + "id": 101234, + "device": { + }, + "dateOfEnrolment": 0, + "dateOfLastUpdate": 0, + "ownership": "BYOD", + "status": "CREATED", + "owner": "admin" }, - "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": { + "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": "S8", - "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" + ] + } + ], + "properties": [ + { + "name": "property1", + "value": "value1" + } + ], + "deviceInfo": { + "deviceModel": "S8", + "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" }, - "latitude": 0, - "longitude": 0, - "street1": "string", - "street2": "string", - "city": "string", - "state": "string", - "zip": "string", - "country": "string" - }, - "deviceDetailsMap": { + "deviceDetailsMap": { + }, + "imei": "string", + "imsi": "string" }, - "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 + } + ] }, - "applications": [ - { - "id": 0, - "platform": "string", - "category": "string", - "name": "string", - "locationUrl": "string", - "imageUrl": "string", - "version": "string", - "type": "string", - "appProperties": { + "PUT": { + "id": 101234, + "name": "androiddevice1234", + "type": "android", + "description": "this is an android device", + "deviceIdentifier": "d24f870f390352a41234", + "enrolmentInfo": { + "id": 101234, + "device": { }, - "applicationIdentifier": "string", - "memoryUsage": 0 - } - ] -} \ No newline at end of file + "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": "property2", + "value": "value2" + } + ], + "deviceInfo": { + "deviceModel": "S8", + "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 + } + ] + } +} diff --git a/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-response-payloads.json b/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-response-payloads.json index dd51c631..2b158a47 100644 --- a/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-response-payloads.json +++ b/modules/integration/tests-integration/src/test/resources/payloads/android-enrollment-response-payloads.json @@ -1,4 +1,19 @@ { - "responseCode": "OK", - "responseMessage": "Android device, which carries the id \u0027d24f870f390352a41\u0027 has successfully been enrolled" + "POST": { + "responseCode": "OK", + "responseMessage": "Android device, which carries the id \u0027d24f870f390352a41234\u0027 has successfully been enrolled" + }, + "GET": { + "responseCode": "OK", + "responseMessage": "Android device that carries the id \u0027d24f870f390352a41234\u0027 is enrolled" + }, + "PUT": { + "responseCode": "Accepted", + "responseMessage": "Enrollment of Android device that carries the id \u0027d24f870f390352a41234\u0027 has successfully updated" + }, + "DELETE" : { + "responseCode":"OK", + "responseMessage":"Android device that carries id \u0027d24f870f390352a41234\u0027 has successfully dis-enrolled" + } + } \ No newline at end of file diff --git a/modules/integration/tests-integration/src/test/resources/payloads/permissions.json b/modules/integration/tests-integration/src/test/resources/payloads/permissions.json new file mode 100644 index 00000000..7b3f663a --- /dev/null +++ b/modules/integration/tests-integration/src/test/resources/payloads/permissions.json @@ -0,0 +1,3 @@ +{ + "default 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:devices:view 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:dashboard:by-groups perm:dashboard:count-overview perm:dashboard:details perm:dashboard:device-counts perm:dashboard:feature-non-compliant perm:dashboard:filtered-count perm:dashboard:non-compliant perm:dashboard:non-compliant-count perm:dashboard:vulnerabilities perm:device-types:features perm:device-types:types 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: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" +} \ No newline at end of file diff --git a/modules/integration/tests-integration/src/test/resources/testng.xml b/modules/integration/tests-integration/src/test/resources/testng.xml index dd0662b0..c91658a2 100644 --- a/modules/integration/tests-integration/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/src/test/resources/testng.xml @@ -18,24 +18,16 @@ - + - + - + - - - - - - diff --git a/pom.xml b/pom.xml index a5683816..64cc514e 100644 --- a/pom.xml +++ b/pom.xml @@ -1529,14 +1529,14 @@ 4.7.0 - 2.0.11-SNAPSHOT + 2.0.11 [2.0.0, 3.0.0) 3.1.0-SNAPSHOT - 3.0.9-SNAPSHOT + 3.0.8 6.1.35