diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/IOTIntegrationUIBaseTestCase.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/IOTIntegrationUIBaseTestCase.java
index a629876f..6b0a0b41 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/IOTIntegrationUIBaseTestCase.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/IOTIntegrationUIBaseTestCase.java
@@ -30,10 +30,7 @@ import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
import java.rmi.RemoteException;
-/**
- * Created by menaka on 1/19/16.
- *
- */
+
public class IOTIntegrationUIBaseTestCase {
private static final Log log = LogFactory.getLog(IOTIntegrationUIBaseTestCase.class);
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java
index 86432874..8f579988 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceAddGroupPage.java
@@ -28,7 +28,9 @@ import org.wso2.iot.integration.ui.pages.UIElementMapper;
import java.io.IOException;
/**
- * Add group page of iot server
+ * Add group page of iot server. This class contains methods to,
+ * 1. Create a new group
+ * 2. Submit an empty form
*/
public class DeviceAddGroupPage {
@@ -48,6 +50,12 @@ public class DeviceAddGroupPage {
}
+ /**
+ * @param name The group name that is need to be created.
+ * @param description the description for the group
+ * @return The resultant page.
+ * @throws Exception
+ */
public DeviceGroupsPage addNewGroup (String name, String description) throws Exception{
WebElement nameField = driver.findElement(By.id(
@@ -66,6 +74,9 @@ public class DeviceAddGroupPage {
}
+ /**
+ * @return The error string when trying to submit an empty form.
+ */
public String submitEmptyForm() {
WebElement nameField = driver.findElement(By.id(
uiElementMapper.getElement("iot.device.group.addGroupForm.name.id")));
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java
index a679886b..52c00778 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/groups/DeviceGroupsPage.java
@@ -30,10 +30,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-/**
- * Created by menaka on 1/24/16.
- *
- */
public class DeviceGroupsPage {
private static final Log log = LogFactory.getLog(DeviceGroupsPage.class);
private WebDriver driver;
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java
index 9d254d9b..a3731fc7 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTAdminDashboard.java
@@ -31,6 +31,23 @@ import org.wso2.iot.integration.ui.pages.uesr.UserListingPage;
import java.io.IOException;
+
+/**
+ * This class represents the Admin Dashboard of the IOT server.
+ * Server dashboard has following sections and functions.
+ * 1. User Management
+ * - View users.
+ * - Add a new user
+ * 2. Group Management.
+ * - View Groups.
+ * - Add a new group.
+ * 3. Device Management.
+ * - View enrolled devices.
+ * - Enroll a device.
+ * 3. Policy Management.
+ * - View Policies.
+ * - Create a policy.
+ */
public class IOTAdminDashboard {
private static final Log log = LogFactory.getLog(IOTHomePage.class);
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java
index f74167c9..ef3f0fc6 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/home/IOTHomePage.java
@@ -72,7 +72,6 @@ public class IOTHomePage {
}
//To add new Device groups as user
-
public void goToGroupMgt() throws Exception {
driver.findElement(By.xpath("iot.home.page.uuf-menu.xpath")).click();
driver.findElement(By.xpath("iot.home.page.uuf-menu.groupmgt.xpath")).click();
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java
index b6469feb..b974bfab 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/login/LoginPage.java
@@ -32,7 +32,7 @@ import org.wso2.iot.integration.ui.pages.uesr.NewUserRegisterPage;
import java.io.IOException;
/**
- * Login page of the iot server
+ * Represents the Login page of the iot server.
*
*/
public class LoginPage {
@@ -50,6 +50,13 @@ public class LoginPage {
}
}
+ /**
+ * Method to login as a registered user.
+ * @param username Username of the user.
+ * @param password Password of the user.
+ * @return After a user is logged in, it will redirect to the IOT Server Home page.
+ * @throws IOException
+ */
public IOTHomePage loginAsUser(String username, String password) throws IOException {
log.info("Login as " + username);
WebElement userNameField = driver.findElement(By.xpath(
@@ -62,6 +69,13 @@ public class LoginPage {
return new IOTHomePage(driver);
}
+ /**
+ * Method to login as the server admin.
+ * @param username The admin user name (admin).
+ * @param password The admin password (admin).
+ * @return After admin logged in, it will redirect to the IOT Server dashboard.
+ * @throws IOException
+ */
public IOTAdminDashboard loginAsAdmin(String username, String password) throws IOException {
log.info("Login as " + username);
WebElement userNameField = driver.findElement(By.xpath(
@@ -74,6 +88,11 @@ public class LoginPage {
return new IOTAdminDashboard(driver);
}
+ /**
+ * Method for new user registration.
+ * @return After clicking the Register link, it will navigate to the User Registration page.
+ * @throws IOException
+ */
public NewUserRegisterPage registerNewUser() throws IOException {
WebElement registerLink = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.user.register.link.xpath")));
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/AddUserPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/AddUserPage.java
index e1e07241..7d6b239a 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/AddUserPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/AddUserPage.java
@@ -9,6 +9,10 @@ import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
+
+/**
+ * This class represents the add user page of the IOT server.
+ */
public class AddUserPage {
private static final Log log = LogFactory.getLog(AddUserPage.class);
private WebDriver driver;
@@ -24,7 +28,16 @@ public class AddUserPage {
}
}
- public UserAddedPage createNewUser(String userName, String firstName, String lastName, String email) throws Exception {
+ /**
+ * Method to create a new user.
+ * @param userName The username for the user.
+ * @param firstName The user's first name.
+ * @param lastName The user's last name.
+ * @param email Email address of the user.
+ * @return The user added confirmation page.
+ * @throws Exception
+ */
+ public UserAddedConfirmationPage createNewUser(String userName, String firstName, String lastName, String email) throws Exception {
WebElement userNameField = driver.findElement(By.id(
uiElementMapper.getElement("iot.admin.addUser.username.id")));
@@ -44,9 +57,9 @@ public class AddUserPage {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(
uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath"))));
- driver.findElement(By.xpath("//button[@id='add-user-btn']")).click();
+ driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.add.btn.xpath"))).click();
- return new UserAddedPage(driver);
+ return new UserAddedConfirmationPage(driver);
}
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/EditUserPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/EditUserPage.java
index 7011cfa3..e66b54e5 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/EditUserPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/EditUserPage.java
@@ -9,8 +9,7 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
/**
- * Created by menaka on 2/8/16.
- *
+ * This class represents the Edit user page of the IOT server
*/
public class EditUserPage {
private static final Log log = LogFactory.getLog(EditUserPage.class);
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java
index 7f5064c1..407da339 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/NewUserRegisterPage.java
@@ -13,7 +13,7 @@ import org.wso2.iot.integration.ui.pages.login.LoginPage;
import java.io.IOException;
/**
- * Created by menaka on 1/19/16.
+ * This class represents the new user registration page.
*/
public class NewUserRegisterPage {
private static final Log log = LogFactory.getLog(NewUserRegisterPage.class);
@@ -30,8 +30,19 @@ public class NewUserRegisterPage {
}
}
- public LoginPage addUser(String firstName, String lastName, String email, String userName, String password,
- String
+ /**
+ * The method to register a new user.
+ * @param firstName First name of the user.
+ * @param lastName Last name of the user.
+ * @param email Email address of the user.
+ * @param userName User name for the user. This will be used to login to the server.
+ * @param password The password for the user.
+ * @param confirmPassword Password confirmation.
+ * @return After the user is created it navigates back to the login page.
+ * @throws IOException
+ */
+ public LoginPage registerUser(String firstName, String lastName, String email, String userName, String password,
+ String
confirmPassword) throws IOException {
WebElement firstNameField = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.user.add.input.firstname.xpath")));
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedConfirmationPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedConfirmationPage.java
new file mode 100644
index 00000000..6893b952
--- /dev/null
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedConfirmationPage.java
@@ -0,0 +1,27 @@
+package org.wso2.iot.integration.ui.pages.uesr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.wso2.iot.integration.ui.pages.UIElementMapper;
+
+/**
+ * This class represents the confirmation page for adding a new user.
+ */
+public class UserAddedConfirmationPage {
+ private static final Log log = LogFactory.getLog(UserAddedConfirmationPage.class);
+ private WebDriver driver;
+ private UIElementMapper uiElementMapper;
+
+ public UserAddedConfirmationPage(WebDriver driver) throws Exception {
+ this.driver = driver;
+ this.uiElementMapper = UIElementMapper.getInstance();
+
+ driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.view.btn.xpath"))).click();
+
+ }
+
+
+
+}
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedPage.java
deleted file mode 100644
index 3b3149e6..00000000
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserAddedPage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.wso2.iot.integration.ui.pages.uesr;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.WebDriverWait;
-import org.wso2.iot.integration.ui.pages.UIElementMapper;
-
-/**
- * Created by menaka on 1/27/16.
- *
- */
-public class UserAddedPage {
- private static final Log log = LogFactory.getLog(UserAddedPage.class);
- private WebDriver driver;
- private UIElementMapper uiElementMapper;
-
- public UserAddedPage(WebDriver driver) throws Exception {
- this.driver = driver;
- this.uiElementMapper = UIElementMapper.getInstance();
-
- driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.addUser.view.btn.xpath"))).click();
-// WebDriverWait webDriverWait = new WebDriverWait(driver, 10);
-// if (!driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.user.added.page.subtitle.xpath")))
-// .getText().contains("User was added successfully.")){
-// throw new IllegalStateException("This is not the User Added page");
-// }
-
-
-
- }
-
-
-
-}
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserListingPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserListingPage.java
index 1cc2a3ad..7adc3088 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserListingPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/UserListingPage.java
@@ -1,15 +1,15 @@
package org.wso2.iot.integration.ui.pages.uesr;
-import org.apache.commons.jexl2.UnifiedJEXL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.omg.PortableServer.THREAD_POLICY_ID;
import org.openqa.selenium.By;
-import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
+/**
+ * Class to represent the user listing page.
+ */
public class UserListingPage {
private static final Log log = LogFactory.getLog(UserListingPage.class);
private WebDriver driver;
@@ -19,12 +19,16 @@ public class UserListingPage {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
- if (!driver.findElement(By.xpath("//span[@class='page-sub-title']"))
+ if (!driver.findElement(By.xpath(uiElementMapper.getElement("iot.admin.user.added.page.subtitle.xpath")))
.getText().contains("USERS")){
throw new IllegalStateException("This is not the User Listing page");
}
}
+ /**
+ * @return After deleting a user, returns back to the user listing page.
+ * @throws Exception
+ */
public UserListingPage deleteUser() throws Exception {
WebElement deleteBtn = driver.findElement(By.xpath(
uiElementMapper.getElement("iot.admin.deleteUser.btn.xpath")));
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/ViewUserPage.java b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/ViewUserPage.java
index e5c56b11..9d66ff0b 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/ViewUserPage.java
+++ b/modules/integration/tests-common/web-ui-pages/src/main/java/org/wso2/iot/integration/ui/pages/uesr/ViewUserPage.java
@@ -8,7 +8,7 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import org.wso2.iot.integration.ui.pages.UIElementMapper;
/**
- * Created by menaka on 2/8/16.
+ * Class to represent the user view.
*/
public class ViewUserPage {
private static final Log log = LogFactory.getLog(ViewUserPage.class);
diff --git a/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties b/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties
index 43e319b8..d2af86d6 100644
--- a/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties
+++ b/modules/integration/tests-common/web-ui-pages/src/main/resources/mapper.properties
@@ -102,7 +102,7 @@ iot.admin.user.addButton.xpath=/html/body/div[3]/div[2]/div[1]/div[3]/div/div/di
iot.admin.user.viewButton.xpath=/html/body/div[3]/div[2]/div[1]/div[3]/div/div/div[2]/div[2]/span[2]/a[1]/span/i[2]
iot.admin.user.added.page.subtitle.xpath="//p[@class='page-sub-title']"
-
+#="//span[@class='page-sub-title']"
iot.admin.addUser.username.id=username
iot.admin.addUser.firstName.id=firstname
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/Constants.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/Constants.java
index 769bbeeb..4b5c37f8 100644
--- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/Constants.java
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/Constants.java
@@ -19,14 +19,8 @@ package org.wso2.carbon.iot.integration.web.ui.test;
public class Constants {
public static final String IOT_LOGIN_PATH = "/devicemgt/login";
-// public static final String LOGIN_GROUP = "login-group";
-// public static final String MDM_ROLES_URL = "/mdm/roles";
public static final String IOT_USER_REGISTER_URL = "/devicemgt/register";
public static final String IOT_USER_ADD_URL = "/devicemgt/user/add";
public static final String IOT_GROUP_ADD_URL = "/devicemgt/group/add";
-// public static final String MDM_USER_URL = "/mdm/users/";
-// public static final String MDM_ROLES_EDIT_URL = "/mdm/roles/edit-role/";
-// public static final String MDM_PLATFORM_CONFIG_URL = "/mdm/platform-configuration";
-// public static final String MDM_NOTIFICATION_URL = "/mdm/notification-listing";
public static final String IOT_HOME_URL = "/devicemgt/";
}
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/LoginUtils.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/LoginUtils.java
index cc6fec5d..e0da2d9f 100644
--- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/LoginUtils.java
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/LoginUtils.java
@@ -23,11 +23,20 @@ import org.wso2.iot.integration.ui.pages.UIElementMapper;
import org.wso2.iot.integration.ui.pages.login.LoginPage;
/**
- * Login as registered user
+ * This class is used to login to the system as the Admin.
*/
public class LoginUtils {
private static UIElementMapper uiElementMapper;
+ /**
+ *
+ * This method is used to login as admin.
+ *
+ * @param driver The selenium web driver
+ * @param automationContext Test Automation context
+ * @param webAppURL The server url
+ * @throws Exception
+ */
public static void login(WebDriver driver, AutomationContext automationContext,
String webAppURL) throws Exception {
uiElementMapper = UIElementMapper.getInstance();
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
index 8ceacb79..724ab175 100644
--- 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
@@ -30,8 +30,9 @@ import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
/**
- * Created by menaka on 1/25/16.
- *
+ * 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;
@@ -43,7 +44,7 @@ public class DeviceGroupFailTest extends IOTIntegrationUIBaseTestCase {
LoginUtils.login(driver, automationContext, getWebAppURL());
}
- @Test(description = "Test for submitting an empty form.")
+ @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);
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFailTest.java
similarity index 98%
rename from modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormTest.java
rename to modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFailTest.java
index c80b29a0..8809afbc 100644
--- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFormTest.java
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/AddUserFailTest.java
@@ -40,7 +40,7 @@ import org.wso2.iot.integration.ui.pages.UIElementMapper;
* 5. Empty email
* 6. Incorrect email
*/
-public class AddUserFormTest extends IOTIntegrationUIBaseTestCase {
+public class AddUserFailTest extends IOTIntegrationUIBaseTestCase {
private WebDriver driver;
UIElementMapper uiElementMapper;
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegisterTest.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegisterTest.java
index 0c4f9782..5cf16e24 100644
--- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegisterTest.java
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegisterTest.java
@@ -49,7 +49,7 @@ public class RegisterTest extends IOTIntegrationUIBaseTestCase {
LoginPage test = new LoginPage(driver);
uiElementMapper = UIElementMapper.getInstance();
NewUserRegisterPage registerTest = test.registerNewUser();
- LoginPage loginPage = registerTest.addUser(
+ LoginPage loginPage = registerTest.registerUser(
uiElementMapper.getElement("iot.user.add.firstname"),
uiElementMapper.getElement("iot.user.add.lastname"),
uiElementMapper.getElement("iot.user.add.email"),
diff --git a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormTests.java b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormTests.java
index 6b275d10..5cfb12f1 100644
--- a/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormTests.java
+++ b/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/user/RegistrationFormTests.java
@@ -125,7 +125,7 @@ public class RegistrationFormTests extends IOTIntegrationUIBaseTestCase{
uiElementMapper.getElement("iot.user.register.confirmPassword.error"))).getText(),
"Please enter the same password as above");
}
-//
+
@Test (description = "Test for email")
public void incorrectEmail() throws Exception {
clearForm();
@@ -140,7 +140,7 @@ public class RegistrationFormTests extends IOTIntegrationUIBaseTestCase{
"Email is not valid. Please enter a correct email address.");
}
-//
+
@Test (description = "Test for password length")
public void passwordLengthTest() throws Exception {
clearForm();
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
index 8a4cd94b..da8dd4ca 100644
--- a/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml
+++ b/modules/integration/tests-iot-web-ui/src/test/resources/testng.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/modules/samples/connectedcup/component/controller/src/main/java/org/coffeeking/controller/service/transport/ConnectedCupMQTTConnector.java b/modules/samples/connectedcup/component/controller/src/main/java/org/coffeeking/controller/service/transport/ConnectedCupMQTTConnector.java
index 00c6f569..fbb508cc 100644
--- a/modules/samples/connectedcup/component/controller/src/main/java/org/coffeeking/controller/service/transport/ConnectedCupMQTTConnector.java
+++ b/modules/samples/connectedcup/component/controller/src/main/java/org/coffeeking/controller/service/transport/ConnectedCupMQTTConnector.java
@@ -122,6 +122,7 @@ public class ConnectedCupMQTTConnector extends MQTTTransportHandler {
public void processIncomingMessage(MqttMessage mqttMessage, String... strings) throws TransportHandlerException {
String topic = strings[0];
+
String ownerAndId = topic.replace("wso2" + File.separator, "");
ownerAndId = ownerAndId.replace(File.separator + ConnectedCupConstants.DEVICE_TYPE + File.separator, ":");
ownerAndId = ownerAndId.replace(File.separator + "connected_publisher", "");
@@ -154,11 +155,13 @@ public class ConnectedCupMQTTConnector extends MQTTTransportHandler {
//
switch(messageData[0]) {
- case "temperature": SensorDataManager.getInstance().setSensorRecord(deviceId, ConnectedCupConstants.SENSOR_TEMPERATURE,
+ case "temperature":
+ SensorDataManager.getInstance().setSensorRecord(deviceId, ConnectedCupConstants.SENSOR_TEMPERATURE,
String.valueOf(messageData[1]),
Calendar.getInstance().getTimeInMillis());
break;
- case "coffeelevel": SensorDataManager.getInstance().setSensorRecord(deviceId, ConnectedCupConstants.SENSOR_LEVEL,
+ case "coffeelevel":
+ SensorDataManager.getInstance().setSensorRecord(deviceId, ConnectedCupConstants.SENSOR_LEVEL,
String.valueOf(messageData[1]),
Calendar.getInstance().getTimeInMillis());
break;