diff --git a/modules/integration/pom.xml b/modules/integration/pom.xml
index 9a39035b..c82420df 100644
--- a/modules/integration/pom.xml
+++ b/modules/integration/pom.xml
@@ -21,7 +21,7 @@
org.wso2.iot
wso2iot-parent
- 3.1.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
../../pom.xml
diff --git a/modules/integration/tests-artifacts/pom.xml b/modules/integration/tests-artifacts/pom.xml
index b82a7758..1abe51e1 100644
--- a/modules/integration/tests-artifacts/pom.xml
+++ b/modules/integration/tests-artifacts/pom.xml
@@ -21,7 +21,7 @@
org.wso2.iot
wso2iot-integration
- 3.1.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
../pom.xml
diff --git a/modules/integration/tests-common/pom.xml b/modules/integration/tests-common/pom.xml
index 027bb14a..4692faac 100644
--- a/modules/integration/tests-common/pom.xml
+++ b/modules/integration/tests-common/pom.xml
@@ -21,7 +21,7 @@
org.wso2.iot
wso2iot-integration
- 3.1.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
../pom.xml
diff --git a/modules/integration/tests-common/web-ui-pages/pom.xml b/modules/integration/tests-common/web-ui-pages/pom.xml
index 7dcce232..0dbd7992 100644
--- a/modules/integration/tests-common/web-ui-pages/pom.xml
+++ b/modules/integration/tests-common/web-ui-pages/pom.xml
@@ -22,7 +22,7 @@
org.wso2.iot
tests-common
- 3.1.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
../pom.xml
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/Constants.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/Constants.java
index 787a14cf..00fd8262 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/Constants.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/Constants.java
@@ -27,7 +27,7 @@ public final class Constants {
public static final String DEVICE_ID = "1234";
public static final String NUMBER_NOT_EQUAL_TO_DEVICE_ID = "1111";
public static final String DEVICE_IMEI = "123123123";
- public static final String AUTOMATION_CONTEXT = "MDM";
+ public static final String AUTOMATION_CONTEXT = "IOT";
public static final String APPLICATION_JSON = "application/json";
public static final String APPLICATION_URL_ENCODED = "application/x-www-form-urlencoded";
public static final String OAUTH_CLIENT_ID = "client_id";
@@ -46,16 +46,23 @@ public final class Constants {
public static final String ZERO = "0";
public static final String NULL = "[]";
- public static final class DynamicClientAuthentication {
- public static final String REGISTRATION_ENDPOINT = "/dynamic-client-web/register";
- public static final String TOKEN_ENDPOINT = "/oauth2/token";
- public static final String OAUTH_TOKEN_PAYLOAD = "grant_type=password&username=admin&password=admin&scope=prod";
+ 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 OAUTH_TOKEN_PAYLOAD = "username=admin&password=admin&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: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";
private static StringBuffer dynamicClientPayloadBuffer = new StringBuffer();
- public static final String DYNAMIC_CLIENT_REGISTRATION_PAYLOAD = dynamicClientPayloadBuffer.append("{\"clientName\":").
- append(" \"device\",\"owner\": \"admin\",\"grantType\": \"password\",\"callbackUrl\": \"www.google.lk\"," +
- "\"saasApp\": \"" + true + "\"}").toString();
+ public static final String API_APP_REGISTRATION_PAYLOAD = dynamicClientPayloadBuffer.append("{ \n"
+ + " \"applicationName\":\"app_12345\",\n" + " \"isAllowedToAllDomains\":false,\n"
+ + " \"tags\":[\"android\", \"device_management\"],\n" + " \"isMappingAnExistingOAuthApp\":false\n"
+ + "}").toString();
- private DynamicClientAuthentication() {
+ private APIApplicationRegistration() {
throw new AssertionError();
}
}
@@ -63,7 +70,7 @@ public final class Constants {
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 = "/mdm-android-agent/enrollment/";
+ public static final String ENROLLMENT_ENDPOINT = "/api/device-mgt/android/v1.0/devices";
public static final String ENROLLMENT_GROUP = "android-enrollment";
private AndroidEnrollment() {
@@ -189,7 +196,7 @@ public final class Constants {
public static final class MobileDeviceManagement {
public static final String MOBILE_DEVICE_MANAGEMENT_GROUP = "mobile-device-mgt";
- public static final String GET_DEVICE_COUNT_ENDPOINT = "/mdm-admin/devices/count";
+ public static final String GET_DEVICE_COUNT_ENDPOINT = "/api/device-mgt/v1.0/devices";
public static final String NO_OF_DEVICES = "1";
public static final String GET_ALL_DEVICES_ENDPOINT = "/mdm-admin/devices";
public static final String VIEW_DEVICE_TYPES_ENDPOINT = "/mdm-admin/devices/types";
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/MDMHttpClient.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/MDMHttpClient.java
index 01142195..76ec1137 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/MDMHttpClient.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/MDMHttpClient.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.wso2.mdm.integration.common;
+package org.wso2.iot.integration.common;
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
@@ -27,42 +27,39 @@ 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 org.wso2.carbon.automation.engine.context.AutomationContext;
-import org.wso2.carbon.automation.engine.context.TestUserMode;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
* This class creates a customised Http Client Class
*/
-public class MDMHttpClient {
+public class IOTHttpClient {
private static final String AUTHORIZATION = "Authorization";
- private static Log log = LogFactory.getLog(MDMHttpClient.class);
+ private static Log log = LogFactory.getLog(IOTHttpClient.class);
private String backEndUrl;
- private String authrizationString;
+ private String authorizationString;
private Map requestHeaders = new HashMap();
- public MDMHttpClient(String backEndUrl, String contentType, String authorization) {
+ public IOTHttpClient(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.authorizationString = authorization;
this.requestHeaders.put(AUTHORIZATION, authorization);
}
}
- public String getAuthrizationString() {
- return authrizationString;
+ public String getAuthorizationString() {
+ return authorizationString;
}
- public void setAuthrizationString(String authrizationString) {
- this.authrizationString = authrizationString;
+ public void setAuthorizationString(String authorizationString) {
+ this.authorizationString = authorizationString;
}
public void setHttpHeader(String headerName, String value) {
@@ -77,108 +74,108 @@ public class MDMHttpClient {
this.requestHeaders.remove(headerName);
}
- public MDMResponse post(String endpoint, String body) {
+ public IOTResponse post(String endpoint, String body) {
HttpClient client = new HttpClient();
try {
ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();
- Protocol https = new Protocol("https", socketFactory, 9443);
- Protocol.registerProtocol("https", https);
+ 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, authrizationString);
+ method.setRequestHeader(AUTHORIZATION, authorizationString);
StringRequestEntity requestEntity = new StringRequestEntity(body,
requestHeaders.get(Constants.CONTENT_TYPE), Constants.UTF8);
method.setRequestEntity(requestEntity);
- MDMResponse mdmResponse = new MDMResponse();
- mdmResponse.setStatus(client.executeMethod(method));
- mdmResponse.setBody(method.getResponseBodyAsString());
- return mdmResponse;
+ IOTResponse iotResponse = new IOTResponse();
+ iotResponse.setStatus(client.executeMethod(method));
+ iotResponse.setBody(method.getResponseBodyAsString());
+ return iotResponse;
} catch (GeneralSecurityException e) {
- log.error("Failure occurred at MDMResponse post for GeneralSecurityException", e);
+ log.error("Failure occurred at IOTResponse post for GeneralSecurityException", e);
} catch (IOException e) {
- log.error("Failure occured at MDMResponse post for IOException", e);
+ log.error("Failure occurred at IOTResponse post for IOException", e);
}
return null;
}
- public MDMResponse put(String endpoint, String body) {
+ public IOTResponse put(String endpoint, String body) {
HttpClient client = new HttpClient();
try {
ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();
- Protocol https = new Protocol("https", socketFactory, 9443);
- Protocol.registerProtocol("https", https);
+ 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, authrizationString);
+ method.setRequestHeader(AUTHORIZATION, authorizationString);
StringRequestEntity requestEntity = new StringRequestEntity(
body, requestHeaders.get(Constants.CONTENT_TYPE), Constants.UTF8);
method.setRequestEntity(requestEntity);
- MDMResponse mdmResponse = new MDMResponse();
- mdmResponse.setStatus(client.executeMethod(method));
- mdmResponse.setBody(method.getResponseBodyAsString());
- return mdmResponse;
+ IOTResponse iotResponse = new IOTResponse();
+ iotResponse.setStatus(client.executeMethod(method));
+ iotResponse.setBody(method.getResponseBodyAsString());
+ return iotResponse;
} catch (GeneralSecurityException e) {
- log.error("Failure occurred at MDMResponse put for GeneralSecurityException", e);
+ log.error("Failure occurred at IOTResponse put for GeneralSecurityException", e);
} catch (IOException e) {
- log.error("Failure occurred at MDMResponse put for IO Exception", e);
+ log.error("Failure occurred at IOTResponse put for IO Exception", e);
}
return null;
}
- public MDMResponse get(String endpoint) {
+ public IOTResponse get(String endpoint) {
HttpClient client = new HttpClient();
try {
ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();
- Protocol https = new Protocol("https", socketFactory, 9443);
- Protocol.registerProtocol("https", https);
+ 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, authrizationString);
+ method.setRequestHeader(AUTHORIZATION, authorizationString);
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));
- MDMResponse mdmResponse = new MDMResponse();
- mdmResponse.setStatus(client.executeMethod(method));
- mdmResponse.setBody(new String(method.getResponseBody()));
- return mdmResponse;
+ 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 MDMResponse get for GeneralSecurityException", e);
+ log.error("Failure occurred at IOTResponse get for GeneralSecurityException", e);
} catch (IOException e) {
- log.error("Failure occurred at MDMResponse get for IOException", e);
+ log.error("Failure occurred at IOTResponse get for IOException", e);
}
return null;
}
- public MDMResponse delete(String endpoint) {
+ public IOTResponse delete(String endpoint) {
HttpClient client = new HttpClient();
try {
ProtocolSocketFactory socketFactory = new EasySSLProtocolSocketFactory();
- Protocol https = new Protocol("https", socketFactory, 9443);
- Protocol.registerProtocol("https", https);
+ 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, authrizationString);
+ method.setRequestHeader(AUTHORIZATION, authorizationString);
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));
- MDMResponse mdmResponse = new MDMResponse();
- mdmResponse.setStatus(client.executeMethod(method));
- mdmResponse.setBody(method.getResponseBodyAsString());
- return mdmResponse;
+ IOTResponse iotResponse = new IOTResponse();
+ iotResponse.setStatus(client.executeMethod(method));
+ iotResponse.setBody(method.getResponseBodyAsString());
+ return iotResponse;
} catch (GeneralSecurityException e) {
- log.error("Failure occurred at MDMResponse delete for GeneralSecurityException", e);
+ log.error("Failure occurred at IOTResponse delete for GeneralSecurityException", e);
} catch (IOException e) {
- log.error("Failure occurred at MDMResponse delete for IOException", e);
+ log.error("Failure occurred at IOTResponse delete for IOException", e);
}
return null;
}
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/OAuthUtil.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/OAuthUtil.java
index 95665a75..6d373a95 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/OAuthUtil.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/OAuthUtil.java
@@ -30,8 +30,9 @@ public class OAuthUtil {
public static String getOAuthToken(String backendHTTPURL, String backendHTTPSURL)
throws Exception {
RestClient client = new RestClient(backendHTTPURL, Constants.APPLICATION_JSON);
- HttpResponse oAuthData = client.post(Constants.DynamicClientAuthentication.REGISTRATION_ENDPOINT,
- Constants.DynamicClientAuthentication.DYNAMIC_CLIENT_REGISTRATION_PAYLOAD);
+ client.setHttpHeader("Authorization", "Basic YWRtaW46YWRtaW4=");
+ 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();
@@ -39,8 +40,9 @@ public class OAuthUtil {
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.DynamicClientAuthentication.TOKEN_ENDPOINT,
- Constants.DynamicClientAuthentication.OAUTH_TOKEN_PAYLOAD);
+ oAuthData = client.post(Constants.APIApplicationRegistration.TOKEN_ENDPOINT,
+ Constants.APIApplicationRegistration.OAUTH_TOKEN_PAYLOAD);
+ System.out.println(oAuthData.getData());
jsonObj = new JSONObject(oAuthData.getData());
return jsonObj.get(Constants.OAUTH_ACCESS_TOKEN).toString();
}
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/PayloadGenerator.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/PayloadGenerator.java
index 5999297c..30e748e2 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/PayloadGenerator.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/PayloadGenerator.java
@@ -35,7 +35,7 @@ public class PayloadGenerator {
public static JsonObject getJsonPayload(String fileName, String method)
throws FileNotFoundException {
- URL url = Thread.currentThread().getContextClassLoader().getResource(PAYLOAD_LOCATION + fileName);
+ URL url = PayloadGenerator.class.getClassLoader().getResource(PAYLOAD_LOCATION + fileName);
JsonObject jsonObject = parser.parse(new FileReader(url.getPath())).getAsJsonObject();
return jsonObject.get(method).getAsJsonObject();
}
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/TestBase.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/TestBase.java
index 1e91f6b4..6e9cbb32 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/TestBase.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/common/TestBase.java
@@ -19,6 +19,7 @@ package org.wso2.mdm.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;
@@ -35,8 +36,10 @@ public class TestBase {
protected void init(TestUserMode userMode) throws Exception {
automationContext = new AutomationContext(Constants.AUTOMATION_CONTEXT, userMode);
- backendHTTPSURL = automationContext.getContextUrls().getWebAppURLHttps();
- backendHTTPURL = automationContext.getContextUrls().getWebAppURL();
+ backendHTTPSURL = automationContext.getContextUrls().getWebAppURLHttps().replace("9443", String.valueOf(Constants
+ .HTTPS_GATEWAY_PORT));
+ backendHTTPURL = automationContext.getContextUrls().getWebAppURL().replace("9763", String.valueOf(Constants
+ .HTTP_GATEWAY_PORT));
}
protected void initPublisher(String productGroupName, String instanceName,
@@ -55,7 +58,7 @@ public class TestBase {
}
protected String getBackendHTTPSURL() throws XPathExpressionException {
- return automationContext.getContextUrls().getBackEndUrl();
+ return backendHTTPSURL;
}
protected String getSessionCookie() throws Exception {
diff --git a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/device/enrollment/AndroidEnrollment.java b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/device/enrollment/AndroidEnrollment.java
index 7f01d7ce..4160d89a 100644
--- a/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/device/enrollment/AndroidEnrollment.java
+++ b/modules/integration/tests-integration-old/src/test/java/org/wso2/mdm/integration/device/enrollment/AndroidEnrollment.java
@@ -42,15 +42,12 @@ public class AndroidEnrollment extends TestBase {
@Test(description = "Test an Android device enrollment.")
public void testEnrollment() throws Exception {
- JsonObject enrollmentData = PayloadGenerator.getJsonPayload(
- Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME,
- Constants.HTTP_METHOD_POST);
- enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID);
- HttpResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString());
+ String enrollmentData = PayloadGenerator.getJsonPayloadToString(Constants.AndroidEnrollment
+ .ENROLLMENT_PAYLOAD_FILE_NAME);
+ HttpResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData);
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
- AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(
- Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME,
- Constants.HTTP_METHOD_POST).toString(), response.getData().toString(), true);
+ AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayloadToString(
+ Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME), response.getData(), true);
}
@Test(description = "Test an Android device is enrolled.", dependsOnMethods = {"testEnrollment"})
@@ -59,7 +56,7 @@ public class AndroidEnrollment extends TestBase {
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(
Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME,
- Constants.HTTP_METHOD_GET).toString(), response.getData().toString(), true);
+ Constants.HTTP_METHOD_GET).toString(), response.getData(), true);
}
@Test(description = "Test modify enrollment.", dependsOnMethods = {"testIsEnrolled"})
@@ -72,7 +69,7 @@ public class AndroidEnrollment extends TestBase {
enrollmentData.toString());
AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(
Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME,
- Constants.HTTP_METHOD_PUT).toString(), response.getData().toString(), true);
+ Constants.HTTP_METHOD_PUT).toString(), response.getData(), true);
}
@Test(description = "Test disenrollment.", dependsOnMethods = {"testModifyEnrollment"})
@@ -82,6 +79,6 @@ public class AndroidEnrollment extends TestBase {
AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(
Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME,
Constants.HTTP_METHOD_DELETE).toString(),
- response.getData().toString(), true);
+ response.getData(), true);
}
}
diff --git a/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-payloads.json b/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-payloads.json
index 6fc027a8..f246be2f 100644
--- a/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-payloads.json
+++ b/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-payloads.json
@@ -1,45 +1,92 @@
{
- "POST": {
- "name": "milan",
- "type": "android",
- "description": "milan123",
- "deviceIdentifier": "1234",
- "enrolmentInfo": {
- "ownership": "BYOD",
- "status": "ACTIVE",
- "owner": "admin"
+ "id": 101234,
+ "name": "androiddevice1234",
+ "type": "android",
+ "description": "this is an android device",
+ "deviceIdentifier": "d24f870f390352a41234",
+ "enrolmentInfo": {
+ "id": 101234,
+ "device": {
},
- "properties": [
- {
- "name": "IMEI",
- "value": "123123123"
- },
- {
- "name": "IMSI",
- "value": "123123123"
- }
- ]
+ "dateOfEnrolment": 0,
+ "dateOfLastUpdate": 0,
+ "ownership": "BYOD",
+ "status": "CREATED",
+ "owner": "admin"
},
- "PUT": {
- "name": "milan123",
- "type": "android",
- "description": "updatedDescription",
- "deviceIdentifier": "1234",
- "enrolmentInfo": {
- "ownership": "BYOD",
- "status": "ACTIVE",
- "owner": "admin",
- "dateOfEnrolment": "1445438864650"
+ "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"
+ },
+ "latitude": 0,
+ "longitude": 0,
+ "street1": "string",
+ "street2": "string",
+ "city": "string",
+ "state": "string",
+ "zip": "string",
+ "country": "string"
},
- "properties": [
- {
- "name": "IMEI",
- "value": "123123123"
+ "deviceDetailsMap": {
+ },
+ "imei": "string",
+ "imsi": "string"
+ },
+ "applications": [
+ {
+ "id": 0,
+ "platform": "string",
+ "category": "string",
+ "name": "string",
+ "locationUrl": "string",
+ "imageUrl": "string",
+ "version": "string",
+ "type": "string",
+ "appProperties": {
},
- {
- "name": "IMSI",
- "value": "123123123"
- }
- ]
- }
+ "applicationIdentifier": "string",
+ "memoryUsage": 0
+ }
+ ]
}
\ No newline at end of file
diff --git a/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-response-payloads.json b/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-response-payloads.json
index 2e0c38d1..dd51c631 100644
--- a/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-response-payloads.json
+++ b/modules/integration/tests-integration-old/src/test/resources/payloads/android-enrollment-response-payloads.json
@@ -1,18 +1,4 @@
{
- "POST": {
- "responseCode": "Created",
- "responseMessage": "Device enrollment succeeded."
- },
- "PUT": {
- "responseCode": "Accepted",
- "responseMessage": "Device enrollment has updated successfully"
- },
- "GET": {
- "responseCode": "Accepted",
- "responseMessage": "Device has already enrolled"
- },
- "DELETE": {
- "responseCode": "Accepted",
- "responseMessage": "Device has removed successfully"
- }
+ "responseCode": "OK",
+ "responseMessage": "Android device, which carries the id \u0027d24f870f390352a41\u0027 has successfully been enrolled"
}
\ No newline at end of file
diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/ServerRestart.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/ServerRestart.java
new file mode 100644
index 00000000..ea5967d5
--- /dev/null
+++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/util/ServerRestart.java
@@ -0,0 +1,4 @@
+package org.wso2.iot.integration.util;
+
+public class ServerRestart {
+}
diff --git a/modules/integration/tests-integration/src/test/resources/automation.xml b/modules/integration/tests-integration/src/test/resources/automation.xml
index c36ffbd8..b538772d 100644
--- a/modules/integration/tests-integration/src/test/resources/automation.xml
+++ b/modules/integration/tests-integration/src/test/resources/automation.xml
@@ -1,6 +1,6 @@
-
-
+
@@ -25,15 +24,11 @@
- 60000
+ 300000
standalone
-
- false
@@ -50,7 +45,7 @@
- http://10.100.2.51:4444/wd/hub/
+ http://10.100.2.51:4444/wd/hub/
@@ -169,39 +164,35 @@
-
+
-
+
localhost
- 10863
- 10543
+ 9763
+
+ 9443
+
-
+
+
+
-
-
-
- org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension
-
-
-
-
-
-
- org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension
-
+
+ org.wso2.iot.integration.extensions.IOTServerExtension
+
+ org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension
@@ -209,13 +200,13 @@
-
+
-
+
diff --git a/modules/integration/tests-integration/src/test/resources/testng.xml b/modules/integration/tests-integration/src/test/resources/testng.xml
index 2cfc4734..cb4780ba 100644
--- a/modules/integration/tests-integration/src/test/resources/testng.xml
+++ b/modules/integration/tests-integration/src/test/resources/testng.xml
@@ -1,5 +1,5 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/pom.xml b/modules/integration/tests-iot-web-ui/pom.xml
index 3aab2b9e..a16001e2 100644
--- a/modules/integration/tests-iot-web-ui/pom.xml
+++ b/modules/integration/tests-iot-web-ui/pom.xml
@@ -20,7 +20,7 @@
org.wso2.iot
wso2iot-integration
- 3.1.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
../pom.xml