forked from community/product-iots
Merge pull request #272 from menakaj/master
Integration Tests : Fixed Android Enrollment flow.application-manager-new
commit
83f4b392a8
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,92 +1,186 @@
|
|||||||
{
|
{
|
||||||
"id": 101234,
|
"POST": {
|
||||||
"name": "androiddevice1234",
|
|
||||||
"type": "android",
|
|
||||||
"description": "this is an android device",
|
|
||||||
"deviceIdentifier": "d24f870f390352a41234",
|
|
||||||
"enrolmentInfo": {
|
|
||||||
"id": 101234,
|
"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,
|
"features": [
|
||||||
"dateOfLastUpdate": 0,
|
{
|
||||||
"ownership": "BYOD",
|
"id": 10,
|
||||||
"status": "CREATED",
|
"code": "aaaa1111",
|
||||||
"owner": "admin"
|
"name": "newfeature1",
|
||||||
},
|
"description": "this is the new feature 1",
|
||||||
"features": [
|
"deviceType": "android",
|
||||||
{
|
"metadataEntries": [
|
||||||
"id": 10,
|
{
|
||||||
"code": "aaaa1111",
|
"id": 10,
|
||||||
"name": "newfeature1",
|
"value": {
|
||||||
"description": "this is the new feature 1",
|
}
|
||||||
"deviceType": "android",
|
|
||||||
"metadataEntries": [
|
|
||||||
{
|
|
||||||
"id": 10,
|
|
||||||
"value": {
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
],
|
||||||
],
|
"properties": [
|
||||||
"properties": [
|
{
|
||||||
{
|
"name": "property1",
|
||||||
"name": "property1",
|
"value": "value1"
|
||||||
"value": "value1"
|
}
|
||||||
}
|
],
|
||||||
],
|
"deviceInfo": {
|
||||||
"deviceInfo": {
|
"deviceModel": "S8",
|
||||||
"deviceModel": "S8",
|
"vendor": "SAMSUNG",
|
||||||
"vendor": "SAMSUNG",
|
"osVersion": "5.1",
|
||||||
"osVersion": "5.1",
|
"batteryLevel": 1,
|
||||||
"batteryLevel": 1,
|
"internalTotalMemory": 32,
|
||||||
"internalTotalMemory": 32,
|
"internalAvailableMemory": 24,
|
||||||
"internalAvailableMemory": 24,
|
"externalTotalMemory": 64,
|
||||||
"externalTotalMemory": 64,
|
"externalAvailableMemory": 60,
|
||||||
"externalAvailableMemory": 60,
|
"operator": "dialog",
|
||||||
"operator": "dialog",
|
"connectionType": "GSM",
|
||||||
"connectionType": "GSM",
|
"mobileSignalStrength": 1,
|
||||||
"mobileSignalStrength": 1,
|
"ssid": "picassowifi",
|
||||||
"ssid": "picassowifi",
|
"cpuUsage": 0,
|
||||||
"cpuUsage": 0,
|
"totalRAMMemory": 2,
|
||||||
"totalRAMMemory": 2,
|
"availableRAMMemory": 1,
|
||||||
"availableRAMMemory": 1,
|
"pluggedIn": false,
|
||||||
"pluggedIn": false,
|
"location": {
|
||||||
"location": {
|
"deviceId": 0,
|
||||||
"deviceId": 0,
|
"deviceIdentifier": {
|
||||||
"deviceIdentifier": {
|
"id": "string",
|
||||||
"id": "string",
|
"type": "string"
|
||||||
"type": "string"
|
},
|
||||||
|
"latitude": 0,
|
||||||
|
"longitude": 0,
|
||||||
|
"street1": "string",
|
||||||
|
"street2": "string",
|
||||||
|
"city": "string",
|
||||||
|
"state": "string",
|
||||||
|
"zip": "string",
|
||||||
|
"country": "string"
|
||||||
},
|
},
|
||||||
"latitude": 0,
|
"deviceDetailsMap": {
|
||||||
"longitude": 0,
|
},
|
||||||
"street1": "string",
|
"imei": "string",
|
||||||
"street2": "string",
|
"imsi": "string"
|
||||||
"city": "string",
|
|
||||||
"state": "string",
|
|
||||||
"zip": "string",
|
|
||||||
"country": "string"
|
|
||||||
},
|
|
||||||
"deviceDetailsMap": {
|
|
||||||
},
|
},
|
||||||
"imei": "string",
|
"applications": [
|
||||||
"imsi": "string"
|
{
|
||||||
|
"id": 0,
|
||||||
|
"platform": "string",
|
||||||
|
"category": "string",
|
||||||
|
"name": "string",
|
||||||
|
"locationUrl": "string",
|
||||||
|
"imageUrl": "string",
|
||||||
|
"version": "string",
|
||||||
|
"type": "string",
|
||||||
|
"appProperties": {
|
||||||
|
},
|
||||||
|
"applicationIdentifier": "string",
|
||||||
|
"memoryUsage": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"applications": [
|
"PUT": {
|
||||||
{
|
"id": 101234,
|
||||||
"id": 0,
|
"name": "androiddevice1234",
|
||||||
"platform": "string",
|
"type": "android",
|
||||||
"category": "string",
|
"description": "this is an android device",
|
||||||
"name": "string",
|
"deviceIdentifier": "d24f870f390352a41234",
|
||||||
"locationUrl": "string",
|
"enrolmentInfo": {
|
||||||
"imageUrl": "string",
|
"id": 101234,
|
||||||
"version": "string",
|
"device": {
|
||||||
"type": "string",
|
|
||||||
"appProperties": {
|
|
||||||
},
|
},
|
||||||
"applicationIdentifier": "string",
|
"dateOfEnrolment": 0,
|
||||||
"memoryUsage": 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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,19 @@
|
|||||||
{
|
{
|
||||||
"responseCode": "OK",
|
"POST": {
|
||||||
"responseMessage": "Android device, which carries the id \u0027d24f870f390352a41\u0027 has successfully been enrolled"
|
"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"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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"
|
||||||
|
}
|
Loading…
Reference in new issue