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 99%
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..852e9130 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,7 +60,7 @@ 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 "
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..2ec67fd5 100644
--- a/modules/integration/tests-integration/pom.xml
+++ b/modules/integration/tests-integration/pom.xml
@@ -261,6 +261,10 @@
com.google.code.gson
gson
+
+ org.wso2.iot
+ org.wso2.carbon.iot.integration.common
+
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 569f7f67..05ecbe12 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