diff --git a/modules/integration/pom.xml b/modules/integration/pom.xml index 53891d6b..373a5ea6 100644 --- a/modules/integration/pom.xml +++ b/modules/integration/pom.xml @@ -32,9 +32,8 @@ http://wso2.org - tests-artifacts tests-common - + tests-integration tests-iot-web-ui diff --git a/modules/integration/tests-artifacts/pom.xml b/modules/integration/tests-artifacts/pom.xml deleted file mode 100644 index b82a7758..00000000 --- a/modules/integration/tests-artifacts/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - org.wso2.iot - wso2iot-integration - 3.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - tests-artifacts - pom - WSO2 IoT - Integration Test Artifacts - - diff --git a/modules/integration/tests-common/admin-clients/pom.xml b/modules/integration/tests-common/admin-clients/pom.xml deleted file mode 100644 index a536774f..00000000 --- a/modules/integration/tests-common/admin-clients/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.wso2.iot - tests-common - 3.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.iot.integration.common.clients - jar - WSO2 IoT - Integration Test Common Admin Clients - - diff --git a/modules/integration/tests-common/integration-common/pom.xml b/modules/integration/tests-common/integration-common/pom.xml new file mode 100644 index 00000000..2270613b --- /dev/null +++ b/modules/integration/tests-common/integration-common/pom.xml @@ -0,0 +1,145 @@ + + + + + + + org.wso2.iot + tests-common + 3.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.iot.integration.common + jar + WSO2 IoT - Integration Common + + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.admin.client + compile + + + org.wso2.carbon + org.wso2.carbon.user.mgt.stub + + + org.wso2.carbon + org.wso2.carbon.logging.view.stub + + + org.wso2.carbon + org.wso2.carbon.ndatasource.stub + + + org.wso2.carbon + org.wso2.carbon.server.admin.stub + + + org.wso2.carbon + org.wso2.carbon.throttle.stub + + + org.wso2.carbon + org.wso2.carbon.tenant.mgt.stub + + + org.wso2.carbon + org.wso2.carbon.application.mgt.stub + + + org.wso2.carbon + org.wso2.carbon.security.mgt.stub + + + org.wso2.carbon + org.wso2.carbon.identity.user.profile.stub + + + org.wso2.carbon + org.wso2.carbon.identity.user.profile.stub + + + org.slf4j + slf4j-api + + + + + org.wso2.carbon + org.wso2.carbon.utils + + + org.wso2.carbon.automation + org.wso2.carbon.automation.extensions + compile + + + org.slf4j + slf4j-api + + + + + org.seleniumhq.selenium + selenium-java + + + org.seleniumhq.selenium + selenium-android-driver + + + compile + + + org.testng + testng + compile + + + org.wso2.carbon.automation + org.wso2.carbon.automation.test.utils + compile + + + org.wso2.carbon.automation + org.wso2.carbon.automation.engine + compile + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.extensions + compile + + + com.google.code.gson + gson + compile + + + org.wso2.carbon.automationutils + org.wso2.carbon.integration.common.utils + compile + + + + diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/AssertUtil.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/AssertUtil.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/AssertUtil.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/AssertUtil.java diff --git a/modules/integration/tests-integration/src/test/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 similarity index 81% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/Constants.java index 03e58241..d6bf713a 100644 --- a/modules/integration/tests-integration/src/test/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 @@ -60,40 +60,35 @@ public final class Constants { 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 API_APP_REGISTRATION_PAYLOAD = dynamicClientPayloadBuffer.append("{ \n" - + " \"applicationName\":\"app_12345\",\n" + " \"isAllowedToAllDomains\":false,\n" + + " \"applicationName\":\"app_123456\",\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 " - + "perm:devices:change-status"; + 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: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(); @@ -137,8 +132,8 @@ public final class Constants { public static final String WS_STEP_FILE = "windows" + File.separator + "enrollment" + File.separator + "wstep.xml"; public static final String BSD_PAYLOAD = "{\"credentials\" : {\"username\" : \"admin\", \"email\" : \"admin@wso2.com\", " + - "\"password\" : \"admin\", \"ownership\" : \"BYOD\", " + - "\"token\" : \"cbe53efd46ec612c456540f8dfef5428\"}}"; + "\"password\" : \"admin\", \"ownership\" : \"BYOD\", " + + "\"token\" : \"cbe53efd46ec612c456540f8dfef5428\"}}"; private WindowsEnrollment() { throw new AssertionError(); @@ -146,14 +141,14 @@ public final class Constants { } public static final class AndroidOperations { - private static final String PAYLOAD_COMMON = "["+DEVICE_ID+"]"; + private static final String PAYLOAD_COMMON = "[" + DEVICE_ID + "]"; public static final String OPERATION_PAYLOAD_FILE_NAME = "android-operation-payloads.json"; public static final String OPERATIONS_GROUP = "operations"; public static final String CAMERA_OPERATION = "control-camera"; public static final String CAMERA_OPERATION_PAYLOAD = "{\n" + " \"operation\": {\n" - + " \"enabled\": false\n" + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\" \n" + + " \"enabled\": false\n" + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\" \n" + " ]\n" + "}"; public static final String WIPE_DATA_OPERATION = "wipe_data"; @@ -171,7 +166,7 @@ public final class Constants { public static final String UNLOCK_OPERATION_PAYLOAD = PAYLOAD_COMMON; public static final String LOCK_ENDPOINT = "lock-devices"; - public static final String LOCK_OPERATION_PAYLOAD = "{ \"deviceIDs\": [\""+DEVICE_ID+"\"]," + public static final String LOCK_OPERATION_PAYLOAD = "{ \"deviceIDs\": [\"" + DEVICE_ID + "\"]," + "\"operation\": { \"message\": \"string\", \"hardLockEnabled\": false }}"; public static final String LOCATION_ENDPOINT = "location"; @@ -181,14 +176,14 @@ public final class Constants { public static final String CLEAR_PASSWORD_PAYLOAD = PAYLOAD_COMMON; public static final String DEVICE_INFO_ENDPOINT = "/info"; - public static final String DEVICE_INFO_PAYLOAD = "[\""+DEVICE_ID+"\"]"; + public static final String DEVICE_INFO_PAYLOAD = "[\"" + DEVICE_ID + "\"]"; public static final String ENTERPRISE_WIPE_ENDPOINT = "enterprise-wipe"; public static final String ENTERPRISE_WIPE_PAYLOAD = PAYLOAD_COMMON; public static final String WIPE_DATA_ENDPOINT = "wipe"; public static final String WIPE_DATA_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"pin\": \"string\"\n" - + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}"; + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; public static final String APPLICATION_LIST_ENDPOINT = "applications"; public static final String APPLICATION_LIST_PAYLOAD = PAYLOAD_COMMON; @@ -200,50 +195,51 @@ public final class Constants { public static final String MUTE_PAYLOAD = PAYLOAD_COMMON; public static final String INSTALL_APPS_ENDPOINT = "install-application"; - public static final String INSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + public static final String INSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ],\n" + " \"operation\": {\n" + " \"appIdentifier\": \"string\",\n" + " \"type\": \"string\",\n" + " \"url\": \"string\"\n" + " }\n" + "}"; public static final String UNINSTALL_APPS_ENDPOINT = "uninstall-application"; public static final String UNINSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" - + " \""+DEVICE_ID+"\"\n" + " ],\n" + " \"operation\": {\n" + + " \"" + DEVICE_ID + "\"\n" + " ],\n" + " \"operation\": {\n" + " \"appIdentifier\": \"string\",\n" + " \"type\": \"string\",\n" + " \"url\": \"string\",\n" + " \"name\": \"string\"\n" + " }\n" + "}"; public static final String BLACKLIST_APPS_ENDPOINT = "blacklist-applications"; public static final String NOTIFICATION_ENDPOINT = "send-notification"; - public static final String NOTIFICATION_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + public static final String NOTIFICATION_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ],\n" + " \"operation\": {\n" + " \"messageText\": \"string\",\n" + " \"messageTitle\": \"string\"\n" + " }\n" + "}"; public static final String WIFI_ENDPOINT = "configure-wifi"; public static final String WIFI_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"ssid\": \"string\",\n" - + " \"password\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + + " \"password\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; public static final String ENCRYPT_ENDPOINT = "encrypt-storage"; public static final String ENCRYPT_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"encrypted\": false\n" - + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}"; + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; public static final String REBOOT_ENDPOINT = "reboot"; - public static final String REBOOT_PAYLOAD = PAYLOAD_COMMON;; + public static final String REBOOT_PAYLOAD = PAYLOAD_COMMON; + ; public static final String CHANGE_LOCK_ENDPOINT = "change-lock-code"; public static final String CHANGE_LOCK_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"lockCode\": \"0000\"\n" - + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}\n"; + + " },\n" + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}\n"; public static final String PASSWORD_POLICY_ENDPOINT = "set-password-policy"; public static final String PASSWORD_POLICY_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"maxFailedAttempts\": 0,\n" + " \"minLength\": 0,\n" + " \"pinHistory\": 0,\n" + " \"minComplexChars\": 0,\n" + " \"maxPINAgeInDays\": 0,\n" + " \"requireAlphanumeric\": false,\n" + " \"allowSimple\": false\n" + " },\n" - + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}"; + + " \"deviceIDs\": [\n" + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; public static final String WEB_CLIP_ENDPOINT = "set-webclip"; public static final String WEB_CLIP_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"identity\": \"string\",\n" + " \"title\": \"string\",\n" + " \"type\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" - + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}"; + + " \"" + DEVICE_ID + "\"\n" + " ]\n" + "}"; private AndroidOperations() { throw new AssertionError(); @@ -258,12 +254,12 @@ public final class Constants { public static final String LICENSE_SECTION = "This"; public static final String LICENSE_ENDPOINT = DEVICE_MGT_ENDPOINT + "license"; public static final String APP_LIST_ENDPOINT = DEVICE_MGT_ENDPOINT + "appList/" + - Constants.DEVICE_ID; + Constants.DEVICE_ID; public static final String REQUEST_MODIFY_DEVICE_EXPECTED = "{\"responseMessage\":\"Device information " + - "has modified successfully.\"}"; + "has modified successfully.\"}"; public static final String APPLIST_PAYLOAD = "{\"id\":\"1\"," + - "\"applicationIdentifier\": \"appid\",\"\"platform\": \"android\"," + - "\"name\": \"testapp\"}"; + "\"applicationIdentifier\": \"appid\",\"\"platform\": \"android\"," + + "\"name\": \"testapp\"}"; public static final String RESPONSE_PAYLOAD_FILE_NAME = "android-device-mgt-response-payloads.json"; private AndroidDeviceManagement() { diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/IOTHttpClient.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/IOTHttpClient.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/IOTHttpClient.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/IOTHttpClient.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/IOTResponse.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/IOTResponse.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/IOTResponse.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/IOTResponse.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/OAuthUtil.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/OAuthUtil.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/OAuthUtil.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/PayloadGenerator.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/PayloadGenerator.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/PayloadGenerator.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/PayloadGenerator.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/RestClient.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/RestClient.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/RestClient.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/TestBase.java similarity index 100% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/TestBase.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/TestBase.java diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/AnalyticsServerExtension.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java similarity index 98% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/AnalyticsServerExtension.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java index a4248b10..23e932c0 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/AnalyticsServerExtension.java +++ b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/AnalyticsServerExtension.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.iot.integration.extensions; +package org.wso2.iot.integration.common.extensions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/BrokerServerExtension.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java similarity index 98% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/BrokerServerExtension.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java index 2bb86d87..881323b6 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/BrokerServerExtension.java +++ b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/BrokerServerExtension.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.iot.integration.extensions; +package org.wso2.iot.integration.common.extensions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/CustomTestServerManager.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java similarity index 71% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/CustomTestServerManager.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java index 7f383780..b6e858c6 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/CustomTestServerManager.java +++ b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/CustomTestServerManager.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.iot.integration.extensions; +package org.wso2.iot.integration.common.extensions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -26,6 +26,7 @@ import org.wso2.carbon.automation.extensions.ExtensionConstants; import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerManager; import javax.xml.xpath.XPathExpressionException; +import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -54,7 +55,7 @@ public class CustomTestServerManager { } public CustomTestServerManager(AutomationContext context, String carbonZip, - Map commandMap) { + Map commandMap) { carbonServer = new CarbonServerManager(context); this.carbonZip = carbonZip; if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { @@ -91,24 +92,40 @@ public class CustomTestServerManager { * TestSuite *

* Add the @BeforeSuite TestNG annotation in the method overriding this method + * * @param server : The server which needs to be start. * @return The CARBON_HOME * @throws IOException If an error occurs while copying the deployment artifacts into the - * Carbon server + * Carbon server */ - public String startServer(String server) + public synchronized String startServer(String server) throws AutomationFrameworkException, IOException, XPathExpressionException { - if(carbonHome == null) { + if (carbonHome == null) { if (carbonZip == null) { carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION); } if (carbonZip == null) { throw new IllegalArgumentException("carbon zip file cannot find in the given location"); } - carbonHome = carbonServer.setUpCarbonHome(carbonZip) + "/" + server; + String extractedDir = getExistingExtractedDir(); + if (server.equalsIgnoreCase("core")) { + if (extractedDir == null) { + carbonHome = carbonServer.setUpCarbonHome(carbonZip); + } else { + carbonHome = extractedDir; + } + } else if (server.equalsIgnoreCase("analytics") || server.equalsIgnoreCase("broker")) { + if (extractedDir == null) { + carbonHome = carbonServer.setUpCarbonHome(carbonZip) + File.separator + "wso2" + File.separator + server; + } else { + carbonHome = extractedDir + File.separator + "wso2" + File.separator + server; + } + } else { + throw new IllegalArgumentException("Unsupported server type provided - " + server); + } configureServer(); } - log.info("Carbon Home - " + carbonHome ); + log.info("Carbon Home - " + carbonHome); if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { @@ -118,12 +135,33 @@ public class CustomTestServerManager { return carbonHome; } + private String getExistingExtractedDir() { + File zipDir = new File(System.getProperty("basedir", ".") + File.separator + "target"); + File[] subFiles = zipDir.listFiles(); + if (subFiles != null) { + for (File subFile : subFiles) { + if (subFile.getName().startsWith("carbontmp")) { + File[] carbonServerFiles = subFile.listFiles(); + if (carbonServerFiles != null) { + for (File file : carbonServerFiles) { + if (file.getName().startsWith("wso2iot")) { + return file.getAbsolutePath(); + } + } + } + } + } + } + return null; + } + /** * Restarting server already started by the method startServer + * * @throws AutomationFrameworkException */ public void restartGracefully() throws AutomationFrameworkException { - if(carbonHome == null) { + if (carbonHome == null) { throw new AutomationFrameworkException("No Running Server found to restart. " + "Please make sure whether server is started"); } @@ -142,6 +180,4 @@ public class CustomTestServerManager { } - - } diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/IOTServerExtension.java b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java similarity index 98% rename from modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/IOTServerExtension.java rename to modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java index e8df4bad..a5d414d8 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/extensions/IOTServerExtension.java +++ b/modules/integration/tests-common/integration-common/src/main/java/org/wso2/iot/integration/common/extensions/IOTServerExtension.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.iot.integration.extensions; +package org.wso2.iot.integration.common.extensions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/modules/integration/tests-common/integration-test-utils/pom.xml b/modules/integration/tests-common/integration-test-utils/pom.xml deleted file mode 100644 index 8095b03f..00000000 --- a/modules/integration/tests-common/integration-test-utils/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - org.wso2.iot - tests-common - 3.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.iot.integration.common.utils - jar - WSO2 IoT - Integration Test Common Utils - - - - Apache License Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - - - - diff --git a/modules/integration/tests-common/pom.xml b/modules/integration/tests-common/pom.xml index fa0ba5f8..053d8c77 100644 --- a/modules/integration/tests-common/pom.xml +++ b/modules/integration/tests-common/pom.xml @@ -31,8 +31,7 @@ WSO2 IoT - Integration Test Common - - + integration-common web-ui-pages diff --git a/modules/integration/tests-integration/pom.xml b/modules/integration/tests-integration/pom.xml index 124c5b2a..41e28ea2 100644 --- a/modules/integration/tests-integration/pom.xml +++ b/modules/integration/tests-integration/pom.xml @@ -261,10 +261,14 @@ com.google.code.gson gson + + org.wso2.iot + org.wso2.carbon.iot.integration.common + - true + false diff --git a/modules/integration/tests-integration/src/test/resources/automation.xml b/modules/integration/tests-integration/src/test/resources/automation.xml index 5e6200ee..eddb09c1 100644 --- a/modules/integration/tests-integration/src/test/resources/automation.xml +++ b/modules/integration/tests-integration/src/test/resources/automation.xml @@ -189,9 +189,9 @@ - - org.wso2.iot.integration.extensions.IOTServerExtension - + + org.wso2.iot.integration.common.extensions.IOTServerExtension + org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension diff --git a/modules/integration/tests-integration/src/test/resources/keystores/products/wso2certs.jks b/modules/integration/tests-integration/src/test/resources/keystores/products/wso2certs.jks index eb27997d..d40aca98 100644 Binary files a/modules/integration/tests-integration/src/test/resources/keystores/products/wso2certs.jks and b/modules/integration/tests-integration/src/test/resources/keystores/products/wso2certs.jks differ diff --git a/modules/integration/tests-integration/src/test/resources/keystores/stratos/wso2certs.jks b/modules/integration/tests-integration/src/test/resources/keystores/stratos/wso2certs.jks index eb27997d..d40aca98 100644 Binary files a/modules/integration/tests-integration/src/test/resources/keystores/stratos/wso2certs.jks and b/modules/integration/tests-integration/src/test/resources/keystores/stratos/wso2certs.jks differ diff --git a/modules/integration/tests-platform/pom.xml b/modules/integration/tests-platform/pom.xml deleted file mode 100644 index 29157189..00000000 --- a/modules/integration/tests-platform/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - org.wso2.iot - wso2iot-integration - 3.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - tests-platform - pom - WSO2 IoT - Integration Test Platform - - diff --git a/pom.xml b/pom.xml index 6fdbcafe..fd02c575 100644 --- a/pom.xml +++ b/pom.xml @@ -879,6 +879,11 @@ gson ${google.gson.version} + + org.wso2.iot + org.wso2.carbon.iot.integration.common + ${product.iot.version} + junit junit @@ -1513,7 +1518,7 @@ - 2.0.36 + 2.0.38 [2.0.0, 3.0.0)