getCommands() {
+ return commandMap;
+ }
+
+ /**
+ * This method is called for starting a Carbon server in preparation for execution of a
+ * 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 java.io.IOException If an error occurs while copying the deployment artifacts into the
+ * Carbon server
+ */
+ public String startServer(String server)
+ throws AutomationFrameworkException, IOException, XPathExpressionException {
+ 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;
+ configureServer();
+ }
+ 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 {
+ this.portOffset = 0;
+ }
+ carbonServer.startServerUsingCarbonHome(carbonHome, commandMap);
+ return carbonHome;
+ }
+
+ /**
+ * Restarting server already started by the method startServer
+ * @throws AutomationFrameworkException
+ */
+ public void restartGracefully() throws AutomationFrameworkException {
+ if(carbonHome == null) {
+ throw new AutomationFrameworkException("No Running Server found to restart. " +
+ "Please make sure whether server is started");
+ }
+ carbonServer.restartGracefully();
+ }
+
+ /**
+ * This method is called for stopping a Carbon server
+ *
+ * Add the @AfterSuite annotation in the method overriding this method
+ *
+ * @throws AutomationFrameworkException If an error occurs while shutting down the server
+ */
+ public void stopServer() throws AutomationFrameworkException {
+ carbonServer.serverShutdown(portOffset);
+ }
+
+
+
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/extension/IOTServerExtension.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/extension/IOTServerExtension.java
new file mode 100644
index 00000000..c7992a47
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/extension/IOTServerExtension.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.extension;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment;
+import org.wso2.carbon.automation.engine.context.AutomationContext;
+import org.wso2.carbon.automation.engine.context.ContextXpathConstants;
+import org.wso2.carbon.automation.engine.context.TestUserMode;
+import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException;
+import org.wso2.carbon.automation.engine.extensions.ExecutionListenerExtension;
+import org.wso2.carbon.automation.extensions.ExtensionConstants;
+import org.wso2.carbon.automation.extensions.servers.carbonserver.CarbonServerExtension;
+
+import javax.xml.xpath.XPathExpressionException;
+
+/**
+ * Test Automation server extension to start the IOT core.
+ * This will set the carbon_home to {carbonHome}/core and port offset : 0
+ */
+public class IOTServerExtension extends ExecutionListenerExtension {
+
+ private CustomTestServerManager serverManager;
+ private static final Log log = LogFactory.getLog(CarbonServerExtension.class);
+ private String executionEnvironment;
+ private AutomationContext automationContext;
+
+
+ @Override
+ public void initiate() throws AutomationFrameworkException {
+ try {
+ automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
+ if(getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
+ getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0");
+ }
+ serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
+ executionEnvironment =
+ automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
+
+ } catch (XPathExpressionException e) {
+ handleException("Error while initiating test environment", e);
+ }
+ }
+
+ @Override
+ public void onExecutionStart() throws AutomationFrameworkException {
+ try {
+ if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) {
+ String carbonHome = serverManager.startServer("core");
+ log.info(carbonHome);
+ System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome);
+ }
+ } catch (Exception e) {
+ handleException("Fail to start carbon server ", e);
+ }
+ }
+
+ @Override
+ public void onExecutionFinish() throws AutomationFrameworkException {
+ try {
+ if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) {
+ serverManager.stopServer();
+ }
+ } catch (Exception e) {
+ handleException("Fail to stop carbon server ", e);
+ }
+ }
+
+ private static void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupFailTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupFailTest.java
new file mode 100644
index 00000000..57f899b6
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupFailTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.group;
+
+import org.junit.Assert;
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
+
+/**
+ * This class contains methods to test the failing scenarios of Group creation.
+ * There can be groups with same name.
+ * So the failing scenario is sending the form with empty group name.
+ */
+public class DeviceGroupFailTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws Exception {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ }
+
+ @Test(description = "Test for empty group name.")
+ public void addNewGroupFailTest() throws Exception {
+ driver.get(getWebAppURL() + Constants.IOT_GROUP_ADD_URL);
+ DeviceAddGroupPage addGroupPage = new DeviceAddGroupPage(driver);
+
+ Assert.assertEquals(addGroupPage.submitEmptyForm(), Constants.GROUP_NAME_FIELD_ERROR);
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupTest.java
new file mode 100644
index 00000000..d3e52f21
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/group/DeviceGroupTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.group;
+
+import org.openqa.selenium.WebDriver;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
+import org.wso2.iot.integration.ui.pages.groups.DeviceGroupsPage;
+import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
+
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test cases for grouping feature of IOT server.
+ */
+public class DeviceGroupTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private IOTAdminDashboard adminDashboard;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws Exception {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ adminDashboard = new IOTAdminDashboard(driver);
+ }
+
+ @Test(description = "Test for adding a new device group.")
+ public void addNewGroupTest() throws IOException {
+ DeviceAddGroupPage addGroupPage = adminDashboard.addGroup();
+ addGroupPage.addNewGroup(Constants.GROUP_NAME, Constants.GROUP_DESCRIPTION);
+ }
+
+ @Test(description = "Check whether the created group exists", dependsOnMethods = {"addNewGroupTest"})
+ public void isGroupCreatedTest() throws IOException, XPathExpressionException {
+ driver.get(getWebAppURL() + Constants.IOT_HOME_URL);
+ DeviceGroupsPage groupsPage = adminDashboard.viewGroups();
+ Assert.assertTrue(groupsPage.isGroupCreated(Constants.GROUP_NAME));
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java
new file mode 100644
index 00000000..9b478a8c
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginFormValidationTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.login;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.UIElementMapper;
+
+
+/**
+ * Test cases to test the incorrect login from submissions.
+ * Ex:
+ * 1. Empty form
+ * 2. Incorrect username or password
+ * 3. short password
+ */
+public class LoginFormValidationTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private UIElementMapper uiElementMapper;
+
+ WebElement userNameField;
+ WebElement passwordField;
+ WebElement loginButton;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws Exception {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ clearForm();
+ }
+
+ @Test(description = "Test for incorrect username")
+ public void incorrectUserNameTest() throws Exception {
+ clearForm();
+ userNameField.sendKeys(Constants.User.Login.WRONG_USER_NAME);
+ passwordField.sendKeys(automationContext.getSuperTenant().getTenantAdmin().getPassword());
+ loginButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(uiElementMapper.getElement("iot.user.login.incorrect.xpath")));
+ if (alert.isDisplayed()) {
+ Assert.assertEquals(alert.getText(), Constants.User.Login.FAILED_ERROR);
+ } else {
+ Assert.assertTrue(false, Constants.ALERT_NOT_PRESENT);
+ }
+
+ }
+
+ @Test(description = "Test for incorrect password")
+ public void incorrectPasswordTest() throws Exception {
+ clearForm();
+ userNameField.sendKeys(automationContext.getSuperTenant().getTenantAdmin().getPassword());
+ passwordField.sendKeys(Constants.User.Login.WRONG_USER_PASSWORD);
+ loginButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(uiElementMapper.getElement("iot.user.login.incorrect.xpath")));
+ if (alert.isDisplayed()) {
+ Assert.assertEquals(alert.getText(), Constants.User.Login.FAILED_ERROR);
+ } else {
+ Assert.assertTrue(false, Constants.ALERT_NOT_PRESENT);
+ }
+ }
+
+ public void clearForm() throws Exception {
+ driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH);
+ uiElementMapper = UIElementMapper.getInstance();
+
+ userNameField = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.user.login.input.username.xpath")));
+ passwordField = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.user.login.input.password.xpath")));
+ loginButton = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.user.login.button.xpath")));
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java
new file mode 100644
index 00000000..ba219038
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/login/LoginTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.login;
+
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
+import org.wso2.iot.integration.ui.pages.login.LoginPage;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test Login as Admin
+ */
+public class LoginTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH);
+ }
+
+ @Test(description = "Verify logins to IOT server dashboard")
+ public void testAdminLogin() throws IOException, XPathExpressionException {
+ LoginPage loginPage = new LoginPage(driver);
+ IOTAdminDashboard dashboard = loginPage.loginAsAdmin(
+ automationContext.getSuperTenant().getTenantAdmin().getUserName(),
+ automationContext.getSuperTenant().getTenantAdmin().getPassword());
+ dashboard.logout();
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown(){
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrollmentTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrollmentTest.java
new file mode 100644
index 00000000..c906eb26
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrollmentTest.java
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+* WSO2 Inc. licenses this file to you under the Apache License,
+* Version 2.0 (the "License"); you may not use this file except
+* in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.wso2.carbon.iot.integration.web.ui.test.samples;
+
+import junit.framework.Assert;
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
+import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
+import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test cases to verify the enrolment process.
+ */
+public class SampleEnrollmentTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private ConnectedCupDeviceTypeViewPage connectedCupDeviceTypeViewPage;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ IOTAdminDashboard adminDashboard = new IOTAdminDashboard(driver);
+ EnrollDevicePage enrollDevicePage = adminDashboard.enrollNewDevice();
+ connectedCupDeviceTypeViewPage = enrollDevicePage.gotoConnectedCupDeviceTypeViewPage();
+ }
+
+ @Test(description = "Verify the pop up modal is displayed.",
+ groups = Constants.TestSample.ENROLL,
+ dependsOnGroups = Constants.TestSample.INSTALL_VERIFY)
+ public void enrollDevicePopUpModalTest() throws InterruptedException, IOException {
+ Assert.assertTrue(connectedCupDeviceTypeViewPage.isPopUpPresent());
+ }
+
+ @Test(description = "Test case for device enrolment",
+ groups = Constants.TestSample.ENROLL,
+ dependsOnMethods = {"enrollDevicePopUpModalTest"})
+ public void enrollDeviceTest() throws InterruptedException {
+ Assert.assertTrue(connectedCupDeviceTypeViewPage.enrollDevice(Constants.IOT_CONNECTED_CUP_NAME));
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrolmentVerificationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrolmentVerificationTest.java
new file mode 100644
index 00000000..1dc592bc
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleEnrolmentVerificationTest.java
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+* WSO2 Inc. licenses this file to you under the Apache License,
+* Version 2.0 (the "License"); you may not use this file except
+* in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.wso2.carbon.iot.integration.web.ui.test.samples;
+
+import junit.framework.Assert;
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
+import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
+import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test cases to check whether the sample is enrolled correctly.
+ */
+public class SampleEnrolmentVerificationTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver webDriver;
+ private DevicesPage devicesPage;
+ private ConnectedCupDeviceViewPage connectedCupDeviceViewPage;
+
+ @BeforeClass(alwaysRun = true)
+ public void setUp() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ webDriver = BrowserManager.getWebDriver();
+ LoginUtils.login(webDriver, automationContext, getWebAppURL());
+ webDriver.get(getWebAppURL() + Constants.IOT_DEVICES_URL);
+ devicesPage = new DevicesPage(webDriver);
+ }
+
+ @Test(description = "Verify enrolment of the sample device",
+ groups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnGroups = Constants.TestSample.ENROLL)
+ public void verifyEnrollmentTest() {
+ Assert.assertTrue(devicesPage.isDeviceEnrolled(Constants.IOT_CONNECTED_CUP_NAME));
+ }
+
+ @Test(description = "Verify navigation to device view",
+ dependsOnMethods = "verifyEnrollmentTest",
+ groups = Constants.TestSample.ENROLL_VERIFY)
+ public void verifyNavigationTest() throws IOException {
+ connectedCupDeviceViewPage = devicesPage.viewDevice(Constants.IOT_CONNECTED_CUP_NAME);
+ Assert.assertNotNull(connectedCupDeviceViewPage);
+ }
+
+ @Test(description = "Verify sample functions",
+ dependsOnMethods = {"verifyNavigationTest"})
+ public void sampleStartUpTest() throws IOException {
+ ConnectedCupDeviceInterface sampleViewPage = connectedCupDeviceViewPage.gotoDevice();
+ Assert.assertNotNull(sampleViewPage);
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ webDriver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleFunctionalityTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleFunctionalityTest.java
new file mode 100644
index 00000000..d8bde532
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleFunctionalityTest.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.samples;
+
+import junit.framework.Assert;
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
+import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
+import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test cases for test the functionality of the connected cup sample.
+ * In these test cases following features are tested.
+ * 1. Setting temperature and Coffee level
+ * 2. Order coffee
+ * 3. Test the stat graphs
+ */
+public class SampleFunctionalityTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driverDevice;
+ private WebDriver driverServer;
+ private ConnectedCupDeviceInterface sampleViewPage;
+ private ConnectedCupDeviceViewPage deviceViewPage;
+
+ @BeforeClass(alwaysRun = true)
+ public void setUp() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driverDevice = BrowserManager.getWebDriver();
+ driverServer = BrowserManager.getWebDriver();
+ LoginUtils.login(driverServer, automationContext, getWebAppURL());
+ driverServer.get(getWebAppURL() + Constants.IOT_DEVICES_URL);
+ DevicesPage devicesPage = new DevicesPage(driverServer);
+ deviceViewPage = devicesPage.viewDevice(Constants.IOT_CONNECTED_CUP_NAME);
+
+ //Opens the connected cup device interface in the browser.
+ driverDevice.get(deviceViewPage.getDeviceLink());
+ sampleViewPage = new ConnectedCupDeviceInterface(driverDevice);
+ }
+
+ @Test(description = "Set the temperature level.",
+ groups = Constants.TestSample.VERIFY,
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY)
+ public void setTemperatureTest() {
+ Assert.assertTrue(sampleViewPage.changeTemperature(Constants.ConnectedCup.TEMPERATURE));
+ }
+
+ @Test(description = "Set the coffee level.",
+ groups = Constants.TestSample.VERIFY,
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY)
+ public void setCoffeeLevelTest() throws IOException {
+ Assert.assertTrue(sampleViewPage.changeCoffeeLevel(Constants.ConnectedCup.COFFEE_LEVEl));
+ }
+
+ @Test(description = "Verify order coffee function.",
+ groups = Constants.TestSample.VERIFY,
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY)
+ public void orderCoffeeTest() throws IOException, InterruptedException {
+ Assert.assertTrue(sampleViewPage.orderCoffee());
+ }
+
+ @Test(description = "Test the graphs are present in device view.",
+ groups = Constants.TestSample.VERIFY,
+ dependsOnMethods = {"setTemperatureTest", "setCoffeeLevelTest", "orderCoffeeTest"})
+ public void verifyGraphs() throws IOException {
+ Assert.assertTrue(deviceViewPage.isGraphsAvailable(2));
+ }
+
+ @Test(description = "Test the Y axis name of Temperature graph.",
+ groups = {Constants.TestSample.VERIFY,
+ Constants.TestSample.TEMPERATURE},
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnMethods = {"verifyGraphs"})
+ public void temperatureGraphYAxisNameTest() throws IOException {
+ Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_Y_AXIS,
+ Constants.ConnectedCup.TEMPERATURE_ID,
+ Constants.ConnectedCup.TEMPERATURE_Y_AXIS));
+ }
+
+ @Test(description = "Test the X axis name of Temperature graph.",
+ groups = {Constants.TestSample.VERIFY,
+ Constants.TestSample.TEMPERATURE},
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnMethods = {"verifyGraphs"})
+ public void temperatureGraphXAxisNameTest() throws IOException {
+ Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_X_AXIS,
+ Constants.ConnectedCup.TEMPERATURE_ID,
+ Constants.ConnectedCup.TEMPERATURE_X_AXIS));
+ }
+
+ @Test(description = "Test the whether the Coffee Level graph legend is present.",
+ groups = {Constants.TestSample.VERIFY,
+ Constants.TestSample.TEMPERATURE},
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnMethods = {"verifyGraphs"})
+ public void temperatureGraphLegendTest() {
+ Assert.assertTrue(deviceViewPage.graphLegendName(Constants.ConnectedCup.TEMPERATURE_ID,
+ Constants.ConnectedCup.TEMPERATURE_LEGEND));
+ }
+
+ @Test(description = "Test the whether the Temperature graph path is visible.",
+ groups = {Constants.TestSample.VERIFY,
+ Constants.TestSample.TEMPERATURE},
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnMethods = {"verifyGraphs"})
+ public void temperatureGraphPathTest() {
+ Assert.assertTrue(deviceViewPage.checkGraphPath(Constants.ConnectedCup.TEMPERATURE_GRAPH_ID));
+ }
+
+ @Test(description = "Test the whether the Temperature graph gets values.",
+ groups = {Constants.TestSample.VERIFY,
+ Constants.TestSample.TEMPERATURE},
+ dependsOnGroups = Constants.TestSample.ENROLL_VERIFY,
+ dependsOnMethods = {"verifyGraphs"})
+ public void temperatureGraphDataPublisherTest() {
+ Assert.assertTrue(deviceViewPage.checkGraphValues(Constants.ConnectedCup.TEMPERATURE_GRAPH_ID,
+ Constants.ConnectedCup.TEMPERATURE));
+ }
+
+ @Test(description = "Test the Y axis name of Coffee Level graph.",
+ groups = Constants.TestSample.COFFEE_LEVEL,
+ dependsOnGroups = Constants.TestSample.TEMPERATURE)
+ public void coffeeLevelGraphYAxisNameTest() {
+ Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_Y_AXIS,
+ Constants.ConnectedCup .COFFEE_LEVEL_ID,
+ Constants.ConnectedCup.COFFEE_LEVEL_Y_AXIS));
+ }
+
+ @Test(description = "Test the X axis name of Coffee Level graph.",
+ groups = Constants.TestSample.COFFEE_LEVEL,
+ dependsOnGroups = {Constants.TestSample.ENROLL_VERIFY,
+ Constants.TestSample.TEMPERATURE})
+ public void coffeeLevelGraphXAxisNameTest() {
+ Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_X_AXIS,
+ Constants.ConnectedCup.COFFEE_LEVEL_ID,
+ Constants.ConnectedCup.COFFEE_LEVEL_X_AXIS));
+ }
+
+ @Test(description = "Test the whether the Coffee Level graph legend is present.",
+ groups = Constants.TestSample.COFFEE_LEVEL,
+ dependsOnGroups = {Constants.TestSample.TEMPERATURE})
+ public void coffeeLevelGraphLegendTest() throws IOException {
+ Assert.assertTrue(deviceViewPage.graphLegendName(Constants.ConnectedCup.COFFEE_LEVEL_ID,
+ Constants.ConnectedCup.COFFEE_LEVEL_LEGEND));
+ }
+
+ @Test(description = "Test the whether the Coffee Level graph path is visible.",
+ groups = Constants.TestSample.COFFEE_LEVEL,
+ dependsOnGroups = {Constants.TestSample.TEMPERATURE})
+ public void coffeeLevelGraphPathTest() {
+ Assert.assertTrue(deviceViewPage.checkGraphPath(Constants.ConnectedCup.COFFEE_LEVEL_GRAPH_ID));
+ }
+
+ @Test(description = "Test the whether the Coffee Level graph gets values.",
+ groups = Constants.TestSample.COFFEE_LEVEL,
+ dependsOnGroups = Constants.TestSample.TEMPERATURE)
+ public void coffeeLevelGraphDataPublisherTest() {
+ Assert.assertTrue(deviceViewPage.checkGraphValues(Constants.ConnectedCup.COFFEE_LEVEL_GRAPH_ID,
+ Constants.ConnectedCup.COFFEE_LEVEl));
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ driverServer.quit();
+ driverDevice.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationTest.java
new file mode 100644
index 00000000..1368e0b1
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationTest.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.samples;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;
+import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException;
+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.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException;
+import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.rmi.RemoteException;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * Test cases for building and installation of sample device types.
+ * When installing a custom device type to the IOT server, developer has to create the device type as a feature and
+ * put it in to the samples folder.
+ * Then build the device type created with maven.
+ * After that install the device type by running the device-deployer.xml.
+ * Then the server has to be restarted, in order to activate newly installed device type.
+ *
+ * In this test case, the build process of a new device type and installation to the server is tested.
+ */
+public class SampleInstallationTest extends IOTIntegrationUIBaseTestCase {
+ private Log log = LogFactory.getLog(SampleInstallationTest.class);
+ private Process tempProcess = null;
+ private Properties properties = System.getProperties();
+ private String carbonHome = properties.getProperty(Constants.CARBON_HOME);
+ private String[] commands;
+ private LogViewerClient logViewerClient;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException, AutomationFrameworkException,
+ LoginAuthenticationExceptionException {
+ super.init();
+ logViewerClient = new LogViewerClient(getBackendURL(), getSessionCookie(automationContext));
+ }
+
+ @Test(description = "Verify the sample build process",
+ groups = Constants.TestSample.SAMPLE_INSTALL)
+ public void sampleBuildTest() throws IOException {
+ String connectedCupDir = carbonHome + File.separator + "samples" + File.separator + "connectedcup";
+ log.info("Connected cup Sample: " + connectedCupDir);
+ File dir = new File(connectedCupDir);
+ try {
+ if (System.getProperty(Constants.OS_NAME).toLowerCase().contains("windows")) {
+ log.info("Executing maven clean install --------------------------------");
+ commands = new String[]{"cmd.exe", "/c", "mvn clean install"};
+ tempProcess = Runtime.getRuntime().exec(commands, null, dir);
+ } else {
+ log.info("Executing maven clean install --------------------------------");
+ commands = new String[]{"mvn", "clean", "install"};
+ tempProcess = Runtime.getRuntime().exec(commands, null, dir);
+ }
+
+ boolean buildStatus = waitForMessage(tempProcess.getInputStream(), Constants.BUILD_SUCCESS_MSG);
+ Assert.assertTrue(buildStatus, "Building the sample was not successful");
+ } finally {
+ if (tempProcess != null) {
+ tempProcess.destroy();
+ }
+ }
+ }
+
+ @Test(description = "Verify the sample installation process",
+ groups = Constants.TestSample.SAMPLE_INSTALL,
+ dependsOnMethods = {"sampleBuildTest"})
+ public void sampleInstallationTest() throws IOException {
+
+ log.info("CARBON_HOME: " + System.getProperty(Constants.CARBON_HOME));
+ File dir = new File(carbonHome);
+ log.info("Sample installation started : mvn clean install -f device-deployer.xml");
+ try {
+ if (System.getProperty(Constants.OS_NAME).toLowerCase().contains("windows")) {
+ commands = new String[]{"cmd.exe", "/c", "mvn clean install -f device-deployer.xml"};
+ tempProcess = Runtime.getRuntime().exec(commands, null, dir);
+ } else {
+ commands = new String[]{"mvn", "clean", "install", "-f", "device-deployer.xml"};
+ tempProcess = Runtime.getRuntime().exec(commands, null, dir);
+ }
+ boolean buildStatus = waitForMessage(tempProcess.getInputStream(), Constants.BUILD_SUCCESS_MSG);
+ Assert.assertTrue(buildStatus, "Sample installation was not successful");
+ } finally {
+ if (tempProcess != null) {
+ tempProcess.destroy();
+ }
+ }
+ }
+
+ @Test(description = "Test restarting the server",
+ groups = Constants.TestSample.SAMPLE_INSTALL,
+ dependsOnMethods = {"sampleInstallationTest"})
+ 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());
+ }
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ if (tempProcess != null) {
+ tempProcess.destroy();
+ }
+ }
+
+ /**
+ * Wait for a given message to be printed in terminal. Used for processes.
+ * @param inputStream : Input stream of the process
+ * @param message : The message which is to be look for
+ */
+ private boolean waitForMessage(InputStream inputStream, String message) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+ String line;
+ boolean status = false;
+ while ((line = br.readLine()) != null) {
+ log.info(line);
+ if (!status && line.contains(message)) {
+ status = true;
+ }
+ }
+ return status;
+ }
+
+ /**
+ * 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(Constants.IOT_RESTART_THREAD_TIMEOUT, TimeUnit.MINUTES);
+ } catch (final InterruptedException e) {
+ log.error("Interrupted "+e.getMessage());
+ Assert.assertTrue(false);
+ } catch (final TimeoutException e) {
+ log.error("Timeout " + e.getMessage());
+ Assert.assertTrue(false);
+ } catch (final ExecutionException e) {
+ log.error("Execution failed " + e.getMessage());
+ Assert.assertTrue(false);
+ } finally {
+ service.shutdown();
+ }
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationVerification.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationVerification.java
new file mode 100644
index 00000000..6c9d54c6
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleInstallationVerification.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.samples;
+
+import org.openqa.selenium.WebDriver;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
+import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test cases to verify the sample installation is successful and device type is installed correctly.
+ */
+public class SampleInstallationVerification extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private IOTAdminDashboard adminDashboard;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ adminDashboard = new IOTAdminDashboard(driver);
+ }
+
+ @Test(description = "Verify the sample is available in Virtual devices section.",
+ groups = Constants.TestSample.INSTALL_VERIFY,
+ dependsOnGroups = Constants.TestSample.SAMPLE_INSTALL)
+ public void installationVerificationTest() throws IOException {
+ EnrollDevicePage enrollDevicePage = adminDashboard.enrollNewDevice();
+ Assert.assertTrue(enrollDevicePage.isInstalled());
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void teardown() {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormValidationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormValidationTest.java
new file mode 100644
index 00000000..44175b14
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormValidationTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.user;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.UIElementMapper;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Class contains test cases for Add user form validation.
+ * 1. Empty form submission
+ * 2. Short user name
+ * 3. Empty First Name
+ * 4. Empty Last Name
+ * 5. Empty email
+ * 6. Incorrect email
+ */
+public class AddUserFormValidationTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private UIElementMapper uiElementMapper;
+ private WebElement firstNameField;
+ private WebElement lastNameField;
+ private WebElement emailField;
+ private WebElement userNameField;
+ private WebElement addUserButton;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ driver.get(getWebAppURL() + Constants.IOT_USER_ADD_URL);
+ uiElementMapper = UIElementMapper.getInstance();
+
+ userNameField = driver.findElement(By.id(uiElementMapper.getElement("iot.admin.addUser.username.id")));
+ firstNameField = driver.findElement(By.id(uiElementMapper.getElement("iot.admin.addUser.firstName.id")));
+ lastNameField = driver.findElement(By.id(uiElementMapper.getElement("iot.admin.addUser.lastName.id")));
+ emailField = driver.findElement(By.id(uiElementMapper.getElement("iot.admin.addUser.email.id")));
+
+ addUserButton = driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath")));
+ }
+
+ @Test(description = "Test for empty form submission")
+ public void emptyFormTest() {
+ clearForm();
+
+ firstNameField.sendKeys("");
+ lastNameField.sendKeys("");
+ emailField.sendKeys("");
+ userNameField.sendKeys("");
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for empty form not is displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), "Username is a required field. It cannot be empty.");
+ }
+
+ @Test(description = "Test for short user name")
+ public void shortUserNameTest() {
+ clearForm();
+
+ firstNameField.sendKeys(Constants.User.Add.FIRST_NAME);
+ lastNameField.sendKeys(Constants.User.Add.LAST_NAME);
+ emailField.sendKeys(Constants.User.Add.EMAIL);
+ userNameField.sendKeys(Constants.User.Add.SHORT_USER_NAME);
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for short user name is not displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), Constants.User.Add.SHORT_USER_NAME_ERROR_MSG);
+ }
+
+ @Test(description = "Test for empty first name")
+ public void emptyFirstNameTest() {
+ clearForm();
+
+ firstNameField.sendKeys("");
+ lastNameField.sendKeys(Constants.User.Add.LAST_NAME);
+ emailField.sendKeys(Constants.User.Add.EMAIL);
+ userNameField.sendKeys(Constants.User.Add.USER_NAME);
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for First name is not displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), Constants.User.Add.FIRST_NAME_ERROR_MSG);
+ }
+
+ @Test(description = "Test for empty last name")
+ public void emptyLastNameTest() {
+ clearForm();
+
+ firstNameField.sendKeys(Constants.User.Add.FIRST_NAME);
+ lastNameField.sendKeys("");
+ emailField.sendKeys(Constants.User.Add.EMAIL);
+ userNameField.sendKeys(Constants.User.Add.USER_NAME);
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for Last name is not displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), Constants.User.Add.LAST_NAME_ERROR_MSG);
+ }
+
+ @Test(description = "Test for empty email name")
+ public void emptyEmailTest() {
+ clearForm();
+
+ firstNameField.sendKeys(Constants.User.Add.FIRST_NAME);
+ lastNameField.sendKeys(Constants.User.Add.LAST_NAME);
+ emailField.sendKeys("");
+ userNameField.sendKeys(Constants.User.Add.USER_NAME);
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for E-mail is not displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), Constants.User.Add.NO_EMAIL_ERROR_MSG);
+ }
+
+ @Test(description = "Test for incorrect email")
+ public void incorrectEmailTest() {
+ clearForm();
+
+ firstNameField.sendKeys(Constants.User.Add.FIRST_NAME);
+ lastNameField.sendKeys(Constants.User.Add.LAST_NAME);
+ emailField.sendKeys(Constants.User.Add.EMAIL_ERROR);
+ userNameField.sendKeys(Constants.User.Add.USER_NAME);
+
+ addUserButton.click();
+
+ WebElement alert = driver.findElement(By.xpath(
+ uiElementMapper.getElement("iot.admin.addUser.formError.xpath")));
+
+ if (!alert.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for incorrect E-mail is not displayed.");
+ }
+
+ Assert.assertEquals(alert.getText(), Constants.User.Add.WRONG_EMAIL_ERROR_MSG);
+ }
+
+ private void clearForm() {
+ firstNameField.clear();
+ lastNameField.clear();
+ emailField.clear();
+ userNameField.clear();
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AdminFunctionsTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AdminFunctionsTest.java
new file mode 100644
index 00000000..e25740e9
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AdminFunctionsTest.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.user;
+
+import org.openqa.selenium.WebDriver;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
+import org.wso2.iot.integration.ui.pages.uesr.AddUserPage;
+import org.wso2.iot.integration.ui.pages.uesr.UserListingPage;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test for check following admin capabilities.
+ * - Create a new User
+ * - Delete a user
+ */
+public class AdminFunctionsTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws IOException, XPathExpressionException, XMLStreamException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ LoginUtils.login(driver, automationContext, getWebAppURL());
+ }
+
+ @Test(description = "Test for creating a new user")
+ public void createUserTest() throws IOException {
+ IOTAdminDashboard adminDashboard = new IOTAdminDashboard(driver);
+ AddUserPage addUserPage = adminDashboard.addUser();
+ addUserPage.createNewUser("user1", "User", "User", "user@wso2.com");
+ }
+
+ @Test(description = "Test for deleting a created user", dependsOnMethods = {"createUserTest"})
+ public void deleteUserTest() throws XPathExpressionException, IOException, InterruptedException {
+ driver.get(getWebAppURL() + Constants.IOT_HOME_URL);
+ IOTAdminDashboard adminDashboard = new IOTAdminDashboard(driver);
+ UserListingPage userListingPage = adminDashboard.viewUser();
+ userListingPage.deleteUser();
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/NewUserRegistrationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/NewUserRegistrationTest.java
new file mode 100644
index 00000000..3d66675f
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/NewUserRegistrationTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.user;
+
+import org.openqa.selenium.WebDriver;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.UIElementMapper;
+import org.wso2.iot.integration.ui.pages.home.IOTHomePage;
+import org.wso2.iot.integration.ui.pages.login.LoginPage;
+import org.wso2.iot.integration.ui.pages.uesr.NewUserRegisterPage;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * Test for registering a new user and login
+ */
+public class NewUserRegistrationTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ driver.get(getWebAppURL() + Constants.IOT_LOGIN_PATH);
+ }
+
+ @Test(description = "Verify new User registration")
+ public void userRegisterTest() throws IOException {
+ LoginPage login = new LoginPage(driver);
+ NewUserRegisterPage registerTest = login.registerNewUser();
+ LoginPage loginPage = registerTest.registerUser(Constants.User.Register.FIRST_NAME,
+ Constants.User.Register.LAST_NAME,
+ Constants.User.Register.EMAIL,
+ Constants.User.Register.USER_NAME,
+ Constants.User.Register.PASSWORD,
+ Constants.User.Register.CONFIRM_PASSWORD);
+
+ IOTHomePage homePage = loginPage.loginAsUser(Constants.User.Register.USER_NAME,
+ Constants.User.Register.PASSWORD);
+
+ Assert.assertTrue(homePage.checkUserName());
+ }
+
+ @Test(description = "Test user logout function", dependsOnMethods = {"userRegisterTest"})
+ public void logoutTest() throws IOException {
+ IOTHomePage homePage = new IOTHomePage(driver);
+ homePage.logout();
+ Assert.assertEquals(driver.getTitle(), Constants.User.Login.PAGE_TITLE);
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() throws Exception {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java
new file mode 100644
index 00000000..ec088dd4
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormValidationTest.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.iot.integration.web.ui.test.user;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
+import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
+import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
+import org.wso2.iot.integration.ui.pages.UIElementMapper;
+import org.wso2.iot.integration.ui.pages.uesr.NewUserRegisterPage;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.IOException;
+
+/**
+ * These test cases check for following:
+ * - Submitting an empty form
+ * - Existing username
+ * - Non matching passwords
+ * - Password, username length
+ */
+public class RegistrationFormValidationTest extends IOTIntegrationUIBaseTestCase {
+
+ private WebDriver driver;
+ private UIElementMapper uiElementMapper;
+ private NewUserRegisterPage registerPage;
+
+ @BeforeClass(alwaysRun = true)
+ public void setup() throws XPathExpressionException, XMLStreamException, IOException {
+ super.init();
+ driver = BrowserManager.getWebDriver();
+ driver.get(getWebAppURL() + Constants.IOT_USER_REGISTER_URL);
+ registerPage = new NewUserRegisterPage(driver);
+ uiElementMapper = UIElementMapper.getInstance();
+ }
+
+ @Test(description = "Test for submitting an empty registration form")
+ public void emptyFormTest() throws IOException {
+ registerPage.validateForm("", "", "", "", "", "");
+
+ WebElement alertFirstName = driver.findElement(By.id(
+ uiElementMapper.getElement("iot.user.register.form.error")));
+
+ if (!alertFirstName.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for first name is not displayed");
+ }
+
+ Assert.assertEquals(alertFirstName.getText(), "Firstname is a required field. It cannot be empty.");
+ }
+
+ @Test(description = "Test for non matching passwords")
+ public void nonMatchingPasswordTest() {
+ registerPage.validateForm("user", "user", "user@wso2.com", "user1", "password", "Password");
+ WebElement alertConfPassword = driver.findElement(By.id(
+ uiElementMapper.getElement("iot.user.register.form.error")));
+
+ if (!alertConfPassword.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for confirm password is not displayed");
+ }
+
+ Assert.assertEquals(alertConfPassword.getText(), "Please enter the same password for confirmation.");
+ }
+
+ @Test(description = "Test for email")
+ public void incorrectEmailTest() {
+ registerPage.validateForm("user", "user", "user123", "user1", "password", "password");
+ WebElement alertEmail = driver.findElement(By.id(
+ uiElementMapper.getElement("iot.user.register.form.error")));
+ if (!alertEmail.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for email is not displayed");
+ }
+
+ Assert.assertEquals(alertEmail.getText(), "Provided email is invalid.");
+ }
+
+ @Test(description = "Test for password length")
+ public void passwordLengthTest() {
+ registerPage.validateForm("user", "user", "user@wso2.com", "user1", "pass", "pass");
+ WebElement alertPassword = driver.findElement(By.id(
+ uiElementMapper.getElement("iot.user.register.form.error")));
+ if (!alertPassword.isDisplayed()) {
+ Assert.assertTrue(false, "Alert for password is not displayed");
+ }
+
+ Assert.assertEquals(alertPassword.getText(), "Password is a required field. It cannot be empty.");
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ driver.quit();
+ }
+
+}
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/automation.xml b/modules/integration/tests-iot-web-ui/src/test/resources/automation.xml
new file mode 100644
index 00000000..5cfb0229
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/automation.xml
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+
+
+ 300000
+
+ standalone
+
+ false
+
+ false
+
+
+
+
+
+
+ http://10.100.2.51:4444/wd/hub/
+
+
+
+ firefox
+
+ /home/test/name/webDriver
+
+
+
+
+
+
+ jdbc:h2:testDB
+ wso2carbon
+ wso2carbon
+ org.h2.Driver
+
+
+ jdbc:h2:testDB
+ wso2carbon
+ wso2carbon
+ org.h2.Driver
+
+
+
+
+
+
+ keystores/products/wso2carbon.jks
+
+ JKS
+
+ wso2carbon
+
+ wso2carbon
+
+ wso2carbon
+
+
+
+
+ client-truststore.jks
+
+ JKS
+
+ wso2carbon
+
+
+
+
+
+ https://wso2.org/repo
+ file:///home/krishantha/test
+
+
+
+
+
+
+
+
+
+ admin
+ admin
+
+
+
+
+ testuser11
+ testuser11
+
+
+ testuser21
+ testuser21
+
+
+
+
+
+
+
+
+ admin
+ admin
+
+
+
+
+ testuser11
+ testuser11
+
+
+ testuser21
+ testuser21
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ 9763
+ 9446
+ 9443
+ 9445
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.wso2.carbon.iot.integration.web.ui.test.extension.BrokerServerExtension
+ org.wso2.carbon.iot.integration.web.ui.test.extension.IOTServerExtension
+ org.wso2.carbon.iot.integration.web.ui.test.extension.AnalyticsServerExtension
+ org.wso2.carbon.integration.common.extensions.usermgt.UserPopulateExtension
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/automationXMLSchema.xsd b/modules/integration/tests-iot-web-ui/src/test/resources/automationXMLSchema.xsd
new file mode 100644
index 00000000..b800b2ba
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/automationXMLSchema.xsd
@@ -0,0 +1,611 @@
+
+
+
+
+
+
+ =================================================
+ Parameters =================================================
+ Browser type with used by framework to execute UI test, supported types
+ - chrome|firefox|opera|ie|htmlUnit
+
+
+
+
+
+
+ Change this to edit wait time for test
+ artifact deployment
+
+
+
+
+
+ Change this to product|platform/cloud to
+ execute test on specific environment
+
+
+
+
+
+
+ Change this to true if you want to generate
+ coverage statistics
+
+
+
+
+
+ Change this to true if you want to enable
+ framework dashboard
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Change to enable remote webDriver
+ URL of remote webDriver server
+
+
+
+
+
+
+
+
+
+
+
+
+ Type of the browser selenium tests
+ are running"
+
+
+
+
+
+
+
+ path to webDriver
+ executable - required only for
+ chrome
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KeyStore which will be used for
+ encrypting/decrypting passwords
+ and other sensitive information.
+
+
+
+
+
+
+ Keystore file location
+
+
+
+
+
+ Keystore type (JKS/PKCS12 etc.)
+
+
+
+
+
+ Keystore password
+
+
+
+
+
+ Private Key alias
+
+
+
+
+
+ Private Key password
+
+
+
+
+
+
+
+
+
+ System wide trust-store which is used to
+ maintain the certificates of all
+ the trusted parties.
+
+
+
+
+
+
+ trust-store file location
+
+
+
+
+
+ trust-store type (JKS/PKCS12
+ etc.)
+
+
+
+
+
+ trust-store password
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/axis2config/axis2_client.xml b/modules/integration/tests-iot-web-ui/src/test/resources/axis2config/axis2_client.xml
new file mode 100644
index 00000000..a8b584d0
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/axis2config/axis2_client.xml
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+ true
+ false
+ false
+
+
+ 500
+
+ 15000
+
+
+ false
+
+
+
+ true
+
+
+
+
+
+ false
+
+
+ admin
+ axis2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 6071
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ HTTP/1.1
+ chunked
+ 60000
+ 60000
+
+
+ HTTP/1.1
+ chunked
+ 60000
+ 60000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v10.mar b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v10.mar
new file mode 100644
index 00000000..57f85764
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v10.mar differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v11-20140908.185829-596.mar b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v11-20140908.185829-596.mar
new file mode 100644
index 00000000..4ca7737a
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v11-20140908.185829-596.mar differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v15.mar b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v15.mar
new file mode 100644
index 00000000..68f5cbd6
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/addressing-1.6.1-wso2v15.mar differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/rampart-1.6.1-wso2v8.mar b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/rampart-1.6.1-wso2v8.mar
new file mode 100644
index 00000000..60cd6cdf
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/client/modules/rampart-1.6.1-wso2v8.mar differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/emma.properties b/modules/integration/tests-iot-web-ui/src/test/resources/emma.properties
new file mode 100644
index 00000000..9c48e81b
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/emma.properties
@@ -0,0 +1,105 @@
+# -------------------------------------------------------------
+#
+# for user-editable property overrides use one of these options:
+#
+# (1) option-specific command line overrides, e.g.
+# -Dreport.txt.out.file=coverage.txt
+#
+# (2) '-p ' command line option,
+#
+# (3) 'emma.properties' resource placed somewhere in the classpath
+# (e.g., in \classes directory -- note that it does
+# not exist by default),
+#
+# (4) '-Demma.*' JVM options, e.g.
+# -Demma.report.txt.out.file=coverage.txt
+#
+# (5) 'emma.properties' JVM option pointing to a properties file
+# -Demma.properties=./myproperties.txt
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# logging properties:
+
+verbosity.level: none
+
+# classloading properties:
+
+#clsload.forced_delegation_filter:
+#clsload.through_delegation_filter: -*
+
+# -------------------------------------------------------------
+
+# instrumentation properties:
+
+instr.exclude_empty_classes: true
+instr.exclude_synthetic_methods: true
+instr.exclude_bridge_methods: true
+instr.do_suid_compensation: true
+
+# -------------------------------------------------------------
+
+# runtime properties:
+
+rt.control: false
+rt.control.host: localhost
+#rt.control.port: 44444
+
+rt.filelock: true
+#rt.filelock.portbase: 59141
+rt.filelock.maxtime: 120000
+rt.filelock.retries: 11
+
+# -------------------------------------------------------------
+
+# apprunner session data output properties:
+
+session.out.file: coverage.es
+session.out.merge: true
+
+# -------------------------------------------------------------
+
+# runtime coverage data output properties:
+
+coverage.out.file: coverage.ec
+coverage.out.merge: true
+
+# -------------------------------------------------------------
+
+# instr metadata output properties:
+
+metadata.out.file: coverage.em
+metadata.out.merge: true
+
+# -------------------------------------------------------------
+
+# common report defaults:
+
+report.units: instr
+report.depth: method
+report.columns: name, line, block, method, class
+report.sort: -line,-block,-method,-class,+name
+report.metrics: method:40,block:80,line:40,class:100
+
+# -------------------------------------------------------------
+# txt report properties:
+
+report.txt.depth: all
+report.txt.columns: class,method,block,line,name
+report.txt.out.file: coverage.txt
+
+# -------------------------------------------------------------
+# html report properties:
+
+#report.html.out.dir: coverage
+#report.html.out.file: /Users/azeez/Desktop/coverage/index.html
+report.html.out.encoding: ISO-8859-1
+
+# -------------------------------------------------------------
+# xml report properties:
+
+#report.xml.out.file: coverage.xml
+report.xml.out.encoding: UTF-8
+# -------------------------------------------------------------
+# end of file
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/filters.txt b/modules/integration/tests-iot-web-ui/src/test/resources/filters.txt
new file mode 100644
index 00000000..54913a22
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/filters.txt
@@ -0,0 +1,17 @@
+-*.stub*
+-*.stub_
+-*.stub_4.0.0
+-*.stub-
+-org.eclipse.*
+-*.equinox.*
+-org.wso2.carbon.user.core.*
+-samples.*
+-*.log4j*
+-*.axis2*
+-*.ui*
+-*.tenant*
+-*.stratos*
+-*.eventing*
+-*transports*
+-org.wso2.carbon.mediation.statistics*
+-*startup*
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/instrumentation.txt b/modules/integration/tests-iot-web-ui/src/test/resources/instrumentation.txt
new file mode 100644
index 00000000..917b2bb7
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/instrumentation.txt
@@ -0,0 +1,11 @@
+org.wso2.carbon.datasource_
+org.wso2.carbon.dataservices.core_
+org.wso2.carbon.transaction.manager_
+org.wso2.carbon.dataservices.sql.driver_
+org.wso2.carbon.dataservices.task_
+org.wso2.carbon.ndatasource.common_
+org.wso2.carbon.ndatasource.core_
+org.wso2.carbon.ndatasource.rdbms_
+org.wso2.carbon.ntask.common_
+org.wso2.carbon.ntask.core_
+org.wso2.carbon.ntask.solutions_
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/client-truststore.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/client-truststore.jks
new file mode 100644
index 00000000..ab222fdd
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/client-truststore.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2carbon.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2carbon.jks
new file mode 100644
index 00000000..79784a5e
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2carbon.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2certs.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2certs.jks
new file mode 100644
index 00000000..eb27997d
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2certs.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2mdm.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2mdm.jks
new file mode 100644
index 00000000..66b68ea3
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/products/wso2mdm.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/client-truststore.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/client-truststore.jks
new file mode 100644
index 00000000..ab222fdd
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/client-truststore.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2carbon.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2carbon.jks
new file mode 100644
index 00000000..79784a5e
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2carbon.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2certs.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2certs.jks
new file mode 100644
index 00000000..eb27997d
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2certs.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2emm.jks b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2emm.jks
new file mode 100644
index 00000000..ae5670b0
Binary files /dev/null and b/modules/integration/tests-iot-web-ui/src/test/resources/keystores/stratos/wso2emm.jks differ
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/log4j.properties b/modules/integration/tests-iot-web-ui/src/test/resources/log4j.properties
new file mode 100644
index 00000000..6fc06a7e
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/log4j.properties
@@ -0,0 +1,43 @@
+#
+# Copyright 2009 WSO2, Inc. (http://wso2.com)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# This is the log4j configuration file used by WSO2 Carbon
+#
+# IMPORTANT : Please do not remove or change the names of any
+# of the Appenders defined here. The layout pattern & log file
+# can be changed using the WSO2 Carbon Management Console, and those
+# settings will override the settings in this file.
+#
+
+log4j.rootLogger=INFO, console, Default
+
+log4j.logger.org.wso2=INFO
+
+#Automation file apender
+log4j.appender.Default=org.apache.log4j.RollingFileAppender
+log4j.appender.Default.File=logs/automation.log
+log4j.appender.Default.Append=true
+log4j.appender.Default.MaxFileSize=10MB
+log4j.appender.Default.MaxBackupIndex=10
+log4j.appender.Default.layout=org.apache.log4j.PatternLayout
+log4j.appender.Default.layout.ConversionPattern=%d{ISO8601} %-5p [%c] - %m%n
+
+
+#Automation console apender
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p [%c] - %m%n
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario-config.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario-config.xml
new file mode 100644
index 00000000..79f018ca
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario-config.xml
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+ UsernameToken
+ Provides Authentication. Clients have Username Tokens
+ ut
+
+ rampart
+
+ UTOverTransport
+ basic
+
+
+ Non-repudiation
+ Provides Authentication and Integrity. Clients have X509 certificates
+ keystore
+
+ rampart
+
+ SigOnly
+ basic
+
+
+ Integrity
+ Provides Integrity. Clients do not have X509 certificates
+ keystore
+
+ rampart
+
+ SgnOnlyAnonymous
+ basic
+
+
+ Confidentiality
+ Provides Confidentiality. Clients do not have X509 certificates
+ keystore
+
+ rampart
+
+ EncrOnlyAnonymous
+ basic
+
+
+
+
+ Sign and encrypt - X509 Authentication
+ Provides Authentication, Integrity and Confidentiality. Clients have X509 certificates
+
+ keystore
+
+ rampart
+
+ SigEncr
+ advanced
+
+
+ Sign and Encrypt - Anonymous clients
+ Provides Integrity and Confidentiality.
+ keystore
+
+ rampart
+
+ SgnEncrAnonymous
+ advanced
+
+
+ Encrypt only - Username Token Authentication
+ Provides Authentication and Confidentiality. Clients have Username Tokens
+ ut-keystore
+
+ rampart
+
+ EncrOnlyUsername
+ advanced
+
+
+ Sign and Encrypt - Username Token Authentication
+ Provides Authentication, Integrity and Confidentiality. Clients have Username Tokens
+ ut-keystore
+
+ rampart
+
+ SgnEncrUsername
+ advanced
+
+
+ SecureConversation - Sign only - Service as STS - Bootstrap policy - Sign and Encrypt , X509
+ Authentication
+
+ Provides Authentication and Integrity. Multiple message exchange.Clients have X509 certificates.
+
+ keystore
+
+ rampart
+ rahas
+
+ SecConSignOnly
+ advanced
+
+
+ SecureConversation - Encrypt only - Service as STS - Bootstrap policy -
+ Sign and Encrypt , X509 Authentication
+
+ Provides Confidentiality. Multiple message exchange.Clients have X509 certificates.
+ keystore
+
+ rampart
+ rahas
+
+ SecConEncrOnly
+ advanced
+
+
+ SecureConversation - Sign and Encrypt - Service as STS - Bootstrap policy - Sign and Encrypt , X509
+ Authentication
+
+ Provides Authentication, Integrity and Confidentiality. Multiple message exchange.Clients have X509
+ certificates.
+
+ keystore
+
+ rampart
+ rahas
+
+ SecConSgnEncr
+ advanced
+
+
+ SecureConversation - Sign Only - Service as STS - Bootstrap policy - Sign and Encrypt , Anonymous
+ clients
+
+ Provides Integrity. Multiple message exchange.
+ keystore
+
+ rampart
+ rahas
+
+ SecConSignOnlyAnonymous
+ advanced
+
+
+ SecureConversation - Encrypt Only - Service as STS - Bootstrap policy - Sign and Encrypt , Anonymous
+ clients
+
+ Provides Confidentiality. Multiple message exchange.
+ keystore
+
+ rampart
+ rahas
+
+ SecConEncrOnlyAnonymous
+ advanced
+
+
+ SecureConversation - Encrypt Only - Service as STS - Bootstrap policy - Sign and Encrypt , Username
+ Token Authentication
+
+ Provides Authentication and Confidentiality. Multiple message exchange. Clients have Username
+ Tokens.
+
+ ut-keystore
+
+ rampart
+ rahas
+
+ SecConEncrUsername
+ advanced
+
+
+ SecureConversation - Sign and Encrypt - Service as STS - Bootstrap policy - Sign and Encrypt , Username
+ Token Authentication
+
+ Provides Authentication Integrity and Confidentiality. Multiple message exchange. Clients have
+ Username Tokens.
+
+ ut-keystore
+
+ rampart
+ rahas
+
+ SecConSgnEncrUsername
+ advanced
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario1-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario1-policy.xml
new file mode 100644
index 00000000..4a232f73
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario1-policy.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario10-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario10-policy.xml
new file mode 100644
index 00000000..2d076e06
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario10-policy.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario11-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario11-policy.xml
new file mode 100644
index 00000000..794d52ee
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario11-policy.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario12-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario12-policy.xml
new file mode 100644
index 00000000..6ac14ecd
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario12-policy.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario13-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario13-policy.xml
new file mode 100644
index 00000000..dbefeda8
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario13-policy.xml
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario14-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario14-policy.xml
new file mode 100644
index 00000000..bafd7263
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario14-policy.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario15-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario15-policy.xml
new file mode 100644
index 00000000..47fb6711
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario15-policy.xml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario16-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario16-policy.xml
new file mode 100644
index 00000000..dc383d79
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario16-policy.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ https://kirillgdev04/Security_Federation_SecurityTokenService_Indigo/Symmetric.svc/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport
+
+
+
+
+ urn:oasis:names:tc:SAML:1.0:assertion
+
+
+ http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey
+
+
+ 256
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario17-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario17-policy.xml
new file mode 100644
index 00000000..637cf81d
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario17-policy.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ http://foo.bar/we/don/t/process/this/yet
+
+
+
+
+ urn:oasis:names:tc:SAML:1.0:assertion
+
+
+ http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey
+
+ 256
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario2-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario2-policy.xml
new file mode 100644
index 00000000..08a45d55
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario2-policy.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario3-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario3-policy.xml
new file mode 100644
index 00000000..0bfd14eb
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario3-policy.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario4-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario4-policy.xml
new file mode 100644
index 00000000..9ee47cc2
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario4-policy.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario5-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario5-policy.xml
new file mode 100644
index 00000000..9454c745
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario5-policy.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario6-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario6-policy.xml
new file mode 100644
index 00000000..7de14746
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario6-policy.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario7-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario7-policy.xml
new file mode 100644
index 00000000..db95d371
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario7-policy.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario8-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario8-policy.xml
new file mode 100644
index 00000000..1fdfd940
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario8-policy.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario9-policy.xml b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario9-policy.xml
new file mode 100644
index 00000000..73fa833b
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/security/policies/scenario9-policy.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/testng-server-mgt.xml b/modules/integration/tests-iot-web-ui/src/test/resources/testng-server-mgt.xml
new file mode 100644
index 00000000..b57f1223
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/testng-server-mgt.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml b/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml
new file mode 100644
index 00000000..73139933
--- /dev/null
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/integration/tests-platform/pom.xml b/modules/integration/tests-platform/pom.xml
new file mode 100644
index 00000000..29157189
--- /dev/null
+++ b/modules/integration/tests-platform/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+ 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 39675a5e..042f9952 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
modules/tools
modules/p2-profile
modules/distribution
+ modules/integration